]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
6 years agoMerge pull request #4089 from ton31337/stable/7.0
Donald Sharp [Fri, 5 Apr 2019 12:14:17 +0000 (08:14 -0400)]
Merge pull request #4089 from ton31337/stable/7.0

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

6 years agobgpd: Remove private AS numbers if local-as is defined 4089/head
Donatas Abraitis [Sat, 2 Mar 2019 20:36:31 +0000 (22:36 +0200)]
bgpd: Remove private AS numbers if local-as is defined

When using remove-private-AS together with local-as
aspath_remove_private_asns() is called before bgp_packet_attribute().

In this case, private AS will always appear in front of change_local_as.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
6 years agoMerge pull request #4049 from donaldsharp/interface_deletion_7.0
Renato Westphal [Sat, 30 Mar 2019 03:23:22 +0000 (00:23 -0300)]
Merge pull request #4049 from donaldsharp/interface_deletion_7.0

bfdd, nhrpd, pimd: When deleting an interface clean up

6 years agobfdd, nhrpd, pimd: When deleting an interface clean up 4049/head
Donald Sharp [Fri, 29 Mar 2019 02:08:37 +0000 (22:08 -0400)]
bfdd, nhrpd, pimd: When deleting an interface clean up

When we delete an interface, we need to set the interface
ifindex to an internal value so that we don't end up in
a state where the re-addition of the same ifindex, due to
a rename operation, causes an infinite loop.

Fixes:#4007
Fix-Suggested-by: Saravanan K
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #4039 from manuhalo/fix-lu-bgp-7.0
Donald Sharp [Fri, 29 Mar 2019 00:18:15 +0000 (20:18 -0400)]
Merge pull request #4039 from manuhalo/fix-lu-bgp-7.0

[7.0] bgpd: fix show bgp labeled_unicast

6 years agobgpd: fix show bgp labeled_unicast 4039/head
Emanuele Di Pascale [Thu, 28 Mar 2019 16:02:33 +0000 (17:02 +0100)]
bgpd: fix show bgp labeled_unicast

while labeled_unicast routes should be fetched in the
unicast table, we cannot set the safi to SAFI_UNICAST
else the peer afc checks and subgroup retrieval will fail

Signed-off-by: Emanuele Di Pascale <emanuele@voltanet.io>
6 years agoMerge pull request #3961 from donaldsharp/connected_7.0
Mark Stapp [Thu, 28 Mar 2019 14:18:01 +0000 (10:18 -0400)]
Merge pull request #3961 from donaldsharp/connected_7.0

Connected 7.0

6 years agozebra: System routes sometimes can not be properly selected 3961/head
Donald Sharp [Mon, 11 Mar 2019 13:39:19 +0000 (09:39 -0400)]
zebra: System routes sometimes can not be properly selected

System Routes if received over the netlink bus in a
specific pattern that causes an update operation for that
route in zebra can leave the dest->selected_fib pointer NULL,
while having the ZEBRA_FLAG_SELECTED flag set. Specifically
one way to achieve this is to do this:

`ip addr del 4.5.6.7/32 dev swp1 ; ip addr add 4.5.6.7/32 dev swp1 metric 9`

Why is this a big deal?
Because nexthop tracking is looking at ZEBRA_FLAG_SELECTED to
know if we can use a route, while nexthop active checking uses
dest->selected_fib.

So imagine we have bgp registering a nexthop. nexthop tracking in
the above case will be able to choose the 4.5.6.7/32 route
if that is what the nexthop is, due to the ZEBRA_FLAG_SELECTED being
properly set. BGP then allows the peers connection to come up and we
install routes with a 4.5.6.7 nexthop. The rib processing for route
installation will then look at the 4.5.6.7 route see no
dest->selected_fib and then start walking up the tree to resolve
the route. In our case we could easily hit the default route and be
unable to resolve the route. Which then becomes inactive in the
rib so we never attempt to install it.

This commit fixes this problem because when the rib_process decides
that we need to update the fib( ie replace old w/ new ), the
replacement with new was not setting the `dest->selected_fib` pointer
to the new route_entry, when the route was a system route.

Ticket: CM-24203
Signed-off-by: Donald Sharp <sharpd@cumulusnetworkscom>
6 years agozebra: set connected route metric based on the devaddr metric
Anuradha Karuppiah [Mon, 14 Jan 2019 23:45:33 +0000 (15:45 -0800)]
zebra: set connected route metric based on the devaddr metric

MACVLAN devices are typically used for applications such as VRR/VRRP that
require a second MAC address (virtual). These devices have a corresponding
SVI/VLAN device -
root@TORC11:~# ip addr show vlan1002
39: vlan1002@bridge: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
    link/ether 00:02:00:00:00:2e brd ff:ff:ff:ff:ff:ff
    inet6 2001:aa:1::2/64 scope global
       valid_lft forever preferred_lft forever
root@TORC11:~# ip addr show vlan1002-v0
40: vlan1002-v0@vlan1002: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9152 qdisc noqueue master vrf1 state UP group default
    link/ether 00:00:5e:00:01:01 brd ff:ff:ff:ff:ff:ff
    inet6 2001:aa:1::a/64 metric 1024 scope global
       valid_lft forever preferred_lft forever
root@TORC11:~#

The macvlan device is used primarily for RX (VR-IP/VR-MAC). And TX is via
the SVI. To acheive that functionality the macvlan network's metric
is set to a higher value.

Zebra currently ignores the devaddr metric sent by the kernel and hardcodes
it to 0. This commit eliminates that hardcoding. If the devaddr metric
is available (METRIC_MAX) it is used for setting up the connected route
otherwise we fallback to the dev/interface metric.

Setting the macvlan metric to a higher value ensures that zebra will always
select the connected route on the SVI (and subsequently use it for next hop
resolution etc.) -
root@TORC11:~# vtysh -c "show ip route vrf vrf1 2001:aa:1::/64"
Routing entry for 2001:aa:1::/64
  Known via "connected", distance 0, metric 1024, vrf vrf1
  Last update 11:30:56 ago
  * directly connected, vlan1002-v0

Routing entry for 2001:aa:1::/64
  Known via "connected", distance 0, metric 0, vrf vrf1, best
  Last update 11:30:56 ago
  * directly connected, vlan1002

root@TORC11:~#

Ticket: CM-23511
Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
6 years agozebra: display metric for connected routes
Anuradha Karuppiah [Mon, 14 Jan 2019 23:56:30 +0000 (15:56 -0800)]
zebra: display metric for connected routes

