]> git.proxmox.com Git - mirror_frr.git/log
mirror_frr.git
3 years agoMerge pull request #8015 from mjstapp/fix_topo_gen_support
Martin Winter [Tue, 16 Feb 2021 16:49:18 +0000 (17:49 +0100)]
Merge pull request #8015 from mjstapp/fix_topo_gen_support

tests: make generate support bundle python3

3 years agoMerge pull request #8051 from volta-networks/fix_ospf6_hello_lo
Russ White [Tue, 16 Feb 2021 16:42:01 +0000 (11:42 -0500)]
Merge pull request #8051 from volta-networks/fix_ospf6_hello_lo

ospf6d: Don't send hellos on loopback interface

3 years agoMerge pull request #8059 from ton31337/fix/nexthop_ipv4_handling_table_map_apply
Russ White [Tue, 16 Feb 2021 16:32:25 +0000 (11:32 -0500)]
Merge pull request #8059 from ton31337/fix/nexthop_ipv4_handling_table_map_apply

bgpd: Print IPv4 nexthop for IPv6 prefixes under bgp_table_map_apply()

3 years agoMerge pull request #8066 from dteach-rv/master
Russ White [Tue, 16 Feb 2021 16:27:19 +0000 (11:27 -0500)]
Merge pull request #8066 from dteach-rv/master

Add Support for rfc 8050 MRT add-path

3 years agoMerge pull request #8077 from taspelund/ospf_flood_debug_improvements
Russ White [Tue, 16 Feb 2021 16:19:47 +0000 (11:19 -0500)]
Merge pull request #8077 from taspelund/ospf_flood_debug_improvements

ospfd: cleanup ospf_flood debugs

3 years agoMerge pull request #8093 from opensourcerouting/format-strings-20210216
Russ White [Tue, 16 Feb 2021 12:46:40 +0000 (07:46 -0500)]
Merge pull request #8093 from opensourcerouting/format-strings-20210216

*: fix format string SNAFUs

3 years agoMerge pull request #8091 from mjstapp/fix_config_icc_diag
Donald Sharp [Tue, 16 Feb 2021 00:11:38 +0000 (19:11 -0500)]
Merge pull request #8091 from mjstapp/fix_config_icc_diag

build: detect ICC, only try ICC options if ICC

3 years agoMerge pull request #8044 from SaiGomathiN/nsg
Donald Sharp [Mon, 15 Feb 2021 23:55:01 +0000 (18:55 -0500)]
Merge pull request #8044 from SaiGomathiN/nsg

pimd: json support added

3 years ago*: fix format string SNAFUs
David Lamparter [Mon, 15 Feb 2021 23:46:48 +0000 (00:46 +0100)]
*: fix format string SNAFUs

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agoMerge pull request #8050 from taspelund/bgp_vpn_advertised_routes
Donatas Abraitis [Mon, 15 Feb 2021 20:38:17 +0000 (22:38 +0200)]
Merge pull request #8050 from taspelund/bgp_vpn_advertised_routes

bgpd: fix empty advertised-routes for 2-tier safis

3 years agoMerge pull request #8075 from opensourcerouting/assorted-20210212
Donald Sharp [Mon, 15 Feb 2021 20:20:18 +0000 (15:20 -0500)]
Merge pull request #8075 from opensourcerouting/assorted-20210212

lib: bunch of random small fixes

3 years agobuild: detect ICC, only try ICC options if ICC
Mark Stapp [Mon, 15 Feb 2021 18:59:02 +0000 (13:59 -0500)]
build: detect ICC, only try ICC options if ICC

Some ICC command-line options can cause confusion for other
compilers; test for ICC specifically, and only try to use those
options if ICC is being used.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoMerge pull request #8082 from donaldsharp/nhrp_priv
Patrick Ruddy [Mon, 15 Feb 2021 15:19:48 +0000 (15:19 +0000)]
Merge pull request #8082 from donaldsharp/nhrp_priv

new clang fixes

3 years agoMerge pull request #8081 from ton31337/fix/static_network_vrf
Donald Sharp [Mon, 15 Feb 2021 15:15:21 +0000 (10:15 -0500)]
Merge pull request #8081 from ton31337/fix/static_network_vrf

bgpd: Check for peer->su_remote if not NULL when handling IPv6 nexthop

3 years agotests: make generate support bundle python3 only
Mark Stapp [Thu, 4 Feb 2021 16:13:01 +0000 (11:13 -0500)]
tests: make generate support bundle python3 only

Make the generate-support-bundle script and interactions more
python3-friendly, and use python3 explicitly.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
3 years agoMerge pull request #8067 from qlyoung/fix-bmp-incorrect-peer-down-message
Mark Stapp [Mon, 15 Feb 2021 13:11:25 +0000 (08:11 -0500)]
Merge pull request #8067 from qlyoung/fix-bmp-incorrect-peer-down-message

bgpd: send correct BMP down message when nht fails

3 years agolib: fix CRNL causing empty prompt lines
David Lamparter [Fri, 12 Feb 2021 22:30:55 +0000 (23:30 +0100)]
lib: fix CRNL causing empty prompt lines

CR, NL and CRNL are all OK, but CRNL shouldn't get treated as 2
newlines (which causes an empty command to be executed => empty prompt
line.)

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agolib: stop parallel-passing vty_sock, detangle
David Lamparter [Fri, 12 Feb 2021 22:22:32 +0000 (23:22 +0100)]
lib: stop parallel-passing vty_sock, detangle

The FDs are in struct vty, and there's ->fd and ->wfd, which shouldn't
be confused.  Passing vty_sock along separately just creates mixups.

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agoMerge pull request #8055 from Orange-OpenSource/ospf-sr
Donald Sharp [Mon, 15 Feb 2021 00:15:28 +0000 (19:15 -0500)]
Merge pull request #8055 from Orange-OpenSource/ospf-sr

ospfd: Debug race condition in Segment Routing

