]> git.puffer.fish Git - mirror/frr.git/log
mirror/frr.git
15 months agoMerge pull request #15143 from FRRouting/mergify/bp/stable/8.2/pr-14664 stable/8.2
Donald Sharp [Tue, 16 Jan 2024 15:39:39 +0000 (10:39 -0500)]
Merge pull request #15143 from FRRouting/mergify/bp/stable/8.2/pr-14664

isisd: staticd: need to link directly against libyang (backport #14664)

15 months agoisisd: staticd: need to link directly against libyang 15143/head
Christian Hopps [Fri, 27 Oct 2023 02:51:08 +0000 (22:51 -0400)]
isisd: staticd: need to link directly against libyang

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 81d1d399521bb18f3fdd5353c9d58c4b3988f225)

2 years agoMerge pull request #12894 from FRRouting/mergify/bp/stable/8.2/pr-12884
Donald Sharp [Fri, 24 Feb 2023 14:27:36 +0000 (09:27 -0500)]
Merge pull request #12894 from FRRouting/mergify/bp/stable/8.2/pr-12884

bgpd: Flowspec overflow issue (backport #12884)

2 years agobgpd: Flowspec overflow issue 12894/head
Donald Sharp [Thu, 23 Feb 2023 18:29:32 +0000 (13:29 -0500)]
bgpd: Flowspec overflow issue

According to the flowspec RFC 8955 a flowspec nlri is <length, <nlri data>>
Specifying 0 as a length makes BGP get all warm on the inside.  Which
in this case is not a good thing at all.  Prevent warmth, stay cold
on the inside.

Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 0b999c886e241c52bd1f7ef0066700e4b618ebb3)

2 years agoMerge pull request #12193 from FRRouting/mergify/bp/stable/8.2/pr-12178
Donald Sharp [Tue, 25 Oct 2022 12:19:39 +0000 (08:19 -0400)]
Merge pull request #12193 from FRRouting/mergify/bp/stable/8.2/pr-12178

Revert "doc: Add `neighbor PEER extended-optional-parameters` command" (backport #12178)

2 years agoRevert "doc: Add `neighbor PEER extended-optional-parameters` command" 12193/head
Donatas Abraitis [Fri, 21 Oct 2022 18:45:29 +0000 (21:45 +0300)]
Revert "doc: Add `neighbor PEER extended-optional-parameters` command"

I don't know how I missed that it was already defined. Let's just revert it.

This reverts commit 13111667513a0f91a8e875cdf12c940ea2b60b05.

(cherry picked from commit 37abfd6d191389718557730e28ad0caa77e4ba93)

2 years agoMerge pull request #12133 from FRRouting/mergify/bp/stable/8.2/pr-12113
Donatas Abraitis [Fri, 14 Oct 2022 11:18:12 +0000 (14:18 +0300)]
Merge pull request #12133 from FRRouting/mergify/bp/stable/8.2/pr-12113

bgpd: Allow `network XXX` to work with bgp suppress-fib-pending (backport #12113)

2 years agobgpd: Allow `network XXX` to work with bgp suppress-fib-pending 12133/head
Donald Sharp [Wed, 12 Oct 2022 18:53:21 +0000 (14:53 -0400)]
bgpd: Allow `network XXX` to work with bgp suppress-fib-pending

When bgp is using `bgp suppress-fib-pending` and the end
operator is using network statements, bgp was not sending
the network'ed prefix'es to it's peers.  Fix this.

Also update the test cases for bgp_suppress_fib to test
this new corner case( I am sure that there are going to
be others that will need to be added ).

Fixes: #12112
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4801fc4670020406fc609dedabc7482d88e3b656)

2 years agoMerge pull request #12086 from donaldsharp/some_memory_backport_8.2
Donatas Abraitis [Tue, 11 Oct 2022 06:21:59 +0000 (09:21 +0300)]
Merge pull request #12086 from donaldsharp/some_memory_backport_8.2

Some memory backport 8.2

2 years agobgpd: Make sure hdr length is at a minimum of what is expected 12086/head
Donald Sharp [Thu, 21 Jul 2022 12:11:58 +0000 (08:11 -0400)]
bgpd: Make sure hdr length is at a minimum of what is expected

Ensure that if the capability length specified is enough data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoisisd: Ensure rcap is freed in error case
Donald Sharp [Wed, 20 Jul 2022 20:49:09 +0000 (16:49 -0400)]
isisd: Ensure rcap is freed in error case

unpack_tlv_router_cap allocates memory that in the error
case is not being freed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoospfclient: Ensure ospf_apiclient_lsa_originate cannot accidently write into stack
Donald Sharp [Wed, 20 Jul 2022 20:43:17 +0000 (16:43 -0400)]
ospfclient: Ensure ospf_apiclient_lsa_originate cannot accidently write into stack

Even though OSPF_MAX_LSA_SIZE is quite large and holds the upper bound
on what can be written into a lsa, let's add a small check to ensure
it is not possible to do a bad thing.

This wins one of the long standing bug awards.  2003!

Fixes: #11602
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agoMerge pull request #12078 from FRRouting/mergify/bp/stable/8.2/pr-12043
Donatas Abraitis [Mon, 10 Oct 2022 09:37:38 +0000 (12:37 +0300)]
Merge pull request #12078 from FRRouting/mergify/bp/stable/8.2/pr-12043

Bgp hate (backport #12043)

2 years agobgpd: Ensure FRR has enough data to read 2 bytes in bgp_open_option_parse 12078/head
Donald Sharp [Fri, 30 Sep 2022 12:57:43 +0000 (08:57 -0400)]
bgpd: Ensure FRR has enough data to read 2 bytes in bgp_open_option_parse

In bgp_open_option_parse the code is checking that the
stream has at least 2 bytes to read ( the opt_type and
the opt_length).  However if BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)
is configured then FRR is reading 3 bytes.  Which is not good
since the packet could be badly formateed.  Ensure that
FRR has the appropriate data length to read the data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 1117baca3c592877a4d8a13ed6a1d9bd83977487)

2 years agobgpd: Ensure FRR has enough data to read 2 bytes in peek_for_as4_capability
Donald Sharp [Fri, 30 Sep 2022 12:51:45 +0000 (08:51 -0400)]
bgpd: Ensure FRR has enough data to read 2 bytes in peek_for_as4_capability

In peek_for_as4_capability the code is checking that the
stream has at least 2 bytes to read ( the opt_type and the
opt_length ).  However if BGP_OPEN_EXT_OPT_PARAMS_CAPABLE(peer)
is configured then FRR is reading 3 bytes.  Which is not good
since the packet could be badly formated.  Ensure that
FRR has the appropriate data length to read the data.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 3e46b43e3788f0f87bae56a86b54d412b4710286)

2 years agoMerge pull request #12032 from FRRouting/mergify/bp/stable/8.2/pr-12006
Donald Sharp [Wed, 28 Sep 2022 12:31:54 +0000 (08:31 -0400)]
Merge pull request #12032 from FRRouting/mergify/bp/stable/8.2/pr-12006

doc: Add `neighbor PEER extended-optional-parameters` command (backport #12006)

2 years agodoc: Add `neighbor PEER extended-optional-parameters` command 12032/head
Donatas Abraitis [Sun, 25 Sep 2022 18:02:06 +0000 (21:02 +0300)]
doc: Add `neighbor PEER extended-optional-parameters` command

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 13111667513a0f91a8e875cdf12c940ea2b60b05)

2 years agoMerge pull request #11665 from FRRouting/mergify/bp/stable/8.2/pr-11662
Donald Sharp [Fri, 22 Jul 2022 17:07:25 +0000 (13:07 -0400)]
Merge pull request #11665 from FRRouting/mergify/bp/stable/8.2/pr-11662

