2 days agoMerge pull request #4165 from dslicenc/rnh-invalid-nexthops master
Mark Stapp [Fri, 19 Apr 2019 18:11:22 +0000 (14:11 -0400)]
Merge pull request #4165 from dslicenc/rnh-invalid-nexthops

zebra: stop sending invalid nexthops to clients

2 days agozebra: stop sending invalid nexthops to clients 4165/head
Don Slice [Mon, 15 Apr 2019 18:27:00 +0000 (18:27 +0000)]
zebra: stop sending invalid nexthops to clients

Found that zebra_rnh_apply_nht_rmap would set the
NEXTHOP_FLAG_ACTIVE if not blocked by the route-map, even
if the flag was not active prior to the check.  This fix
changes the flag used to denote the nexthop is filtered so
that proper active state can be retained. Additionally,
found two cases where we would send invalid nexthops via
send_client, which would also cause this crash.  All three
fixed in this commit.

Signed-off-by: Don Slice <>
2 days agoMerge pull request #4164 from opensourcerouting/rm-ports
Quentin Young [Fri, 19 Apr 2019 16:03:40 +0000 (12:03 -0400)]
Merge pull request #4164 from opensourcerouting/rm-ports

ports: remove abandoned ports subdirectory

2 days agoMerge pull request #4154 from donaldsharp/zebra_run_once
Mark Stapp [Fri, 19 Apr 2019 15:57:39 +0000 (11:57 -0400)]
Merge pull request #4154 from donaldsharp/zebra_run_once

Zebra: run nht once

3 days agozebra: Update flag output for route entry dump 4154/head
Donald Sharp [Wed, 17 Apr 2019 15:47:48 +0000 (11:47 -0400)]
zebra: Update flag output for route entry dump

Update the nexthop flag output for the route entry dump to
include all possible flag states be output.

Signed-off-by: Donald Sharp <>
3 days agozebra: Run nexthop_active_check once
Donald Sharp [Tue, 16 Apr 2019 13:06:35 +0000 (09:06 -0400)]
zebra: Run nexthop_active_check once

We currently run nexthop_active_check multiple times.  Make the
code run once and figure out state from that.

Signed-off-by: Donald Sharp <>
3 days agozebra: Double check is not necessary in nexthop_active_update
Donald Sharp [Tue, 16 Apr 2019 13:07:12 +0000 (09:07 -0400)]
zebra: Double check is not necessary in nexthop_active_update

The nexthop_active_update command looks at each individual
nexthop and decides if it has changed.  If any nexthop
has changed we will set the re->status to ROUTE_ENTRY_CHANGED

Additionally the test for old_nh_num != curr_active
makes no sense because suppose we have several events
we are processing at the same time and a total ecmp
of 16 but 14 are active at the start and 14 are active
at the end but different interfaces are up or down.

Signed-off-by: Donald Sharp <>
3 days agolib, zebra: Remove unused flag
Donald Sharp [Tue, 16 Apr 2019 12:37:24 +0000 (08:37 -0400)]
lib, zebra: Remove unused flag

The NEXTHOP_FLAG_FILTERED went away when we started treating
static routes like every other route in the system.  This was
a special case for handling static route code that just didn't
get finished cleaning up.

Signed-off-by: Donald Sharp <>
3 days agozebra: nexthop_active_update does not need set
Donald Sharp [Tue, 16 Apr 2019 12:09:56 +0000 (08:09 -0400)]
zebra: nexthop_active_update does not need set

We are effectively calling nexthop_active_update() on every
route entry being processed for installation at least 2 times.
This is a bit ridiculous.  We need to resolve the nexthops
when we know a route has changed in some manner, so do so.

Signed-off-by: Donald Sharp <>
3 days agoMerge pull request #4116 from nitinsoniism/show_l2vpn_evpn_route_detail
Sri Mohana Singamsetty [Thu, 18 Apr 2019 18:22:50 +0000 (08:22 -1000)]
Merge pull request #4116 from nitinsoniism/show_l2vpn_evpn_route_detail

bgpd: new show cmd - bgp l2vpn evpn route detail

3 days agolib: Add a counter for number of nexthops
Donald Sharp [Fri, 15 Feb 2019 16:02:44 +0000 (11:02 -0500)]
lib: Add a counter for number of nexthops

Add a ability to count the number of nexthops in a nexthop_group.

Signed-off-by: Donald Sharp <>
3 days agotests: bgp_l3vpn_to_bgp_vrf were bailing to quickly
Donald Sharp [Thu, 18 Apr 2019 00:47:44 +0000 (20:47 -0400)]
tests: bgp_l3vpn_to_bgp_vrf were bailing to quickly

The tests are not coming up consistently on my test box.  Add a bit of wait
time to test to allow normal bgp when the first attempt doesn't come up.
Especially since bgp timeouts are 120 seconds with non datacenter compiles.

Signed-off-by: Donald Sharp <>
3 days agoMerge pull request #4141 from opensourcerouting/nb-minor-fixes
Mark Stapp [Thu, 18 Apr 2019 17:48:15 +0000 (13:48 -0400)]
Merge pull request #4141 from opensourcerouting/nb-minor-fixes