In a VRR/VRRP setup we can have connected routes with different costs.
So this change eliminates suppressing metric display for connected routes.

Sample output -
root@TORC11:~# vtysh -c "show ipv6 route vrf vrf1"
Codes: K - kernel route, C - connected, S - static, R - RIPng,
       O - OSPFv3, I - IS-IS, B - BGP, N - NHRP, T - Table,
       v - VNC, V - VNC-Direct, A - Babel, D - SHARP, F - PBR,
       > - selected route, * - FIB route

VRF vrf1:
K * ::/0 [255/8192] unreachable (ICMP unreachable), 00:00:36
C * 2001:aa:1::/64 [0/100] is directly connected, vlan1002-v0, 00:00:36
C>* 2001:aa:1::/64 [0/90] is directly connected, vlan1002, 00:00:36

Signed-off-by: Anuradha Karuppiah <anuradhak@cumulusnetworks.com>
6 years agoMerge pull request #4016 from rtrlib/rpki_prefix_lookup_stable_7_0
David Lamparter [Tue, 26 Mar 2019 15:59:27 +0000 (16:59 +0100)]
Merge pull request #4016 from rtrlib/rpki_prefix_lookup_stable_7_0

bgpd: add command to lookup prefixes in the rpki table (stable/7.0)

6 years agobgpd: add command to lookup prefixes in the rpki table 4016/head
Marcel Röthke [Sat, 23 Mar 2019 10:57:09 +0000 (11:57 +0100)]
bgpd: add command to lookup prefixes in the rpki table

Signed-off-by: Marcel Röthke <marcel.roethke@haw-hamburg.de>
6 years agoMerge pull request #3990 from opensourcerouting/7.0/redhat-new-init
Donald Sharp [Mon, 25 Mar 2019 11:45:20 +0000 (07:45 -0400)]
Merge pull request #3990 from opensourcerouting/7.0/redhat-new-init

[7.0] redhat: switch to new init script

6 years agotools/frrcommon.sh: ignore 'declare' failures 3990/head
David Lamparter [Sun, 24 Mar 2019 14:52:02 +0000 (15:52 +0100)]
tools/frrcommon.sh: ignore 'declare' failures

The "declare -p watchfrr_options" call is just to support backwards
compatibility.  If it fails, silently ignore that.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agoredhat: switch to new init script
David Lamparter [Mon, 18 Feb 2019 23:44:01 +0000 (00:44 +0100)]
redhat: switch to new init script

Drop the special versions of frr.init/frr.service/daemons from redhat/
and use the generic versions instead.

Tested-by: Liam McBirnie <liam.mcbirnie@boeing.com>
Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agoMerge pull request #3955 from donaldsharp/dest_selected_7.0
Sri Mohana Singamsetty [Sun, 17 Mar 2019 17:41:38 +0000 (10:41 -0700)]
Merge pull request #3955 from donaldsharp/dest_selected_7.0

zebra: Allow json output to give a bit more data

6 years agoMerge pull request #3956 from mjstapp/fix_ospf_json_70
Donald Sharp [Fri, 15 Mar 2019 16:15:21 +0000 (12:15 -0400)]
Merge pull request #3956 from mjstapp/fix_ospf_json_70

ospfd: [7.0] fix some json timer output

6 years agoMerge pull request #3917 from AkhileshSamineni/show_bgp_ipv6_summary_fix_7.0
Donald Sharp [Fri, 15 Mar 2019 14:00:07 +0000 (10:00 -0400)]
Merge pull request #3917 from AkhileshSamineni/show_bgp_ipv6_summary_fix_7.0

[7.0] bgpd: Incorrect number of peers count in "show bgp ipv6 summary output

6 years agoospfd: fix some json timer output 3956/head
Mark Stapp [Fri, 15 Mar 2019 13:40:38 +0000 (09:40 -0400)]
ospfd: fix some json timer output

Fix a few json output values: a few are in seconds, not msecs,
and one is a number-per-second, not a duration [7.0 version].

Signed-off-by: Mark Stapp <mjs@voltanet.io>
6 years agozebra: Allow json output to give a bit more data 3955/head
Donald Sharp [Sun, 10 Mar 2019 01:28:49 +0000 (20:28 -0500)]
zebra: Allow json output to give a bit more data

The dest->selected_fib should be reported in json output
so that we can debug subtle conditions a bit better in the
future.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3901 from opensourcerouting/7.0-ripd-fix-no-passive-iface
Donald Sharp [Fri, 15 Mar 2019 12:39:26 +0000 (08:39 -0400)]
Merge pull request #3901 from opensourcerouting/7.0-ripd-fix-no-passive-iface

[7.0] ripd: fix removal of configured passive interfaces

6 years agoMerge pull request #3934 from ton31337/fix/add_missing_ipv6_only_peer_flag_action
Donald Sharp [Fri, 15 Mar 2019 12:35:54 +0000 (08:35 -0400)]
Merge pull request #3934 from ton31337/fix/add_missing_ipv6_only_peer_flag_action

bgpd: [7.0] Add peer action for PEER_FLAG_IFPEER_V6ONLY flag

6 years agoMerge pull request #3948 from opensourcerouting/70-bfd-fix-linklocal-cli
Donald Sharp [Fri, 15 Mar 2019 12:33:11 +0000 (08:33 -0400)]
Merge pull request #3948 from opensourcerouting/70-bfd-fix-linklocal-cli

7.0: bfdd: fix IPv6 link-local peer removal

6 years agobfdd: remove scope-id from the session key 3948/head
Rafael Zalamena [Thu, 14 Mar 2019 15:28:07 +0000 (12:28 -0300)]
bfdd: remove scope-id from the session key

Unbreaks CLI ability to remove IPv6 sessions using link-local
addresses. This moves the scope-id logic to the packet sending
functions.

6 years agoMerge pull request #3939 from donaldsharp/ospf_1000_club_7.0
Olivier Dugeon [Wed, 13 Mar 2019 16:57:53 +0000 (17:57 +0100)]
Merge pull request #3939 from donaldsharp/ospf_1000_club_7.0

[7.0] ospfd: When converting to ms divide by 1000

6 years agoospfd: When converting to ms divide by 1000 3939/head
Donald Sharp [Wed, 13 Mar 2019 00:44:31 +0000 (20:44 -0400)]
ospfd: When converting to ms divide by 1000