bgpd: Call a hook when as-path filter is replaced (backport #11662)

2 years agobgpd: Call a hook when as-path filter is replaced 11665/head
Donatas Abraitis [Fri, 22 Jul 2022 11:16:02 +0000 (14:16 +0300)]
bgpd: Call a hook when as-path filter is replaced

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit f709b31b88b76bf2c0e10eb2a2647bbfbd880ba3)

2 years agoMerge pull request #11660 from FRRouting/mergify/bp/stable/8.2/pr-11655
Jafar Al-Gharaibeh [Thu, 21 Jul 2022 23:13:45 +0000 (18:13 -0500)]
Merge pull request #11660 from FRRouting/mergify/bp/stable/8.2/pr-11655

vtysh: Ignore `end` when parsing frr.conf (backport #11655)

2 years agovtysh: Ignore `end` when parsing frr.conf 11660/head
Donatas Abraitis [Wed, 20 Jul 2022 19:57:33 +0000 (22:57 +0300)]
vtysh: Ignore `end` when parsing frr.conf

If we have `end` at the end of the frr.conf, then we never execute
XFRR_end_configuration command, and start/end markers do not work.

This leads to for example waiting BGP configuration parsing thread to hang,
and the peers are in shutdown state until the timer expires.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit ce2e1a0ed852a6d22385afba7ca44f9ec7f1454e)

2 years agoMerge pull request #11618 from FRRouting/mergify/bp/stable/8.2/pr-11604
Donald Sharp [Sun, 17 Jul 2022 00:57:40 +0000 (20:57 -0400)]
Merge pull request #11618 from FRRouting/mergify/bp/stable/8.2/pr-11604