northbound minor fixes and improvements

3 days agoports: remove abandoned ports subdirectory 4164/head
Renato Westphal [Thu, 18 Apr 2019 17:05:07 +0000 (14:05 -0300)]
ports: remove abandoned ports subdirectory

This subdirectory is outdated in all possible ways. Remove it.

FRR already has a FreeBSD port and it's maintained separately.

Signed-off-by: Renato Westphal <>
3 days agoMerge pull request #4160 from pguibert6WIND/optionZforgotten
Renato Westphal [Thu, 18 Apr 2019 16:18:42 +0000 (13:18 -0300)]
Merge pull request #4160 from pguibert6WIND/optionZforgotten

bgpd: add the -Z option to run bgp without zebra

3 days agolib: make nb_candidate_edit() more flexible 4141/head
Renato Westphal [Mon, 15 Apr 2019 22:04:30 +0000 (19:04 -0300)]
lib: make nb_candidate_edit() more flexible

Certain operations, like removing non-presence containers or
modifying list keys, are not considered to be valid from the
perspective of the northbound layer. This is because we want to
implement a minimum set of northbound configuration callbacks and
use them to process all possible configuration changes.

The removal of a np-container [1], for example, can be processed by
calling the "delete" callback of all of its child nodes (recursion
is used for np-container child nodes). Similarly, the modification
of a list key can be processed as if the corresponding list entry
was removed and readded with updated key values. This strategy saves
us the burden of implementing lots of extra configuration callbacks.

That said, the nb_operation_is_valid() function shouldn't be used
for anything other than checking which callbacks are valid for
which YANG nodes. Using it in the nb_candidate_edit() function
is inappropriate as we want as much flexibility as possible when
editing a candidate configuration. We should allow CLI commands,
for example, to remove np-containers (the northbound layer will then
figure out which callbacks need to be called when this candidate
is committed). Remove the check.

[1] We can't do the same for presence containers since they have a
"create" callback associated with them.

Signed-off-by: Renato Westphal <>
3 days agolib: introduce flog() to simplify the northbound code a little bit
Renato Westphal [Mon, 15 Apr 2019 22:03:57 +0000 (19:03 -0300)]
lib: introduce flog() to simplify the northbound code a little bit

flog() is a small wrapper around zlog() that can be useful in a
few places to reduce code duplication.

Signed-off-by: Renato Westphal <>
3 days agolib: move zlog() prototype back to the public logging API
Renato Westphal [Thu, 18 Apr 2019 16:13:26 +0000 (13:13 -0300)]
lib: move zlog() prototype back to the public logging API

zlog() should be part of the public logging API as it's useful in
the cases where the logging priority isn't known at compile time
(i.e. it depends on a variable).

Signed-off-by: Renato Westphal <>
3 days agolib: don't initialize the northbound database in the unit tests
Renato Westphal [Mon, 15 Apr 2019 22:03:15 +0000 (19:03 -0300)]
lib: don't initialize the northbound database in the unit tests

Move call to nb_db_init() from nb_init() to frr_init() so that only
the FRR daemons will initialize the northbound database. This should
fix a few warnings when running some unit tests.

Signed-off-by: Renato Westphal <>
3 days agolib: sync sysrepo module with latest API changes
Renato Westphal [Mon, 15 Apr 2019 22:01:43 +0000 (19:01 -0300)]
lib: sync sysrepo module with latest API changes

Signed-off-by: Renato Westphal <>
3 days agobgpd: add the -Z option to run bgp without zebra 4160/head
Philippe Guibert [Thu, 18 Apr 2019 13:46:36 +0000 (15:46 +0200)]
bgpd: add the -Z option to run bgp without zebra

this feature was already pushed, but the way the arguments were passed
to bgp were wrong.

Signed-off-by: Philippe Guibert <>
3 days ago.gitignore: ignore core dumps
Quentin Young [Wed, 17 Apr 2019 20:40:46 +0000 (20:40 +0000)]
.gitignore: ignore core dumps

Signed-off-by: Quentin Young <>
3 days agolib: remove core dump
Quentin Young [Wed, 17 Apr 2019 20:31:30 +0000 (20:31 +0000)]
lib: remove core dump

Signed-off-by: Quentin Young <>
4 days agoMerge pull request #4151 from opensourcerouting/ospf-assorted-20190417
Donald Sharp [Wed, 17 Apr 2019 12:47:08 +0000 (08:47 -0400)]
Merge pull request #4151 from opensourcerouting/ospf-assorted-20190417

assorted OSPF fixes

4 days agoMerge pull request #4148 from donaldsharp/ospf6_list_headinator
Mark Stapp [Wed, 17 Apr 2019 12:21:24 +0000 (08:21 -0400)]
Merge pull request #4148 from donaldsharp/ospf6_list_headinator

ospf6d: listhead returns a listnode *

4 days agoospfd: make ECMP nexthop order deterministic
David Lamparter [Tue, 16 Apr 2019 19:33:06 +0000 (21:33 +0200)]
ospfd: make ECMP nexthop order deterministic

