Commit graph

30 commits

Author SHA1 Message Date
Mark Stapp 2998eeb0a5 pbrd,staticd,vrrpd: clean up variable-shadow warnings
Clean up -Wshadow warnings in three daemons

Signed-off-by: Mark Stapp <mjs@cisco.com>
2025-04-08 14:41:27 -04:00
David Lamparter 8b23c0b0bd *: convert struct interface->connected to DLIST
Replace `struct list *` with `DLIST(if_connected, ...)`.

NB: while converting this, I found multiple places using connected
prefixes assuming they were IPv4 without checking:

- vrrpd/vrrp.c: vrrp_socket()
- zebra/irdp_interface.c: irdp_get_prefix(), irdp_if_start(),
  irdp_advert_off()

(these fixes are really hard to split off into separate commits as that
would require going back and reapplying the change but with the old list
handling)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-22 23:00:30 +01:00
David Lamparter d889055d8e lib: convert if_zapi_callbacks into actual hooks
...so that multiple functions can be subscribed.

The create/destroy hooks are renamed to real/unreal because that's what
they *actually* signal.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-11-02 17:10:43 -07:00
David Lamparter acddc0ed3c *: auto-convert to SPDX License IDs
Done with a combination of regex'ing and banging my head against a wall.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2023-02-09 14:09:11 +01:00
Igor Ryzhov 096f7609f9 *: cleanup ifp->vrf_id
Since f60a1188 we store a pointer to the VRF in the interface structure.
There's no need anymore to store a separate vrf_id field.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-11-22 20:47:23 +03:00
David Lamparter a243d1db93 *: convert zclient callbacks to table
This removes a giant `switch { }` block from lib/zclient.c and
harmonizes all zclient callback function types to be the same (some had
a subset of the args, some had a void return, now they all have
ZAPI_CALLBACK_ARGS and int return.)

Apart from getting rid of the giant switch, this is a minor security
benefit since the function pointers are now in a `const` array, so they
can't be overwritten by e.g. heap overflows for code execution anymore.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2021-10-20 13:28:46 +02:00
Donald Sharp 7cfdb48554 *: Convert all usage of zclient_send_message to new enum
The `enum zclient_send_status` enum needs to be extended
throughout the code base to use the new states and
to fix up places where we tested against the return
value being non zero.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2020-11-15 15:04:52 -05:00
Pat Ruddy 26b6d034b0 vrrpd: Convert to using %pFX
Signed-off-by: Pat Ruddy <pat@voltanet.io>
2020-10-15 16:57:11 +01:00
Donatas Abraitis 15569c58f8 *: Replace __PRETTY_FUNCTION__/__FUNCTION__ to __func__
Just keep the code cool.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2020-03-05 20:23:23 +02:00
Quentin Young 490810d52a vrrpd: add vrf support
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-12-09 12:17:53 -05:00
Donald Sharp 3c3c325203 *: Convert zapi->interface_delete to ifp callback
Convert the callback of the interface_delete to the new
ifp callback.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp b0b69e59f4 *: Convert interface_down to interface down callback
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp ddbf3e6060 *: Convert from ->interface_up to the interface callback
For all the places we have a zclient->interface_up convert
them to use the interface ifp_up callback instead.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp ef7bd2a3d5 *: Switch all zclient->interface_add to interface create callback
Switch the zclient->interface_add functionality to have everyone
use the interface create callback in lib/if.c

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Donald Sharp 138c5a7450 *: Add infrastructure to support zapi interface callbacks
Start the conversion to allow zapi interface callbacks to be
controlled like vrf creation/destruction/change callbacks.

This will allow us to consolidate control into the interface.c
instead of having each daemon read the stream and react accordingly.
This will hopefully reduce a bunch of cut-n-paste stuff

Create 4 new callback functions that will be controlled by
lib/if.c

create -> A upper level protocol receives an interface creation event
The ifp is brand spanking newly created in the system.
up -> A upper level protocol receives a interface up event
This means the interface is up and ready to go.
down -> A upper level protocol receives a interface down
destroy -> A upper level protocol receives a destroy event
This means to delete the pointers associated with it.

At this point this is just boilerplate setup for future commits.
There is no new functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
2019-09-19 13:34:06 -04:00
Quentin Young 76bcde9e5d vrrpd: add more dbg logs around interfaces
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-08-02 17:20:44 +00:00
Quentin Young 2d8cb4be87 vrrpd: set interface ifindex to internal upon interface deletion
That fix line should have been in a different place.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-29 19:36:30 +00:00
Quentin Young 4b94b7ac92 vrrpd: set interface ifindex to internal upon deletion
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-07-08 18:35:14 +00:00
Quentin Young 4f576e7575 lib, vrrpd: define & use ZEBRA_ROUTE_VRRP
Allow Zebra to know our protocol name.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 2fff50ec01 vrrpd, lib: style fixes
Fixup:
* Blank lines after declarations
* Trailing whitespace
* Braces and parentheses

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 8bceffc7c2 vrrpd: don't update interface addrs on ifup
Updating interface addresses on autoconfigured VRRP instances when we
receive notification that an interface is up will cause us to delete
that VRRP instance because Zebra deletes all interface addresses when an
interfaces goes down so when it comes back up it has no addresses which
causes us to delete the instance, then Zebra subsequently sends us the
addresses which causes the instance to get recreated, however in a
non-owner scenario this will merely cause us to start in Backup, wait a
while, transition to Master, protodown off our interface, get an
interface up notification, delete all our ip addresses, destroy
ourselves, receive address notifications, recreate ourselves, reenter
Backup and cycle through it all over again.

So we just have to assume that no addresses went away since this
interface was last up.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young dca8cfccd2 vrrpd: enable vrrp zebra debugging
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 6e93585e6f vrrpd: interface tracking
* Dynamically bind interfaces when they become available
* Automatically start VRRP sessions when their interfaces are added or
  come up
* Automatically shut down VRRP sessions when their interfaces are
  deleted or go down
* Automatically unbind interfaces when they are deleted

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 27fd882710 vrrpd: autoconfig support, continued
* Add support for interface up/down + address add/del events when using
  autoconfigure mode
* Add autoconfig information to show command

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 53e60e5c58 vrrpd: autoconfig support
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young c3bd894e4d vrrpd: protodown macvlan in backup state
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 63d4bd12ca vrrpd: fix headers
* Add include guards where missing
* Add include guard comments where missing
* Fix copyright notices
* Sort includes

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young f3fe004780 vrrpd: send ND Router Advertisements
Send ND Router Advertisements when IPv6 VR is in Master state.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young b6029d6a5f vrrpd: zebra connections
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00
Quentin Young 5435a2bf61 vrrpd: initial commit
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2019-05-17 00:27:08 +00:00