When a VRRP router was shut down - either due to an administrative
event, or its interface getting deleted, or some other reason - it was
forgetting to cancel its read task. When it was started again, the read
task was still around, and so it wasn't getting scheduled again with the
new socket fd's. This caused our socket to queue ingress packets but
never read them, resulting in the restarted router always electing
itself to Master (since it wasn't listening to any other advertisements,
even though the kernel was delivering them).
The t_write cancellation call doesn't matter here, but I'm putting it in
there because it doesn't hurt and this way I won't forget about it if it
becomes necessary in the future.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Pt 2: When transitioning directly into Master (because we are the
address owner), wait until Zebra sets the macvlan device to protodown
off before transmitting advertisements, gratuitous ARPs, or Unsolicited
Neighbor Advertisements.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When transitioning to Master from Backup, wait until Zebra sets the
macvlan device to protodown off before transmitting advertisements,
gratuitous ARPs, or Unsolicited Neighbor Advertisements.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Too many problems with implicit ownership determination via duplicate
address assignment. Will revisit that in the future. For now, allow user
to specify 255 as a priority value. This is functionally no different
than any other priority value; it just serves as a self-documenting way
of saying you want one router to always be master.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When autoconfiguring VRRP, interfaces that are protodown'd should be
automatically brought up. Otherwise Zebra won't send us their interface
addresses and we'll sit in Initialize forever.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Interface MACs for v6 macvlan devices are the same, so the link local
address will be the same, which breaks mastership election based on
primary address comparison. Use the parent interface link local address.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When using an autoconfigured VRRP instance, when an interface address
was added or deleted we were trying to update the address list for both
v4 and v6 vrrp_router's which sometimes would cause all the addresses to
get deleted off of one of them and result in an automatic shutdown.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
If we just detected a macvlan and used it to automatically create an
interface, set that interface into protodown off. This way users don't
have to manually bring the interface back up in order to get autoconfig
to work again.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
They used a %u where they should have used a PRIu16, and a %lu where
they wanted a %zu. Shame!
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
If we do a checkstart and cannot start the VRRP router, log the reason
why for debugging purposes.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Stop caring about interface state so much. It's screwing up autoconfig
because Zebra's message semantics are pretty much absolute nonsense when
it comes to indicating interface state.
This change will cause us to do things like attempt to transmit
advertisements on a down interface, but I'd rather have the user see
those error messages in the log file than force them to fight vrrpd to
convince it that, yes, they actually do want a VRRP instance created.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Allow configuring the following as global defaults:
- Priority
- Advertisement interval
- Preempt mode
- Administrative shutdown
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Transitioning to backup on an interface down causes all sorts of
problems when it comes back up, not least of which is breaking preempt
mode.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When an interface is deleted from the system, stop any attached VRRP
sessions before nulling out the interface fields.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
We have no facilities to enforce accept mode = false yet so this is
updated to reflect the actual state of the system.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
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>
Checks for interface usability instead of admin state, which is what I
wanted anyway. Also removes the operstate check when binding interfaces.
This way we can bind currently inoperative interfaces, won't start until
they're at least admin up, but *will* start if they're carrier down,
because we can fix that (and probably caused it :)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Having a v6 link-local is a precondition for starting a v6 VRRP router;
check that we do.
Also add some helpful comments to the check-start function because good
lord that thing is getting unwieldy.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Change the interface tracking code to react to an interface down by
automatically transitioning to Backup, instead of shutting down the
session. This is because we get ZEBRA_INTERFACE_DOWN messages when we
set an interface to protodown as part of transitioning to Backup; if we
shut down the session in response to these messages, we end up shutting
ourselves down every time we try to transition to Backup.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Was missing a check to make sure that the v6 address we select as the
source IP for advertisements was a link local address
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* 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>
When automatically creating new VRRP instances, we don't need to try to
bind them to macvlan interfaces again. We only need to do that when we
got notified that a new interface came up and want an existing VRRP
instance to update its interface bindings.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When shutting down a VRRP router, kill the sockets as well. Too
dangerous to try to reuse them.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
When adding and removing addreses. log them. Also include a VRID tag
when autoconfiguring new instances.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Ifindexes apparently change more often than one might expect and so are
not suitable for use in hash keys.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Fix null dereference when retrieving IPv6 source address
* Change IPv4 code path to use system-specified source address instead
of the one delivered in the IPv4 raw header
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Typo caused the IPv4 VRRP router to be shutdown instead of the IPv6 one,
and sometimes a crash.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Gate all debugging messages with the debugging system
* Simplify a bit of debugging where it was easy to do inline
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>