The order of ECMP nexthops currently depends on whatever order the
pqueue code returns the vertices in, which is essentially random since
they compare as equal.  While this shouldn't cause issues normally, it
is nondeterministic and causes the ldp-topo1 test to fail when the
ordering comes up different.  Also, nondeterministic behaviour is not a
nice thing to have here in general.

Just sort by nexthop address;  realistic numbers of ECMP nexthops should
hopefully not make this a performance issue.  (Also, nexthops should be
hot in the caches here.)

Signed-off-by: David Lamparter <>
4 days agoospfd: fix clang-SA warning
David Lamparter [Fri, 29 Mar 2019 11:25:45 +0000 (12:25 +0100)]
ospfd: fix clang-SA warning

Need to clear refresh_list before dropping the reference.

Signed-off-by: David Lamparter <>
4 days agoospf6d: listhead returns a listnode *
Donald Sharp [Wed, 17 Apr 2019 03:15:56 +0000 (23:15 -0400)]
ospf6d: listhead returns a listnode *

The ospf6_route_get_first_nh_index function call calls
listhead which returns a (listnode *) but we are casting
it to a (struct ospf6_nexthop *) and away we go.

Fixes: #4142
Found By: Kwind
Signed-off-by: Donald Sharp <>
4 days agoMerge pull request #4147 from mjstapp/fix_pim_zebra_warning
Donald Sharp [Tue, 16 Apr 2019 23:31:34 +0000 (19:31 -0400)]
Merge pull request #4147 from mjstapp/fix_pim_zebra_warning

pimd: fix compile warnings

4 days agoMerge pull request #4084 from qlyoung/bgp-prefix-md5-auth
Russ White [Tue, 16 Apr 2019 23:25:43 +0000 (19:25 -0400)]
Merge pull request #4084 from qlyoung/bgp-prefix-md5-auth

Support TCP MD5 auth on prefixes & enable MD5 auth for BGP listen ranges

5 days agopimd: fix compile warnings 4147/head
Mark Stapp [Tue, 16 Apr 2019 18:28:10 +0000 (14:28 -0400)]
pimd: fix compile warnings

Remove set-but-unused variables that provoke compile warnings

Signed-off-by: Mark Stapp <>
5 days agoMerge pull request #4132 from opensourcerouting/northbound-debug
Mark Stapp [Tue, 16 Apr 2019 16:01:09 +0000 (12:01 -0400)]
Merge pull request #4132 from opensourcerouting/northbound-debug

lib: add fine-grained debugging in the northbound

5 days agoMerge pull request #4143 from opensourcerouting/update-libyang-build-intr
Quentin Young [Tue, 16 Apr 2019 15:58:51 +0000 (11:58 -0400)]
Merge pull request #4143 from opensourcerouting/update-libyang-build-intr

doc: update libyang build instructions to enable compiler optimizations

5 days agoMerge pull request #4031 from nitinsoniism/show_evpn_route_vni_all_detail
Russ White [Tue, 16 Apr 2019 15:42:25 +0000 (11:42 -0400)]
Merge pull request #4031 from nitinsoniism/show_evpn_route_vni_all_detail

bgpd: new show cmd  - bgp l2vpn evpn route vni all detail

5 days agodoc: document bgp listen ranges and md5 behavior
Quentin Young [Tue, 16 Apr 2019 15:19:10 +0000 (15:19 +0000)]
doc: document bgp listen ranges and md5 behavior

Signed-off-by: Quentin Young <>
5 days agobgpd: add support for MD5 auth on listen ranges
Quentin Young [Fri, 29 Mar 2019 23:24:08 +0000 (19:24 -0400)]
bgpd: add support for MD5 auth on listen ranges

Co-authored-by: Donald Sharp <>
Co-authored-by: Quentin Young <>
Signed-off-by: Quentin Young <>
5 days agolib: add support for extended TCP MD5 auth
Quentin Young [Mon, 1 Apr 2019 18:16:54 +0000 (18:16 +0000)]
lib: add support for extended TCP MD5 auth

MD5 auth on TCP is supported for prefixes in recent versions of Linux;
add complementary support for FRR.

This is a reworked version of Donald's commit to keep library
compatibility and obviate the need for changes in daemons that don't
need to support this themselves.

Signed-off-by: Quentin Young <>
5 days agoMerge pull request #3720 from donaldsharp/bgp_vrf_peering
Renato Westphal [Tue, 16 Apr 2019 15:25:26 +0000 (12:25 -0300)]
Merge pull request #3720 from donaldsharp/bgp_vrf_peering

lib: Allow bgp to always create a listen socket for the vrf

5 days agoMerge pull request #3762 from pguibert6WIND/do_not_alloc_lists_fs_by_def
Lou Berger [Tue, 16 Apr 2019 15:24:48 +0000 (11:24 -0400)]
Merge pull request #3762 from pguibert6WIND/do_not_alloc_lists_fs_by_def

bgpd: do not allocate lists on fs entries of bgp entries.

5 days agoMerge pull request #4096 from donaldsharp/pim_nht_cleanup
Russ White [Tue, 16 Apr 2019 14:27:35 +0000 (10:27 -0400)]
Merge pull request #4096 from donaldsharp/pim_nht_cleanup