When converting to miliseconds divide by 1000 not
the other way around.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag 3934/head
Donatas Abraitis [Mon, 25 Feb 2019 19:16:02 +0000 (21:16 +0200)]
bgpd: Add peer action for PEER_FLAG_IFPEER_V6ONLY flag

peer_flag_modify() will always return BGP_ERR_INVALID_FLAG because
the action was not defined for PEER_FLAG_IFPEER_V6ONLY flag.

```
global PEER_FLAG_IFPEER_V6ONLY = 16384;
global BGP_ERR_INVALID_FLAG = -2;

probe process("/usr/lib/frr/bgpd").statement("peer_flag_modify@/root/frr/bgpd/bgpd.c:3975")
{
if ($flag == PEER_FLAG_IFPEER_V6ONLY && $action->type == 0)
printf("action not found for the flag PEER_FLAG_IFPEER_V6ONLY\n");
}

probe process("/usr/lib/frr/bgpd").function("peer_flag_modify").return
{
if ($return == BGP_ERR_INVALID_FLAG)
printf("return BGP_ERR_INVALID_FLAG\n");
}
```
produces:
action not found for the flag PEER_FLAG_IFPEER_V6ONLY
return BGP_ERR_INVALID_FLAG

$ vtysh -c 'conf t' -c 'router bgp 20' -c 'neighbor eth1 interface v6only remote-as external'

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
6 years agoMerge pull request #3916 from AkhileshSamineni/show_bgp_af_neigh_fix_7.0
David Lamparter [Mon, 11 Mar 2019 18:44:07 +0000 (19:44 +0100)]
Merge pull request #3916 from AkhileshSamineni/show_bgp_af_neigh_fix_7.0

[7.0] bgpd: 'show bgp [ipv4|ipv6] neighbors' displays all address family neighbors

6 years agoMerge pull request #3913 from mjstapp/fix_privs_elev_7.0
Quentin Young [Wed, 6 Mar 2019 18:50:15 +0000 (13:50 -0500)]
Merge pull request #3913 from mjstapp/fix_privs_elev_7.0

libs: [7.0] make privs elevation thread-safe

6 years ago[7.0] bgpd: Incorrect number of peers count in "show bgp ipv6 summary" output 3917/head
Akhilesh Samineni [Wed, 6 Mar 2019 18:14:14 +0000 (23:44 +0530)]
[7.0] bgpd: Incorrect number of peers count in "show bgp ipv6 summary" output

The "show bgp ipv6 summary" output displays incorrect number of peers count.

sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 5, using 103 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#
In the above output, the peers count displays as 5 but the actual peer count is 3, i.e.. 3 neighbors are activated in ipv6 unicast address family.
Displayed peer count (5) is the number of the neighbors activated in a BGP instance.

Fix : Now the peers count displays the number of neighbors activated per afi/safi.
After Fix:
sonic# show bgp ipv6 summary

IPv6 Unicast Summary:
BGP router identifier 10.1.0.1, local AS number 65100 vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 3, using 62 KiB of memory
Peer groups 1, using 64 bytes of memory

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2003::1 4 65099 0 0 0 0 0 never Active
2088::1 4 65100 0 0 0 0 0 never Active
3021::2 4 65100 0 0 0 0 0 never Active

Total number of neighbors 3
sonic#

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
6 years ago[7.0] bgpd: 'show bgp [ipv4|ipv6] neighbors' displays all address family neighbors 3916/head
Akhilesh Samineni [Wed, 6 Mar 2019 15:53:41 +0000 (21:23 +0530)]
[7.0] bgpd: 'show bgp [ipv4|ipv6] neighbors' displays all address family neighbors

Display only ipv4 neighbors when 'show bgp ipv4 neighbors' command is issued.
Display only ipv6 neighbors when 'show bgp ipv6 neighbors' command is issued.
Take the address family of the peer address into account, while displaying the neighbors.

Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
6 years agolibs: make privs elevation thread-safe 3913/head
Mark Stapp [Wed, 6 Mar 2019 15:41:47 +0000 (10:41 -0500)]
libs: make privs elevation thread-safe

[Double-commit PR 3911 to 7.0] Privs elevation is per-process,
and can deadlock if a multiple threads drive into the uid system
call. Add a refcount and a mutex to avoid reentrant calls to
the OS.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
6 years agoMerge pull request #3897 from donaldsharp/install_replace_7.0
Mark Stapp [Mon, 4 Mar 2019 14:03:57 +0000 (09:03 -0500)]
Merge pull request #3897 from donaldsharp/install_replace_7.0

zebra: When installing a new route always use REPLACE

6 years agoripd: fix removal of configured passive interfaces 3901/head
Renato Westphal [Sat, 2 Mar 2019 20:45:14 +0000 (17:45 -0300)]
ripd: fix removal of configured passive interfaces

libyang-0.16-rc3 fixed a bug [1] in which data would be auto-deleted
when it shouldn't. The problem is that the "no passive-interface"
command was relying on that wrong behavior, so the command was
affected when the libyang bug was fixed. Adapt the command to do
the right thing in order to get rid of the problem (regardless of
the libyang version being used).

"passive-interface default" still has problems though, but that
will be addressed separetely in the future.

Fixes #3870.

[1] https://github.com/CESNET/libyang/commit/8af82206908

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #3896 from opensourcerouting/7.0-fix-6vpe
Donald Sharp [Sat, 2 Mar 2019 14:03:34 +0000 (09:03 -0500)]
Merge pull request #3896 from opensourcerouting/7.0-fix-6vpe

[7.0] 6VPE fixes

6 years agozebra: When installing a new route always use REPLACE 3897/head
Donald Sharp [Fri, 1 Mar 2019 18:56:12 +0000 (13:56 -0500)]
zebra: When installing a new route always use REPLACE

When we install a new route into the kernel always use
REPLACE.  Else if the route is already there it can
be translated into an append with the flags we are
using.

This is especially true for the way we handle pbr
routes as that we are re-installing the same route
entry from pbr at the moment.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agobgpd: add missing checks for vpnv6 nexthop lengths 3896/head
Renato Westphal [Tue, 26 Feb 2019 21:22:27 +0000 (18:22 -0300)]
bgpd: add missing checks for vpnv6 nexthop lengths

