]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
5 years agoMerge pull request #4390 from qlyoung/frrstr-beginswith-endswith
Renato Westphal [Mon, 27 May 2019 23:55:14 +0000 (20:55 -0300)]
Merge pull request #4390 from qlyoung/frrstr-beginswith-endswith

lib: rename begins_with, add frrstr_endswith

5 years agozebra: Add kernel level graceful restart (#4301)
David Lamparter [Sat, 25 May 2019 09:43:10 +0000 (11:43 +0200)]
zebra: Add kernel level graceful restart (#4301)

zebra: Add kernel level graceful restart

5 years agoMerge branch 'pr4392'
David Lamparter [Sat, 25 May 2019 09:37:53 +0000 (11:37 +0200)]
Merge branch 'pr4392'

... with an extra space character added.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agodoc: fix space character nit
David Lamparter [Sat, 25 May 2019 09:37:06 +0000 (11:37 +0200)]
doc: fix space character nit

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agobgpd, lib: Remove SO_MARK
Donald Sharp [Fri, 24 May 2019 12:30:53 +0000 (08:30 -0400)]
bgpd, lib: Remove SO_MARK

The SO_MARK socket option was being used pre vrf to allow for the
separation of the front panel -vs- the management port.  This
was facilitated by a ip rule.  Since this is undocumented anywhere
in our system( other than old commits see
ed40466af80c9d0b88436c637a1d54b28a669b1c ).  We should remove this
because this will cause interference with people using rules
and are not aware of this offshoot of functionality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agobgpd: Display FD used for peer
Donald Sharp [Fri, 24 May 2019 12:27:19 +0000 (08:27 -0400)]
bgpd: Display FD used for peer

When issuing a `show bgp neighbor...` command display to the
end user the FD used for communication.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agodoc: Add 'show thread cpu' and 'show thread poll' documentation
Donald Sharp [Fri, 24 May 2019 12:15:40 +0000 (08:15 -0400)]
doc: Add 'show thread cpu' and 'show thread poll' documentation

Add some very basic 'show thread cpu' and 'show thread poll'
documentation to our system.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agodoc, tools: Update to code to show example MAX_FDS
Donald Sharp [Fri, 24 May 2019 12:04:33 +0000 (08:04 -0400)]
doc, tools: Update to code to show example MAX_FDS

Place in the code the ability for end operators to know how
to modify MAX_FDS so that they can run large scale operations.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: Display to end user the MAX_FDS allowed
Donald Sharp [Fri, 24 May 2019 11:53:32 +0000 (07:53 -0400)]
lib: Display to end user the MAX_FDS allowed

Upon startup FRR reads in the MAX_FDS variable from
it's control files via the getrlimit call.  We then
setup code to limit the poll data structure size to
that value.  The OS also limits our FD's to that value
because that is what is set.  Provide a methodology
that a interested end user can figure this data out.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: 'show thread cpu' help strings referenced a weird option
Donald Sharp [Fri, 24 May 2019 12:22:07 +0000 (08:22 -0400)]
lib: 'show thread cpu' help strings referenced a weird option

The 'show thread cpu' command referenced a 'b' option.  Which
is not parsed at all in the parse_filter function.  As such
I do not know what this was referencing as that it has been
removed.  Update the help strings to reflect this reality.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agodoc, zebra: Remove `keep_kernel_mode` from zebra
Donald Sharp [Sat, 11 May 2019 07:50:11 +0000 (03:50 -0400)]
doc, zebra: Remove `keep_kernel_mode` from zebra

This code doees this:

a) Imagine ospf installs a route into zebra.  Zebra crashes and
we restart FRR.  If we are using the -k option on zebra than
all routes are re-read in, including this OSPF route.
b) Now imagine at the same time that zebra is starting backup
ospf on a different router looses a link to the this route.
c) Since zebra was run with -k this OSPF route is read back
in but never replaced and we now have a route pointing out
an interface to other routers that cannot handle it.

We should never allow users to implement bad options from zebra's
perspective that allow them to put themselves into a clear problem
state and additionally we have *absolutely* no mechanism to ever
fix that broken route without special human interaction.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: Add kernel level graceful restart
Donald Sharp [Fri, 10 May 2019 00:06:13 +0000 (20:06 -0400)]
zebra: Add kernel level graceful restart