Pim nht cleanup

5 days agoMerge pull request #4094 from mjstapp/dplane_system_routes
Russ White [Tue, 16 Apr 2019 14:22:26 +0000 (10:22 -0400)]
Merge pull request #4094 from mjstapp/dplane_system_routes

zebra: dataplane notifications for system route changes

5 days agoMerge pull request #4029 from ak503/isis_yang
Russ White [Tue, 16 Apr 2019 14:09:57 +0000 (10:09 -0400)]
Merge pull request #4029 from ak503/isis_yang

isis: priority of isis commands in interface configuration

5 days agodoc: update libyang build instructions to enable compiler optimizations 4143/head
Renato Westphal [Tue, 16 Apr 2019 12:52:20 +0000 (09:52 -0300)]
doc: update libyang build instructions to enable compiler optimizations

libyang defaults CMAKE_BUILD_TYPE to "Debug", which disables compiler
optimizations. We should instruct our users to build libyang in the
"Release" mode so that compiler optimizations are enabled and they
can benefit from the associated performance improvements.

Signed-off-by: Renato Westphal <>
5 days agofabricd: allow redistribute statements with both the route-map and metric options 4029/head
Dmitrii Turlupov [Mon, 1 Apr 2019 13:55:38 +0000 (16:55 +0300)]
fabricd: allow redistribute statements with both the route-map and metric options

Signed-off-by: Dmitrii Turlupov <>
5 days agoisisd: allow redistribute statements with both the route-map and metric options
Dmitrii Turlupov [Fri, 29 Mar 2019 11:17:41 +0000 (14:17 +0300)]
isisd: allow redistribute statements with both the route-map and metric options

Fixes #4012.

Signed-off-by: Dmitrii Turlupov <>
5 days agoyang: priority of isis commands in interface configuration
Dmitrii Turlupov [Wed, 27 Mar 2019 12:27:36 +0000 (15:27 +0300)]
yang: priority of isis commands in interface configuration

Move down the "circuit-type" leaf in the isisd YANG module so that
"ip[v6] router isis" will be the first commands displayed in the
running configuration.

Fixes #4028.

Signed-off-by: Dmitrii Turlupov <>
5 days agoMerge pull request #4139 from qlyoung/doc-add-libyang-denablecache-fix
Renato Westphal [Mon, 15 Apr 2019 19:33:26 +0000 (16:33 -0300)]
Merge pull request #4139 from qlyoung/doc-add-libyang-denablecache-fix

doc: document libyang cache bug workaround

5 days agodoc: document libyang cache bug workaround 4139/head
Quentin Young [Mon, 15 Apr 2019 19:29:10 +0000 (19:29 +0000)]
doc: document libyang cache bug workaround

Document workaround for

Signed-off-by: Quentin Young <>
6 days agolib: add fine-grained debugging in the northbound 4132/head
Renato Westphal [Fri, 12 Apr 2019 21:00:26 +0000 (18:00 -0300)]
lib: add fine-grained debugging in the northbound

Split the "debug northbound" command into the following commands:
* debug northbound callbacks configuration
* debug northbound callbacks state
* debug northbound callbacks rpc
* debug northbound notifications
* debug northbound events
* debug northbound client confd
* debug northbound client sysrepo

If "debug northbound" is entered alone, all of its suboptions
are enabled.

This commit also adds code to debug state/rpc callbacks and
notifications (only configuration callbacks were logged before).

Use the debugging infrastructure from "lib/debug.h" in order to
benefit from its facilities (e.g. MT-safe debugging) and avoid
code duplication.

Signed-off-by: Renato Westphal <>
6 days agolib: fix inverted logic in the "debug all" command
Renato Westphal [Fri, 12 Apr 2019 21:00:05 +0000 (18:00 -0300)]
lib: fix inverted logic in the "debug all" command

Signed-off-by: Renato Westphal <>
6 days agoMerge pull request #4130 from donaldsharp/show_frr
Philippe Guibert [Sun, 14 Apr 2019 20:20:12 +0000 (22:20 +0200)]
Merge pull request #4130 from donaldsharp/show_frr

zebra: Add hidden 'show frr' command

9 days agozebra: Add hidden 'show frr' command 4130/head
Donald Sharp [Fri, 12 Apr 2019 14:25:11 +0000 (10:25 -0400)]
zebra: Add hidden 'show frr' command

Signed-off-by: Donald Sharp <>
9 days agoMerge pull request #4081 from donaldsharp/rnh_reorder
Russ White [Thu, 11 Apr 2019 22:02:20 +0000 (18:02 -0400)]
Merge pull request #4081 from donaldsharp/rnh_reorder

zebra: Make rnh only send response once on first registration

9 days agoMerge pull request #4103 from qlyoung/fix-ospf-+metric
Russ White [Thu, 11 Apr 2019 21:45:41 +0000 (17:45 -0400)]
Merge pull request #4103 from qlyoung/fix-ospf-+metric

ospfd: fix behavior of +/-metric