A few code paths weren't handling the vpnv6 nexthop lenghts as
expected, which was leading to problems like imported vpnv6 routes
not being marked as valid when they should. Fix this.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoRevert "bgpd: in case nexthop is ipv6, set nh attribute flag in mpls vpn case"
Renato Westphal [Tue, 26 Feb 2019 21:22:10 +0000 (18:22 -0300)]
Revert "bgpd: in case nexthop is ipv6, set nh attribute flag in mpls vpn case"

BGP IPv6 routes should never contain the NEXT_HOP attribute
(MP_REACH_NLRI should be used instead).

This reverts commit 75cd35c6977137a14ac37347a465d4e8a91eb4c4.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoFRRouting Release 7.0 frr-7.0
Martin Winter [Thu, 28 Feb 2019 23:32:04 +0000 (15:32 -0800)]
FRRouting Release 7.0

Major Changes since 6.0.x:
- Added libyang dependency: New work for northbound interface based on libyang
- Fabricd: New Daemon based on https://datatracker.ietf.org/doc/draft-white-openfabric/
- various bug fixes and other enhancements

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoMerge pull request #3867 from donaldsharp/ospf_allow_vrf_starup_7.0
Olivier Dugeon [Tue, 26 Feb 2019 08:49:57 +0000 (09:49 +0100)]
Merge pull request #3867 from donaldsharp/ospf_allow_vrf_starup_7.0

[7.0] ospfd: Allow pre-existing vrf's to work

6 years agoospfd: Allow pre-existing vrf's to work 3867/head
Donald Sharp [Mon, 25 Feb 2019 19:10:10 +0000 (14:10 -0500)]
ospfd: Allow pre-existing vrf's to work

When creating a ospf vrf based instance allow it to work
if the vrf has been created *before* we create the ospf
instance.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3857 from donaldsharp/dplane_use_after_free_7.0
Russ White [Sun, 24 Feb 2019 01:10:47 +0000 (20:10 -0500)]
Merge pull request #3857 from donaldsharp/dplane_use_after_free_7.0

zebra: Fix use after free in rib_process_result

6 years agozebra: Fix use after free in rib_process_result 3857/head
Donald Sharp [Sun, 24 Feb 2019 00:58:20 +0000 (19:58 -0500)]
zebra: Fix use after free in rib_process_result

Running zebra after commit 888756b208edc7935705d95b83f9513acc21e78a
in valgrind produces this item:

==17102== Invalid read of size 8
==17102==    at 0x44D84C: rib_dest_from_rnode (rib.h:375)
==17102==    by 0x4546ED: rib_process_result (zebra_rib.c:1904)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==  Address 0x83bd468 is 88 bytes inside a block of size 96 free'd
==17102==    at 0x4A35F54: free (vg_replace_malloc.c:530)
==17102==    by 0x4CCAC00: qfree (memory.c:129)
==17102==    by 0x4D03DC6: route_node_destroy (table.c:501)
==17102==    by 0x4D039EE: route_node_free (table.c:90)
==17102==    by 0x4D03971: route_node_delete (table.c:382)
==17102==    by 0x44D82A: route_unlock_node (table.h:256)
==17102==    by 0x454617: rib_process_result (zebra_rib.c:1882)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==  Block was alloc'd at
==17102==    at 0x4A36FF6: calloc (vg_replace_malloc.c:752)
==17102==    by 0x4CCAA2D: qcalloc (memory.c:110)
==17102==    by 0x4D03D88: route_node_create (table.c:489)
==17102==    by 0x4D0360F: route_node_new (table.c:65)
==17102==    by 0x4D034F8: route_node_set (table.c:74)
==17102==    by 0x4D03486: route_node_get (table.c:327)
==17102==    by 0x4CFB700: srcdest_rnode_get (srcdest_table.c:243)
==17102==    by 0x4545C1: rib_process_result (zebra_rib.c:1872)
==17102==    by 0x45436D: rib_process_dplane_results (zebra_rib.c:3295)
==17102==    by 0x4D0902B: thread_call (thread.c:1607)
==17102==    by 0x4CC3983: frr_run (libfrr.c:1011)
==17102==    by 0x4266F6: main (main.c:473)
==17102==

This is happening because of this order of events:

1) Route is deleted in the main thread and scheduled for rib processing.
2) Rib garbage collection is run and we remove the route node since it
is no longer needed.
3) Data plane returns from the deletion in the kernel and we call
the srcdest_rnode_get function to get the prefix that was deleted.
This recreates a new route node.  This creates a route_node with
a lock count of 1, which we freed via the route_unlock_node call.
Then we continued to use the rn pointer.  Which leaves us with use
after frees.

The solution is, of course, to just move the unlock the node at the
end of the function if we have a route_node.

Fixes: #3854
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
6 years agoMerge pull request #3845 from opensourcerouting/rpm-new-libyang-7.0
Donald Sharp [Fri, 22 Feb 2019 21:11:45 +0000 (16:11 -0500)]
Merge pull request #3845 from opensourcerouting/rpm-new-libyang-7.0

[7.0] redhat: Require newer libyang (> 0.16.74) for embedded extensions

6 years agoMerge pull request #3842 from opensourcerouting/new-cli-fuzzer-fixes
Donald Sharp [Fri, 22 Feb 2019 21:11:06 +0000 (16:11 -0500)]
Merge pull request #3842 from opensourcerouting/new-cli-fuzzer-fixes

[7.0] More cli fuzzer fixes

6 years agoMerge pull request #3629 from opensourcerouting/debian/7.0-kill-backports
Donald Sharp [Fri, 22 Feb 2019 19:45:41 +0000 (14:45 -0500)]
Merge pull request #3629 from opensourcerouting/debian/7.0-kill-backports

[7.0] debian packaging

6 years agoMerge pull request #3852 from mjstapp/fix_rnode_unlock_7.0
Donald Sharp [Fri, 22 Feb 2019 19:17:49 +0000 (14:17 -0500)]
Merge pull request #3852 from mjstapp/fix_rnode_unlock_7.0

[7.0] zebra: unlock route-node when processing dplane results

6 years agozebra: unlock route-node when processing dplane results 3852/head
Mark Stapp [Thu, 21 Feb 2019 21:41:24 +0000 (16:41 -0500)]
zebra: unlock route-node when processing dplane results

Unlock the route-node datastruct we access while processing
results from the async dataplane. [7.0]