<Initial Code from Praveen Chaudhary>

Add the a `--graceful_restart X` flag to zebra start that
now creates a timer that pops in X seconds and will go
through and remove all routes that are older than startup.

If graceful_restart is not specified then we will just pop
a timer that cleans everything up immediately.

Signed-off-by: Praveen Chaudhary <pchaudhary@linkedin.com>
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agolib: replace begins_with, add frrstr_endswith
Quentin Young [Sat, 18 May 2019 01:35:38 +0000 (01:35 +0000)]
lib: replace begins_with, add frrstr_endswith

* Change 'begins_with' to 'frrstr_startswith' for consistency
* Add suffix checker, frrstr_endswith()
* Update vtysh to use the new function

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agoMerge pull request #4385 from manuhalo/fix_deprecate_retain
Quentin Young [Wed, 22 May 2019 19:02:27 +0000 (12:02 -0700)]
Merge pull request #4385 from manuhalo/fix_deprecate_retain

bgpd, ripd, ripngd: remove deprecated -r option

5 years agobgpd, ripd, ripngd: remove deprecated -r option
Emanuele Di Pascale [Wed, 22 May 2019 15:42:40 +0000 (17:42 +0200)]
bgpd, ripd, ripngd: remove deprecated -r option

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
5 years agoMerge pull request #4359 from adharkar/frr-master-rtm_vxlan
Donald Sharp [Tue, 21 May 2019 20:53:27 +0000 (16:53 -0400)]
Merge pull request #4359 from adharkar/frr-master-rtm_vxlan

Zebra: Handle VxLAN encap in netlink rtmsg for FPM

5 years agoMerge pull request #4374 from opensourcerouting/typesafe-minor-fixes
Donald Sharp [Tue, 21 May 2019 20:43:38 +0000 (16:43 -0400)]
Merge pull request #4374 from opensourcerouting/typesafe-minor-fixes

Minor fixes in the typesafe API for better C++ compatibility

5 years agoclang-format: update the ForEachMacros setting
Renato Westphal [Mon, 20 May 2019 21:52:16 +0000 (18:52 -0300)]
clang-format: update the ForEachMacros setting

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agotests: update list of headers in the cxx compat test
Renato Westphal [Mon, 20 May 2019 21:52:16 +0000 (18:52 -0300)]
tests: update list of headers in the cxx compat test

Now, whenever a new header is added to libfrr, this test needs to
be updated manually (unless we automate this somehow in the future).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years ago*: rename new ForEach macros from the typesafe API
Renato Westphal [Mon, 20 May 2019 21:52:16 +0000 (18:52 -0300)]
*: rename new ForEach macros from the typesafe API

This is necessary to avoid a name collision with std::for_each
from C++.

Fixes the compilation of the gRPC northbound module.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agolib: add missing extern "C" {} blocks to new headers
Renato Westphal [Mon, 20 May 2019 21:52:16 +0000 (18:52 -0300)]
lib: add missing extern "C" {} blocks to new headers

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #4364 from FRRouting/doc-libsnmp-dev-debian9
Renato Westphal [Tue, 21 May 2019 18:54:49 +0000 (15:54 -0300)]
Merge pull request #4364 from FRRouting/doc-libsnmp-dev-debian9

doc: add libsnmp-dev to debian 9 build deps

5 years agodoc: add libsnmp-dev to debian 8 & 9 build deps
Quentin Young [Fri, 17 May 2019 17:12:12 +0000 (10:12 -0700)]
doc: add libsnmp-dev to debian 8 & 9 build deps

Needed for `--enable-snmp`

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agoMerge pull request #4373 from opensourcerouting/ds-dlist
Donald Sharp [Tue, 21 May 2019 13:53:08 +0000 (09:53 -0400)]
Merge pull request #4373 from opensourcerouting/ds-dlist

lib: DECLARE_DLIST + DECLARE_HEAP + other datastructure improvements

5 years agoMerge pull request #4376 from opensourcerouting/remove-deprecated-cmd
Donald Sharp [Tue, 21 May 2019 13:02:32 +0000 (09:02 -0400)]
Merge pull request #4376 from opensourcerouting/remove-deprecated-cmd

bgpd: remove deprecated "bgp enforce-first-as" command