9 days agoMerge pull request #4105 from donaldsharp/pim_cleanups
Russ White [Thu, 11 Apr 2019 21:44:50 +0000 (17:44 -0400)]
Merge pull request #4105 from donaldsharp/pim_cleanups

Pim cleanups

9 days agoMerge pull request #4111 from sworleys/Netlink-Rule-SA-Fix
Russ White [Thu, 11 Apr 2019 21:39:48 +0000 (17:39 -0400)]
Merge pull request #4111 from sworleys/Netlink-Rule-SA-Fix

zebra: Fix late memset of pbr rule in rule_netlink

9 days agoMerge pull request #4125 from mjstapp/fix_debug_pim_static
Quentin Young [Thu, 11 Apr 2019 20:14:30 +0000 (16:14 -0400)]
Merge pull request #4125 from mjstapp/fix_debug_pim_static

pimd: use debug pim static

10 days agopimd: use debug pim static 4125/head
Mark Stapp [Thu, 11 Apr 2019 15:46:40 +0000 (11:46 -0400)]
pimd: use debug pim static

Replace cli 'debug static' with 'debug pim static', to make
the 'debug static' node available for staticd (eventually).

Signed-off-by: Mark Stapp <>
10 days agoMerge pull request #4119 from pacovn/201904_master__pw_fixes
Donald Sharp [Thu, 11 Apr 2019 12:20:02 +0000 (08:20 -0400)]
Merge pull request #4119 from pacovn/201904_master__pw_fixes

zebra: pseudowire event recovery (DoS fix)

10 days agobgpd: new show cmd - bgp l2vpn evpn route detail 4116/head
Nitin Soni [Wed, 10 Apr 2019 06:13:51 +0000 (23:13 -0700)]
bgpd: new show cmd - bgp l2vpn evpn route detail

This command is added to provide detailed information. It will be
useful in troubleshooting as we will be able to dump all detailed info
using a single command.
"show bgp l2vpn evpn route [detail] ...". Additional filtering
can be done by providing type of the route.

Command will display the detailed content for all rd and macs-ip as
displayed by "show bgp l2vpn evpn route rd <> mac <>" for a single
rd, mac, ip from the global bgp routing table.

Ticket: CM-24397
Signed-off-by: Nitin Soni <>

10 days agozebra: dataplane notifications for system route changes 4094/head
Mark Stapp [Thu, 21 Mar 2019 18:26:54 +0000 (14:26 -0400)]
zebra: dataplane notifications for system route changes

Add notifications from zebra to the dataplane subsystem when
kernel or connected routes change.

Signed-off-by: Mark Stapp <>
11 days agozebra: pseudowire event recovery (DoS fix) 4119/head
F. Aragon [Wed, 10 Apr 2019 17:08:50 +0000 (19:08 +0200)]
zebra: pseudowire event recovery (DoS fix)

When having a route recovery, because of the route installation
cycling and the next hop label check, it could happen that the PW
never gets recovered. The original code shows the intention of retrying,
but the code was missing. The fix includes the call to the timer programming
the recovery attempt.

Example for reproducing the issue:

      |P1|  <->  |P2|  <->  |P3|

- Being P1, P2, P3 nodes, using IS-IS as IGP, and having a pseudowire
betwen P1 and P3 (P1, P2, P3 having configured LDP daemons).
- After 60 seconds, kill the IS-IS daemon in P2.
- Wait 30 seconds
- Launch again the IS-IS daemon in P2
- The bug/issue is that after P1 <-> P3 recovering connectivity sometimes
  the PW is not recovered because the reason explained in the first paragraph.

Signed-off-by: F. Aragon <>
11 days agoMerge pull request #4115 from Wojtek242/wojtek242/doc-overview-fix
Donald Sharp [Wed, 10 Apr 2019 02:29:06 +0000 (22:29 -0400)]
Merge pull request #4115 from Wojtek242/wojtek242/doc-overview-fix

doc: replace old text with info about integrated configuration mode

11 days agoMerge pull request #4114 from chiragshah6/evpn_dev2
Mark Stapp [Tue, 9 Apr 2019 20:46:59 +0000 (16:46 -0400)]
Merge pull request #4114 from chiragshah6/evpn_dev2

zebra: avoid removing node twice from rb_tree

11 days agodoc: replace old text with info about integrated configuration mode 4115/head
Wojciech Kozlowski [Tue, 9 Apr 2019 20:38:35 +0000 (22:38 +0200)]
doc: replace old text with info about integrated configuration mode

Signed-off-by: W. Kozlowski <>
11 days agozebra: avoid removing node twice from rb_tree 4114/head
Chirag Shah [Tue, 9 Apr 2019 19:30:15 +0000 (12:30 -0700)]
zebra: avoid removing node twice from rb_tree

In zebra terminate path, the node was attempted to remove
twice from the RB_TREE table. This lead to a crash during
zebra shutdown zebra_router_free_table already calls RB_REMOVE
to remove a node from rb tree table.

    siginfo=0x7fffd9134a30, context=<optimized out>) at lib/sigevent.c:249
     rbt=<optimized out>, t=<optimized out>) at lib/openbsd-tree.c:226
     t=0x56296965ff50 <zebra_router_table_head_RB_INFO>) at lib/openbsd-tree.c:383
    rbt=rbt@entry=0x562969669bd0 <zrouter+16>, elm=elm@entry=0x56296afcf810)
    at lib/openbsd-tree.c:393
    (elm=0x56296afcf810, head=0x562969669bd0 <zrouter+16>) at zebra/zebra_router.h:46