3 years agolib, bgpd: smux_trap return code is never used
Donald Sharp [Sun, 14 Feb 2021 21:18:39 +0000 (16:18 -0500)]
lib, bgpd: smux_trap return code is never used

The return code from smux_trap is never used.  If we have
never used it after all this time.  Remove the return from
the function.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Prevent store but never read of i
Donald Sharp [Sun, 14 Feb 2021 21:08:07 +0000 (16:08 -0500)]
bgpd: Prevent store but never read of i

The new bgp_mplsvpn_snmp.c code increments i and
never uses that value.  Comment the code out
to make the clang SA analyzer happy.  Shouldn't
be a problem since this code will never probably
be touched again(ha!).

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agonhrpd: Fix clang SA about null deref
Donald Sharp [Sun, 14 Feb 2021 21:04:16 +0000 (16:04 -0500)]
nhrpd: Fix clang SA about null deref

Clang was complaining when running SA that the nhrpd_privs.change
function was null.  It just does not fully understand how things
are setup.  Add a assert to make it happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #8080 from opensourcerouting/log-whitespace
Donald Sharp [Sun, 14 Feb 2021 19:58:40 +0000 (14:58 -0500)]
Merge pull request #8080 from opensourcerouting/log-whitespace

*: remove tabs & newlines from log messages

3 years agobgpd: Check for peer->su_remote if not NULL when handling IPv6 nexthop
Donatas Abraitis [Sun, 14 Feb 2021 15:49:19 +0000 (17:49 +0200)]
bgpd: Check for peer->su_remote if not NULL when handling IPv6 nexthop

```
(gdb) bt
0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
1  0x00007fe57ca4a42a in __GI_abort () at abort.c:89
2  0x00007fe57ddd1935 in core_handler (signo=6, siginfo=0x7ffc81067570, context=<optimized out>) at lib/sigevent.c:255
3  <signal handler called>
4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
5  0x00007fe57ca4a42a in __GI_abort () at abort.c:89
6  0x00007fe57ddd1935 in core_handler (signo=11, siginfo=0x7ffc81067e30, context=<optimized out>) at lib/sigevent.c:255
7  <signal handler called>
8  0x000055a7b25b923f in bgp_path_info_to_ipv6_nexthop (ifindex=ifindex@entry=0x7ffc810683c0, path=<optimized out>, path=<optimized out>) at bgpd/bgp_zebra.c:909
9  0x000055a7b25bb2e5 in bgp_zebra_announce (dest=dest@entry=0x55a7b5239c10, p=p@entry=0x55a7b5239c10, info=info@entry=0x55a7b5239cd0, bgp=bgp@entry=0x55a7b518b090, afi=afi@entry=AFI_IP6, safi=safi@entry=SAFI_UNICAST) at bgpd/bgp_zebra.c:1358
10 0x000055a7b256af6a in bgp_process_main_one (bgp=0x55a7b518b090, dest=0x55a7b5239c10, afi=AFI_IP6, safi=SAFI_UNICAST) at bgpd/bgp_route.c:2918
11 0x000055a7b256b0ee in bgp_process_wq (wq=<optimized out>, data=0x55a7b5221800) at bgpd/bgp_route.c:3027
12 0x00007fe57ddea2e0 in work_queue_run (thread=0x7ffc8106cd60) at lib/workqueue.c:291
13 0x00007fe57dde0781 in thread_call (thread=thread@entry=0x7ffc8106cd60) at lib/thread.c:1684
14 0x00007fe57dda84b8 in frr_run (master=0x55a7b48aaf00) at lib/libfrr.c:1126
15 0x000055a7b250a7da in main (argc=<optimized out>, argv=<optimized out>) at bgpd/bgp_main.c:540
(gdb)
```

This crashes with configs like:

```
router bgp 65534
 no bgp ebgp-requires-policy
 no bgp network import-check
 !
 address-family ipv6 unicast
  import vrf donatas <<<<<< Crashes when entering this command
 exit-address-family
!
router bgp 65534 vrf donatas
 no bgp ebgp-requires-policy
 no bgp network import-check
 neighbor fe80::c15a:ddab:1689:db86 remote-as 65025
 neighbor fe80::c15a:ddab:1689:db86 interface eth2
 neighbor fe80::c15a:ddab:1689:db86 update-source eth2
 neighbor fe80::c15a:ddab:1689:db86 capability extended-nexthop
 !
 address-family ipv6 unicast
  network 2a02:face::/32    <<<<<< Crashes due to static networks
  neighbor fe80::c15a:ddab:1689:db86 activate
 exit-address-family
!
```

Locally configured routes do not have peer->su_remote.

```
exit1-debian-9# show bgp ipv6 unicast
BGP table version is 3, local router ID is 192.168.100.1, vrf id 0
Default local pref 100, local AS 65534
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
*> 2a02:abc::/64    fe80::c15a:ddab:1689:db86@5<
                                                           0 65025 i
   2a02:face::/32   ::@5<                    0         32768 i

Displayed  2 routes and 2 total paths
exit1-debian-9#

```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years ago*: remove tabs & newlines from log messages
David Lamparter [Sun, 14 Feb 2021 14:35:07 +0000 (15:35 +0100)]
*: remove tabs & newlines from log messages

Neither tabs nor newlines are acceptable in syslog messages.  They also
break line-based parsing of file logs.

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agoMerge pull request #8036 from qlyoung/disable-mallinfo
Donatas Abraitis [Sat, 13 Feb 2021 08:46:15 +0000 (10:46 +0200)]
Merge pull request #8036 from qlyoung/disable-mallinfo

lib: support mallinfo2() if available

3 years agoMerge pull request #8076 from qlyoung/doc-lttng-fork-preload
Donatas Abraitis [Sat, 13 Feb 2021 08:43:44 +0000 (10:43 +0200)]
Merge pull request #8076 from qlyoung/doc-lttng-fork-preload

doc: document LD_PRELOAD workaround for lttng

3 years agoospfd: cleanup ospf_flood debugs
Trey Aspelund [Sat, 13 Feb 2021 05:08:19 +0000 (05:08 +0000)]
ospfd: cleanup ospf_flood debugs

