Commit Graph

23768 Commits

Author SHA1 Message Date
Igor Ryzhov
ddd455157e staticd: fix nexthop validation
When checking for local connected address used as a nexthop gateway, we
should check nexthop VRF, not route VRF.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-17 14:17:25 +03:00
Donald Sharp
ac99a2276e *: Add another commit to .git-blame-ignore-revs
Commit: 996c93142d
is a bit of a reformat and the .git-blame-ignore-revs
is missing this commit.  Add it to it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-16 16:09:41 -05:00
Donald Sharp
d6816f68bd zebra: use AF_INET for protocol family
When looking up the conversion from kernel protocol to
internal protocol family make sure we use the correct
AF_INET( what the kernel uses ) instead of AFI_IP (which
is what FRR uses ).

Routes from OSPF will show up from the kernel as OSPF6 instead of
OSPF.  Which will cause mayhem

Ticket: CM-33306
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-16 15:54:08 -05:00
Mark Stapp
e9867ca57b tests: report kernel version check failures
Report kernel version check failures in the test log.

Signed-off-by: Mark Stapp <mjs@voltanet.io>
2021-02-16 11:55:47 -05:00
Karen Schoener
ec48460efd lib: add agentx_enabled hook
Adding agentx_enabled hook.

This permits the main LDP process to signal the lde and ldpe
processes when agentx is enabled.

Signed-off-by: Karen Schoener <karen@voltanet.io>
2021-02-16 11:53:42 -05:00
Martin Winter
9ee2ebdc82
Merge pull request #8015 from mjstapp/fix_topo_gen_support
tests: make generate support bundle python3
2021-02-16 17:49:18 +01:00
Russ White
67821bf2ad
Merge pull request #8051 from volta-networks/fix_ospf6_hello_lo
ospf6d: Don't send hellos on loopback interface
2021-02-16 11:42:01 -05:00
Russ White
dba34d41a1
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()
2021-02-16 11:32:25 -05:00
Russ White
f8bdd66fbf
Merge pull request #8066 from dteach-rv/master
Add Support for rfc 8050 MRT add-path
2021-02-16 11:27:19 -05:00
Russ White
9238b5ba4b
Merge pull request #8077 from taspelund/ospf_flood_debug_improvements
ospfd: cleanup ospf_flood debugs
2021-02-16 11:19:47 -05:00
Russ White
f37a846db5
Merge pull request #8093 from opensourcerouting/format-strings-20210216
*: fix format string SNAFUs
2021-02-16 07:46:40 -05:00
Donald Sharp
40c1b0e6b8
Merge pull request #8091 from mjstapp/fix_config_icc_diag
build: detect ICC, only try ICC options if ICC
2021-02-15 19:11:38 -05:00
Donald Sharp
6599008a0f
Merge pull request #8044 from SaiGomathiN/nsg
pimd: json support added
2021-02-15 18:55:01 -05:00
David Lamparter
f1db813dbb *: fix format string SNAFUs
Signed-off-by: David Lamparter <equinox@diac24.net>
2021-02-16 00:47:51 +01:00
Donatas Abraitis
ef1a9fc47a
Merge pull request #8050 from taspelund/bgp_vpn_advertised_routes
bgpd: fix empty advertised-routes for 2-tier safis
2021-02-15 22:38:17 +02:00
Donald Sharp
a6d1b6a043
Merge pull request #8075 from opensourcerouting/assorted-20210212
lib: bunch of random small fixes
2021-02-15 15:20:18 -05:00
Mark Stapp
4e90d19ea3 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>
2021-02-15 13:59:02 -05:00
Patrick Ruddy
54c7adbf49
Merge pull request #8082 from donaldsharp/nhrp_priv
new clang fixes
2021-02-15 15:19:48 +00:00
Donald Sharp
f736532d94
Merge pull request #8081 from ton31337/fix/static_network_vrf
bgpd: Check for peer->su_remote if not NULL when handling IPv6 nexthop
2021-02-15 10:15:21 -05:00
Mark Stapp
70b99f2fff 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>
2021-02-15 08:13:06 -05:00
Mark Stapp
b10e30232e
Merge pull request #8067 from qlyoung/fix-bmp-incorrect-peer-down-message
bgpd: send correct BMP down message when nht fails
2021-02-15 08:11:25 -05:00
David Lamparter
e0a5979d58 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>
2021-02-15 01:29:44 +01:00
David Lamparter
ab699721a1 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>
2021-02-15 01:28:52 +01:00
Donald Sharp
6431b49137
Merge pull request #8055 from Orange-OpenSource/ospf-sr
ospfd: Debug race condition in Segment Routing
2021-02-14 19:15:28 -05:00
Donald Sharp
97e21b4bd8 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>
2021-02-14 16:18:39 -05:00
Donald Sharp
227b6af0d7 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>
2021-02-14 16:08:07 -05:00
Donald Sharp
8ca7a3ed38 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>
2021-02-14 16:04:16 -05:00
Donald Sharp
0fec6da172
Merge pull request #8080 from opensourcerouting/log-whitespace
*: remove tabs & newlines from log messages
2021-02-14 14:58:40 -05:00
Donatas Abraitis
ab0e0f733d 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🔤:/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>
2021-02-14 17:49:19 +02:00
David Lamparter
1d5453d607 *: 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>
2021-02-14 15:36:51 +01:00
Donald Sharp
824065c401 bgpd: Blackhole nexthops are not reachable
When bgp registers for a nexthop that is not reachable due
to the nexthop pointing to a blackhole, bgp is never going
to be able to reach it when attempting to open a connection.