5 years agoRevert "lib: Make _find functions treat the head as const"
David Lamparter [Tue, 21 May 2019 02:53:30 +0000 (04:53 +0200)]
Revert "lib: Make _find functions treat the head as const"

This reverts commit 98d28ef55dd11a6efaa2bf3101ac57cf78e803bb.

No longer needed with previous commit.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib/table: remove nonsensical const, add pure
David Lamparter [Tue, 21 May 2019 02:48:30 +0000 (04:48 +0200)]
lib/table: remove nonsensical const, add pure

Passing the struct route_table *ptr as const doesn't really help; if
anything it semantically would imply that the returned route_node is
const too since constness should propagate (but it doesn't in C.)

The right thing to do here - which actually helps the compiler optimize
the code too - is to tag functions with __attribute__((pure)).  The
compiler does this automatically if it has the function body (and the
body of all called functions) available.  That should cover most "static
inline" functions in headers, as well as functions in the same file.

However, this doesn't work (at least without LTO) for extern functions.
Hence, add "ext_pure" for this case.  (Built-in "extern" to make lines
shorter.)

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib/table: remove odd casts
David Lamparter [Tue, 21 May 2019 03:00:09 +0000 (05:00 +0200)]
lib/table: remove odd casts

Working with a proper struct route_node gets us around a bunch of weird
casts here and makes the code slightly more robust.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agotests: more datastructure tests
David Lamparter [Tue, 21 May 2019 01:53:51 +0000 (03:53 +0200)]
tests: more datastructure tests

A little something for everybody in here.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib: add missing atomlist_init/fini
David Lamparter [Tue, 21 May 2019 03:16:08 +0000 (05:16 +0200)]
lib: add missing atomlist_init/fini

Only noticed this when trying to add atomlists to the typesafe
datastructure tests...  the atomic-specific test_atomlist doesn't use
init/fini :/

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib: add DECLARE_HEAP datastructure
David Lamparter [Tue, 21 May 2019 01:53:29 +0000 (03:53 +0200)]
lib: add DECLARE_HEAP datastructure

This is an 8-ary heap (cacheline optimized.)  It works as a semi-sorted
kind of middle ground between unsorted and sorted datastructures;  pop()
always returns the lowest item but ordering is only loosely enforced.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agobgpd: use DLIST for adv_fifo
David Lamparter [Mon, 20 May 2019 21:41:16 +0000 (23:41 +0200)]
bgpd: use DLIST for adv_fifo

I mistakenly assumed that something called "FIFO" would primarily be
used by removing items from the front.  This isn't the case for the
adv_fifo... so use a DLIST there to make sure deletions from the middle
of the queue are fast.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agotests: extend DECLARE_* tests
David Lamparter [Mon, 20 May 2019 21:20:11 +0000 (23:20 +0200)]
tests: extend DECLARE_* tests

The unsorted datastructures (LIST, DLIST) had no test before this.  Also
add a hash check (mostly to make testing the unsorted lists easier.)

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agotests: test DECLARE_HASH with good and bad hashfn
David Lamparter [Mon, 20 May 2019 19:04:14 +0000 (21:04 +0200)]
tests: test DECLARE_HASH with good and bad hashfn

The hash table test was previously (intentionally) using a bad hash
function to test the code in the face of hash collisions.  Add a test
with a good hash function to see some performance numbers.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib: add DECLARE_DLIST (double-linked list)
David Lamparter [Sun, 12 May 2019 10:05:44 +0000 (12:05 +0200)]
lib: add DECLARE_DLIST (double-linked list)

Turns out we need one of these.  Same API as DECLARE_LIST, but deleting
random items is much faster.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agolib: add dedicated pop() to DECLARE_SKIPLIST
David Lamparter [Sun, 12 May 2019 10:05:14 +0000 (12:05 +0200)]
lib: add dedicated pop() to DECLARE_SKIPLIST

The skiplist code was previously falling back to the del() code path for
a pop() on a skiplist.  This is unneeded complexity, a pop() can be done
more efficiently.

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agobgpd: remove deprecated "bgp enforce-first-as" command
Renato Westphal [Tue, 21 May 2019 01:01:41 +0000 (22:01 -0300)]
bgpd: remove deprecated "bgp enforce-first-as" command

The one-year deprecation period has passed, remove it.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
5 years agoMerge pull request #4362 from donaldsharp/more_more_less
Sri Mohana Singamsetty [Mon, 20 May 2019 23:23:25 +0000 (16:23 -0700)]
Merge pull request #4362 from donaldsharp/more_more_less

bgpd: Routemap processing was testing for an impossible flag

5 years agoMerge pull request #4372 from opensourcerouting/bgp-reason-warning
Donald Sharp [Mon, 20 May 2019 22:46:07 +0000 (18:46 -0400)]
Merge pull request #4372 from opensourcerouting/bgp-reason-warning

bgpd: fix compiler warning in reason2str

5 years agobgpd: fix compiler warning in reason2str
David Lamparter [Mon, 20 May 2019 21:45:34 +0000 (23:45 +0200)]
bgpd: fix compiler warning in reason2str

Signed-off-by: David Lamparter <equinox@diac24.net>
5 years agoMerge pull request #4365 from adharkar/frr-master-fpm_rtm_table
Donald Sharp [Mon, 20 May 2019 20:03:44 +0000 (16:03 -0400)]
Merge pull request #4365 from adharkar/frr-master-fpm_rtm_table

Zebra: Enhancements for rtm_table field in FPM netlink message

5 years agoMerge pull request #4285 from vishaldhingra/no_neighbor
Donald Sharp [Mon, 20 May 2019 18:10:16 +0000 (14:10 -0400)]
Merge pull request #4285 from vishaldhingra/no_neighbor

bgpd : no neighbor <> send-community large is not working dynamically

5 years agoMerge pull request #4350 from patrasar/pim_sg_expiry
Donald Sharp [Mon, 20 May 2019 17:30:14 +0000 (13:30 -0400)]
Merge pull request #4350 from patrasar/pim_sg_expiry

pimd: fix (s,g) expiry.

5 years agopimd: fix (s,g) expiry.
Sarita Patra [Thu, 16 May 2019 16:55:34 +0000 (09:55 -0700)]
pimd: fix (s,g) expiry.

Fix: When RP receives a (*, G) join and corresponding (s,g)
is present, then check for OIL is not-empty, then only switch
upstream (s, g) state to JOINED.

Signed-off-by: Sarita Patra <saritap@vmware.com>
5 years agoMerge pull request #4367 from qlyoung/doc-bgp-mpls
Renato Westphal [Mon, 20 May 2019 13:32:08 +0000 (10:32 -0300)]
Merge pull request #4367 from qlyoung/doc-bgp-mpls

doc: clarify mpls label export docs

5 years agoMerge pull request #4366 from qlyoung/vrrp-coverity-fixes
Renato Westphal [Mon, 20 May 2019 13:24:25 +0000 (10:24 -0300)]
Merge pull request #4366 from qlyoung/vrrp-coverity-fixes

vrrpd: fix coverity warnings

5 years agoMerge pull request #4328 from sworleys/Re-order-RouteEntry
Renato Westphal [Mon, 20 May 2019 13:20:47 +0000 (10:20 -0300)]
Merge pull request #4328 from sworleys/Re-order-RouteEntry

zebra: Reorder `struct route_entry` to reduce size

5 years agobgpd : no neighbor <> send-community large is not working dynamically
vishaldhingra [Wed, 8 May 2019 03:31:39 +0000 (20:31 -0700)]
bgpd : no neighbor <> send-community large is not working dynamically

updgrp_hash_key_make() uses the PEER_UPDGRP_AF_FLAGS for the key.
PEER_UPDGRP_AF_FLAGS contains the neigbor flags.
If user do no neighbor <> send community large, then the hash key
does not change and BGP does not send update for large community change.
Added the PEER_FLAG_SEND_LARGE_COMMUNITY in PEER_UPDGRP_AF_FLAGS.
After this the hash key gets changed and update will be processed
with large community.

Signed-off-by: vishaldhingra<vdhingra@vmware.com>
5 years agodoc: clarify mpls label export docs
btarno [Wed, 15 May 2019 17:26:25 +0000 (12:26 -0500)]
doc: clarify mpls label export docs

The current wording can sometimes be misinterpreted to mean that this
command is optional, but for an MPLS-VPN to function a VPN label MUST be
assigned to routes exported from the VPN.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix coverity warnings
Quentin Young [Fri, 17 May 2019 21:38:31 +0000 (21:38 +0000)]
vrrpd: fix coverity warnings

* 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>
5 years agoZebra: Enhancements for rtm_table field in FPM netlink message
Ameya Dharkar [Fri, 17 May 2019 19:47:57 +0000 (12:47 -0700)]
Zebra: Enhancements for rtm_table field in FPM netlink message

- Today,  rtm_table field takes a vrf_id. It should take table_id
- rtm_table field is a uchar field which can only accomodate table_id less than
  256. To support table id greater than 255, if the table_id is greater than 255,
  set rtm_table to 0 and add RTA_TABLE attribute with 32 bit value as the
  table_id.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
5 years agoMerge pull request #4357 from sworleys/Table-Null-Cov
Mark Stapp [Fri, 17 May 2019 18:44:11 +0000 (14:44 -0400)]
Merge pull request #4357 from sworleys/Table-Null-Cov

zebra: Continue rm update if table not found

5 years agoMerge pull request #4168 from qlyoung/vrrp
Sri Mohana Singamsetty [Fri, 17 May 2019 18:39:27 +0000 (11:39 -0700)]
Merge pull request #4168 from qlyoung/vrrp

VRRP

5 years agoZebra: Handle VxLAN encap in netlink rtmsg for FPM
Ameya Dharkar [Fri, 17 May 2019 01:38:03 +0000 (18:38 -0700)]
Zebra: Handle VxLAN encap in netlink rtmsg for FPM

- For data plane processing of VxLAN routes, add encap type and L3VNI info to
  rtmsg message for FPM.
- Add "RTA_ENCAP_TYPE" attribute for VxLAN encap with value 100.
  This value is not currently used for RTA_ENCAP_TYPE for any encap.
- If "RTA_ENCAP_TYPE" is 100, add "RTA_ENCAP" attribute with "RTA_VNI" as a
  nested attribute of RTA_ENCAP

Format of RTA_VNI attribute:
Len(2 bytes)       type (2 bytes)      Value(4 bytes)(VNI)
   00    08     :     00    00     :      1000

RTA_VNI attribute is a custom attribute.

Signed-off-by: Ameya Dharkar <adharkar@vmware.com>
5 years agoMerge pull request #4349 from donaldsharp/bgp_reason
Sri Mohana Singamsetty [Fri, 17 May 2019 16:51:17 +0000 (09:51 -0700)]
Merge pull request #4349 from donaldsharp/bgp_reason

Bgp reason

5 years agovrrpd: const vrrp_hash_key
Quentin Young [Fri, 17 May 2019 16:33:44 +0000 (16:33 +0000)]
vrrpd: const vrrp_hash_key

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agotools: add vrrpd to frrcommon.sh
Quentin Young [Fri, 17 May 2019 16:26:26 +0000 (16:26 +0000)]
tools: add vrrpd to frrcommon.sh

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix some clang-analyze warnings
Quentin Young [Fri, 17 May 2019 16:25:57 +0000 (16:25 +0000)]
vrrpd: fix some clang-analyze warnings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agobgpd: Routemap processing was testing for an impossible flag
Donald Sharp [Fri, 17 May 2019 11:29:47 +0000 (07:29 -0400)]
bgpd: Routemap processing was testing for an impossible flag

The flag PEER_FLAG_RSERVER_CLIENT is never set on peer->flags
and as such testing the flag for not being set will never
cause the if statement to be not entered.

Conversely setting update to 0 and then testing if (update && ...
will always cause another if statement to be never called, remove
it as well.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
5 years agozebra: gracefully fail to protodown on bsd
Quentin Young [Fri, 17 May 2019 00:26:24 +0000 (00:26 +0000)]
zebra: gracefully fail to protodown on bsd

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd, zebra: fix checkpatch warnings
Quentin Young [Fri, 17 May 2019 00:21:52 +0000 (00:21 +0000)]
vrrpd, zebra: fix checkpatch warnings

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: remove trailing whitespace in vrrp manpage
Quentin Young [Fri, 17 May 2019 00:18:50 +0000 (00:18 +0000)]
doc: remove trailing whitespace in vrrp manpage

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agozebra: update zebra_rib for vrrp
Quentin Young [Thu, 2 May 2019 17:22:42 +0000 (17:22 +0000)]
zebra: update zebra_rib for vrrp

VRRP doesn't install any routes, but should still have an array entry.
Also add a help string for VRRP to route_types.txt

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: add 'show vrrp summary' command
Quentin Young [Thu, 2 May 2019 15:53:58 +0000 (15:53 +0000)]
vrrpd: add 'show vrrp summary' command

Shows a brief summary table of all VRRP routers

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix memleak during config write
Quentin Young [Thu, 2 May 2019 15:54:25 +0000 (15:54 +0000)]
vrrpd: fix memleak during config write

Forgot to free a list created in the course of writing our config.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix magnitude error when removing adver_int
Quentin Young [Wed, 24 Apr 2019 17:02:35 +0000 (17:02 +0000)]
vrrpd: fix magnitude error when removing adver_int

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>
5 years agovrrpd: convert defaults command to milliseconds
Quentin Young [Wed, 24 Apr 2019 17:02:14 +0000 (17:02 +0000)]
vrrpd: convert defaults command to milliseconds

Missed this in the conversion from centiseconds to milliseconds.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agotools: fix vrrp autoconfigure reload
Quentin Young [Tue, 16 Apr 2019 18:24:01 +0000 (18:24 +0000)]
tools: fix vrrp autoconfigure reload

Ticket: CM-24375
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix global buffer overflow from style fix
Quentin Young [Mon, 22 Apr 2019 18:20:47 +0000 (18:20 +0000)]
vrrpd: fix global buffer overflow from style fix

I knew I had done that for a reason

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: gracefully shutdown on SIGTERM / SIGINT
Quentin Young [Mon, 22 Apr 2019 18:04:56 +0000 (18:04 +0000)]
vrrpd: gracefully shutdown on SIGTERM / SIGINT

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>
5 years agolib, vrrpd: define & use ZEBRA_ROUTE_VRRP
Quentin Young [Mon, 22 Apr 2019 18:03:30 +0000 (18:03 +0000)]
lib, vrrpd: define & use ZEBRA_ROUTE_VRRP

Allow Zebra to know our protocol name.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: use frr_elevate_privs
Quentin Young [Sat, 20 Apr 2019 00:41:30 +0000 (00:41 +0000)]
vrrpd: use frr_elevate_privs

Missed a few in the uplift.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: add VRRP documentation
Quentin Young [Thu, 18 Apr 2019 21:59:24 +0000 (21:59 +0000)]
doc: add VRRP documentation

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd, lib: style fixes
Quentin Young [Thu, 18 Apr 2019 20:03:35 +0000 (20:03 +0000)]
vrrpd, lib: style fixes

Fixup:
* Blank lines after declarations
* Trailing whitespace
* Braces and parentheses

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: add vrrpd(8)
Quentin Young [Mon, 15 Apr 2019 22:03:43 +0000 (22:03 +0000)]
doc: add vrrpd(8)

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agodoc: change vrrp to listen on port 2619
Quentin Young [Mon, 15 Apr 2019 22:15:28 +0000 (22:15 +0000)]
doc: change vrrp to listen on port 2619

2617 was taken by BFD while VRRP was indev.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: include vrrp_packet.h in subdir.am
Quentin Young [Mon, 25 Mar 2019 21:18:06 +0000 (21:18 +0000)]
vrrpd: include vrrp_packet.h in subdir.am

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: display configured adv int in json output
Quentin Young [Wed, 20 Mar 2019 04:55:35 +0000 (04:55 +0000)]
vrrpd: display configured adv int in json output

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: change all user facing times to ms
Quentin Young [Wed, 20 Mar 2019 04:50:22 +0000 (04:50 +0000)]
vrrpd: change all user facing times to ms

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: tweak startup criteria for v6 VRRP router
Quentin Young [Fri, 15 Mar 2019 19:54:37 +0000 (19:54 +0000)]
vrrpd: tweak startup criteria for v6 VRRP router

* 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>
5 years agozebra: don't protodown a NULL interface
Quentin Young [Thu, 14 Mar 2019 19:51:32 +0000 (19:51 +0000)]
zebra: don't protodown a NULL interface

We were running into some problems where VRRP is trying to protodown
interfaces that no longer exist. While this is a minor bug in its own
right, this was crashing Zebra because Zebra was not doing a null check
after its ifindex lookup.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: add asserts for VRRPv2 and IPv6
Quentin Young [Thu, 14 Mar 2019 15:56:39 +0000 (15:56 +0000)]
vrrpd: add asserts for VRRPv2 and IPv6

Disallow adding IPv6 addresses to VRRPv2 routers.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: do not start v6 router if using VRRPv2
Quentin Young [Thu, 14 Mar 2019 15:54:49 +0000 (15:54 +0000)]
vrrpd: do not start v6 router if using VRRPv2

v2 doesn't support IPv6.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: make useless assert useful
Quentin Young [Thu, 14 Mar 2019 15:43:22 +0000 (15:43 +0000)]
vrrpd: make useless assert useful

Assert would always come back true due to improper placement.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: late bind to Tx address
Quentin Young [Thu, 14 Mar 2019 15:18:20 +0000 (15:18 +0000)]
vrrpd: late bind to Tx address

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>
5 years agovrrpd: fix v2 master_down_interval computation
Quentin Young [Wed, 13 Mar 2019 18:37:48 +0000 (18:37 +0000)]
vrrpd: fix v2 master_down_interval computation

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>
5 years agovrrpd: include auth fields in v2 packet
Quentin Young [Wed, 13 Mar 2019 17:18:36 +0000 (17:18 +0000)]
vrrpd: include auth fields in v2 packet

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>
5 years agovrrpd: allow centisecond precision for vrrpv2
Quentin Young [Tue, 12 Mar 2019 17:31:39 +0000 (17:31 +0000)]
vrrpd: allow centisecond precision for vrrpv2

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>
5 years agovrrpd: display primary address in json output
Quentin Young [Fri, 8 Mar 2019 18:52:56 +0000 (18:52 +0000)]
vrrpd: display primary address in json output

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>
5 years agoRevert "Revert "vrrpd: protodown mvlans when shutting down""
Quentin Young [Fri, 8 Mar 2019 18:35:04 +0000 (18:35 +0000)]
Revert "Revert "vrrpd: protodown mvlans when shutting down""

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.

5 years agovrrpd: allow OS to choose VRRP IPv6 src address
Quentin Young [Fri, 8 Mar 2019 18:30:03 +0000 (18:30 +0000)]
vrrpd: allow OS to choose VRRP IPv6 src address

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>
5 years agoRevert "vrrpd: protodown mvlans when shutting down"
Quentin Young [Thu, 7 Mar 2019 21:18:03 +0000 (21:18 +0000)]
Revert "vrrpd: protodown mvlans when shutting down"

This reverts commit 9ed05814d5451379d37b6b3382b5b886afa1230f

5 years agovrrpd: protodown mvlans when shutting down
Quentin Young [Thu, 7 Mar 2019 19:14:14 +0000 (19:14 +0000)]
vrrpd: protodown mvlans when shutting down

This way VMACs get uninstalled from any lower-layer hardware.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: clean up logging
Quentin Young [Thu, 7 Mar 2019 18:46:02 +0000 (18:46 +0000)]
vrrpd: clean up logging

* Always include address family when available
* Log advertisement decodes on one line

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agoRevert "vrrpd: use parent interface LLA for advert tx"
Quentin Young [Wed, 6 Mar 2019 20:00:57 +0000 (20:00 +0000)]
Revert "vrrpd: use parent interface LLA for advert tx"

This reverts commit 23e1accb0b083713ee7b0ef7fb08a0c47d4bbc85.

This bug has now been fixed by preconfiguring the VRRP macvlan
interfaces to use addrgenmode random instead of eui64.

5 years agovrrpd: disallow setting priority = 255
Quentin Young [Wed, 6 Mar 2019 18:34:34 +0000 (18:34 +0000)]
vrrpd: disallow setting priority = 255

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>
5 years agovrrpd: fix broken reads when reinitializing
Quentin Young [Tue, 5 Mar 2019 20:33:27 +0000 (20:33 +0000)]
vrrpd: fix broken reads when reinitializing

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>
5 years agovtysh: don't sort vrrp interface config
Quentin Young [Tue, 5 Mar 2019 18:57:14 +0000 (18:57 +0000)]
vtysh: don't sort vrrp interface config

It is order dependent

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: fix debug message = -> <=
Quentin Young [Tue, 5 Mar 2019 18:38:20 +0000 (18:38 +0000)]
vrrpd: fix debug message = -> <=

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
5 years agovrrpd: delay sending advert/garp/una for ifup pt 2
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>