Singned-off-by: Chirag Shah <>
12 days agopimd: Add JoinDesired(S,G) to deciding to set spt bit 4105/head
Donald Sharp [Tue, 9 Apr 2019 17:20:32 +0000 (13:20 -0400)]
pimd: Add JoinDesired(S,G) to deciding to set spt bit

The decision for Update_SPTbit(S,G, iif) includes a test
for JoinDesired(S,G) in section 4.2.2.  When we were deciding
to update the spt bit we were not taking this into account.

This commit fixes this issue.

Signed-off-by: Donald Sharp <>
12 days agopimd: Update state when receiving S,G join when in S,G RPT Prune state
Donald Sharp [Mon, 8 Apr 2019 18:37:00 +0000 (14:37 -0400)]
pimd: Update state when receiving S,G join when in S,G RPT Prune state

When we receive a S,G join and the ifchannel is in S,G RPT Prune state,
pim should transition the ifchannel state to JOIN and transition the
pim_upstream state for the S,G stream.

Ticket: CM-24513
Signed-off-by: Donald Sharp <>
12 days agopimd: Only send triggered response after all of *,G message is read
Donald Sharp [Mon, 8 Apr 2019 22:02:45 +0000 (18:02 -0400)]
pimd: Only send triggered response after all of *,G message is read

pim was sending a triggered response on every S,G RPT prune information
read.  Suppose we had this in a *,G message:

  S1, G RPT Prune
  S2, G RPT Prune

We would send two triggered *,G messages upstream.  This leads to over
processing and quickly changing state if S1 or S2 were in different

Modify the code to send just one Triggered *,G upstream after looking
at all S,G state for a *,G.

Ticket: CM-24531
Signed-off-by: Donald Sharp <>
12 days agobgpd: new show cmd - bgp l2vpn evpn route vni all detail 4031/head
Nitin Soni [Thu, 28 Mar 2019 05:49:03 +0000 (22:49 -0700)]
bgpd: new show cmd  - bgp l2vpn evpn route vni all detail

This command is added to provide detailed information. It will be
useful in troubleshooting as we will be able to dump all detailed info
using a single command.
"net show bgp evpn route vni <all|id> [detail]". Additional filtering
can be done by providing vtep ip.

Command will display the detailed content for all vni and macs as
displayed by "net show bgp evpn route vni <> mac <> ip <>" for a single
vni, mac, ip.

Ticket: CM-24397
Signed-off-by: Nitin Soni <>

12 days agoMerge pull request #3779 from opensourcerouting/fix-mpls-label-topotests
Quentin Young [Tue, 9 Apr 2019 15:25:40 +0000 (11:25 -0400)]
Merge pull request #3779 from opensourcerouting/fix-mpls-label-topotests

tests: Remove some inconsistent local labels in check in test_ldp_vpls_topo1

12 days agoMerge pull request #4102 from opensourcerouting/sendbuf_recvbuf_privs
Quentin Young [Tue, 9 Apr 2019 14:59:00 +0000 (10:59 -0400)]
Merge pull request #4102 from opensourcerouting/sendbuf_recvbuf_privs

*: setting the socket send/recv buffer sizes doesn't need elevated privs

12 days agozebra: Fix late memset of pbr rule in rule_netlink 4111/head
Stephen Worley [Tue, 9 Apr 2019 14:35:11 +0000 (10:35 -0400)]
zebra: Fix late memset of pbr rule in rule_netlink

We were memsetting zebra_pbr_rule struct after
we had already put some information in it. Also updated
the init of the struct to use braces instead of a

Signed-off-by: Stephen Worley <>
12 days agoMerge pull request #4095 from pacovn/201904_master__lm_aliasing_fixes
Donald Sharp [Tue, 9 Apr 2019 12:38:02 +0000 (08:38 -0400)]
Merge pull request #4095 from pacovn/201904_master__lm_aliasing_fixes

zebra: label manager race condition fix

13 days agoMerge pull request #4099 from donaldsharp/clang_sa
Mark Stapp [Mon, 8 Apr 2019 17:43:16 +0000 (19:43 +0200)]
Merge pull request #4099 from donaldsharp/clang_sa

Clang sa fixes

13 days agoospfd: fix behavior of +/-metric 4103/head
Quentin Young [Mon, 8 Apr 2019 17:05:45 +0000 (17:05 +0000)]
ospfd: fix behavior of +/-metric

OSPFD uses -1 as a sentinel value for uninitialized metrics. When
applying a route map with a +/-metric to redistributed routes, we were
using -1 as our base value to increment or decrement on, which meant
that if you set e.g. +10, you would end up with a redistributed route of
metric 9.

This patch also removes an off-by-one sanity check that would cause a
set metric +1 or set metric 0 to result in a metric value of 20 :-)