Broken behavior:

<show bgp nexthop>
 192.168.161.204 valid [IGP metric 0], #paths 0, peer 192.168.161.204
  blackhole
  Last update: Thu Feb 11 09:46:10 2021

eva# show bgp ipv4 uni summ fail
BGP router identifier 10.10.3.11, local AS number 3235 vrf-id 0
BGP table version 40
RIB entries 78, using 14 KiB of memory
Peers 2, using 54 KiB of memory

Neighbor             EstdCnt DropCnt ResetTime Reason
192.168.161.204            0       0     never Waiting for peer OPEN

The log file fills up with this type of message:
2021-02-09T18:53:11.653433+00:00 nq-sjc6c-cor-01 bgpd[6548]: can't connect to 24.51.27.241 fd 26 : Invalid argument
2021-02-09T18:53:21.654005+00:00 nq-sjc6c-cor-01 bgpd[6548]: can't connect to 24.51.27.241 fd 26 : Invalid argument
2021-02-09T18:53:31.654381+00:00 nq-sjc6c-cor-01 bgpd[6548]: can't connect to 24.51.27.241 fd 26 : Invalid argument
2021-02-09T18:53:41.654729+00:00 nq-sjc6c-cor-01 bgpd[6548]: can't connect to 24.51.27.241 fd 26 : Invalid argument
2021-02-09T18:53:51.655147+00:00 nq-sjc6c-cor-01 bgpd[6548]: can't connect to 24.51.27.241 fd 26 : Invalid argument

As that the connect to a blackhole is correctly rejected by the kernel

Fixed behavior:

eva# show bgp ipv4 uni summ
BGP router identifier 10.10.3.11, local AS number 3235 vrf-id 0
BGP table version 40
RIB entries 78, using 14 KiB of memory
Peers 2, using 54 KiB of memory
Neighbor             V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
annie(192.168.161.2) 4      64539    126264        39        0    0    0 00:01:36           38       40 N/A
192.168.161.178      4          0         0         0        0    0    0    never       Active        0 N/A
Total number of neighbors 2
eva# show bgp ipv4 uni summ fail
BGP router identifier 10.10.3.11, local AS number 3235 vrf-id 0
BGP table version 40
RIB entries 78, using 14 KiB of memory
Peers 2, using 54 KiB of memory
Neighbor             EstdCnt DropCnt ResetTime Reason
192.168.161.178            0       0     never Waiting for NHT
Total number of neighbors 2
eva# show bgp nexthop
Current BGP nexthop cache:
 192.168.161.2 valid [IGP metric 0], #paths 38, peer 192.168.161.2
  if enp39s0
  Last update: Thu Feb 11 09:52:05 2021
 192.168.161.131 valid [IGP metric 0], #paths 0, peer 192.168.161.131
  if enp39s0
  Last update: Thu Feb 11 09:52:05 2021
 192.168.161.178 invalid, #paths 0, peer 192.168.161.178
  Must be Connected
  Last update: Thu Feb 11 09:53:37 2021
