summaryrefslogtreecommitdiffstats
path: root/vrrpd (follow)
Commit message (Collapse)AuthorAgeFilesLines
* vrrpd: fix coverity warningsQuentin Young2019-05-173-5/+15
| | | | | | | | | * Suppress false positive on out of bounds access * Suppress false positive on unchecked str2sockunion * Remove self assignment * Initialze struct msghdr to zero Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: const vrrp_hash_keyQuentin Young2019-05-171-2/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix some clang-analyze warningsQuentin Young2019-05-171-1/+3
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd, zebra: fix checkpatch warningsQuentin Young2019-05-173-7/+8
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: add 'show vrrp summary' commandQuentin Young2019-05-171-0/+69
| | | | | | Shows a brief summary table of all VRRP routers Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix memleak during config writeQuentin Young2019-05-171-0/+2
| | | | | | Forgot to free a list created in the course of writing our config. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix magnitude error when removing adver_intQuentin Young2019-05-171-1/+1
| | | | | | | When resetting advertisement interval back to the default, we were dividing centiseconds by 10 instead of milliseconds. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: convert defaults command to millisecondsQuentin Young2019-05-172-4/+11
| | | | | | Missed this in the conversion from centiseconds to milliseconds. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix global buffer overflow from style fixQuentin Young2019-05-171-1/+1
| | | | | | I knew I had done that for a reason Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: gracefully shutdown on SIGTERM / SIGINTQuentin Young2019-05-173-1/+29
| | | | | | | | Handle kill signals by gracefully destroying all of our VRRP instances. If any of them are in Master state, send an advert with 0 priority to notify Backup routers we are going down. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* lib, vrrpd: define & use ZEBRA_ROUTE_VRRPQuentin Young2019-05-171-1/+1
| | | | | | Allow Zebra to know our protocol name. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: use frr_elevate_privsQuentin Young2019-05-172-6/+3
| | | | | | Missed a few in the uplift. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd, lib: style fixesQuentin Young2019-05-178-25/+72
| | | | | | | | | Fixup: * Blank lines after declarations * Trailing whitespace * Braces and parentheses Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* doc: change vrrp to listen on port 2619Quentin Young2019-05-171-1/+1
| | | | | | 2617 was taken by BFD while VRRP was indev. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: include vrrp_packet.h in subdir.amQuentin Young2019-05-171-0/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: display configured adv int in json outputQuentin Young2019-05-171-0/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: change all user facing times to msQuentin Young2019-05-173-24/+35
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: tweak startup criteria for v6 VRRP routerQuentin Young2019-05-171-2/+3
| | | | | | | | | | * Remove check for having at least 2 IPv6 addresses on the macvlan device; this was only taking place in v6, and breaking the ability to start VRRP on an IPv6 macvlan that was already set to protodown on * Improve log messaging indicating that we cannot start because we haven't got any VIPs configured Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: add asserts for VRRPv2 and IPv6Quentin Young2019-05-171-1/+4
| | | | | | Disallow adding IPv6 addresses to VRRPv2 routers. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: do not start v6 router if using VRRPv2Quentin Young2019-05-171-0/+3
| | | | | | v2 doesn't support IPv6. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: make useless assert usefulQuentin Young2019-05-171-1/+2
| | | | | | Assert would always come back true due to improper placement. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: late bind to Tx addressQuentin Young2019-05-171-85/+94
| | | | | | | Stupid stupid stupid. I can just bind to the Tx address right before I Tx, since if I've gotten there I know my link is up. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix v2 master_down_interval computationQuentin Young2019-05-171-1/+3
| | | | | | | | VRRPv2 uses the configured advertisement interval to compute the master down timer, whereas VRRPv3 uses the one advertised by the master. Fix computation to use the configured in in v2. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: include auth fields in v2 packetQuentin Young2019-05-172-10/+16
| | | | | | | | | | Based on looking at other vendors, seems I misinterpreted the RFC - type 0 auth (no authentication) still requires the authentication fields to be present, just set to all zero. This should fix VRRPv2 interop with other vendors. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: allow centisecond precision for vrrpv2Quentin Young2019-05-171-1/+1
| | | | | | | | | | | | | The RFC is not clear about how precise the skew time calculation should be in VRRPv2. The advertisement interval is given in seconds, and the field in the advertisement packet only supports non-fractional seconds, so I was following this for calculating skew time as well. However the skew time formula in vrrpv2 always yields a fractional amount of seconds in the range (0-1), which right now means we always truncate to 0 seconds. I doubt this is what the RFC wanted so I'm allowing centisecond precision for skew time. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: display primary address in json outputQuentin Young2019-05-171-2/+12
| | | | | | | | | And also, fill in the non-json output with a :: for the v6 primary since we're letting the operating system select which one it wants to use and we don't actually know what our primary address is. Another thing to revisit in the future... Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "Revert "vrrpd: protodown mvlans when shutting down""Quentin Young2019-05-171-0/+3
| | | | | | | | | Now that the requirement of knowing our VRRP IPv6 primary address in advance is lifted, it's no problem for us that the macvlans could be down when we get them. We can handle this in both the v4 and v6 case now, so we don't need to behave as if they should always be left up. This reverts commit 6eae67dabcbc31a2117ce3847c18ac52b3b76b1e.
* vrrpd: allow OS to choose VRRP IPv6 src addressQuentin Young2019-05-171-7/+8
| | | | | | | | | | | | | | | | | | | | | | Under IPv6, Linux will look at our destination address and select the source address with the smallest scope that covers the destination. For the VRRP multicast address ff02::12, Linux will always select a link local address. We can take advantage of this behavior to avoid a subtle and complicated class of bugs caused by Zebra's semantics around inoperative interfaces. As far as Zebra is concerned, an inoperative interface has no addresses assigned to it. This is a real bummer for VRRP because it's quite possible that the IPv6 VRRP macvlan device is down when we attach to it, and we would really like to be able to know in advance which address we will be transmitting IPv6 advertisements from without having to bring an interface up to convince Zebra to tell us its address list. In the future, though, it would be better to be explicit about selecting the link local we want. This will require adding the ability to Zebra to read and send us address information for inoperative interfaces. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "vrrpd: protodown mvlans when shutting down"Quentin Young2019-05-171-3/+0
| | | | This reverts commit 9ed05814d5451379d37b6b3382b5b886afa1230f
* vrrpd: protodown mvlans when shutting downQuentin Young2019-05-171-0/+3
| | | | | | This way VMACs get uninstalled from any lower-layer hardware. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: clean up loggingQuentin Young2019-05-175-147/+167
| | | | | | | * Always include address family when available * Log advertisement decodes on one line Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* Revert "vrrpd: use parent interface LLA for advert tx"Quentin Young2019-05-171-1/+5
| | | | | | | This reverts commit 23e1accb0b083713ee7b0ef7fb08a0c47d4bbc85. This bug has now been fixed by preconfiguring the VRRP macvlan interfaces to use addrgenmode random instead of eui64.
* vrrpd: disallow setting priority = 255Quentin Young2019-05-171-1/+1
| | | | | | | | | Assuming we fix our automatic detection method in the future, we won't be able to revert this back to disallowing 255 without breaking user configs. Let's just disallow it now, there's no functional difference still. Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix broken reads when reinitializingQuentin Young2019-05-171-0/+2
| | | | | | | | | | | | | | | | | 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>
* vrrpd: fix debug message = -> <=Quentin Young2019-05-171-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: delay sending advert/garp/una for ifup pt 2Quentin Young2019-05-171-25/+37
| | | | | | | | | 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>
* vrrpd: delay sending adverts/garp/una for iface upQuentin Young2019-05-172-8/+95
| | | | | | | | 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>
* vrrpd: allow user to set priority = 255Quentin Young2019-05-172-4/+27
| | | | | | | | | | 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>
* vrrpd: fix sign compare on armelQuentin Young2019-05-171-1/+1
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix interface block config writesQuentin Young2019-05-171-4/+5
| | | | | | Improper reuse of list node broke config writes of multiple instances Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix autoconfig of protodown'd interfacesQuentin Young2019-05-171-15/+47
| | | | | | | | 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>
* vrrpd: add more debugging infoQuentin Young2019-05-172-4/+16
| | | | | | | * Add reason why we are discarding adverts * Add primary IP to show vrrp output Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: fix unsigned - signed cmpQuentin Young2019-05-171-1/+1
| | | | | | For some reason this warning only shows up on armel Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: check start for manual v6 addr addQuentin Young2019-05-171-0/+2
| | | | Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
* vrrpd: use parent interface LLA for advert txQuentin Young2019-05-171-5/+1
| | | | | | | | 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>
* vrrpd: only update one vrrp_router list at a timeQuentin Young2019-05-171-54/+45
| | | | | | | | | 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>
* vrrpd: set autoconfed VRRP ifaces protodown offQuentin Young2019-05-171-1/+4
| | | | | | | | | 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>
* vrrpd: fix bad fmt specifiers in dgram validatorQuentin Young2019-05-171-1/+2
| | | | | | | 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>
* vrrpd: log why vrouter could not be startedQuentin Young2019-05-171-2/+19
| | | | | | | 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>
* vrrpd: be less smart about interface stateQuentin Young2019-05-171-0/+8
| | | | | | | | | | | | | 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>