Signed-off-by: Quentin Young <>
13 days ago*: setting the socket send/recv buffer sizes doesn't need elevated privs 4102/head
Renato Westphal [Mon, 8 Apr 2019 16:08:00 +0000 (13:08 -0300)]
*: setting the socket send/recv buffer sizes doesn't need elevated privs

The less code running under elevated privileges the better.

Signed-off-by: Renato Westphal <>
13 days agoMerge pull request #4101 from pacovn/doc_typo1
Quentin Young [Mon, 8 Apr 2019 15:11:27 +0000 (11:11 -0400)]
Merge pull request #4101 from pacovn/doc_typo1

doc: fix typo

13 days agodoc: fix typo 4101/head
F. Aragon [Mon, 8 Apr 2019 14:46:33 +0000 (16:46 +0200)]
doc: fix typo

Signed-off-by: F. Aragon <>
2 weeks agobgpd: Remove extra alloc function bgp_path_info_new 4099/head
Donald Sharp [Sun, 7 Apr 2019 00:08:34 +0000 (20:08 -0400)]
bgpd: Remove extra alloc function bgp_path_info_new

The bgp_path_info_new function whenever it was called
pretty much duplicated the info_make function call.  So
convert over to using it and remove the bgp_path_info_new
function so people are not tempted.

Signed-off-by: Donald Sharp <>
2 weeks agoospfd: rn may be null
Donald Sharp [Sat, 6 Apr 2019 23:56:06 +0000 (19:56 -0400)]
ospfd: rn may be null