Signed-off-by: Mark Stapp <mjs@voltanet.io>
6 years agoredhat: Require newer libyang (> 0.16.74) for embedded extensions 3845/head
Martin Winter [Wed, 20 Feb 2019 13:09:03 +0000 (05:09 -0800)]
redhat: Require newer libyang (> 0.16.74) for embedded extensions

The support of embedded extensions doesn't allow to build the
RPM with and without (for older version). Require new version of
Lbyang with embedded extensions supported

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoMerge pull request #3821 from opensourcerouting/snap_libyang_nocache
Donald Sharp [Thu, 21 Feb 2019 12:59:02 +0000 (07:59 -0500)]
Merge pull request #3821 from opensourcerouting/snap_libyang_nocache

snapcraft: Disable libyang CACHE for snap package (Temp workaround)

6 years agoMerge pull request #3829 from opensourcerouting/7.0/cherrypicks
Donald Sharp [Thu, 21 Feb 2019 02:28:46 +0000 (21:28 -0500)]
Merge pull request #3829 from opensourcerouting/7.0/cherrypicks

[7.0] cherrypick backlog

6 years agobgpd: fix the add-path code to understand the mpls-vpn safi 3842/head
Renato Westphal [Wed, 20 Feb 2019 18:54:32 +0000 (15:54 -0300)]
bgpd: fix the add-path code to understand the mpls-vpn safi

In order to iterate over MPLS VPN routes, it's necessary to use
two nested loops (the outer loop iterates over the MPLS VPN RDs,
and the inner loop iterates over the VPN routes from that RD).

The add-path code wasn't doing this, which was leading to lots of
crashes when add-path was enabled for the MPLS VPN SAFI. This patch
fixes the problem.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agobgpd: fix null pointer dereference bug
Renato Westphal [Wed, 20 Feb 2019 18:37:29 +0000 (15:37 -0300)]
bgpd: fix null pointer dereference bug

If path->net is NULL in the bgp_path_info_free() function, then
bgpd would crash in bgp_addpath_free_info_data() with the following
backtrace:

 (gdb) bt
 #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
 #1  0x00007ff7b267a42a in __GI_abort () at abort.c:89
 #2  0x00007ff7b39c1ca0 in core_handler (signo=11, siginfo=0x7ffff66414f0, context=<optimized out>) at lib/sigevent.c:249
 #3  <signal handler called>
 #4  idalloc_free_to_pool (pool_ptr=pool_ptr@entry=0x0, id=3) at lib/id_alloc.c:368
 #5  0x0000560096246688 in bgp_addpath_free_info_data (d=d@entry=0x560098665468, nd=0x0) at bgpd/bgp_addpath.c:100
 #6  0x00005600961bb522 in bgp_path_info_free (path=0x560098665400) at bgpd/bgp_route.c:252
 #7  bgp_path_info_unlock (path=0x560098665400) at bgpd/bgp_route.c:276
 #8  0x00005600961bb719 in bgp_path_info_reap (rn=rn@entry=0x5600986b2110, pi=pi@entry=0x560098665400) at bgpd/bgp_route.c:320
 #9  0x00005600961bf4db in bgp_process_main_one (safi=SAFI_MPLS_VPN, afi=AFI_IP, rn=0x5600986b2110, bgp=0x560098587320) at bgpd/bgp_route.c:2476
 #10 bgp_process_wq (wq=<optimized out>, data=0x56009869b8f0) at bgpd/bgp_route.c:2503
 #11 0x00007ff7b39d5fcc in work_queue_run (thread=0x7ffff6641e10) at lib/workqueue.c:294
 #12 0x00007ff7b39ce3b1 in thread_call (thread=thread@entry=0x7ffff6641e10) at lib/thread.c:1606
 #13 0x00007ff7b39a3538 in frr_run (master=0x5600980795b0) at lib/libfrr.c:1011
 #14 0x000056009618a5a3 in main (argc=3, argv=0x7ffff6642078) at bgpd/bgp_main.c:481

Add a null-check protection to fix this problem.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoisisd: fix crash when entering "no ip[v6] router isis" twice
Renato Westphal [Wed, 20 Feb 2019 18:36:50 +0000 (15:36 -0300)]
isisd: fix crash when entering "no ip[v6] router isis" twice

isisd CLI has some housekeeping code that removes the
"frr-isisd:isis" container from the interface configuration when
IS-IS is disabled for both IPv4 and IPv6 in the corresponding
interface.

The problem is that the code was checking the values of the
"ipv4-routing" and "ipv6-routing" leafs without checking if the
parent "frr-isisd:isis" container was present. So, entering "no
ip[v6] router isis" twice would cause isisd to crash since the
"frr-isisd:isis" container wouldn't be present the second time the
command is processed. Fix this.

isisd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "no ip router isis WORD"
isisd aborted: vtysh -c "configure terminal" -c "interface eth99" -c "no ipv6 router isis"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agopbrd: add missing newline at the end of warning message
Renato Westphal [Wed, 20 Feb 2019 18:34:17 +0000 (15:34 -0300)]
pbrd: add missing newline at the end of warning message

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agopbrd: fix removal of ipv6 nexthops
Renato Westphal [Wed, 20 Feb 2019 18:32:55 +0000 (15:32 -0300)]
pbrd: fix removal of ipv6 nexthops

Fix bug in the code that compares IPv6 addresses. If memcmp()
returns 0 then the two addresses are equal.

Because of this problem, hash_release() could return NULL in a few
places, leading to the following crashes (found by the CLI fuzzer):
pbrd aborted: vtysh -c "configure terminal" -c "pbr-map WORD seq 100" -c "no set nexthop 2001:db8::1"
pbrd aborted: vtysh -c "configure terminal" -c "nexthop-group NHGROUP" -c "no nexthop 2001:db8::1"

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agotools: fix new init script wrt. multi-instance 3829/head
David Lamparter [Mon, 18 Feb 2019 23:27:45 +0000 (00:27 +0100)]
tools: fix new init script wrt. multi-instance

TBH when I looked at watchfrr I didn't see any MI support and hence
assumed this just didn't work to begin with.  However, it actually does
(transparently to watchfrr, by just using "ospfd-1" as daemon name.)

So, fix this up and make it work again.

(Also remove 2 extraneous \n in messages.)

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agodoc: update for new daemons settings
David Lamparter [Thu, 24 Jan 2019 17:20:56 +0000 (18:20 +0100)]
doc: update for new daemons settings