ospfd: free unreachable router LSA node so that it is not left unreachable (backport #11604)

2 years agoMerge pull request #11621 from FRRouting/mergify/bp/stable/8.2/pr-11615
Donald Sharp [Sun, 17 Jul 2022 00:56:56 +0000 (20:56 -0400)]
Merge pull request #11621 from FRRouting/mergify/bp/stable/8.2/pr-11615

bgpd: Fix memory leak for community stuff (backport #11615)

2 years agoMerge pull request #11617 from FRRouting/mergify/bp/stable/8.2/pr-11614
Donald Sharp [Sun, 17 Jul 2022 00:56:23 +0000 (20:56 -0400)]
Merge pull request #11617 from FRRouting/mergify/bp/stable/8.2/pr-11614

bgpd: Fix memory leak for community alias (backport #11614)

2 years agobgpd: Fix memory leak for community stuff 11621/head
Donatas Abraitis [Sat, 16 Jul 2022 13:26:13 +0000 (16:26 +0300)]
bgpd: Fix memory leak for community stuff

Do not forget to cleanup after we are done:

==395247== 8,268 (32 direct, 8,236 indirect) bytes in 1 blocks are definitely lost in loss record 199 of 205
==395247==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==395247==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x1FBF63: community_intern (in /usr/lib/frr/bgpd)
==395247==    by 0x1FC0C5: community_parse (in /usr/lib/frr/bgpd)
==395247==    by 0x1F0B66: bgp_attr_community (in /usr/lib/frr/bgpd)
==395247==    by 0x1F4185: bgp_attr_parse (in /usr/lib/frr/bgpd)
==395247==    by 0x26BC29: bgp_update_receive (in /usr/lib/frr/bgpd)
==395247==    by 0x26E887: bgp_process_packet (in /usr/lib/frr/bgpd)
==395247==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==395247==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 9571a61a12c063a5c8ae2b05d5ec189eb84f18d6)

2 years agoospfd: free unreachable router LSA node so that it is not left unreachable 11618/head
Lou Berger [Thu, 14 Jul 2022 11:40:39 +0000 (07:40 -0400)]
ospfd: free unreachable router LSA node so that it is not left unreachable

       allows for an LSA to be unreachable via one link and reachable via another

Signed-off-by: Lou Berger <lberger@labn.net>
(cherry picked from commit b976af1b093faf2723257a185070c48cb5de6813)

2 years agobgpd: Fix memory leak for community alias 11617/head
Donatas Abraitis [Sat, 16 Jul 2022 13:18:07 +0000 (16:18 +0300)]
bgpd: Fix memory leak for community alias

==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 94 of 97
==361630==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==361630==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1FD3CC: bgp_ca_alias_insert (in /usr/lib/frr/bgpd)
==361630==    by 0x2CF8E5: bgp_community_alias_magic (in /usr/lib/frr/bgpd)
==361630==    by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd)
==361630==    by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)
==361630==
==361630== 24,780 (96 direct, 24,684 indirect) bytes in 3 blocks are definitely lost in loss record 95 of 97
==361630==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==361630==    by 0x492EB8E: qcalloc (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x490BB12: hash_get (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1FD39C: bgp_ca_community_insert (in /usr/lib/frr/bgpd)
==361630==    by 0x2CF8F4: bgp_community_alias_magic (in /usr/lib/frr/bgpd)
==361630==    by 0x2C980B: bgp_community_alias (in /usr/lib/frr/bgpd)
==361630==    by 0x48E3556: cmd_execute_command_real (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E384B: cmd_execute_command_strict (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3D41: command_config_read_one_line (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x48E3EBA: config_from_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x499065C: vty_read_file (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4990FF4: vty_read_config (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491CB95: frr_config_read_in (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x4985380: thread_call (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x491D521: frr_run (in /usr/local/lib/libfrr.so.0.0.0)
==361630==    by 0x1EBEE8: main (in /usr/lib/frr/bgpd)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 176d7beabc26b4494261d82f656f6b024cbfece4)

2 years agoMerge pull request #11612 from FRRouting/mergify/bp/stable/8.2/pr-10724
Jafar Al-Gharaibeh [Sat, 16 Jul 2022 20:52:33 +0000 (15:52 -0500)]
Merge pull request #11612 from FRRouting/mergify/bp/stable/8.2/pr-10724

lib: rotate log file supplied by command line (backport #10724)

2 years agolib: rotate log file supplied by command line 11612/head
Rafael Zalamena [Tue, 11 Jan 2022 18:39:11 +0000 (15:39 -0300)]
lib: rotate log file supplied by command line

Call `zlog_file_rotate` for command file lines as well otherwise on
`SIGUSR1` the old descriptor will still be used and no new log file will
be created for the rotation.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
(cherry picked from commit 3c1f92018bfa6a14ccf6eb70ccd93f38e54bf83f)

2 years agoMerge pull request #11562 from FRRouting/mergify/bp/stable/8.2/pr-11545
Donald Sharp [Fri, 8 Jul 2022 14:56:46 +0000 (10:56 -0400)]
Merge pull request #11562 from FRRouting/mergify/bp/stable/8.2/pr-11545

bgpd: Free memory for BMP listeners when deleting BGP instance (backport #11545)

2 years agoMerge pull request #11551 from FRRouting/mergify/bp/stable/8.2/pr-11548
Donald Sharp [Thu, 7 Jul 2022 20:24:31 +0000 (16:24 -0400)]
Merge pull request #11551 from FRRouting/mergify/bp/stable/8.2/pr-11548

lib: check hostname in resolver_resolve (backport #11548)

2 years agoMerge pull request #11558 from FRRouting/mergify/bp/stable/8.2/pr-11549
Donald Sharp [Thu, 7 Jul 2022 18:51:49 +0000 (14:51 -0400)]
Merge pull request #11558 from FRRouting/mergify/bp/stable/8.2/pr-11549

tools: Add missing bfdd to logrotate config (backport #11549)

2 years agobgpd: Free memory for BMP listeners when deleting BGP instance 11562/head
Donatas Abraitis [Wed, 6 Jul 2022 14:26:05 +0000 (17:26 +0300)]
bgpd: Free memory for BMP listeners when deleting BGP instance

When using `no router bgp` we MUST free the memory for the listeners too.

Replicate with:
```
router bgp 100
bmp targets server1
bmp listener 0.0.0.0 port 65535
no router bgp
router bgp 100
bmp targets server1
bmp listener 0.0.0.0 port 65535
no router bgp
router bgp 100
bmp targets server1
bmp listener 0.0.0.0 port 65535
no router bgp
```

Before:
```
Type                          : Current#   Size       Total     Max#  MaxBytes
BMP targets                   :        0    240           0        1       248
BMP targets name              :        0      8           0        1        24
BMP listener                  :       12    152        1824       12      1824
BMP instance state            :        0     88           0        1        88
```

After:
```
Type                          : Current#   Size       Total     Max#  MaxBytes
BMP targets                   :        0    240           0        1       248
BMP targets name              :        0      8           0        1        24
BMP listener                  :        0    152           0        1       152
BMP instance state            :        0     88           0        1        88
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 5cb3a15300749a0bdc0eb391c822ee2473f0caec)

2 years agotools: Add missing bfdd to logrotate config 11558/head
Donatas Abraitis [Thu, 7 Jul 2022 06:49:21 +0000 (09:49 +0300)]
tools: Add missing bfdd to logrotate config

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 97634742788475cd4a8581f8d37e29ffa2e6280b)

2 years agolib: check hostname in resolver_resolve 11551/head
kevinshen [Thu, 7 Jul 2022 04:10:03 +0000 (12:10 +0800)]
lib: check hostname in resolver_resolve

resolver_resolve should check hostname is null or not.

if ares_gethostbyname() get null hostname string, the hostname string will access a null pointer and crash.

Signed-off-by: kevinshen <kevinshen@inspur.com>
(cherry picked from commit 30220d1e35a92bbf3e6694d81b308630c7db27c3)

2 years agoMerge pull request #11532 from opensourcerouting/freebsd-if-misconfig
Donald Sharp [Tue, 5 Jul 2022 23:52:52 +0000 (19:52 -0400)]
Merge pull request #11532 from opensourcerouting/freebsd-if-misconfig

[8.2] Fix FreeBSD interface configuration

2 years agozebra: Don't send uninited data to kernel on FreeBSD 11532/head
Donald Sharp [Thu, 24 Mar 2022 16:57:01 +0000 (12:57 -0400)]
zebra: Don't send uninited data to kernel on FreeBSD

When running zebra w/ valgrind, it was noticed that there
was a bunch of passing uninitialized data to the kernel:

==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194==    at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194==    by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194==    by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194==    by 0x2AFF39: if_get_mtu (ioctl.c:161)
==38194==    by 0x2B12C3: ifm_read (kernel_socket.c:653)
==38194==    by 0x2A7F76: interface_list (if_sysctl.c:129)
==38194==    by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194==    by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194==    by 0x2B3F82: main (main.c:401)
==38194==  Address 0x7fc000967 is on thread 1's stack
==38194==  in frame #3, created by if_get_mtu (ioctl.c:155)
==38194==
==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194==    at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194==    by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194==    by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194==    by 0x2AFED9: if_get_metric (ioctl.c:143)
==38194==    by 0x2B12CB: ifm_read (kernel_socket.c:655)
==38194==    by 0x2A7F76: interface_list (if_sysctl.c:129)
==38194==    by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194==    by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194==    by 0x2B3F82: main (main.c:401)
==38194==  Address 0x7fc000967 is on thread 1's stack
==38194==  in frame #3, created by if_get_metric (ioctl.c:137)
==38194==
==38194== Syscall param ioctl(generic) points to uninitialised byte(s)
==38194==    at 0x4CDF88A: ioctl (in /lib/libc.so.7)
==38194==    by 0x49A4031: vrf_ioctl (vrf.c:860)
==38194==    by 0x2AFE29: vrf_if_ioctl (ioctl.c:91)
==38194==    by 0x2B052D: if_get_flags (ioctl.c:419)
==38194==    by 0x2B1CF1: ifam_read (kernel_socket.c:930)
==38194==    by 0x2A7F57: interface_list (if_sysctl.c:132)
==38194==    by 0x2E9958: zebra_ns_enable (zebra_ns.c:127)
==38194==    by 0x2E9958: zebra_ns_init (zebra_ns.c:214)
==38194==    by 0x2B3F82: main (main.c:401)
==38194==  Address 0x7fc000707 is on thread 1's stack
==38194==  in frame #3, created by if_get_flags (ioctl.c:411)

Valgrind is no longer reporting these issues.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit ceacdc721682cdc929835ff3adc1e0f824f83dcb)

2 years agozebra: Keep the interface flags safe on multiple ioctl calls
Bijan [Tue, 1 Feb 2022 07:33:00 +0000 (11:03 +0330)]
zebra: Keep the interface flags safe on multiple ioctl calls

Trying to call multiple ioctl calls on ifreq will result in
overwriting ifreq with garbage data. On if_get_flags call,
try to keep the flags field safe from another possible ioctl
call before applying the flags field.

Modified code as per Code Review, done by Donald Sharp.

Signed-off-by: Bijan <bijanebrahimi@riseup.net>
(cherry picked from commit 16dca7cec5f47b7a6f83822a1e681652b7d2d60d)

2 years agoMerge pull request #11511 from FRRouting/mergify/bp/stable/8.2/pr-11488
Donatas Abraitis [Fri, 1 Jul 2022 10:06:45 +0000 (13:06 +0300)]
Merge pull request #11511 from FRRouting/mergify/bp/stable/8.2/pr-11488

lib: Allow downgrade of all caps when none are specified (backport #11488)

2 years agolib: Allow downgrade of all caps when none are specified 11511/head
Donald Sharp [Tue, 28 Jun 2022 14:26:52 +0000 (10:26 -0400)]
lib: Allow downgrade of all caps when none are specified

Staticd when run tells privs.c that it does not need any
priviledges.  The lib/privs.c code was not downgrading
any and all permissions it may have been given at startup.

Since we don't need any let's actually tell the system that
FRR does not need the capabilities anymore in the case
where a daemon does not ask for any cap's.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 88be4045c9e09d9b36952ed594e4bbc19633deba)

2 years agoMerge pull request #11436 from FRRouting/mergify/bp/stable/8.2/pr-11425
Donatas Abraitis [Sun, 19 Jun 2022 19:41:13 +0000 (22:41 +0300)]
Merge pull request #11436 from FRRouting/mergify/bp/stable/8.2/pr-11425

lib: cleanup red-herring memleaks in parent of daemonizing fork (backport #11425)

2 years agolib: cleanup red-herring memleaks in parent of daemonizing fork 11436/head
Christian Hopps [Fri, 17 Jun 2022 06:04:51 +0000 (02:04 -0400)]
lib: cleanup red-herring memleaks in parent of daemonizing fork

- The parent of the daemonizing fork reports memleaks for the early
northbound allocations (libyang). If these were real memleaks these
would show up in the child as well; however, ignoring all memleaks in
the parent of the fork is too hard a sale. Instead, spend some CPU
cycles cleaning up the allocations in the parent after the fork and
immeidatley prior to exiting the parent after the daemonizing fork.

Signed-off-by: Christian Hopps <chopps@labn.net>
(cherry picked from commit 1213e46bfd4aaf2897787b4dc03879d4d1b81fa6)

2 years agoMerge pull request #11420 from opensourcerouting/fix/backport_local-preference_rmap_a...
Donald Sharp [Fri, 17 Jun 2022 12:06:48 +0000 (08:06 -0400)]
Merge pull request #11420 from opensourcerouting/fix/backport_local-preference_rmap_add_substract

bgpd: [8.2] Initialize attr->local_pref to the configured default value

2 years agobgpd: Initialize attr->local_pref to the configured default value 11420/head
Donatas Abraitis [Mon, 6 Jun 2022 06:49:37 +0000 (09:49 +0300)]
bgpd: Initialize attr->local_pref to the configured default value

When we use network/redistribute local_preference is configured inproperly
when using route-maps something like:

```
network 100.100.100.100/32 route-map rm1
network 100.100.100.200/32 route-map rm2

route-map rm1 permit 10
 set local-preference +10
route-map rm2 permit 10
 set local-preference -10
```

Before:
```
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf'
10
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf'
0
```

After:
```
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.100/32 json' | jq '.paths[].locPrf'
110
root@spine1-debian-11:~# vtysh -c 'show bgp ipv4 unicast 100.100.100.200/32 json' | jq '.paths[].locPrf'
90
```

Set local-preference as the default value configured per BGP instance, but
do not set LOCAL_PREF flag by default.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11399 from opensourcerouting/fix/backport_vrf_leak_rmap_change_rt_8.2
Russ White [Tue, 14 Jun 2022 13:06:02 +0000 (09:06 -0400)]
Merge pull request #11399 from opensourcerouting/fix/backport_vrf_leak_rmap_change_rt_8.2

bgpd: [8.2] Withdraw implicitly old paths from VRFs when import/export list…

2 years agobgpd: Withdraw implicitly old paths from VRFs when import/export list changes 11399/head
Donatas Abraitis [Tue, 7 Jun 2022 19:12:07 +0000 (22:12 +0300)]
bgpd: Withdraw implicitly old paths from VRFs when import/export list changes

If we overwrite import/export RT list via route-maps or even flush by using
`set extcommunity none`, then we must withdraw old paths from VRFs to avoid
stale paths.

For example using:

```
router bgp 65500 vrf vrf1
 bgp router-id 10.180.1.1
 !
 address-family ipv4 unicast
  network 192.168.100.100/32 route-map rm
  rd vpn export 65500:10001
  rt vpn import 65500:10000 65500:10990
  rt vpn export 65500:10000
  export vpn
  import vpn
 exit-address-family
exit
!
router bgp 65500 vrf vrf2
 bgp router-id 10.180.1.1
 !
 address-family ipv4 unicast
  rd vpn export 65500:11001
  rt vpn import 65500:11000 65500:11990
  rt vpn export 65500:11000
  export vpn
  import vpn
 exit-address-family
exit
!
route-map rm permit 10
 set extcommunity rt 65500:10100 65500:12990 65500:13990 65500:11990
exit
```

If we strip extcommunities using:

```
route-map rm permit 10
 set extcommunity none
exit
```

or

```
route-map rm permit 10
 set extcommunity rt 65500:10100 65500:12990 65500:13990
```

Routes that are imported with 65500:11990 (192.168.100.100/32 from vrf1)
becomes stale.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11379 from FRRouting/mergify/bp/stable/8.2/pr-11377
Donatas Abraitis [Fri, 10 Jun 2022 12:42:50 +0000 (15:42 +0300)]
Merge pull request #11379 from FRRouting/mergify/bp/stable/8.2/pr-11377

pimd: Show interface traffic even if interface is currently `down` (backport #11377)

2 years agoMerge pull request #11339 from opensourcerouting/fix/memory_leak_with_rmaps_8.2
Jafar Al-Gharaibeh [Thu, 9 Jun 2022 17:03:53 +0000 (12:03 -0500)]
Merge pull request #11339 from opensourcerouting/fix/memory_leak_with_rmaps_8.2

bgpd: [8.2] Fix memory leak when setting [l]community at egress

2 years agopimd: Show interface traffic even if interface is currently `down` 11379/head
Donald Sharp [Thu, 9 Jun 2022 14:29:04 +0000 (10:29 -0400)]
pimd: Show interface traffic even if interface is currently `down`

the `show ip pim interface [x] traffic` command was deciding
to skip display of interfaces if they happened to be down at
that moment.  This of course does not make a bunch of sense
to limit the output for a interface that may have sent data
in the past.

This fixes this test crash:
rnode = <lib.topogen.TopoRouter object at 0x7fc755be3880>, dut = 'c1', input_dict = {'c1': {'c1-l1-eth2': ['helloTx', 'helloRx']}}, output_dict = {'c1': {}}

    def show_pim_intf_traffic(rnode, dut, input_dict, output_dict):
        show_pim_intf_traffic_json = run_frr_cmd(
            rnode, "show ip pim interface traffic json", isjson=True
        )

        output_dict[dut] = {}
        for intf, data in input_dict[dut].items():
>           interface_json = show_pim_intf_traffic_json[intf]
E           KeyError: 'c1-l1-eth2'

/home/sharpd/frr8/tests/topotests/lib/pim.py:1496: KeyError

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit a64543e3e8f0210e12bf9749e4302dc216f93b61)

2 years agoMerge pull request #11362 from opensourcerouting/feature/github_workflow
Jafar Al-Gharaibeh [Thu, 9 Jun 2022 04:57:05 +0000 (23:57 -0500)]
Merge pull request #11362 from opensourcerouting/feature/github_workflow

github: [8.2] Add base branch label to every PR to distinguish easily

2 years agogithub: Add base branch label to every PR to distinguish easily 11362/head
Donatas Abraitis [Wed, 8 Jun 2022 08:34:25 +0000 (11:34 +0300)]
github: Add base branch label to every PR to distinguish easily

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Fix memory leak when setting [l]community at egress 11339/head
Donatas Abraitis [Thu, 2 Jun 2022 10:30:42 +0000 (13:30 +0300)]
bgpd: Fix memory leak when setting [l]community at egress

```
==2209758== 7,791,480 (399,840 direct, 7,391,640 indirect) bytes in 9,996 blocks are definitely lost in loss record 102 of 103
==2209758==    at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2209758==    by 0x4EE264F: qcalloc (memory.c:116)
==2209758==    by 0x22E62A: lcommunity_new (bgp_lcommunity.c:42)
==2209758==    by 0x22E62A: lcommunity_dup (bgp_lcommunity.c:155)
==2209758==    by 0x26F28F: route_set_lcommunity (bgp_routemap.c:2382)
==2209758==    by 0x4EFF7EF: route_map_apply_ext (routemap.c:2663)
==2209758==    by 0x250B3D: subgroup_announce_check (bgp_route.c:2202)
==2209758==    by 0x27A195: subgroup_announce_table (bgp_updgrp_adv.c:690)
==2209758==    by 0x27A509: subgroup_coalesce_timer (bgp_updgrp_adv.c:332)
==2209758==    by 0x4F1C3FC: thread_call (thread.c:2002)
==2209758==    by 0x4ED6D67: frr_run (libfrr.c:1196)
==2209758==    by 0x1E921B: main (bgp_main.c:519)
```

To reproduce it's enough to have something like applied at egress:

```
route-map test permit 10
 on-match goto 15
 set large-community 20717:0:0 20717:1:1820 20717:1:3303 20717:1:4788 20717:1:5416 20717:1:5713 20717:1:6774 20717:1:8309 20717:1:8529 20717:1:8697 20717:1:8966 20717:1:9038 20717:1:9119 20717:1:9304 20717:1:9498 20717:1:12779 20717:1:12883 20717:1:13113 20717:1:14340 20717:1:14907 20717:1:15802 20717:1:16347 20717:1:16637 20717:1:18403 20717:1:20717 20717:1:20928 20717:1:21245 20717:1:25818 20717:1:28917 20717:1:30844 20717:1:30990 20717:1:31133 20717:1:35297 20717:1:35320 20717:1:35432 20717:1:35819 20717:1:35838 20717:1:36994 20717:1:37100 20717:1:37558 20717:1:37662 20717:1:39180 20717:1:39405 20717:1:41095 20717:1:43996 20717:1:45489 20717:1:45903 20717:1:47794 20717:1:51185 20717:1:51254 20717:1:58715 20717:1:59605 20717:1:60427 20717:1:62955 20717:1:63008 20717:1:63927 20717:1:64049 20717:1:132602 20717:1:198435 20717:1:205988 20717:1:208278 20717:1:327700
exit
!
route-map test deny 15
exit
!
```

On the other side doing:
```
spine1-debian-11# sharp install routes 100.100.100.1 nexthop 192.168.10.65 30
spine1-debian-11# sharp remove routes 100.100.100.1 30
spine1-debian-11# sharp install routes 100.100.100.1 nexthop 192.168.10.65 30
```

Before:

```
Large Community               :       66     40        2816       66      2816
Large Community value         :       66 variable     29728       66     29728
Large Community               :       96     40        4096       96      4096
Large Community value         :       96 variable     52048       96     52048
```

After:
```
Large Community               :       28     40        1152       29      1192
Large Community value         :       28 variable      1456       29      2200
Large Community               :       28     40        1152       29      1192
Large Community value         :       28 variable      1456       29      2200
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11320 from FRRouting/mergify/bp/stable/8.2/pr-11300
Donatas Abraitis [Wed, 1 Jun 2022 05:08:24 +0000 (08:08 +0300)]
Merge pull request #11320 from FRRouting/mergify/bp/stable/8.2/pr-11300

tools: add eigrp support on frr-reload (backport #11300)

2 years agotools: add eigrp support on frr-reload 11320/head
Christian Poessinger [Sun, 29 May 2022 08:56:56 +0000 (10:56 +0200)]
tools: add eigrp support on frr-reload

Signed-off-by: Christian Poessinger <christian@poessinger.com>
(cherry picked from commit 93ced413424fdc732307add57b178a0bde86376f)

2 years agoMerge pull request #11308 from FRRouting/mergify/bp/stable/8.2/pr-11277
Donatas Abraitis [Tue, 31 May 2022 11:57:10 +0000 (14:57 +0300)]
Merge pull request #11308 from FRRouting/mergify/bp/stable/8.2/pr-11277

pimd: Allow the LPM match work properly with prefix lists and normal â€¦ (backport #11277)

2 years agoMerge pull request #11306 from FRRouting/mergify/bp/stable/8.2/pr-11291
Donald Sharp [Tue, 31 May 2022 11:43:45 +0000 (07:43 -0400)]
Merge pull request #11306 from FRRouting/mergify/bp/stable/8.2/pr-11291

bgpd: Memory leak for community alias (backport #11291)

2 years agopimd: Allow the LPM match work properly with prefix lists and normal rp's 11308/head
Donald Sharp [Tue, 24 May 2022 17:33:35 +0000 (13:33 -0400)]
pimd: Allow the LPM match work properly with prefix lists and normal rp's

All rp_info's are being saved in the pim->rp_list and the non prefix-list
rp's are supposed to be saved in table pim->rp_table.  What was happening,
though, is that all the plists were being stored at the 224.0.0.0/4 node
of the tree(irrelevant to the fact that we should not be looking up the
non-prefix list rp's in the table) and since we can have multiple prefix lists
and only one rp_info stored at the 224.0.0.0/4 node of the tree, there can be situations
where the 224.0.0.0/4 node can be overwritten due to the order entered.

As such there exists situations where command enter ordering will cause
what we match to, change in pim_rp_find_match_group.

Fixes:

a) Do not store prefix list based rp_info's in the pim->rp_table
b) In pim_rp_find_match_group, ensure that the node lookup does
not correspond to a prefix list based node.
c) When in the situation there are both:
ip pim rp 4.5.6.7 224.0.0.0/16
ip pim rp 5.6.67.8 prefix-list FOO
ip prefix-list FOO permit 224.0.1.0/24
and we receive a group for 224.0.1.5, we were comparing the
224.0.0.0/16 to the 224.0.0.0/4 of the 5.6.67.8 group, when
FRR should have been comparing to entry that matched in the prefix-list

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 94dc0c4ed4bbca84ad32cb45bbc492e9cae90d73)

2 years agobgpd: Simplify BGP community alias handling 11306/head
Donatas Abraitis [Thu, 26 May 2022 17:15:35 +0000 (20:15 +0300)]
bgpd: Simplify BGP community alias handling

Also, warn in CLI an operator if we are trying to overwrite an existing
community alias with an existing alias.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 8cfa1e78463844518bb95d59fee2da440bbd208e)

2 years agobgpd: Distinguish BGP community alias memory separately from community
Donatas Abraitis [Thu, 26 May 2022 12:43:42 +0000 (15:43 +0300)]
bgpd: Distinguish BGP community alias memory separately from community

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 5b0f36a8f70a6c224771bea4707f6d3c869c0145)

2 years agobgpd: Fix memory leak for BGP community alias in CLI
Donatas Abraitis [Thu, 26 May 2022 11:03:02 +0000 (14:03 +0300)]
bgpd: Fix memory leak for BGP community alias in CLI

Before:
```
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      100     40        4000      100      4000
Large Community value         :      100     12        2400      100      2400
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      200     40        8000      200      8000
Large Community value         :      200     12        4800      200      4800
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :      300     40       12000      300     12000
Large Community value         :      300     12        7200      300      7200
root@spine1-debian-11:~/frr#
```

After:
```
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :        0     40           0        1        56
Large Community display string:        0   8192           0        1      8200
Large Community value         :        0     12           0        1        24
root@spine1-debian-11:~/frr# for x in $(seq 1 100); do vtysh -c 'conf' -c 'bgp community alias 123:123:123 testas' > /dev/null; done
root@spine1-debian-11:~/frr# vtysh -c 'show memory bgpd | include Large Community'
Large Community               :        0     40           0        1        56
Large Community display string:        0   8192           0        1      8200
Large Community value         :        0     12           0        1        24
root@spine1-debian-11:~/frr#
```

After we call [l]community_str2com(), we should free the memory.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit d13d137a1baaea39a24d857de54200dca39410b2)

2 years agoMerge pull request #11264 from FRRouting/mergify/bp/stable/8.2/pr-11261
Donald Sharp [Tue, 24 May 2022 21:52:33 +0000 (17:52 -0400)]
Merge pull request #11264 from FRRouting/mergify/bp/stable/8.2/pr-11261

bgpd: Don't increment twice notification sent stats counter (backport #11261)

2 years agoMerge pull request #11251 from FRRouting/mergify/bp/stable/8.2/pr-11218
Russ White [Tue, 24 May 2022 15:27:33 +0000 (11:27 -0400)]
Merge pull request #11251 from FRRouting/mergify/bp/stable/8.2/pr-11218

bgpd: Show a correct local AS for the advertised/bestpath routes (backport #11218)

2 years agobgpd: Don't increment twice notification sent stats counter 11264/head
Donatas Abraitis [Tue, 24 May 2022 07:04:50 +0000 (10:04 +0300)]
bgpd: Don't increment twice notification sent stats counter

Before:

```
$ vtysh -c 'clear ip bgp 192.168.10.17'
$ vtysh -c 'show bgp neighbor 192.168.10.17 json' | jq '."192.168.10.17".messageStats.notificationsSent'
2
```

After:

```
$ vtysh -c 'clear ip bgp 192.168.10.17'
$ vtysh -c 'show bgp neighbor 192.168.10.17 json' | jq '."192.168.10.17".messageStats.notificationsSent'
1
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 41b1d7a3a4a24c1db1f1efb9eaacf6435605de8c)

2 years agobgpd: Show a correct local AS for the advertised/bestpath routes 11251/head
Donatas Abraitis [Wed, 18 May 2022 10:34:02 +0000 (13:34 +0300)]
bgpd: Show a correct local AS for the advertised/bestpath routes

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 114fc22915c7bb9ec1b197b3deacc9fef8b391bc)

2 years agoMerge pull request #11196 from opensourcerouting/fix/backport_56b91d107ffc090c621bac4...
Igor Ryzhov [Fri, 13 May 2022 13:33:17 +0000 (16:33 +0300)]
Merge pull request #11196 from opensourcerouting/fix/backport_56b91d107ffc090c621bac4f2ff93712c49f0d7b_8.2

bgpd: [8.2] Prevent crash when issuing various forms of `bgp no-rib`

2 years agoMerge pull request #11193 from opensourcerouting/fix/backport_007784ccff3413110e78ba7...
Igor Ryzhov [Fri, 13 May 2022 11:27:00 +0000 (14:27 +0300)]
Merge pull request #11193 from opensourcerouting/fix/backport_007784ccff3413110e78ba7d32f3606b565484ef

pimd: [8.2] registerTx should show sent registrations, not received

2 years agobgpd: Prevent crash when issuing various forms of `bgp no-rib` 11196/head
Donald Sharp [Thu, 12 May 2022 13:39:27 +0000 (09:39 -0400)]
bgpd: Prevent crash when issuing various forms of `bgp no-rib`

The `bgp no-rib` command cycles through all the bgp rib tables
and removes them from zebra.  Modify the code so that FRR notices
that it is attempting to cycle through the safi's that are two level
tables.  In addition these safi's cannot just blindly remove the routes
from the rib as that there are none explicitly.

This code just prevents the crash in bgpd.  It does not properly cycle
through and remove the zebra changes made that are explicit to these afi's.
This should be handled as appropriate by the developers on these safi's when
it becomes important to them.

Fixes: #11178
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2 years agopimd: registerTx should show sent registrations, not received 11193/head
Donatas Abraitis [Thu, 12 May 2022 14:10:27 +0000 (17:10 +0300)]
pimd: registerTx should show sent registrations, not received

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoMerge pull request #11173 from opensourcerouting/fix/rpki_8.2_reverts
Russ White [Tue, 10 May 2022 15:23:57 +0000 (11:23 -0400)]
Merge pull request #11173 from opensourcerouting/fix/rpki_8.2_reverts

bgpd: [8.2] RPKI reverts

2 years agobgpd: Convert int -> void for thread functions in RPKI 11173/head
Donatas Abraitis [Tue, 10 May 2022 06:39:39 +0000 (09:39 +0300)]
bgpd: Convert int -> void for thread functions in RPKI

int -> void not yet in 8.2, thus keeping the same format.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agobgpd: Make sure we print stats if we are sync at least with a single group
Donatas Abraitis [Tue, 3 May 2022 12:13:23 +0000 (15:13 +0300)]
bgpd: Make sure we print stats if we are sync at least with a single group

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoRevert "bgpd: Handle TCP connection errors with connection callbacks for RPKI"
Donatas Abraitis [Tue, 3 May 2022 12:09:52 +0000 (15:09 +0300)]
Revert "bgpd: Handle TCP connection errors with connection callbacks for RPKI"

This reverts commit db3aca462b7d721da85dde12bcc5808f9c32c981.

Connection handling is already fixed in librtr 0.8.0.
https://github.com/rtrlib/rtrlib/releases/tag/v0.8.0

https://github.com/rtrlib/rtrlib/commit/179e7efb59529008eed77b3cf783667435dfba9f

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2 years agoRevert "bgpd: Fix while(read()) for RPKI sync callback"
Donatas Abraitis [Tue, 3 May 2022 12:08:35 +0000 (15:08 +0300)]
Revert "bgpd: Fix while(read()) for RPKI sync callback"

This reverts commit b4fc876a327a89dc212efa48a04b76e53263722f.

2 years agoMerge pull request #11125 from FRRouting/mergify/bp/stable/8.2/pr-11090
Donald Sharp [Mon, 2 May 2022 18:14:14 +0000 (14:14 -0400)]
Merge pull request #11125 from FRRouting/mergify/bp/stable/8.2/pr-11090

lib: Ignore duplicate alist/plist entries in CLI (backport #11090)

3 years agoMerge pull request #11126 from FRRouting/mergify/bp/stable/8.2/pr-11122
Donatas Abraitis [Fri, 29 Apr 2022 20:08:25 +0000 (23:08 +0300)]
Merge pull request #11126 from FRRouting/mergify/bp/stable/8.2/pr-11122

bgpd: fix size of esi_buf (backport #11122)

3 years agoMerge pull request #11124 from FRRouting/mergify/bp/stable/8.2/pr-11106
Donatas Abraitis [Fri, 29 Apr 2022 18:46:27 +0000 (21:46 +0300)]
Merge pull request #11124 from FRRouting/mergify/bp/stable/8.2/pr-11106

Werror error error (backport #11106)

3 years agobgpd: fix size of esi_buf 11126/head
Dmitrii Turlupov [Fri, 29 Apr 2022 11:56:25 +0000 (14:56 +0300)]
bgpd: fix size of esi_buf

Fixes: #11111
Signed-off-by: Dmitrii Turlupov <dturlupov@factor-ts.ru>
(cherry picked from commit 5f933e1eca39ae7aed935502da0c469b8fb2c16a)

3 years agolib: Ignore duplicate alist/plist entries in CLI 11125/head
Donatas Abraitis [Mon, 25 Apr 2022 16:06:49 +0000 (19:06 +0300)]
lib: Ignore duplicate alist/plist entries in CLI

If duplicate value is entered, the whole plist/alist just dropped.

Before:
```
$ grep prefix-list /etc/frr/frr.conf
ip prefix-list test seq 5 permit 1.1.1.1/32
ip prefix-list test seq 10 permit 1.1.1.1/32
$ systemctl restart frr
$ vtysh -c 'show run | include prefix-list'
$
```

After:
```
$ grep prefix-list /etc/frr/frr.conf
ip prefix-list test seq 5 permit 1.1.1.1/32
ip prefix-list test seq 10 permit 1.1.1.1/32
$ systemctl restart frr
$ vtysh -c 'show run | include prefix-list'
ip prefix-list test seq 5 permit 1.1.1.1/32
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 1db0e0c6c8aba5023f807a1be03ca97d20f3c20d)

3 years agotests: Correctly align variable type in tests 11124/head
Donald Sharp [Wed, 27 Apr 2022 12:16:50 +0000 (08:16 -0400)]
tests: Correctly align variable type in tests

New compilers are noticing that the tests are compiling with
a pointer for the bgpd_privs variable while the bgp library
that is being linked against is not a pointer.  Since
these tests had the declaration just to make the compiler
happy, let's actually align the variable type to make the
compiler even happier.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit fcf6dce79a2e1ee4b7a5b4bb565f1755cda0d1f4)

3 years agobgpd: Ensure pkt_afi and pkt_safi are not used uninited in some cases
Donald Sharp [Wed, 27 Apr 2022 11:57:41 +0000 (07:57 -0400)]
bgpd: Ensure pkt_afi and pkt_safi are not used uninited in some cases

The compiler is, rightly, pointing out that in some cases it is
possible that the pkt_afi and pkt_safi values are not properly
set and could result in a use before initialized.  I do not
actually belive that this is possible, but let's make the compiler
happy.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 617975d114f41116a15f81ecf6f6c57487fc2e82)

3 years agoMerge pull request #11117 from FRRouting/mergify/bp/stable/8.2/pr-11095
Donatas Abraitis [Fri, 29 Apr 2022 04:16:25 +0000 (07:16 +0300)]
Merge pull request #11117 from FRRouting/mergify/bp/stable/8.2/pr-11095

bgpd: ensure that the node gets unlocked in all cases (backport #11095)

3 years agobgpd: ensure that the node gets unlocked in all cases 11117/head
Carl Baldwin [Wed, 29 Dec 2021 21:32:33 +0000 (14:32 -0700)]
bgpd: ensure that the node gets unlocked in all cases

The logic to unlock dest if iteration completed without iterating the
entire node was flawed. Specifically, if iteration terminated due to
`gr_deferred == 0` then the node would not get unlocked.

This change takes into account the fact that dest will be NULL only in
the case when the entire table was iterated and all nodes were already
unlocked. In any other case, it needs to be unlocked.

Signed-off-by: Carl Baldwin <carl@ecbaldwin.net>
(cherry picked from commit 067ea16598a444b1ecfda5012f96acb038ba041e)

3 years agoMerge pull request #11100 from FRRouting/mergify/bp/stable/8.2/pr-11089
Donald Sharp [Tue, 26 Apr 2022 19:26:57 +0000 (15:26 -0400)]
Merge pull request #11100 from FRRouting/mergify/bp/stable/8.2/pr-11089

build: fix new gcc 11.2 warnings (backport #11089)

3 years agobuild: fix new gcc 11.2 warnings 11100/head
David Lamparter [Mon, 25 Apr 2022 12:07:41 +0000 (14:07 +0200)]
build: fix new gcc 11.2 warnings

Some recent improvement in GCC triggers 2 new warnings, and they're
actual bugs (reading beyond end of prefix_ipv6 by accessing it as
prefix, which is larger.)  Luckily it's only in sharpd.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
(cherry picked from commit 5c7a6fb36c0cf8113c19af7354782838988b263b)

3 years agoMerge pull request #11094 from FRRouting/mergify/bp/stable/8.2/pr-11081
Donatas Abraitis [Tue, 26 Apr 2022 06:12:34 +0000 (09:12 +0300)]
Merge pull request #11094 from FRRouting/mergify/bp/stable/8.2/pr-11081

bgpd: Fix import check removal (backport #11081)

3 years agobgpd: Fix import check removal 11094/head
Donald Sharp [Sun, 24 Apr 2022 20:52:46 +0000 (16:52 -0400)]
bgpd: Fix import check removal

Fix: 06e4e90132ad23815c6f288dd7e6be334f5ab233

Modified BGP to pay more attention the prefix returned from
zebra to ensure that a LPM wasn't accidently causing BGP
import checks to think it had a match when it did not.
This unfortunately removed the check to handle the route
removal.

This sequence of config and events would leave BGP in a bad state:
ip route 100.100.100.0/24 Null0
router bgp 32932
  bgp network import-check
  address-family ipv4 uni
    network 100.100.100.0/24

Then if you removed the static route the import check would
still think the route existed:

donatas-pc(config)# ip route 100.100.100.0/24 Null0

donatas-pc(config)# do sh ip bgp import-check-table
Current BGP import check cache:
 100.100.100.0 valid [IGP metric 0], #paths 1
  blackhole
  Last update: Sat Apr 23 22:51:34 2022

donatas-pc(config)# do sh ip nht
100.100.100.0
 resolved via static
 is directly connected, Null0
 Client list: bgp(fd 17)

donatas-pc(config)# do sh ip bgp neighbors 192.168.10.123 advertised-routes | include 100.100.100.0
*> 100.100.100.0/24 0.0.0.0                  0         32768 i

donatas-pc(config)# no ip route 100.100.100.0/24 Null0

donatas-pc(config)# do sh ip nht
100.100.100.0
 resolved via kernel
 via 192.168.10.1, enp3s0
 Client list: bgp(fd 17)

donatas-pc(config)# do sh ip bgp import-check-table
Current BGP import check cache:
 100.100.100.0 valid [IGP metric 0], #paths 1
  blackhole
  Last update: Sat Apr 23 22:51:34 2022

donatas-pc(config)# do sh ip bgp neighbors 192.168.10.123 advertised-routes | include 100.100.100.0
*> 100.100.100.0/24 0.0.0.0                  0         32768 i
donatas-pc(config)#

Fix this by moving the code to handle the prefix check to the
evaluation function and mark the bnc as not matching and actually
evaluate the bnc.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 9f002fa5dd34e7d901b501e7d0306027d85b531a)

3 years agoMerge pull request #11082 from FRRouting/mergify/bp/stable/8.2/pr-11067
Donatas Abraitis [Mon, 25 Apr 2022 13:32:11 +0000 (16:32 +0300)]
Merge pull request #11082 from FRRouting/mergify/bp/stable/8.2/pr-11067

lib: Ensure an empty string does not get printed for host/domain (backport #11067)

3 years agolib: Ensure an empty string does not get printed for host/domain 11082/head
Donald Sharp [Thu, 21 Apr 2022 18:13:01 +0000 (14:13 -0400)]
lib: Ensure an empty string does not get printed for host/domain

End operator is showing:
!
frr version 8.0.1
frr defaults traditional
hostname test.example.com
domainname

domainname should not be printed in this case at all.  I do not
see any mechanism in current code that this could happen, but
what do I know?  Put some extra stupid insurance in place
to prevent bad config from being generated.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit a7141b85c8ded6f05edf51d5a61e063493fc85c7)

3 years agoMerge pull request #11057 from FRRouting/mergify/bp/stable/8.2/pr-11004
Donatas Abraitis [Wed, 20 Apr 2022 06:31:19 +0000 (09:31 +0300)]
Merge pull request #11057 from FRRouting/mergify/bp/stable/8.2/pr-11004

zebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces (backport #11004)

3 years agoMerge pull request #11053 from opensourcerouting/fix/backport_c9e4abf81f32deb752fb55d...
Donald Sharp [Wed, 20 Apr 2022 00:02:32 +0000 (20:02 -0400)]
Merge pull request #11053 from opensourcerouting/fix/backport_c9e4abf81f32deb752fb55d8b1e3a9a7cdd9af31_8.2

zebra: [8.2] Allow system routes to recurse through themselves

3 years agozebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces 11057/head
Volodymyr Huti [Mon, 11 Apr 2022 03:58:14 +0000 (06:58 +0300)]
zebra: set ZEBRA_IFC_DOWN on connected routes for inactive interfaces

If you are in a situation where you have multiple addresses on an
interface, zebra creates one connected route for them.
The issue is that the rib entry is not created if addresses were
added before the interface was running.

We add the address to a running interface in a typical flow.
Therefore, we handle the route & rib creation within a single ADD event.
In the opposite case, we create the route entries without activating them.
These are considered to be active since ZEBRA_IFC_DOWN is not set.
On the following interface UP, we ignore the same ADDR_ADD as it overlaps
with the existing prefixes -> rib is never created.

The minimal reproducible setup:
-----------------------------------------
ip link add name dummy0 type dummy
ip addr flush dev dummy0
ip link set dummy0 down
ip addr add 192.168.1.7/24 dev dummy0
ip addr add 192.168.1.8/24 dev dummy0
ip link set dummy0 up
vtysh -c 'show ip route' | grep dummy0

Signed-off-by: Volodymyr Huti <v.huti@vyos.io>
(cherry picked from commit 7fb9825cf7e762add68f5108df4eddda1247f198)

3 years agozebra: Allow system routes to recurse through themselves 11053/head
Donald Sharp [Sat, 9 Apr 2022 17:12:28 +0000 (13:12 -0400)]
zebra: Allow system routes to recurse through themselves

Currently if a end user has something like this:

Routing entry for 192.168.212.1/32
  Known via "kernel", distance 0, metric 100, best
  Last update 00:07:50 ago
  * directly connected, ens5

Codes: K - kernel route, C - connected, S - static, R - RIP,
       O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, F - PBR,
       f - OpenFabric,
       > - selected route, * - FIB route, q - queued, r - rejected, b - backup
       t - trapped, o - offload failure

K>* 0.0.0.0/0 [0/100] via 192.168.212.1, ens5, src 192.168.212.19, 00:00:15
C>* 192.168.212.0/27 is directly connected, ens5, 00:07:50
K>* 192.168.212.1/32 [0/100] is directly connected, ens5, 00:07:50

And FRR does a link flap, it refigures the route and rejects the default
route:

2022/04/09 16:38:20 ZEBRA: [NZNZ4-7P54Y] default(0:254):0.0.0.0/0: Processing rn 0x56224dbb5b00
2022/04/09 16:38:20 ZEBRA: [ZJVZ4-XEGPF] default(0:254):0.0.0.0/0: Examine re 0x56224dbddc20 (kernel) status: Changed Installed flags: Selected dist 0 metric 100
2022/04/09 16:38:20 ZEBRA: [GG8QH-195KE] nexthop_active_update: re 0x56224dbddc20 nhe 0x56224dbdd950 (7), curr_nhe 0x56224dedb550
2022/04/09 16:38:20 ZEBRA: [T9JWA-N8HM5] nexthop_active_check: re 0x56224dbddc20, nexthop 192.168.212.1, via ens5
2022/04/09 16:38:20 ZEBRA: [M7EN1-55BTH]         nexthop_active: Route Type kernel has not turned on recursion
2022/04/09 16:38:20 ZEBRA: [HJ48M-MB610]         nexthop_active_check: Unable to find active nexthop
2022/04/09 16:38:20 ZEBRA: [JPJF4-TGCY5] default(0:254):0.0.0.0/0: After processing: old_selected 0x56224dbddc20 new_selected 0x0 old_fib 0x56224dbddc20 new_fib 0x0

So the 192.168.212.1 route is matched for the nexthop but it is not connected and
zebra treats it as a problem.  Modify the code such that if a system route
matches through another system route, then it should work imo.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
3 years agoMerge pull request #11036 from ton31337/fix/backport_b17d5444f46c55fb131de4e0ab260bb1...
Donald Sharp [Tue, 19 Apr 2022 12:05:27 +0000 (08:05 -0400)]
Merge pull request #11036 from ton31337/fix/backport_b17d5444f46c55fb131de4e0ab260bb1bd7df93d_8.2

bgpd: [8.2] Pass non-transitive ext-communities between Route Server and RS clients

3 years agoMerge pull request #11041 from FRRouting/mergify/bp/stable/8.2/pr-11032
Donatas Abraitis [Tue, 19 Apr 2022 09:50:23 +0000 (12:50 +0300)]
Merge pull request #11041 from FRRouting/mergify/bp/stable/8.2/pr-11032

bgpd: fix NULL deference in evpn-mh's log (backport #11032)

3 years agobgpd: fix NULL deference in evpn-mh's log 11041/head
anlan_cs [Thu, 14 Apr 2022 07:45:48 +0000 (03:45 -0400)]
bgpd: fix NULL deference in evpn-mh's log

Fix NULL deference issue in log. And change one word - "vtep",
it should be with lowercase letters like other places.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit 46281b21afc52b4cc23fb3bd19bce5eff0bbdd0c)

3 years agobgpd: Pass non-transitive ext-communities between Route Server and RS clients 11036/head
Donatas Abraitis [Wed, 13 Apr 2022 17:40:30 +0000 (20:40 +0300)]
bgpd: Pass non-transitive ext-communities between Route Server and RS clients

https://datatracker.ietf.org/doc/html/rfc7947#section-2.2

Optional recognized and unrecognized BGP attributes,
   whether transitive or non-transitive, SHOULD NOT be updated by the
   route server (unless enforced by local IXP operator configuration)
   and SHOULD be passed on to other route server clients.

By default LB ext-community works with iBGP peers. When we receive a route
from eBGP peer, we can send LB ext-community to iBGP peers.

With this patch, allow sending LB ext-community to iBGP/eBGP peers if they
are set as RS clients.

FRR does not send non-transitive ext-communities to eBGP peers, but for
example GoBGP sends and if it's set as RS client, we should pass those attributes
towards another RS client.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
3 years agoMerge pull request #11027 from FRRouting/mergify/bp/stable/8.2/pr-10987
Donatas Abraitis [Fri, 15 Apr 2022 05:07:46 +0000 (08:07 +0300)]
Merge pull request #11027 from FRRouting/mergify/bp/stable/8.2/pr-10987

bgpd: Do not forget to update conditional advertisements rmaps for peer-groups (backport #10987)

3 years agobgpd: Do not forget to update conditional advertisements rmaps for peer-groups 11027/head
Donatas Abraitis [Thu, 7 Apr 2022 20:01:02 +0000 (23:01 +0300)]
bgpd: Do not forget to update conditional advertisements rmaps for peer-groups

When the peer is configured for the first time:
```
neighbor P1 peer-group
neighbor P1 remote-as external
neighbor P1 advertise-map ADV exist-map EXIST
neighbor 10.10.10.1 peer-group P1
```

Conditional advertisements route-maps are not updated and cond. advertisements
do not work until FRR restarted. BGP sessions clear does not help.

Or even changing peer-group for a peer, causes this bug to kick in.

```
no neighbor 10.10.10.1
neighbor 10.10.10.1 peer-group P2
```

With this fix, cond. advertisements start working immediatelly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
(cherry picked from commit 9118301e48af0dc0157184554601c767cbd25128)

3 years agoMerge pull request #11019 from opensourcerouting/fix/bgp_aliases_with_community_backp...
Russ White [Wed, 13 Apr 2022 18:56:47 +0000 (14:56 -0400)]
Merge pull request #11019 from opensourcerouting/fix/bgp_aliases_with_community_backport_8.2

bgpd: [8.2] Allow setting BGP [large]community in route-maps

3 years agobgpd: Allow setting BGP [large]community in route-maps 11019/head
Donatas Abraitis [Fri, 8 Apr 2022 19:57:47 +0000 (22:57 +0300)]
bgpd: Allow setting BGP [large]community in route-maps

Before:
```
spine1-debian-11(config-route-map)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
% Malformed communities attribute
```

After:
```
spine1-debian-11(config)# bgp community alias 65001:65001 test1
spine1-debian-11(config)# route-map rm permit 10
spine1-debian-11(config-route-map)# set community 65001:65001
spine1-debian-11(config-route-map)#
```

Same for large-communities.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>