rn is not set the first time through the do {} while (); loop
As such we need to protect against it from being null( although
highly unlikely to ever happen given the ospf code base.

Signed-off-by: Donald Sharp <>
2 weeks agobgpd: pi->peer assignment exists no need for null check
Donald Sharp [Sat, 6 Apr 2019 23:53:55 +0000 (19:53 -0400)]
bgpd: pi->peer assignment exists no need for null check

The creation of a new `struct bgp_path_info` requires a legitimate
peer being passed in for creation.  There exists no code paths
where this is not true.  As such checking pi->peer for null convinces
SA that it might happen.

Signed-off-by: Donald Sharp <>
2 weeks agolib: Fixup IFF_OUT_LOG macro to make SA happy
Donald Sharp [Sat, 6 Apr 2019 22:38:54 +0000 (18:38 -0400)]
lib: Fixup IFF_OUT_LOG macro to make SA happy

The IFF_OUT_LOG macro is using BUFSIZE, which is the sizeof(logbuf)
but for some reason 8.0 clang SA is not happy with it.  Just
make it happy.

Signed-off-by: Donald Sharp <>
2 weeks agoMerge pull request #4066 from sworleys/Add-NG-Hash-Func
Mark Stapp [Fri, 5 Apr 2019 19:31:41 +0000 (21:31 +0200)]
Merge pull request #4066 from sworleys/Add-NG-Hash-Func

lib: Add hash function for nexthop groups

2 weeks agolib: Add hash function for nexthop groups 4066/head
Stephen Worley [Tue, 2 Apr 2019 17:57:48 +0000 (13:57 -0400)]
lib: Add hash function for nexthop groups

Add a hash function to turn a nexthop group into a
32 bit unsigned hash key with jhash. We do not care to
hash any recursively resolved nexthops, just the group.

Signed-off-by: Stephen Worley <>
2 weeks agoMerge pull request #4085 from donaldsharp/zebra_nht_individual_items
Renato Westphal [Fri, 5 Apr 2019 17:38:12 +0000 (14:38 -0300)]
Merge pull request #4085 from donaldsharp/zebra_nht_individual_items

zebra: Allow specification of v[4|6] addrs on some commands

2 weeks agozebra: Allow specification of v[4|6] addrs on some commands 4085/head
Donald Sharp [Thu, 4 Apr 2019 18:28:31 +0000 (14:28 -0400)]
zebra: Allow specification of v[4|6] addrs on some commands

The `show ipv[4|6] <nht|import-check> ...` commands are starting
to produce a bunch of output due to multiple daemons now
using the code.  Allow the specification of a v4 or v6 address
to allow the show command to only display the interesting nht.

Signed-off-by: Donald Sharp <>
2 weeks agopimd: Initiate *,G S,G RPT Prune in some cases 4096/head
Donald Sharp [Fri, 5 Apr 2019 12:40:51 +0000 (08:40 -0400)]
pimd: Initiate *,G S,G RPT Prune in some cases

On the LHR after we decide that traffic is flowing and
we set the SPT bit for the S,G *and* the incoming IIF
of the S,G is different than the incoming IIF of the *,G
we should immediately send the *,G S,G RPT Prune as
a triggered response instead of waiting for the next

Signed-off-by: Donald Sharp <>
2 weeks agopimd: Add a flag PIM_NEXTHOP_ANSWER_RECEIVED
Donald Sharp [Wed, 3 Apr 2019 15:21:37 +0000 (11:21 -0400)]

Track whether or not we have received an answer from
our query to do nexthop tracking.  This allows us to
go straight to doing a synchronous query for our

Signed-off-by: Donald Sharp <>
2 weeks agopimd: Tracking of RPF is *separate* from the lookup
Donald Sharp [Tue, 2 Apr 2019 13:40:41 +0000 (09:40 -0400)]
pimd: Tracking of RPF is *separate* from the lookup

Start the separation of tracking a Destination from the act
of looking it up.  The cojoining of these two concepts led
to a bunch of code that had to think about both problems leading
to weird situations and code paths.  Simplify the code by making
pim_ecmp_nexthop_search a static function and we only ever
call pim_ecmp_nexthop_lookup when we need to do a RPF().

pim_ecmp_nexthop_lookup will now attempt to find a stored pnc
and if it finds one it will report on the answer from it.

Signed-off-by: Donald Sharp <>
2 weeks agopimd: Determining if we are the RP should happen always
Donald Sharp [Wed, 3 Apr 2019 01:15:21 +0000 (21:15 -0400)]
pimd: Determining if we are the RP should happen always

When creating new RP information from a `ip pim rp A.B.C.D/M A.B.C.D`
we should determine if we are the RP even if we can or cannot
determine if we have a path to the RP via RPF.

This is because we should determine if we are the RP based upon a
connected ip address match not whether or not we have a path to
the RPF.  We would normally think this is not important but
RPF is inherently asynchronous and we can have a state where
we have registered for nht but have not received the actual
path back yet from zebra.

Signed-off-by: Donald Sharp <>
2 weeks agopimd: Zero out nhop being used
Donald Sharp [Tue, 2 Apr 2019 18:15:49 +0000 (14:15 -0400)]
pimd: Zero out nhop being used

Zero out the lookup nexthop for usage, prevent a crash.

Signed-off-by: Donald Sharp <>
2 weeks agoMerge pull request #4093 from mjstapp/fix_vrf_sched_flag
Donald Sharp [Fri, 5 Apr 2019 14:56:08 +0000 (10:56 -0400)]
Merge pull request #4093 from mjstapp/fix_vrf_sched_flag

zebra: remove unused VRF_RIB_SCHEDULED flag

2 weeks agozebra: label manager race condition fix 4095/head
F. Aragon [Fri, 5 Apr 2019 13:26:14 +0000 (15:26 +0200)]
zebra: label manager race condition fix

This fix covers the case where two or more events are processed but only one
becoming effective. E.g. when mixing a synchronous label request from a LDP
deamon and an asynchronous request from a BGP daemon it could happen to the
BGP having the label chunk, but the LDP stuck waiting for the response.

Given e.g.

  ldpd     <-------->
  (sync label request)
                       Zebra (label proxy)  <-->  Zebra (shared label manager)
  bgpd     <-------->
  (async label request)


   LDP label request ----->
                               Zebra (label proxy FW) ----> Zebra (LM)
   BGP label request ----->
                               Zebra (label proxy FW) ----> Zebra (LM)
                                                      <---- Zebra (LM) RP LDP
                                                      <---- Zebra (LM) RP BGP

Signed-off-by: F. Aragon <>
2 weeks agozebra: remove unused VRF_RIB_SCHEDULED flag 4093/head
Mark Stapp [Fri, 5 Apr 2019 12:46:28 +0000 (08:46 -0400)]
zebra: remove unused VRF_RIB_SCHEDULED flag

We don't use th vrf-level VRF_RIB_SCHEDULED flag any longer;
remove it and collapse the zebra_vrf flags' values.

Signed-off-by: Mark Stapp <>
2 weeks agoMerge pull request #4083 from donaldsharp/static_reinstall_nexthops
Jafar Al-Gharaibeh [Fri, 5 Apr 2019 06:09:03 +0000 (01:09 -0500)]
Merge pull request #4083 from donaldsharp/static_reinstall_nexthops

staticd: Allow reinstall of static nexthops on vrf restart

2 weeks agoMerge pull request #3548 from opensourcerouting/rip-vrf
Donald Sharp [Thu, 4 Apr 2019 23:24:14 +0000 (19:24 -0400)]
Merge pull request #3548 from opensourcerouting/rip-vrf

rip(ng)d: add VRF support

2 weeks agotests: test_ldp_vpls_topo1 Remove some inconsistent labels in check 3779/head
Martin Winter [Tue, 12 Feb 2019 02:31:50 +0000 (18:31 -0800)]
tests: test_ldp_vpls_topo1 Remove some inconsistent labels in check

Signed-off-by: Martin Winter <>
2 weeks agoMerge pull request #3899 from ton31337/fix/remove_private_as_with_local_as
Lou Berger [Thu, 4 Apr 2019 20:08:42 +0000 (16:08 -0400)]
Merge pull request #3899 from ton31337/fix/remove_private_as_with_local_as

bgpd: Remove private AS numbers if local-as is defined

2 weeks agoMerge pull request #4065 from mjstapp/fix_nexthop_compare
Quentin Young [Thu, 4 Apr 2019 18:08:22 +0000 (14:08 -0400)]
Merge pull request #4065 from mjstapp/fix_nexthop_compare

libs: nexthop comparison includes labels if present