watchfrr_enable is ignored, watchfrr_options is unneeded and the
valgrind options have been replaced with daemon_wrap/all_wrap.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agowatchfrr: build in defaults for -r/-s/-k 3629/head
David Lamparter [Thu, 24 Jan 2019 17:17:40 +0000 (18:17 +0100)]
watchfrr: build in defaults for -r/-s/-k

There's no good reason to not have these options default to the
installation path of tools/watchfrr.sh.  Doing so allows us to ditch
watchfrr_options from daemons/daemons.conf completely.

Fixes: #3652
Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agoMerge pull request #3818 from pguibert6WIND/70_donotcrash_when_config_l3vpn
Donald Sharp [Tue, 19 Feb 2019 18:11:23 +0000 (13:11 -0500)]
Merge pull request #3818 from pguibert6WIND/70_donotcrash_when_config_l3vpn

bgpd: do not crash when removing ip vpn entries

6 years agoMerge pull request #3828 from opensourcerouting/7.0-assorted-fixes
Donald Sharp [Tue, 19 Feb 2019 18:10:10 +0000 (13:10 -0500)]
Merge pull request #3828 from opensourcerouting/7.0-assorted-fixes

[7.0] Assorted fixes

6 years agoMerge pull request #3833 from opensourcerouting/requires_initscript
Donald Sharp [Tue, 19 Feb 2019 18:09:34 +0000 (13:09 -0500)]
Merge pull request #3833 from opensourcerouting/requires_initscript

Revert "redhat: don't Requires initscript on systemd based distros"

6 years agoMerge pull request #3815 from opensourcerouting/7.0/doc-pager-theme
Quentin Young [Tue, 19 Feb 2019 17:41:35 +0000 (12:41 -0500)]
Merge pull request #3815 from opensourcerouting/7.0/doc-pager-theme

[7.0] doc: VTYSH_PAGER docs + new FRR theme

6 years agoMerge pull request #3819 from pguibert6WIND/cve_2017_3224
Jafar Al-Gharaibeh [Tue, 19 Feb 2019 16:25:27 +0000 (10:25 -0600)]
Merge pull request #3819 from pguibert6WIND/cve_2017_3224

ospfd: address CVE-2017-3224

6 years agoRevert "redhat: don't Requires initscript on systemd based distros" 3833/head
Liam McBirnie [Fri, 1 Feb 2019 09:55:27 +0000 (19:55 +1000)]
Revert "redhat: don't Requires initscript on systemd based distros"

This reverts commit ec59a1559cce612d04131639653eddf65d69e868.

Frr.init (called by frr.service) requires functions provided by
/etc/init.d/functions (part of the initscripts package).

Signed-off-by: Liam McBirnie <liam.mcbirnie@boeing.com>
6 years agodebian: remove superseded systemd lintian override
David Lamparter [Tue, 19 Feb 2019 13:32:08 +0000 (14:32 +0100)]
debian: remove superseded systemd lintian override

This was fixed in f351f5f971e2a37c74e1c966532376177ba920ec.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agodebian: update libyang dependency to >= 0.16.74
David Lamparter [Tue, 19 Feb 2019 13:24:25 +0000 (14:24 +0100)]
debian: update libyang dependency to >= 0.16.74

We're using builtin extension loading, so we need libyang 0.16.74.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agoMerge remote-tracking branch 'frr/dev/7.0' into 7.0-kill-backports
David Lamparter [Tue, 19 Feb 2019 13:22:59 +0000 (14:22 +0100)]
Merge remote-tracking branch 'frr/dev/7.0' into 7.0-kill-backports

6 years agodebian: fix autopkgtest
David Lamparter [Tue, 19 Feb 2019 13:15:19 +0000 (14:15 +0100)]
debian: fix autopkgtest

pgrep is in procps, which is an essential package.  killall is in
psmisc, which isn't.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agodebian: add missing Conflicts:
David Lamparter [Mon, 4 Feb 2019 19:16:34 +0000 (20:16 +0100)]
debian: add missing Conflicts:

We were missing several Conflicts: (or Breaks:) lines.  Specifically,
- the .png diagrams in frr-doc conflict with quagga-doc
- the quagga package was split up and we conflict on each on the
  daemon's man pages
- pimd also conflicts on the man page.

This is a "conservative" fix for the time being, putting everything into
Conflicts:.  Some of these might have other options to fix them (e.g.
renaming the diagrams or man pages) but that needs more thought and
isn't appropriate for a simple fix.

There is also the "layer 9" consideration of whether to add "Replaces:
quagga" lines.  For the time being I'd say it's a bit early to have that
discussion.

Reported-by: Andreas Beckmann <anbe@debian.org>
References: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=921376
Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agodebian: remove bogus libjson0 dependency
David Lamparter [Mon, 4 Feb 2019 03:52:16 +0000 (04:52 +0100)]
debian: remove bogus libjson0 dependency

Dependencies for the actual library packages are autogenerated by shlib
handling.  Removing the bogus line should hopefully get this to build
on Debian buildd...

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agodebian: extend comments on pre/postinst hooks
David Lamparter [Sun, 27 Jan 2019 16:24:36 +0000 (17:24 +0100)]
debian: extend comments on pre/postinst hooks

While originally created to support upgrading within non-official
previous FRR packages, the same logic makes upgrading from Quagga
configs more straightforward.

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agovtysh: fix pager compatibility handling
David Lamparter [Wed, 23 Jan 2019 13:15:52 +0000 (14:15 +0100)]
vtysh: fix pager compatibility handling

I just straight up forgot checking VTYSH_PAGER at startup, and the
"terminal paginate" command is only installed to VIEW_NODE so it can't
be processed from vtysh.conf in CONFIG_NODE...

Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agoMerge pull request #3820 from pguibert6WIND/70_ospfv3_misc_fixes
David Lamparter [Tue, 19 Feb 2019 12:52:48 +0000 (13:52 +0100)]
Merge pull request #3820 from pguibert6WIND/70_ospfv3_misc_fixes

ospfv3 misc fixes

6 years agozebra: fix the "show ip import-check" command 3828/head
Renato Westphal [Thu, 17 Jan 2019 22:55:39 +0000 (20:55 -0200)]
zebra: fix the "show ip import-check" command

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agopython: make DEFPY provide the text token of fixed parameters
Renato Westphal [Sat, 19 Jan 2019 19:24:09 +0000 (17:24 -0200)]
python: make DEFPY provide the text token of fixed parameters

