Quentin Young [Mon, 4 Mar 2019 20:15:25 +0000 (20:15 +0000)]
vrrpd: delay sending advert/garp/una for ifup pt 2
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>
Quentin Young [Mon, 4 Mar 2019 18:46:08 +0000 (18:46 +0000)]
vrrpd: delay sending adverts/garp/una for iface up
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>
Quentin Young [Mon, 4 Mar 2019 17:27:55 +0000 (17:27 +0000)]
vrrpd: allow user to set priority = 255
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>
Quentin Young [Thu, 28 Feb 2019 23:13:20 +0000 (23:13 +0000)]
vrrpd: fix autoconfig of protodown'd interfaces
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>
Quentin Young [Thu, 28 Feb 2019 19:00:26 +0000 (19:00 +0000)]
vrrpd: use parent interface LLA for advert tx
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>
Quentin Young [Thu, 28 Feb 2019 18:25:39 +0000 (18:25 +0000)]
vrrpd: only update one vrrp_router list at a time
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>
Quentin Young [Wed, 27 Feb 2019 22:46:24 +0000 (22:46 +0000)]
vrrpd: set autoconfed VRRP ifaces protodown off
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>
Quentin Young [Wed, 27 Feb 2019 20:46:35 +0000 (20:46 +0000)]
vrrpd: be less smart about interface state
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>
Quentin Young [Tue, 19 Feb 2019 22:36:34 +0000 (22:36 +0000)]
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>
Quentin Young [Tue, 19 Feb 2019 22:01:35 +0000 (22:01 +0000)]
vrrpd: use if_is_operative()
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>
Quentin Young [Fri, 15 Feb 2019 19:32:08 +0000 (19:32 +0000)]
vrrpd: tweak interface tracking on ifdown
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>
Quentin Young [Thu, 14 Feb 2019 22:28:51 +0000 (22:28 +0000)]
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>
Quentin Young [Wed, 13 Feb 2019 22:16:56 +0000 (22:16 +0000)]
vrrpd: skip binding interface after create
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>
Quentin Young [Tue, 12 Feb 2019 21:22:20 +0000 (21:22 +0000)]
vrrpd: properly retrieve pkt src address
* 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>
Quentin Young [Mon, 11 Feb 2019 16:36:09 +0000 (16:36 +0000)]
vrrpd: allow creation of adverts with no addresses
Fuzz testing revealed a crash in which VRRPD tries to create an
advertisement packet with no IP addresses. Should never occur under
normal use but might as well patch.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Fri, 8 Feb 2019 19:47:55 +0000 (19:47 +0000)]
vrrpd: properly find iface in manual cfg mode
As a crutch, interface search when manually configuring VRRP on an
interface did a prefix match on the name of macvlan interfaces,
comparing its name to the name of the interface VRRP was configured on
in order to determine if the interface under question was a subinterface
of the configured interface. This is obviously fragile and prone to
failure. We now pass up parent interface info from Zebra so use that
instead to correctly deduce parent-child relationships.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Fri, 1 Feb 2019 18:49:16 +0000 (18:49 +0000)]
vrrpd: cleanup vrrp packet crafting code
* Prefix all packet functions with 'vrrp_pkt'
* Break out checksum computation into separate function
* Accept version field when building advertisements
* Update doc comments
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Do nothing if user tries to add the same IP twice
* Implement deletion of IPs
* Deactivate virtual router if all IPs are deleted
* Deduplicate add / remove code
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Fri, 25 Jan 2019 18:48:41 +0000 (18:48 +0000)]
vrrpd: allow searching for interfaces late
Break out code for assigning macvlan interface to a vrrp router into its
own function so it can be called multiple times. This allows bringing up
IPv4 and IPv6 at different times if all the interfaces are not created
yet.
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Wed, 16 Jan 2019 23:14:40 +0000 (23:14 +0000)]
vrrpd: fix ownership discovery and mcast OIF
* Look for virtual IP ownership on the parent of the macvlan, not the
macvlan itself
* IPv4: bind socket to real IP of the macvlan parent, but transmit on
the macvlan interface
* IPv6: bind socket to IPv6 link local of the macvlan interface
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Mon, 7 Jan 2019 19:02:53 +0000 (19:02 +0000)]
vrrpd: add initial macvlan support
* Search for macvlan interfaces with the appropriate name and MAC
address when starting up a new VRRP instance
* Split VRRP socket into two; one for Tx, one for Rx
* Bind Tx socket to the macvlan subinterface so our VRRP advertisements
go out with the correct MAC address
* Send ARP requests from this macvlan subinterface
* Improve error messaging
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
Quentin Young [Wed, 19 Dec 2018 16:48:36 +0000 (16:48 +0000)]
vrrpd: read and validate vrrp advertisements
* Validate IPvX headers and packet contents
* Remove filter of non-255 TTL IPv4 packets; better to receive, log and
drop them ourselves
* Set outgoing packet TTL / hop limit to 255
* Use existing sockopt functions
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>