Replaces some hard-coded function names with __func__,
adds some additional references to neighbor/interface,
and cleans up some debug strings to be more readable.

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
3 years agodoc: document LD_PRELOAD workaround for lttng
Quentin Young [Fri, 12 Feb 2021 23:14:53 +0000 (18:14 -0500)]
doc: document LD_PRELOAD workaround for lttng

Signed-off-by: Quentin Young <qlyoung@nvidia.com>
3 years agoMerge pull request #7764 from pguibert6WIND/nhrp_shortcut_routes
Jafar Al-Gharaibeh [Fri, 12 Feb 2021 19:34:40 +0000 (13:34 -0600)]
Merge pull request #7764 from pguibert6WIND/nhrp_shortcut_routes

nhrp: fix shortcut routes

3 years agobgpd: send correct BMP down message when nht fails
Quentin Young [Thu, 11 Feb 2021 23:54:27 +0000 (18:54 -0500)]
bgpd: send correct BMP down message when nht fails

When sending BMP messages for a status change event for a peer whose NHT
has failed, we were sending a Peer Down Reason Code of 1 (Local system
closed, NOTIFICATION follows) with no NOTIFICAION PDU (because there was
none). This is wrong. Also, the reason code of 1 is semantically off, it
should be 2 (Local system closed, FSM event follows).

This patch:

- adds definitions of all BGP FSM event codes per RFC4271
- changes the BMP reason code emitted when a peer changes state due to
  NHT failure to 2 and encodes FSM event 18 (TcpConnectionFails)
- changes the catch-all case where we have not yet
  implemented the appropriate BMP response to indicate reason code 2
  with FSM event 0 (no relevant Event code is defined).

These changes ought to prevent the BMP session from being torn down due
to an improperly formatted message.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
3 years agoMerge pull request #8039 from m-varasteh/master
Quentin Young [Fri, 12 Feb 2021 18:32:44 +0000 (13:32 -0500)]
Merge pull request #8039 from m-varasteh/master

[filter]: change return code for errors

3 years agolib: de-uglify `-t` option + `log stdout` combo
David Lamparter [Thu, 4 Feb 2021 21:27:11 +0000 (22:27 +0100)]
lib: de-uglify `-t` option + `log stdout` combo

The logging code writes log messages with a `\n` line ending, meanwhile
the VTY code switches it so you need `\r\n`...

And we don't flush the newline after executing a command either.

After this patch, starting daemons like `zebra/zebra -t` should provide
a nice development/debugging experience with a VTY open right there on
stdio and `log stdout` interspersed.