eva#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2021-02-13 10:10:19 -05:00
Donatas Abraitis
44b0793e88
Merge pull request #8036 from qlyoung/disable-mallinfo
lib: support mallinfo2() if available
2021-02-13 10:46:15 +02:00
Donatas Abraitis
b60ae61548
Merge pull request #8076 from qlyoung/doc-lttng-fork-preload
doc: document LD_PRELOAD workaround for lttng
2021-02-13 10:43:44 +02:00
Trey Aspelund
9d51b28c3e 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>
2021-02-13 05:17:05 +00:00
Quentin Young
9029461188 doc: document LD_PRELOAD workaround for lttng
Signed-off-by: Quentin Young <qlyoung@nvidia.com>
2021-02-12 18:14:53 -05:00
Jafar Al-Gharaibeh
b1b277fbd2
Merge pull request #7764 from pguibert6WIND/nhrp_shortcut_routes
nhrp: fix shortcut routes
2021-02-12 13:34:40 -06:00
Quentin Young
21e8caa293 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>
2021-02-12 14:11:05 -05:00
Quentin Young
78ae07dbca
Merge pull request #8039 from m-varasteh/master
[filter]: change return code for errors
2021-02-12 13:32:44 -05:00
David Lamparter
b6bc1ee8d3 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>
2021-02-12 19:29:36 +01:00
David Lamparter
877057b67a 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>
2021-02-12 19:28:52 +01:00
David Lamparter
6e3253b979 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>
2021-02-12 19:28:22 +01:00
Philippe Guibert
35da69f154
Merge pull request #8006 from idryzhov/fix-bfd-lookup
bfdd: fix session lookup
2021-02-12 18:25:09 +01:00
Igor Ryzhov
bcbe60d456 lib: allow "show config running" command for non-transactional CLI
This command doesn't rely on transactional CLI and works perfectly for
daemons converted to northbound configuration.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
2021-02-12 18:18:34 +03:00
Donatas Abraitis
8484f8b994
Merge pull request #8065 from donaldsharp/foo_master
bgpd: When deleting a neighbor from a peer-group the PGNAME is optional
2021-02-12 17:04:59 +02:00
Quentin Young
e0302d7eab bgpd: add tracepoints for BMP
Adds the following tracepoints:
- frr_bgp:bmp_mirror_packet
- frr_bgp:bmp_update_saved_open
- frr_bgp:bmp_status_changed
- frr_bgp:bmp_peer_backward_transition
- frr_bgp:bmp_eor
- frr_bgp:bmp_process

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2021-02-11 19:55:05 -05:00
David Teach
1073f44d4d 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>
2021-02-11 16:51:41 -08:00
Quentin Young
169afe9dfc bgpd: add PEER_HOSTNAME() macro
Add macro to get hostname if available or provide a default value if
not.

Signed-off-by: Quentin Young <qlyoung@qlyoung.net>
2021-02-11 19:21:08 -05:00
Trey Aspelund
d9478df0dc 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>
2021-02-11 21:04:10 +00:00
Mark Stapp
497bb82b62
Merge pull request #8063 from ton31337/fix/typo_enum_bestpath
bgpd: Replace typo "Cluser length" => "Cluster length"
2021-02-11 14:59:40 -05:00
Quentin Young
66fdb1d15d
Merge pull request #7915 from kssoman/ospf_test 2021-02-11 14:47:49 -05:00