In the CLI code, each cmd_token has both a "text" field, containing
the full token text (e.g. "unicast"), and an "arg" field,
containing the original text entered by the user (which might be
an abbreviation, like "uni" instead of "unicast").

To avoid the need to handle abbreviations, the recommended pattern
for DEFUN commands is to use the "text" value of fixed parameters
and the "arg" value of everything else.

Using DEFPY, however, the CLI parameters are automagically turned
into C variables which are initialized under the hood (so that
they're conveniently ready for use). The problem is that this
initialization was always using the "arg" value of the parameters,
which was leading to problems like these:

  debian# show ipv6 route isi
  Unknown route type
  debian#
  debian# conf t
  debian(config)# router isis 1
  debian(config-router)# redistribute ipv4 st level-1
  % Configuration failed.

  Invalid value "st" in "protocol" element.
  YANG path: /frr-isisd:isis/instance[area-tag='1']/redistribute/ipv4[protocol='st']/protocol

To fix these problems (and probably others too), make DEFPY commands
auto-detect the type of the input parameters and use either the
"arg" or "text" value from the cmd_tokens accordingly.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: remove the vrf_is_mapped_on_netns() function
Renato Westphal [Sat, 19 Jan 2019 19:19:13 +0000 (17:19 -0200)]
lib: remove the vrf_is_mapped_on_netns() function

Now that all daemons receive the VRF backend from zebra, we can get
rid of vrf_is_mapped_on_netns() in favor of using the more convenient
vrf_is_backend_netns() function, which doesn't require any argument.

This commit also fixes the following problem:
  debian(config)# ip route 50.0.0.0/8 blackhole vrf FAKE table 2
  % table param only available when running on netns-based vrfs

Even when zebra was started with the --vrfwnetns, the error
above would be displayed since the VRF FAKE didn't exist, which
would make vrf_is_mapped_on_netns() return 0 incorrectly. Using
vrf_is_backend_netns() this problem doesn't happen anymore.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra, lib: send VRF backend to the client daemons
Renato Westphal [Sat, 19 Jan 2019 19:19:13 +0000 (17:19 -0200)]
zebra, lib: send VRF backend to the client daemons

Add a new field in the ZEBRA_CAPABILITIES zapi message specifying
the VRF backend in use.

For simplicity, make the zclient code call vrf_configure_backend()
to apply the received value automatically instead of requiring
the daemons to do that themselves in their zebra_capabilities()
callbacks.

Additionally, call zebra_vrf_update_all() only after sending the
capabilities message to the client, so that it will know which VRF
backend is in use when processing the VRF messages.

This commit fixes a couple of bugs in the "interface" CLI command and
associated northbound callbacks, which behave differently depending
on the VRF backend in use. Before this commit, the vrf_backend
variable would always be set to VRF_BACKEND_NETNS in the client
daemons, even when zebra was started without the --vrfwnetns option.
This could lead to inconsistent behavior and subtle bugs under
specific circumstances.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: simplify detection of when the user is leaving the CLI config mode
Renato Westphal [Sat, 19 Jan 2019 01:23:45 +0000 (23:23 -0200)]
lib: simplify detection of when the user is leaving the CLI config mode

We can make use of the vty->config variable to know when the CLI
user is in the configuration mode or not. This is much simpler
than obtaining this information from the vty node, and also a more
robust solution (the three switch statements below, for example,
were out of sync).

Also, fix a bug where vty->config wasn't being unset in the
vty_config_exit() function (bug introduced by commit f344c66ea3).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: reset the vty xpath index when entering the config mode
Renato Westphal [Sat, 19 Jan 2019 00:58:58 +0000 (22:58 -0200)]
lib: reset the vty xpath index when entering the config mode

The CLI code uses the vty->xpath[] array and the vty->xpath_index
variables to keep track of where the user is in the configuration
hierarchy. As such, we were resetting vty->xpath_index to zero
whenever the user exited from the configuration mode in order to
keep the index valid. We weren't doing this in the vty_stop_input()
function however, which is called when the user types ^C in the
terminal. This was leading to bugs like this:

  zebra> en
  zebra# conf t
  zebra(config)# interface eth0
  zebra(config-if)# ^C
  zebra# conf t
  zebra(config)# interface eth0
  % Configuration failed.

  Schema node not found.
  YANG path: /frr-interface:lib/interface[name='eth0'][vrf='default']/frr-interface:lib

To fix this, do something more clever: instead of resetting the
XPath index whenever the user exits from the configuration mode,
do that when the user enters in the configuration mode. This way
the XPath index needs to be reset in a single place only, not to
mention it's a more robust solution.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agodoc: fix small inconsistencies in the table of zapi command values
Renato Westphal [Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)]
doc: fix small inconsistencies in the table of zapi command values

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agozebra: send link parameters to zclients once they request interface info
Renato Westphal [Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)]
zebra: send link parameters to zclients once they request interface info

We were sending ZEBRA_INTERFACE_LINK_PARAMS messages under the
following circumstances:
* New interface was created (via kernel or config);
* Interface went from down to up;
* Update in the link-params configuration.

Now also send ZEBRA_INTERFACE_LINK_PARAMS messages whenever a zclient
connects and sends a ZEBRA_INTERFACE_ADD request. Without this fix,
the client daemons don't receive interface link parameters if they
are configured in the zebra startup configuration.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: use the correct VRF ID when parsing INTERFACE_LINK_PARAMS messages
Renato Westphal [Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)]
lib: use the correct VRF ID when parsing INTERFACE_LINK_PARAMS messages

Bug found during code inspection.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: fix checking of clients subscribed to receive default routes
Renato Westphal [Fri, 18 Jan 2019 18:06:00 +0000 (16:06 -0200)]
lib: fix checking of clients subscribed to receive default routes

In these two functions, we were using VRF_DEFAULT instead of the
VRF ID passed as a parameter when checking if the given client
subscribed to receive default routes or not. This prevented the
"default-originate" command from ospfd/isisd from working correctly
under specific circumstances.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agodoc: update build instructions for freebsd on how to obtain libyang
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
doc: update build instructions for freebsd on how to obtain libyang

Unfortunately the first version of the FreeBSD libyang port contained
a bug in which the libyang pkginfo file wasn't being installed
correctly in the system, and this prevented the FRR build system from
detecting the library. This bug was already fixed months ago but some
FreeBSD package repositories still have the old bugged version of the
port. This means we can't suggest people to install libyang using
"pkg install" since this causes problems for most people. In this
case, suggest FreeBSD users to build and install libyang manually
as we suggest for other BSD platforms.