(This is already documented in the man pages, it just looked like sh*t
previously since the log messages didn't newline correctly.)

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agolib: have a lib_privs for ... lib privs
David Lamparter [Thu, 4 Feb 2021 21:26:41 +0000 (22:26 +0100)]
lib: have a lib_privs for ... lib privs

Logging code might want to raise privs for file operations.

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agolib: memorize what fds were open at startup
David Lamparter [Thu, 4 Feb 2021 21:25:49 +0000 (22:25 +0100)]
lib: memorize what fds were open at startup

... in case the user does something like `zebra 3>logfile`.  Also useful
for some module purposes, maybe even feeding config at some point in the
future.

Signed-off-by: David Lamparter <equinox@diac24.net>
3 years agoMerge pull request #8006 from idryzhov/fix-bfd-lookup
Philippe Guibert [Fri, 12 Feb 2021 17:25:09 +0000 (18:25 +0100)]
Merge pull request #8006 from idryzhov/fix-bfd-lookup

bfdd: fix session lookup

3 years agoMerge pull request #8065 from donaldsharp/foo_master
Donatas Abraitis [Fri, 12 Feb 2021 15:04:59 +0000 (17:04 +0200)]
Merge pull request #8065 from donaldsharp/foo_master

bgpd: When deleting a neighbor from a peer-group the PGNAME is optional

3 years agobgpd: Add Support for rfc 8050 MRT add-path
David Teach [Thu, 11 Feb 2021 20:44:00 +0000 (20:44 +0000)]
bgpd: Add Support for rfc 8050 MRT add-path

 - Rfc 8050 adds support for BGP NLRI that carry path identifiers. this commit adds that support to FRR
 - Updated bgp_dump.h to include new sub-type values
 - Updated bgp_dump.c to check for add_path af_caps in the peer struct.
 - Updated bgp_dump.c to use the proper sub-type values upon detection of add-path af_caps
 - Updated bgp_dump.c to properly dump the path_id wen present.

Signed-off-by: David Teach <dteach@routeviews.org>
3 years agobgpd: fix empty advertised-routes for 2-tier safis
Trey Aspelund [Tue, 9 Feb 2021 01:10:03 +0000 (01:10 +0000)]
bgpd: fix empty advertised-routes for 2-tier safis

'show bgp ipv[46] vpn neighbors ... advertised-routes' was displaying
empty output due to new command syntax using show_adj_routes() which
assumed each bgp_table was single-tier (not nested).  This fixes that
assumption for safis with a two-tier bgp_table (SAFI_MPLS_VPN,
SAFI_ENCAP, and SAFI_EVPN).

Before:
ub18# show bgp ipv6 vpn neighbors 2001:db8:cafe::2 advertised-routes
ub18#

After:
ub20# show bgp ipv6 vpn neighbors 2001:db8:cafe::1 advertised-routes
BGP table version is 2, local router ID is 100.64.0.222, vrf id 0
Default local pref 100, local AS 1
Status codes:  s suppressed, d damped, h history, * valid, > best, = multipath,
               i internal, r RIB-failure, S Stale, R Removed
Nexthop codes: @NNN nexthop's vrf id, < announce-nh-self
Origin codes:  i - IGP, e - EGP, ? - incomplete

   Network          Next Hop            Metric LocPrf Weight Path
Route Distinguisher: 30:30
*> 2::2/128         ::                       0    100  32768 i
*> 2::22/128        ::                       0    100  32768 i
Route Distinguisher: 33:33
*> 2::2/128         ::                       0    100  32768 i
*> 2::22/128        ::                       0    100  32768 i

Total number of prefixes 4

Signed-off-by: Trey Aspelund <taspelund@nvidia.com>
3 years agoMerge pull request #8063 from ton31337/fix/typo_enum_bestpath
Mark Stapp [Thu, 11 Feb 2021 19:59:40 +0000 (14:59 -0500)]
Merge pull request #8063 from ton31337/fix/typo_enum_bestpath

bgpd: Replace typo "Cluser length" => "Cluster length"

3 years agoMerge pull request #7915 from kssoman/ospf_test
Quentin Young [Thu, 11 Feb 2021 19:47:49 +0000 (14:47 -0500)]
Merge pull request #7915 from kssoman/ospf_test

3 years agobgpd: When deleting a neighbor from a peer-group the PGNAME is optional
Donald Sharp [Thu, 11 Feb 2021 18:35:22 +0000 (13:35 -0500)]
bgpd: When deleting a neighbor from a peer-group the PGNAME is optional

Currently when deleting a neighbor from a peer-group:
no neighbor A.B.C.D peer-group FOO

We must specify FOO, while A.B.C.D is sufficient enough of an
identifier to know what to do.

Make PGNAME optional on this command and just delete the peer.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #8060 from donaldsharp/ospf_vrf_baloney
Mark Stapp [Thu, 11 Feb 2021 16:58:15 +0000 (11:58 -0500)]
Merge pull request #8060 from donaldsharp/ospf_vrf_baloney

ospfd:  Prevent duplicate packet read in certain vrf situations

3 years agobgpd: Replace typo "Cluser length" => "Cluster length"
Donatas Abraitis [Thu, 11 Feb 2021 15:10:20 +0000 (17:10 +0200)]
bgpd: Replace typo "Cluser length" => "Cluster length"

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoospfd: Debug race condition in Segment Routing
Olivier Dugeon [Wed, 10 Feb 2021 18:20:24 +0000 (19:20 +0100)]
ospfd: Debug race condition in Segment Routing

Issue #7926 hilight a race condition in Segment Routing processing.

The problem occurs when Router Information Opaque LSA is received late, in
particular after SPF run and after ospf_sr_nhlfe_update() was called. This
scenario is unfrequent and takes place due to a slow DR election.
In this particular case, SR Prefix are handle but not fully fill. In fact,
SRGB for the nexthop is not yet received and thus, output label could not
be computed.

When Router Information Opaque LSA is received and processed, if the
corresponding SR node is a direct neighbor of the self node, update_out_nhlfe()
is called against all SR nodes to adjust SR prefix if the next hop is the new
SR node. The function wrongly computes output label and configure a bad MPLS
LFIB entries.

Another way to hilight the problem is to change through CLI the SRGB of a node
and look to MPLS LFIB of direct neighbor, in particular those who announce
EXPLICIT NULL Prefix SID.

This patch correct the update_out_nhlfe() function by calling the appropriate
function (sr_prefix_out_label() instead of index2label()) to compute the output
label.

Some log debugs were adjusted and unused prefix route table was removed too.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
3 years agoospfd: Prevent duplicate packet read in certain vrf situations
Donald Sharp [Thu, 11 Feb 2021 12:31:05 +0000 (07:31 -0500)]
ospfd:  Prevent duplicate packet read in certain vrf situations

Currently if the sysctl net.ipv4.raw_l3mdev_accept is 1, packets
destined to a specific vrf also end up being delivered to the default
vrf.  We will see logs like this in ospf:

2021/02/10 21:17:05.245727 OSPF: ospf_recv_packet: fd 20(default) on interface 1265(swp1s1.26)
2021/02/10 21:17:05.245740 OSPF: Hello received from [9.9.36.12] via [swp1s1.26:200.254.26.13]
2021/02/10 21:17:05.245741 OSPF:  src [200.254.26.14],
2021/02/10 21:17:05.245743 OSPF:  dst [224.0.0.5]
2021/02/10 21:17:05.245769 OSPF: ospf_recv_packet: fd 45(vrf1036) on interface 1265(swp1s1.26)
2021/02/10 21:17:05.245774 OSPF: Hello received from [9.9.36.12] via [swp1s1.26:200.254.26.13]
2021/02/10 21:17:05.245775 OSPF:  src [200.254.26.14],
2021/02/10 21:17:05.245777 OSPF:  dst [224.0.0.5]

This really really makes ospf unhappy in the vrf we are running in.

I am approaching the problem by just dropping the packet if read in the
default vrf because of:

commit 0556fc33c7275c2a3b00047a536976f8dbf7cbb3
Author: Donald Sharp <sharpd@cumulusnetworks.com>
Date:   Fri Feb 1 11:54:59 2019 -0500

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

Effectively if we have `router ospf vrf BLUE` but no ospf running
in the default vrf, we will not have a listener and that would
require a fundamental change in our approach to handle the ospf->fd
at a global level.  I think this is less than ideal at the moment
but it will get us moving again and allow FRR to work with
a bunch of vrf's and ospf neighbors.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Print IPv4 nexthop for IPv6 prefixes under bgp_table_map_apply()
Donatas Abraitis [Thu, 11 Feb 2021 10:06:54 +0000 (12:06 +0200)]
bgpd: Print IPv4 nexthop for IPv6 prefixes under bgp_table_map_apply()

With latest kernels that's possible to have IPv6 routes with IPv4 nexthops.

We already handled this in bgp_zebra_announce():

nexthop = bgp_path_info_to_ipv6_nexthop(mpinfo_cp,
&ifindex);

if (!nexthop)
nh_updated = update_ipv4nh_for_route_install(
nh_othervrf,
nh_othervrf ? info->extra->bgp_orig
    : bgp,
&mpinfo_cp->attr->nexthop,
mpinfo_cp->attr, is_evpn, api_nh);
else
nh_updated = update_ipv6nh_for_route_install(
nh_othervrf,
nh_othervrf ? info->extra->bgp_orig
    : bgp,
nexthop, ifindex, mpinfo, info, is_evpn,
api_nh);

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agonhrpd: replace nhrp route nexthop with onlink route when prefix=nh
Philippe Guibert [Thu, 30 Jul 2020 16:16:16 +0000 (18:16 +0200)]
nhrpd: replace nhrp route nexthop with onlink route when prefix=nh

There are cases where nhrp wants to create a nhrp route to gre interface
with the nexthop which is the same the prefix. This is the case with
ipv6:

ipv6 route a:ff::ff:4/128 via a:ff::ff:4:/128 dev gre1

This route entry is false from zebra point of view, and to avoid that,
the nexthop is ignored in nhrp only if the prefix equals the nexthop.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 years agonhrpd: shortcut routes installed with nexthop.
Philippe Guibert [Thu, 23 Jul 2020 06:57:05 +0000 (08:57 +0200)]
nhrpd: shortcut routes installed with nexthop.

Previously, when a shortcut entry was created, its associated route was
created on system, with no nexthop, only gre device. eg:

[..]
N>* 192.168.2.0/24 [10/0] is directly connected, gre1, 00:01:04           <--- can not be resolved

[..]
Type     Prefix                   Via                      Identity
dynamic  192.168.2.0/24           10.255.255.2              <---- correct

This situation was forcing neighbor resolution on the first outgoing packet matching the route entry. for instance 192.168.2.1 could not be resolved at link layer, and was going to fail. Instead, nhrp nexthop should have been used.
This is what this commit intends to do, that is to say that when a
shortcut is installed by nhrp, the associated nexthop entry is used.

[..]
N>* 192.168.2.0/24 [10/0] via 10.255.255.2, gre1 onlink, 00:00:31

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
3 years agolib: support mallinfo2()
Quentin Young [Mon, 8 Feb 2021 06:56:07 +0000 (01:56 -0500)]
lib: support mallinfo2()

mallinfo() is deprecated as of glibc 2.33 and emits a warning if used.
Support mallinfo2() if available.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
3 years agoospf6d : fix issue in ecmp inter area route
Soman K S [Wed, 10 Feb 2021 11:15:22 +0000 (16:45 +0530)]
ospf6d : fix issue in ecmp inter area  route

Issue: When a path in the inter area ecmp route is deleted, the route is removed

Fix: The fix is to remove the specific path from the inter area route using
     ospf6_abr_old_route_remove() when abr route entry is not found.
     In  the function ospf6_abr_old_route_remove() the path to be removed needs
     to match adv router and link state ID

     Fixed memory leak in ospf6_intra_prefix_update_route_origin() caused by
     route node lock not getting released.

Signed-off-by: kssoman <somanks@gmail.com>
3 years agoMerge pull request #8033 from qlyoung/fix-gnu-readline-bracketed-paste
Donatas Abraitis [Wed, 10 Feb 2021 09:01:18 +0000 (11:01 +0200)]
Merge pull request #8033 from qlyoung/fix-gnu-readline-bracketed-paste

vtysh: disable bracketed paste in readline

3 years agoMerge pull request #7508 from sudhanshukumar22/zebra-vrf-delete
Stephen Worley [Wed, 10 Feb 2021 07:05:10 +0000 (02:05 -0500)]
Merge pull request #7508 from sudhanshukumar22/zebra-vrf-delete

zebra: treat vrf add for existing vrf as update

3 years agoMerge pull request #7917 from pjdruddy/l3vpn-mpls-snmp-upstream-1
Martin Winter [Wed, 10 Feb 2021 00:37:58 +0000 (01:37 +0100)]
Merge pull request #7917 from pjdruddy/l3vpn-mpls-snmp-upstream-1

L3vpn mpls snmp upstream 1

3 years agoospf6d: Don't send hellos on loopback interface
lynne [Wed, 10 Feb 2021 00:20:09 +0000 (19:20 -0500)]
ospf6d: Don't send hellos on loopback interface

When ospf6 passive is turned off on a loopback interface don't start
sending ospf6 hellos.

Signed-off-by: Lynne Morrison <lynne@voltanet.io>
3 years agoMerge pull request #8048 from idryzhov/fix-vrf-command
Philippe Guibert [Tue, 9 Feb 2021 20:43:54 +0000 (21:43 +0100)]
Merge pull request #8048 from idryzhov/fix-vrf-command

vrf: mark vrf as configured when entering vrf node

3 years agoMerge pull request #8045 from ton31337/feature/doc_ebgp_multihop_with_nht_resolve
Donald Sharp [Tue, 9 Feb 2021 19:59:26 +0000 (14:59 -0500)]
Merge pull request #8045 from ton31337/feature/doc_ebgp_multihop_with_nht_resolve

doc: We have to enable nht tracking via default route multihop eBGP

3 years agovrf: use wrappers to change VRF_CONFIGURED flag
Igor Ryzhov [Tue, 9 Feb 2021 19:39:32 +0000 (22:39 +0300)]
vrf: use wrappers to change VRF_CONFIGURED flag

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agovrf: mark vrf as configured when entering vrf node
Igor Ryzhov [Tue, 9 Feb 2021 18:38:45 +0000 (21:38 +0300)]
vrf: mark vrf as configured when entering vrf node

The VRF must be marked as configured when user enters "vrf NAME" command.

Otherwise, the following problem occurs:

`ip link add red type vrf table 1`

  VRF structure is allocated.

`vtysh -c "conf t" -c "vrf red"`

  `lib_vrf_create` is called, and pointer to the VRF structure is stored
  to the nb_config_entry.

`ip link del red`

  VRF structure is freed (because it is not marked as configured), but
  the pointer is still stored in the nb_config_entry.

`vtysh -c "conf t" -c "no vrf red"`

  Nothing happens, because VRF structure doesn't exist. It means that
  `lib_vrf_destroy` is not called, and nb_config_entry still exists in
  the running config with incorrect pointer.

`ip link add red type vrf table 1`

  New VRF structure is allocated.

`vtysh -c "conf t" -c "vrf red"`

  `lib_vrf_create` is NOT called, because the nb_config_entry for that
  VRF name still exists in the running config.

After that all NB commands for this VRF will use incorrect pointer to
the freed VRF structure.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
3 years agotests: mplsL3vpn SNMP topotest
Pat Ruddy [Thu, 29 Oct 2020 15:44:27 +0000 (15:44 +0000)]
tests: mplsL3vpn SNMP topotest

Tests to exercise the MPLS-L3VPN-STD MIB

Signed-off-by: Pat Ruddy <pat@voltanet.io>
3 years agopimd: json support added
nsaigomathi [Tue, 9 Feb 2021 07:29:50 +0000 (23:29 -0800)]
pimd: json support added

Modify code to add JSON format output in show command.
"show ip igmp [vrf NAME] join" and "show ip igmp vrf all join" with proper formatting

Signed-off-by: Sai Gomathi <nsaigomathi@vmware.com>
3 years agoMerge pull request #7973 from sworleys/Pbr-More-Fixes
Russ White [Tue, 9 Feb 2021 12:37:09 +0000 (07:37 -0500)]
Merge pull request #7973 from sworleys/Pbr-More-Fixes

zebra,pbrd,doc: PBR more fixes

3 years agoMerge pull request #7980 from gromit1811/fix_ospf6_lsa_str_oob
Russ White [Tue, 9 Feb 2021 12:36:29 +0000 (07:36 -0500)]
Merge pull request #7980 from gromit1811/fix_ospf6_lsa_str_oob

Fix ospf6 LSA formatting out-of-bounds access

3 years agoMerge pull request #8042 from donaldsharp/smaller_timers_blackhole
Donatas Abraitis [Tue, 9 Feb 2021 10:04:33 +0000 (12:04 +0200)]
Merge pull request #8042 from donaldsharp/smaller_timers_blackhole

tests: Modify timers on bgp_blackhole_community

3 years agodoc: We have to enable nht tracking via default route multihop eBGP
Donatas Abraitis [Tue, 9 Feb 2021 09:51:45 +0000 (11:51 +0200)]
doc: We have to enable nht tracking via default route multihop eBGP

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #8027 from ton31337/fix/remove_json_aggregatorasmalformed
Donald Sharp [Tue, 9 Feb 2021 01:11:54 +0000 (20:11 -0500)]
Merge pull request #8027 from ton31337/fix/remove_json_aggregatorasmalformed

bgpd: Remove aggregatorAsMalformed related outputs JSON and non-JSON

3 years agotests: Modify timers on bgp_blackhole_community
Donald Sharp [Thu, 28 Jan 2021 12:56:57 +0000 (07:56 -0500)]
tests: Modify timers on bgp_blackhole_community

Modify the timers on the bgp_blackhole_community test to
be more aggressive so our test system will recover faster
when we drop packets.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #8028 from ton31337/fix/aggregator_dump_attributes_if_zero
Donald Sharp [Mon, 8 Feb 2021 21:02:17 +0000 (16:02 -0500)]
Merge pull request #8028 from ton31337/fix/aggregator_dump_attributes_if_zero

bgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0

3 years agoMerge pull request #8038 from imzyxwvu/same-attr
Donald Sharp [Mon, 8 Feb 2021 20:31:43 +0000 (15:31 -0500)]
Merge pull request #8038 from imzyxwvu/same-attr

bgpd: Do not compare attr again.

3 years ago[filter]: change return code for errors
varasteh [Mon, 8 Feb 2021 12:28:47 +0000 (15:58 +0330)]
[filter]: change return code for errors

CMD_WARNING is replaced by CMD_WARNING_CONFIG_FAILED

Signed-off-by: varasteh <mahdy.varasteh@gmail.com>
3 years agobgpd: Do not compare attr again.
zyxwvu Shi [Mon, 8 Feb 2021 12:09:02 +0000 (20:09 +0800)]
bgpd: Do not compare attr again.

`same_attr` has been computed and `hook_call(bgp_process)` (calling
BMP module) would not change it. We could reuse the value to filter
same attribute updates, avoiding an extra comparison.

Signed-off-by: zyxwvu Shi <i@shiyc.cn>
3 years agoMerge pull request #8032 from donaldsharp/dp_uninited
Donatas Abraitis [Mon, 8 Feb 2021 10:03:25 +0000 (12:03 +0200)]
Merge pull request #8032 from donaldsharp/dp_uninited

Some bfd valgrind issues

3 years agoMerge pull request #8031 from donaldsharp/duplicate
Donatas Abraitis [Mon, 8 Feb 2021 08:04:14 +0000 (10:04 +0200)]
Merge pull request #8031 from donaldsharp/duplicate

bgpd: Remove the double decleration of bgp_global_evpn_node_lookup

3 years agoMerge pull request #7946 from ckishimo/ospfv3_json_2
Quentin Young [Mon, 8 Feb 2021 06:23:25 +0000 (01:23 -0500)]
Merge pull request #7946 from ckishimo/ospfv3_json_2

tests: add ospf6 support via json files

3 years agoMerge pull request #8030 from anlancs/fix-pim-debug-double-check
Quentin Young [Mon, 8 Feb 2021 05:43:06 +0000 (00:43 -0500)]
Merge pull request #8030 from anlancs/fix-pim-debug-double-check

Fix double check, remove one

3 years agovtysh: disable bracketed paste in readline
Quentin Young [Mon, 8 Feb 2021 01:15:24 +0000 (20:15 -0500)]
vtysh: disable bracketed paste in readline

GNU Readline 8.1 enables bracketed paste by default. This results in
newlines not ending the readline() call, which breaks the ability of
users to paste in configs to vtysh's interactive shell.

Disable bracketed paste.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
3 years agopimd: check debug flag one time
anlancs [Mon, 8 Feb 2021 01:15:22 +0000 (09:15 +0800)]
pimd: check debug flag one time

    debug flag checked twice, just keep one.

Signed-off-by: anlancs <anlan_cs@tom.com>
3 years agobfdd: Prevent use after free ( again )
Donald Sharp [Sun, 7 Feb 2021 20:03:51 +0000 (15:03 -0500)]
bfdd: Prevent use after free ( again )

Valgrind is still reporting:

466020-==466020==    by 0x11B9F4: main (bfdd.c:403)
466020-==466020==  Address 0x5a7d544 is 84 bytes inside a block of size 272 free'd
466020:==466020==    at 0x48399AB: free (vg_replace_malloc.c:538)
466020-==466020==    by 0x490A947: qfree (memory.c:140)
466020-==466020==    by 0x48F2AE8: if_delete (if.c:322)
466020-==466020==    by 0x48F250D: if_destroy_via_zapi (if.c:195)
466020-==466020==    by 0x497071E: zclient_interface_delete (zclient.c:2040)
466020-==466020==    by 0x49745F6: zclient_read (zclient.c:3687)
466020-==466020==    by 0x4955AEC: thread_call (thread.c:1684)
466020-==466020==    by 0x48FF64E: frr_run (libfrr.c:1126)
466020-==466020==    by 0x11B9F4: main (bfdd.c:403)
466020-==466020==  Block was alloc'd at
466020:==466020==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
466020-==466020==    by 0x490A805: qcalloc (memory.c:115)
466020-==466020==    by 0x48F23D6: if_new (if.c:160)
466020-==466020==    by 0x48F257F: if_create_name (if.c:214)
466020-==466020==    by 0x48F3493: if_get_by_name (if.c:558)
466020-==466020==    by 0x49705F2: zclient_interface_add (zclient.c:1989)
466020-==466020==    by 0x49745E0: zclient_read (zclient.c:3684)
466020-==466020==    by 0x4955AEC: thread_call (thread.c:1684)
466020-==466020==    by 0x48FF64E: frr_run (libfrr.c:1126)
466020-==466020==    by 0x11B9F4: main (bfdd.c:403)

Apparently the bs->ifp pointer is being set even in cases when
the bs->key.ifname is not being set.  So go through and just
match the interface pointer and cut-to-the-chase.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years ago*: Fix usage of bfd_adj_event
Donald Sharp [Sun, 7 Feb 2021 19:59:53 +0000 (14:59 -0500)]
*: Fix usage of bfd_adj_event

Valgrind reports:

469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A090D: bgp_bfd_dest_update (bgp_bfd.c:416)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)
469901-==469901==
469901-==469901== Conditional jump or move depends on uninitialised value(s)
469901:==469901==    at 0x3A093C: bgp_bfd_dest_update (bgp_bfd.c:421)
469901-==469901==    by 0x497469E: zclient_read (zclient.c:3701)
469901-==469901==    by 0x4955AEC: thread_call (thread.c:1684)
469901-==469901==    by 0x48FF64E: frr_run (libfrr.c:1126)
469901-==469901==    by 0x213AB3: main (bgp_main.c:540)
469901-==469901==  Uninitialised value was created by a stack allocation
469901:==469901==    at 0x3A0725: bgp_bfd_dest_update (bgp_bfd.c:376)

