Commit Graph

29152 Commits

Author SHA1 Message Date
Donatas Abraitis
c5fa4459f4 bgpd: Fix mixed print types for BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE_LENGTH
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-28 11:08:33 +03:00
David Lamparter
da4d4d7b39
Merge pull request #10366 from AbhishekNR/mld_cli 2022-03-28 09:18:36 +02:00
Donatas Abraitis
4ffc9d0f26
Merge pull request #10883 from donaldsharp/bgp_evpn_stream_read
bgpd: Fix possible insufficient stream data
2022-03-28 09:04:55 +03:00
Donatas Abraitis
fd5697e356
Merge pull request #10887 from donaldsharp/dump_it
zebra: Note when the netlink DUMP command is interrupted
2022-03-28 09:02:24 +03:00
Nobuhiro MIKI
5a22d2ad33 zebra: fix typo in doc/user/zebra.rst
Signed-off-by: Nobuhiro MIKI <nmiki@yahoo-corp.jp>
2022-03-28 12:13:31 +09:00
David Lamparter
12a0d83c8c pim6d: fix string constant size
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 16:18:59 +02:00
David Lamparter
6bcc46657e staticd: track nexthops per-SAFI
This stops intermixing SAFI_UNICAST NHT into SAFI_MULTICAST static
routes.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:22 +02:00
David Lamparter
e203efe87b staticd: use inline prefix in NHT data
No need to waste malloc overhead on this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:22 +02:00
David Lamparter
50efe4be1f staticd: use typesafe static_nht_hash
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:22 +02:00
David Lamparter
7d08e1e31c zebra: add a few const in RNH code
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:22 +02:00
David Lamparter
eb3c9d9774 *: add SAFI argument to zclient_send_rnh
Just pushing that SAFI_UNICAST up 1 level to the caller.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:22 +02:00
David Lamparter
6c90403bb1 zebra: show ip nht mrib
Prints the SAFI_MULTICAST NHT state in zebra.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:57:18 +02:00
David Lamparter
e9ac2861e5 zebra: register NHT nexthops with proper SAFI
Just a small puzzle piece missing in zebra SAFI NHT support.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:51:00 +02:00
David Lamparter
bc9b1cbfae zebra: check other SAFIs when removing gone client
When a client disconnects, we need to check & remove NHT entries for
other SAFIs too.  Otherwise we crash later trying to access stale data.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-27 14:51:00 +02:00
Donald Sharp
47fd8abae1
Merge pull request #10889 from anlancs/bgpd-cleanup-4
bgpd: remove dead code for evpn
2022-03-27 08:15:15 -04:00
Donald Sharp
535e035ed6
Merge pull request #10891 from opensourcerouting/feature/autocomplate_for_bmptagets
bgpd: Add autocomplete for BMP targets
2022-03-27 07:29:21 -04:00
David Lamparter
73fe8d102b
Merge pull request #10894 from donaldsharp/babel_down_up 2022-03-27 10:56:31 +02:00
David Lamparter
eab6d32dfc
Merge pull request #10892 from donaldsharp/seconds 2022-03-27 10:51:38 +02:00
anlan_cs
3b7e8d0f49 bgpd: small simplification for evpn RT commands
Small simplification for evpn RT commands, i.e. both per-VRF
and per-VNI - `bgp_evpn_vrf_rt_cmd` and `bgp_evpn_vni_rt_cmd`.

Just extract the duplicated code as a common code, there are
no functional changes.

Additionally correct one comment for `ecommunity_free()`.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-27 13:02:05 +08:00
Donald Sharp
93d9b1afbe babeld: Rehook up interface up events
When babeld was switched over to the zapi
interface up/down callbacks the interface up
event was not properly put back in.

Fixes: #10893
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-26 20:46:36 -04:00
Donald Sharp
bddfc29741 lib: Ensure order of operations is expected with SECONDS
These 3 values:
ONE_DAY_SECOND
ONE_WEEK_SECOND
ONE_YEAR_SECOND

Are defined based upon the number of seconds.  Unfortunately doing math
on these values say something like:

days = t->tv_sec / ONE_DAY_SECOND;

Once you go over about a day causes the order of operations to cause the multiplication
to get messed up:

204		if (!t)
(gdb) n
207		w = d = h = m = ms = 0;
(gdb) set t->tv_sec = ONE_DAY_SECOND + 30
(gdb) n
208		memset(buf, 0, size);
(gdb)
210		us = t->tv_usec;
(gdb)
211		if (us >= 1000) {
(gdb)
212			ms = us / 1000;
(gdb)
213			us %= 1000;
(gdb)
217		if (ms >= 1000) {
(gdb)
222		if (t->tv_sec > ONE_WEEK_SECOND) {
(gdb)
227		if (t->tv_sec > ONE_DAY_SECOND) {
(gdb)
228			d = t->tv_sec / ONE_DAY_SECOND;
(gdb) n
229			t->tv_sec -= d * ONE_DAY_SECOND;
(gdb) n
232		if (t->tv_sec >= HOUR_IN_SECONDS) {
(gdb) p d
$6 = 2073600
(gdb) p t->tv_sec
$7 = -179158953570
(gdb)

Converting to adding paranthesis around around the ONE_DAY_SECOND causes
the order of operations to work as expected.

Fixes: #10880
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-26 16:20:53 -04:00
Donatas Abraitis
bbd747dff1 bgpd: Add autocomplete for BMP targets
```
spine1-debian-11(config-router)# bmp targets ?
  BMPTARGETS  Name of the BMP target group
     ok test1
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-26 18:41:54 +02:00
Eugene Crosser
8139cc3a6d autoconf: do not .gitignore m4/ax_lua.m4
The file m4/ax_lua.m4 needs to be a part of distribution, but it is not
inluded in the git repository by default becuase .gitignore file has a
wildcard for all *.m4 files, while individual files that must _not_ be
ignored are listed one by one as exceptions. ax_lua.m4 needs to be added
to this list of exceptions too.

One failure scenario is when you put a snapshot of the source tree in a
new git repository (e.g. the one used for a local CI/CD), this file is
not included in the repository, and subsequently build fails.

This commit adds the exception into m4/.gitignore file

Signed-off-by: Eugene Crosser <crosser@average.org>
2022-03-26 15:05:54 +01:00
anlan_cs
e6f88442fe bgpd: remove dead code for evpn
`is_vni_param_configured()` is used to check whether RD/RT
configured for specific evpn vni.

There seems to be no need for this mixed check. No caller for
about 5 years, just remove it.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-03-26 19:48:52 +08:00
Donald Sharp
2f71996a68 zebra: Note when the netlink DUMP command is interrupted
There exists code paths in the linux kernel where a dump command
will be interrupted( I am not sure I understand what this really
means ) and the data sent back from the kernel is wrong or incomplete.

At this point in time I am not 100% certain what should be done, but
let's start noticing that this has happened so we can formulate a plan
or allow the end operator to know bad stuff is a foot at the circle K.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-25 19:08:14 -04:00
Donald Sharp
5bc17d7bd0
Merge pull request #10677 from mobash-rasool/pimv6-receive-pkt
pim6d: Handling of receiving of PIMv6 packets
2022-03-25 14:09:20 -04:00
Francois Dumontet
5e43330e5c ospfd: fix ospf default route wrongly sent back
That commit aim is to fix an invalid behavior when
default-information is activated on ospf router without always option.

Consider an ASBR with:
-one default route coming from ospf,
-and another default route coming from another deaemon (such BGP or static).

When the daemon bgp stops advertising its default route,
-ospf continues to advertise its previous default route (with aging 0),
-this may create default routing loops.

Expected behavior: is to update the removed external default route with
MAXAGING value.
Updating with MAXAGING value will notify the fact the route is currently
invalid. A later removal from ospf external LSA database will be made.

Analysis: all default routes have their type overwritten by a
DEFAULT_ROUTE type. Thus all default routes whatever its origin (ospf,
bgp, static...) is treated in a same way. But this is not pertinent for
ospf originated default routes.

Fix: avoid overwiting of route type when default route is ospf type.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-03-25 15:40:46 +01:00
plsaranya
db89f2a3eb pimd: Assert fixes
Problem:
PIM assert is not triggered even after receiving WRONGVIF notification because of Could_assert flag not set.
CouldAssert(S,G,I) =
        SPTbit(S,G)==TRUE
        AND (RPF_interface(S) != I)
        AND (I in ( ( joins(*,G) (-) prunes(S,G,rpt) )
                    (+) ( pim_include(*,G) (-) pim_exclude(S,G) )
                    (-) lost_assert(*,G)
                    (+) joins(S,G) (+) pim_include(S,G) ) )
Once SPTbit is set, Could_assert has to be reevaluated

Signed-off-by: plsaranya <Saranya_Panjarathina@dell.com>
2022-03-25 19:48:54 +05:30
Philippe Guibert
7bd1ec9490 ospfd: show running-config displays also srgb on some cases
The following configuration:
router ospf
 segment-routing global-block 16000 23999 local-block 1000 2000
!

appears in the 'show running-config' like below:

router ospf
 local-block 1000 2000
!

When there are custom Adjacencies, display the SRGB even if SRGB
has the default settings.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-03-25 15:18:34 +01:00
Philippe Guibert
052a0cd025 ospfd: silently remove prefix sid already stored in config
There is no need to have an interface available to configure
SRGB. Conversely, it should be possible to remove the SRGB
when no interfaces are available.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-03-25 15:18:34 +01:00
Donald Sharp
52093e0f0e
Merge pull request #10861 from opensourcerouting/fix/replace_strings_to_tr
tools: Replace `strings` to `tr` for frrinit.sh
2022-03-25 10:10:24 -04:00
Donald Sharp
a5f711a11a
Merge pull request #10862 from anlancs/zebra-mh-svi-add
zebra: optimization on the mac addition for evpn-mh
2022-03-25 10:09:59 -04:00
Donald Sharp
4d32f5ae8e
Merge pull request #10881 from opensourcerouting/pim6-ssmpingd-formats
pim6d: fix format string mistakes in ssmpingd
2022-03-25 10:06:42 -04:00
Donald Sharp
5ba2ca9191
Merge pull request #10879 from ton31337/fix/bgp_crash_vrf_all_neighbor_advertise
bgpd: Fix crash for `show ip bgp vrf all all neighbors 192.168.0.1 ...`
2022-03-25 09:58:08 -04:00
Donald Sharp
5c111a25d4 bgpd: Fix possible insufficient stream data
When reading the BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE
it is possible that the length read in the packet is insufficiently
large enough to read a BGP_PREFIX_SID_SRV6_L3_SERVICE_SID_STRUCTURE.
Let's ensure that it is.

Fixes: #10860
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-25 07:44:55 -04:00
David Lamparter
5e6e8a3959 pim6d: IPv6 headers are always stripped on receive
IPV6_HDRINCL is a TX-only option (unlike IP_HDRINCL), so on RX there
never are IPv6 headers to be looked at / skipped over.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-25 04:24:15 -07:00
Mobashshera Rasool
f20d0d7cf2 pim6d: Adjust pim_pkt_dst_addr_ok for PIMv6
Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-25 04:24:15 -07:00
Mobashshera Rasool
5e2b203384 pimd: Modify pim_pim_packet api for receiving v6 packets
Modified the pim_pim_packet api for pimv4/v6.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-25 04:24:09 -07:00
Mobashshera Rasool
76bfa0302c pim6d: Parse BSM packet for PIMv6
Modify pim_bsm_process to accomodate v4 and v6 address
for parsing the received packet.

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
2022-03-25 03:57:19 -07:00
David Lamparter
34389f8886 pim6d: fix format string mistakes in ssmpingd
PR #10653 forgot to update a bunch of format specifiers.  Fix.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-03-25 11:36:21 +01:00
Donatas Abraitis
75ce3b14f3 bgpd: Fix crash for show ip bgp vrf all all neighbors 192.168.0.1 ...
When `all` is specified BGP pointer is always NULL, we need to iterate over
all instances separately.

```
Received signal 11 at 1648199394 (si_addr 0x30, PC 0x562e96597090); aborting...
 /usr/local/lib/libfrr.so.0(zlog_backtrace_sigsafe+0x5e) [0x7f378a57ff6e]
 /usr/local/lib/libfrr.so.0(zlog_signal+0xe6) [0x7f378a580146]
 /usr/local/lib/libfrr.so.0(+0xcd4c2) [0x7f378a5aa4c2]
 /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140) [0x7f378a33e140]
 /usr/lib/frr/bgpd(bgp_afi_safi_peer_exists+0) [0x562e96597090]
 /usr/lib/frr/bgpd(+0x15c3b8) [0x562e9654a3b8]
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-25 11:53:47 +02:00
Donatas Abraitis
fa5ac37865 bgpd: Fix crash for show ip bgp vrf all all
When `all` is specified BGP pointer is always NULL, we need to iterate over
all instances separately.

```
BGP[170822]: Received signal 11 at 1648199394 (si_addr 0x30, PC 0x562e96597090); aborting...
BGP[170822]: /usr/local/lib/libfrr.so.0(zlog_backtrace_sigsafe+0x5e) [0x7f378a57ff6e]
BGP[170822]: /usr/local/lib/libfrr.so.0(zlog_signal+0xe6) [0x7f378a580146]
BGP[170822]: /usr/local/lib/libfrr.so.0(+0xcd4c2) [0x7f378a5aa4c2]
BGP[170822]: /lib/x86_64-linux-gnu/libpthread.so.0(+0x14140) [0x7f378a33e140]
BGP[170822]: /usr/lib/frr/bgpd(bgp_afi_safi_peer_exists+0) [0x562e96597090]
BGP[170822]: /usr/lib/frr/bgpd(+0x15c3b8) [0x562e9654a3b8]
BGP[170822]: /usr/local/lib/libfrr.so.0(+0x75a9e) [0x7f378a552a9e]
BGP[170822]: /usr/local/lib/libfrr.so.0(cmd_execute_command+0x5d) [0x7f378a552e2d]
BGP[170822]: /usr/local/lib/libfrr.so.0(cmd_execute+0xc0) [0x7f378a553070]
BGP[170822]: /usr/local/lib/libfrr.so.0(+0xe3697) [0x7f378a5c0697]
BGP[170822]: /usr/local/lib/libfrr.so.0(+0xe3db1) [0x7f378a5c0db1]
BGP[170822]: /usr/local/lib/libfrr.so.0(+0xe6c30) [0x7f378a5c3c30]
BGP[170822]: /usr/local/lib/libfrr.so.0(thread_call+0x73) [0x7f378a5bb743]
BGP[170822]: /usr/local/lib/libfrr.so.0(frr_run+0xd0) [0x7f378a578750]
BGP[170822]: /usr/lib/frr/bgpd(main+0x344) [0x562e964cf3f4]
BGP[170822]: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xea) [0x7f378a18bd0a]
BGP[170822]: /usr/lib/frr/bgpd(_start+0x2a) [0x562e964d10ea]
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-03-25 11:41:16 +02:00
David Lamparter
619a6623cb
Merge pull request #10867 from donaldsharp/ifp_use_after_free 2022-03-25 06:55:37 +01:00
David Lamparter
d51683e6fe
Merge pull request #10868 from donaldsharp/zlog_backtrace_uninited 2022-03-25 06:25:39 +01:00
David Lamparter
4a090881c8
Merge pull request #10852 from mjstapp/fix_lib_distclean 2022-03-25 06:03:10 +01:00
David Lamparter
86c1ef5667
Merge pull request #10865 from donaldsharp/freebsd_terminal_monitor 2022-03-25 04:22:04 +01:00
David Lamparter
f908faed4a
Merge pull request #10866 from donaldsharp/freebsd_unknown_type2str 2022-03-25 04:20:19 +01:00
Donald Sharp
d0438da6b0 zebra: Fix use after deletion event in freebsd
In the FreeBSD code if you delete the interface
and it has no configuration, the ifp pointer will
be deleted from the system *but* zebra continues
to dereference the just freed pointer.

==58624== Invalid read of size 1
==58624==    at 0x48539F3: strlcpy (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x2B0565: ifreq_set_name (ioctl.c:48)
==58624==    by 0x2B0565: if_get_flags (ioctl.c:416)
==58624==    by 0x2B2D9E: ifan_read (kernel_socket.c:455)
==58624==    by 0x2B2D9E: kernel_read (kernel_socket.c:1403)
==58624==    by 0x499F46E: thread_call (thread.c:2002)
==58624==    by 0x495D2B7: frr_run (libfrr.c:1196)
==58624==    by 0x2B40B8: main (main.c:471)
==58624==  Address 0x6baa7f0 is 64 bytes inside a block of size 432 free'd
==58624==    at 0x484ECDC: free (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x4953A64: if_delete (if.c:283)
==58624==    by 0x2A93C1: if_delete_update (interface.c:874)
==58624==    by 0x2B2DF3: ifan_read (kernel_socket.c:453)
==58624==    by 0x2B2DF3: kernel_read (kernel_socket.c:1403)
==58624==    by 0x499F46E: thread_call (thread.c:2002)
==58624==    by 0x495D2B7: frr_run (libfrr.c:1196)
==58624==    by 0x2B40B8: main (main.c:471)
==58624==  Block was alloc'd at
==58624==    at 0x4851381: calloc (in /usr/local/libexec/valgrind/vgpreload_memcheck-amd64-freebsd.so)
==58624==    by 0x496A022: qcalloc (memory.c:116)
==58624==    by 0x49546BC: if_new (if.c:164)
==58624==    by 0x49546BC: if_create_name (if.c:218)
==58624==    by 0x49546BC: if_get_by_name (if.c:603)
==58624==    by 0x2B1295: ifm_read (kernel_socket.c:628)
==58624==    by 0x2A7FB6: interface_list (if_sysctl.c:129)
==58624==    by 0x2E99C8: zebra_ns_enable (zebra_ns.c:127)
==58624==    by 0x2E99C8: zebra_ns_init (zebra_ns.c:214)
==58624==    by 0x2B3FF2: main (main.c:401)
==58624==

Zebra needs to pass back whether or not the ifp pointer
was freed when if_delete_update is called and it should
then check in ifan_read as well as ifm_read that the
ifp pointer is still valid for use.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-24 20:48:24 -04:00
David Lamparter
b15250ccfd
Merge pull request #10864 from donaldsharp/free_bsd_uninit_values 2022-03-25 01:43:27 +01:00
Donald Sharp
8486b790fe lib: Prevent uninitialized bytes
When using zlog_backtrace I am seeing this:

==66286== Syscall param write(buf) points to uninitialised byte(s)
==66286==    at 0x4CDF48A: syscall (in /lib/libc.so.7)
==66286==    by 0x4A0D409: ??? (in /usr/local/lib/libunwind.so.8.0.1)
==66286==    by 0x4A0D694: ??? (in /usr/local/lib/libunwind.so.8.0.1)
==66286==    by 0x4A0E2F4: _ULx86_64_step (in /usr/local/lib/libunwind.so.8.0.1)
==66286==    by 0x49662DB: zlog_backtrace (log.c:250)
==66286==    by 0x2AFFA6: if_get_mtu (ioctl.c:163)
==66286==    by 0x2B2D9D: ifan_read (kernel_socket.c:457)
==66286==    by 0x2B2D9D: kernel_read (kernel_socket.c:1406)
==66286==    by 0x499F46E: thread_call (thread.c:2002)
==66286==    by 0x495D2B7: frr_run (libfrr.c:1196)
==66286==    by 0x2B4098: main (main.c:471)
==66286==  Address 0x7fc000000 is on thread 1's stack
==66286==  in frame #4, created by zlog_backtrace (log.c:239)
==66286==

Let's initialize some data

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2022-03-24 20:37:44 -04:00