This commit should be reverted once all FreeBSD package repositories
are updated with the new version of the libyang port.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: update suggestions related to some northbound errors
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: update suggestions related to some northbound errors

Since commit 3a11599c, the FRR YANG modules are embedded inside the
binaries and no longer need to be loaded from the file system. This
way, it's impossible for the FRR binaries and YANG modules to be out
of sync anymore. As such, update the suggestions of the northbound
error codes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: don't abort when incomplete xpath is given by the user
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: don't abort when incomplete xpath is given by the user

Instead of aborting when an incomplete xpath is given to the
nb_oper_data_iterate() function, just return an error so that the
callers have a chance to treat this error. Aborting based on invalid
user input is never the right thing to do.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: fix "use of uninitialised value" valgrind warning
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: fix "use of uninitialised value" valgrind warning

When FRR is built without the --enable-config-rollbacks option,
the nb_db_transaction_save() function does nothing and the
"transaction_id" output parameter is left uninitialized. For
this reason, all northbound clients should initialize the
"transaction_id" argument before calling nb_candidate_commit() or
nb_candidate_commit_apply() (except when a NULL pointer is given,
which is the case of the confd and sysrepo plugins).

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib: fix "may be used uninitialized" build warning
Renato Westphal [Mon, 14 Jan 2019 18:29:18 +0000 (16:29 -0200)]
lib: fix "may be used uninitialized" build warning

We are already handling all possible four cases from the "nb_event"
enumeration, so this problem can't happen in practice. Initialize the
"ref" variable to zero to silence the warning.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agolib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages
Renato Westphal [Fri, 11 Jan 2019 21:20:13 +0000 (19:20 -0200)]
lib, zebra: add AFI parameter to the ZEBRA_REDISTRIBUTE_DEFAULT_* messages

Some daemons like ospfd and isisd have the ability to advertise a
default route to their peers only if one exists in the RIB. This
is what the "default-information originate" commands do when used
without the "always" parameter.

For that to work, these daemons use the ZEBRA_REDISTRIBUTE_DEFAULT_ADD
message to request default route information to zebra. The problem
is that this message didn't have an AFI parameter, so a default route
from any address-family would satisfy the requests from both daemons
(e.g. ::/0 would trigger ospfd to advertise a default route to its
peers, and 0.0.0.0/0 would trigger isisd to advertise a default route
to its IPv6 peers).

Fix this by adding an AFI parameter to the
ZEBRA_REDISTRIBUTE_DEFAULT_{ADD,DELETE} messages and making the
corresponding code changes.

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
6 years agoMerge pull request #3824 from opensourcerouting/isis-fix-3533
Donald Sharp [Tue, 19 Feb 2019 00:28:23 +0000 (19:28 -0500)]
Merge pull request #3824 from opensourcerouting/isis-fix-3533

[7.0] isisd: skip over deleted fragments

6 years agoisisd: skip over deleted fragments 3824/head
David Lamparter [Mon, 18 Feb 2019 20:34:06 +0000 (21:34 +0100)]
isisd: skip over deleted fragments

Since LSP fragments are also on our lspdb dict, lsp_tick() needs to skip
over them after calling lsp_destroy().  Otherwise it ends up accessing
free'd memory.

Fixes: #3533
Signed-off-by: David Lamparter <equinox@diac24.net>
6 years agosnapcraft: Disable libyang CACHE for snap package (Temp workaround) 3821/head
Martin Winter [Mon, 18 Feb 2019 15:57:24 +0000 (07:57 -0800)]
snapcraft: Disable libyang CACHE for snap package (Temp workaround)

There seems to be a bug in latest libyang running when running in
a snap container which causes a failure of the cache logic. Disable
CACHE for now as it's not yet needed. Will be re-enabled in a later
release

Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
6 years agoospf6d: reset the global ospf6 pointer 3820/head
Philippe Guibert [Fri, 15 Feb 2019 16:42:13 +0000 (17:42 +0100)]
ospf6d: reset the global ospf6 pointer

reset the global ospf6 pointer.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoospf6d: upon interface deletion, the area if list may be updated
Philippe Guibert [Thu, 14 Feb 2019 13:04:45 +0000 (14:04 +0100)]
ospf6d: upon interface deletion, the area if list may be updated

there are some events where the list of interfaces per area should be
reviewed due to an interface is being removed. This fix avoids having
some memory leak.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoospf6d: closing server socket when leaving ospf6d
Philippe Guibert [Thu, 14 Feb 2019 13:06:41 +0000 (14:06 +0100)]
ospf6d: closing server socket when leaving ospf6d

this commit brings consistency as it closes the socket used to carry
ospfv3 messages.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoospf6d: unitialised buffer zone used by socket
Philippe Guibert [Thu, 14 Feb 2019 13:10:03 +0000 (14:10 +0100)]
ospf6d: unitialised buffer zone used by socket

a buffer zone is initialised, before being used by server socket.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agoospfd: address CVE-2017-3224 3819/head
Chirag Shah [Sat, 26 Jan 2019 01:21:24 +0000 (17:21 -0800)]
ospfd: address CVE-2017-3224

Based on the vulnerability mentioned in 793496 an attacker can craft an
LSA with MaxSequence number wtih invalid links and not set age to MAX_AGE
so the lsa would not be flush from the database.

To address the issue, check incoming LSA is MaxSeq but Age is not set
to MAX_AGE 3600, discard the LSA from processing it.
Based on  RFC-2328 , When a LSA update sequence reaches MaxSequence
number, it should be prematurely aged out from the database with age set
to MAX_AGE (3600).

Ticket:CM-18989
Reviewed By:
Testing Done:

Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
6 years agobgpd: do not crash when removing ip vpn entries 3818/head
Philippe Guibert [Mon, 21 Jan 2019 16:19:53 +0000 (17:19 +0100)]
bgpd: do not crash when removing ip vpn entries

when removing bgp instance, the parsing of rm->info contexts must be
protected. Also, the main level of hierarchy of rds must not be
allocated more than once.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
6 years agodoc: document VTYSH_PAGER and "terminal paginate" 3815/head
David Lamparter [Mon, 18 Feb 2019 13:23:03 +0000 (14:23 +0100)]
doc: document VTYSH_PAGER and "terminal paginate"

Signed-off-by: David Lamparter <equinox@diac24.net>