On looking at bgp_bfd_dest_update the function call into bfd_get_peer_info
when it fails to lookup the ifindex ifp pointer just returns leaving
the dest and src prefix pointers pointing to whatever was passed in.

Let's do two things:

a) The src pointer was sometimes assumed to be passed in and sometimes not.
Forget that.  Make it always be passed in
b) memset the src and dst pointers to be all zeros.  Then when we look
at either of the pointers we are not making decisions based upon random
data in the pointers.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Remove the double decleration of bgp_global_evpn_node_lookup
Donald Sharp [Sun, 7 Feb 2021 12:35:38 +0000 (07:35 -0500)]
bgpd: Remove the double decleration of bgp_global_evpn_node_lookup

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agobgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0
Donatas Abraitis [Sat, 6 Feb 2021 11:57:42 +0000 (13:57 +0200)]
bgpd: Dump BGP attrs to check what's the actual prefix with aggr_as 0

Just for more debug information regarding malformed aggregator_as.

```
bgpd[5589]: [EC 33554434] 192.168.10.25: AGGREGATOR AS number is 0 for aspath: 65030
bgpd[5589]: bgp_attr_aggregator: attributes: nexthop 192.168.10.25, origin i, path 65030
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agobgpd: Remove aggregatorAsMalformed related outputs JSON and non-JSON
Donatas Abraitis [Sat, 6 Feb 2021 11:45:30 +0000 (13:45 +0200)]
bgpd: Remove aggregatorAsMalformed related outputs JSON and non-JSON

Already not necessary, because if BGP aggregator AS attribute is with
value of 0, then the attribute is already discarded at early processing.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #7937 from pjdruddy/topotest-evpn-svi-advertise
Quentin Young [Fri, 5 Feb 2021 19:30:55 +0000 (14:30 -0500)]
Merge pull request #7937 from pjdruddy/topotest-evpn-svi-advertise

tests: update EVPN VXLAN for SVI behaviour change

3 years agoMerge pull request #7981 from gromit1811/fix_ospf6_lsa_str_retval
Quentin Young [Fri, 5 Feb 2021 19:08:37 +0000 (14:08 -0500)]
Merge pull request #7981 from gromit1811/fix_ospf6_lsa_str_retval

ospf6d: Fix LSA formatting inconsistent retvals

3 years agoMerge pull request #8019 from ton31337/fix/bgpd_aggregator_0
Donald Sharp [Fri, 5 Feb 2021 17:33:29 +0000 (12:33 -0500)]
Merge pull request #8019 from ton31337/fix/bgpd_aggregator_0

bgpd: Unset only aggregator flag when AGGREGATOR_AS is 0

3 years agoMerge pull request #7218 from kuldeepkash/multicast_pim_bsm
Donald Sharp [Fri, 5 Feb 2021 15:20:15 +0000 (10:20 -0500)]
Merge pull request #7218 from kuldeepkash/multicast_pim_bsm

tests: Add multicast-pim-bsm-topo1 suite

3 years agobgpd: Unset only aggregator flag when AGGREGATOR_AS is 0
Donatas Abraitis [Fri, 5 Feb 2021 14:47:55 +0000 (16:47 +0200)]
bgpd: Unset only aggregator flag when AGGREGATOR_AS is 0

Avoid mangling packet size which is expected to be the same as received.

Stream pointer advancing is necessary to avoid changing the packet and
reseting BGP sessions.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
3 years agoMerge pull request #7126 from vijaykug/multicast_with_static_rp
Donald Sharp [Fri, 5 Feb 2021 14:37:40 +0000 (09:37 -0500)]
Merge pull request #7126 from vijaykug/multicast_with_static_rp

tests: Add multicast-pim-static-rp-topo1 test suite

3 years agoMerge pull request #7998 from volta-networks/fix_isis_attach_bit
Donald Sharp [Thu, 4 Feb 2021 23:46:19 +0000 (18:46 -0500)]
Merge pull request #7998 from volta-networks/fix_isis_attach_bit

isisd: When adjacencies go up and down add support to modify attached-bit

3 years agoMerge pull request #8010 from ton31337/fix/drop_aggregate_as_attribute_if_malformed
Mark Stapp [Thu, 4 Feb 2021 20:02:42 +0000 (15:02 -0500)]
Merge pull request #8010 from ton31337/fix/drop_aggregate_as_attribute_if_malformed

bgpd: Drop aggregator_as attribute if malformed in case of BGP_AS_ZERO

3 years agoMerge pull request #7709 from donaldsharp/vrf_doc
Mark Stapp [Thu, 4 Feb 2021 18:53:07 +0000 (13:53 -0500)]
Merge pull request #7709 from donaldsharp/vrf_doc

zebra: Slightly touch on the vrf route lookup semantics

3 years agoMerge pull request #8009 from pjdruddy/evpn-cleanup
Donald Sharp [Thu, 4 Feb 2021 18:37:24 +0000 (13:37 -0500)]
Merge pull request #8009 from pjdruddy/evpn-cleanup

zebra: resolve multiple functions for local MAC delete

3 years agoMerge pull request #7961 from mobash-rasool/ospfv3-feature
Mark Stapp [Thu, 4 Feb 2021 18:32:34 +0000 (13:32 -0500)]
Merge pull request #7961 from mobash-rasool/ospfv3-feature

ospf6d: add CLI to control maximum paths for routes.

3 years agoMerge pull request #8007 from wesleycoakley/xcompile-writeup
Mark Stapp [Thu, 4 Feb 2021 18:31:49 +0000 (13:31 -0500)]
Merge pull request #8007 from wesleycoakley/xcompile-writeup

doc: cross compilation guide

3 years agoMerge pull request #7941 from donaldsharp/instance_data
Mark Stapp [Thu, 4 Feb 2021 17:16:15 +0000 (12:16 -0500)]
Merge pull request #7941 from donaldsharp/instance_data

zebra: Display instance id as part of `show zebra client summ`

3 years agodoc: Slightly touch on the vrf route lookup semantics
Donald Sharp [Thu, 10 Dec 2020 12:38:52 +0000 (07:38 -0500)]
doc: Slightly touch on the vrf route lookup semantics

People keep asking about the default unreachable route
in the linux vrf table.  Add a bit of color about the
design choices and what is going on.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agozebra: Display instance id as part of `show zebra client summ`
Donald Sharp [Wed, 27 Jan 2021 13:21:14 +0000 (08:21 -0500)]
zebra: Display instance id as part of `show zebra client summ`

When displaying `show zebra client summ` when we have instances
running, display the instance number as well.

New Output:

sharpd@eva ~/frr7 (instance_data)> vtysh -c "show zebra client summ"
Name      Connect Time    Last Read  Last Write  IPv4 Routes       IPv6 Routes
--------------------------------------------------------------------------------
ospf[1]       00:00:02     00:00:02    00:00:02       0/0              0/0
ospf[5]       00:00:02     00:00:02    00:00:02       0/0              0/0
sharp         00:00:02     00:00:02    00:00:02       0/0              0/0
static        00:00:02     00:00:02    00:00:02       0/0              0/0
Routes column shows (added+updated)/deleted

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #6049 from sarav511/ovrdhold
Russ White [Thu, 4 Feb 2021 12:14:31 +0000 (07:14 -0500)]
Merge pull request #6049 from sarav511/ovrdhold

pimd: SGRpt prune received during prune didn't override holdtime

3 years agoMerge pull request #8013 from mjstapp/fix_topo_ospf6_topo1
Donald Sharp [Thu, 4 Feb 2021 00:59:49 +0000 (19:59 -0500)]
Merge pull request #8013 from mjstapp/fix_topo_ospf6_topo1

tests: fix ospf6_topo1 missing ref files

3 years agobfdd: fix session lookup
Igor Ryzhov [Tue, 2 Feb 2021 22:02:15 +0000 (01:02 +0300)]
bfdd: fix session lookup

BFD key has optional fields "local" and "ifname" which can be empty when
the BFD session is created. In this case, the hash key will be calculated
with these fields filled with zeroes.

Later, when we're looking for the BFD session using the key with fields
"local" and "ifname" populated with actual values, the hash key will be
different. To work around this issue, we're doing multiple hash lookups,
first with full key, then with fields "local" and "ifname" filled with
zeroes.

But there may be another case when the initial key has the actual values
for "local" and "ifname", but the key we're using for lookup has empty
values. This case is covered for IPv4 by using additional hash walk with
bfd_key_lookup_ignore_partial_walker function but is not covered for IPv6.

Instead of introducing more hacks and workarounds, the following solution
is proposed:
- the hash key is always calculated in bfd_key_hash_do using only
  required fields
- the hash data is compared in bfd_key_hash_cmp, taking into account the
  fact that fields "local" and "ifname" may be empty

Using this solution, it's enough to make only one hash lookup.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>