Commit Graph

27060 Commits

Author SHA1 Message Date
Donatas Abraitis
5cb526136a bgpd: Add bgp_check_selected() helper for abstraction
Just check if the path is selected to be advertised: best path or addpath
capable.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-23 21:38:23 +02:00
Donatas Abraitis
a08e5c529c bgpd: Convert bgp_addpath_encode_[tr]x() to bool from int
Rename addpath_encode[d] to addpath_capable to be consistent.

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
2022-02-23 21:38:12 +02:00
Donatas Abraitis
fa2713e7b5
Merge pull request #10631 from FRRouting/mergify/bp/dev/8.2/pr-10615
pimd: Do not allow 224.0.0.0/24 range in igmp join (backport #10615)
2022-02-23 10:34:37 +02:00
Mobashshera Rasool
bddd51838c pimd: Do not allow 224.0.0.0/24 range in igmp join
224.0.0.0/24 cannot be used by igmp since this is reserved
for routing protocols and other low-level topology discovery or
maintenance protocols.

Fixes: #10614

Signed-off-by: Mobashshera Rasool <mrasool@vmware.com>
(cherry picked from commit fcfd479d99)
2022-02-22 17:46:47 +00:00
Jafar Al-Gharaibeh
19ddc13183
Merge pull request #10613 from FRRouting/mergify/bp/dev/8.2/pr-10604
staticd: reject route config with too many nexthops (backport #10604)
2022-02-17 23:31:34 -06:00
Mark Stapp
44309e7a00 staticd: reject route config with too many nexthops
Restrict the number of nexthops for a route to the compiled-in
limit. Be careful with the zapi route struct's array of nexthops
too.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit 1f7ab1a2cc)
2022-02-18 00:52:51 +00:00
Mark Stapp
df8cb5aaf7 staticd: capture zebra's advertised ECMP limit
Capture the ECMP limit advertised by zebra (via zapi).

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit abc246e193)
2022-02-18 00:52:51 +00:00
Mark Stapp
0a8d3ad5f8 staticd: fix spelling in an error message
whitespace change to fix a typo.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
(cherry picked from commit 423e32cb01)
2022-02-18 00:52:51 +00:00
Jafar Al-Gharaibeh
a8adcc6d9b
Merge pull request #10611 from FRRouting/mergify/bp/dev/8.2/pr-10591
ripd: Fix packet send for non primary addresses (backport #10591)
2022-02-17 18:28:41 -06:00
Jafar Al-Gharaibeh
3b058fd2d3
Merge pull request #10610 from FRRouting/mergify/bp/dev/8.2/pr-10562
lib: Save number of times a thread is starved (backport #10562)
2022-02-17 18:28:24 -06:00
Donald Sharp
7a765edf8a ripd: Fix packet send for non primary addresses
When rip is configured to work on secondary addresses
on an interface, rip was not properly sending out
the packets on secondary addresses because the source of the
packet was never properly being setup and rip would
send the packet out multiple times for the primary address
not once for each address on the interface that is setup to work.

tcpdump + rip debugs output with fix:

2022/02/15 19:59:50 RIP: [ZG173-BHW0K] turn on virbr0
2022/02/15 19:59:51 RIP: [PYB7S-80D89] multicast join at virbr0
2022/02/15 19:59:51 RIP: [GZR24-FCQGG] multicast request on virbr0
2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 192.168.122.1 > 224.0.0.9 (virbr0)
2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to  224.0.0.9520
2022/02/15 19:59:51 RIP: [JTNCV-XD8S1] rip_send_packet 73.3.3.8 > 224.0.0.9 (virbr0)
2022/02/15 19:59:51 RIP: [VEJY5-67P5X] SEND to  224.0.0.9520
19:59:51.831128 IP 192.168.122.1.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24
19:59:51.831161 IP c-73-3-3-8.hsd1.mo.comcast.net.route > rip2-routers.mcast.net.route: RIPv2, Request, length: 24

Fixes: #10588
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 114918bd0b)
2022-02-17 19:59:59 +00:00
Donatas Abraitis
fdedfeb760
Merge pull request #10607 from FRRouting/mergify/bp/dev/8.2/pr-10575
bgp: Add a 6 hour warning to missing policy (backport #10575)
2022-02-17 21:56:34 +02:00
Donatas Abraitis
8db26e5853
Merge pull request #10609 from FRRouting/mergify/bp/dev/8.2/pr-10590
Bgp error codes (backport #10590)
2022-02-17 21:56:06 +02:00
Donald Sharp
11e383e75e
Merge pull request #10608 from FRRouting/mergify/bp/dev/8.2/pr-10557
Zebra FPM: don't lose next hop weights while exporting via FPM (backport #10557)
2022-02-17 13:59:06 -05:00
Donald Sharp
d72fdb828e lib: Save number of times a thread is starved
Add a counter to the number of times a thread is starved from
a timer event and add the output to `show thread cpu`

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 1dd08c2243)
2022-02-17 16:09:20 +00:00
Donald Sharp
bd971829f3 bgpd: Renumber bgp_create_error_code enum values
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit e4aa4745f2)
2022-02-17 16:08:55 +00:00
Donald Sharp
152487b3e5 bgpd: Convert bgp error codes for cli input to an enum
Conversion of bgp error codes returned for cli input into
an enum and then properly handling all the error cases
in bgp_vty_return.

Because not all error codes returned were properly handled
in this function there existed configuration examples that
were accepted on the cli without an error message but not
saved.

Fixes: #10589
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 4b7e23e9f2)
2022-02-17 16:08:55 +00:00
Donald Sharp
beaab6f79f bgpd: Remove unused BGP_ERR_MAX #define
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit b5d6f2d068)
2022-02-17 16:08:54 +00:00
Donald Sharp
b462a0a7f6 bgpd: Move some error codes to bgp_vty_return handling
BGP_ERR_PEER_GROUP_MEMBER and BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT
both are not handled by bgp_vty_return, but both can be handled by
this function as that there is nothing special going on here.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 6dcea6fe05)
2022-02-17 16:08:54 +00:00
Donald Sharp
d37c84f28b bgpd: Remove impossible invalid state
confederations are checking to see that the bgp pointer
is non-null.  But it's impossible to have a null pointer
in the cli and in all paths we have already deref'ed the bgp
pointer.  Let's remove that error code as that it is impossible
to happen.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 8b4a0b6631)
2022-02-17 16:08:53 +00:00
kiselev99@gmail.com
d3985d3604 zebra: FPM next hop weights
Don't lose next hop weights while exporting via FPM

Signed-off-by: Alex Kiselev <alex@bisonrouter.com>
(cherry picked from commit eca3256db8)
2022-02-17 16:06:24 +00:00
Donald Sharp
aeb1da0ca2 bgp: Add a 15 minute warning to missing policy
Add a 15 minute warning to the logging system when
bgp policy is not setup properly.  Operators keep asking
about the missing policy( on upgrade typically ).  Let's
try to give them a bit more of a hint when something is
going wrong as that they are clearly missing the other
various places FRR tells them about it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit b17826b715)
2022-02-17 16:01:25 +00:00
Mark Stapp
c432b3c775
Merge pull request #10597 from FRRouting/mergify/bp/dev/8.2/pr-10586
bgpd: uninitialized compiler warning (backport #10586)
2022-02-16 12:57:20 -05:00
Punith Kumar
281c28cd40 bgpd: Fix uninitialized compiler warning
Signed-off-by: Punith Kumar <punithkumar.spk@gmail.com>
(cherry picked from commit 73e770b7ad)
2022-02-16 15:59:36 +00:00
Donatas Abraitis
3b71608cb9
Merge pull request #10564 from FRRouting/mergify/bp/dev/8.2/pr-10552
tools: fix frr-reload context keywords (backport #10552)
2022-02-11 09:48:31 +02:00
Igor Ryzhov
32389bfbbe tools: fix frr-reload context keywords
There are singline-line commands inside `router bgp` that start with
`vnc ` or `bmp `. Those commands are currently treated as node-entering
commands. We need to specify such commands more precisely.

Fixes #10548.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 57692f125e)
2022-02-10 21:55:49 +00:00
Donatas Abraitis
6cb7c5d9b1
Merge pull request #10553 from FRRouting/mergify/bp/dev/8.2/pr-10551
bgpd: fix a couple of memleaks (backport #10551)
2022-02-10 14:47:13 +02:00
Igor Ryzhov
955cc29fb6 bgpd: fix aspath memleak on error in vnc_direct_bgp_add_nve
bgp_attr_default_set creates a new empty aspath. If family error happens,
this aspath is not freed. Move attr initialization after we checked the
family.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 606c3f9fb2)
2022-02-10 06:53:50 +00:00
Igor Ryzhov
2dc64494da bgpd: fix aspath memory leak in aggr_suppress_map_test
aspth_empty a couple of lines earlier creates an aspath and it must be
freed.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit afb254d792)
2022-02-10 06:53:50 +00:00
Igor Ryzhov
ae70f8c3db bgpd: fix missing bgp_attr_flush on errors in bgp_update
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 4dbf2038ea)
2022-02-10 06:53:50 +00:00
Donald Sharp
d992107a44
Merge pull request #10543 from FRRouting/mergify/bp/dev/8.2/pr-10511
ospfd: fix loss of mixed form in "range" command (backport #10511)
2022-02-09 10:19:25 -05:00
Donatas Abraitis
41a197b44b
Merge pull request #10534 from FRRouting/mergify/bp/dev/8.2/pr-10531
bgpd: avoid memcmp comparison of struct nexthop (backport #10531)
2022-02-09 17:01:03 +02:00
Donatas Abraitis
7e38a5f2f4
Merge pull request #10541 from FRRouting/mergify/bp/dev/8.2/pr-10161
zebra: Fix improper usage of hash_iterate that caused crashes (backport #10161)
2022-02-09 15:15:31 +02:00
Donald Sharp
6110c8158e
Merge pull request #10542 from FRRouting/mergify/bp/dev/8.2/pr-10517
isisd: fix router capability TLV parsing issues (backport #10517)
2022-02-09 08:13:25 -05:00
Donald Sharp
cd56a45488
Merge pull request #10544 from FRRouting/mergify/bp/dev/8.2/pr-10530
*: use ipaddr_cmp instead of memcmp (backport #10530)
2022-02-09 08:12:49 -05:00
Igor Ryzhov
52c82cb7af *: use ipaddr_cmp instead of memcmp
Using memcmp is wrong because struct ipaddr may contain unitialized
padding bytes that should not be compared.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 60cda04dda)
2022-02-09 10:50:58 +00:00
anlan_cs
3e13cb8310 ospfd: fix loss of mixed form in "range" command
Currently "range" command can only accept `cost` or `substitute`
individually, and `show running` will mix them.

So need make it accept mixed form with both of them, otherwise
configuration file in mixed form will fail to start.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
(cherry picked from commit ec88a72a37)
2022-02-09 10:49:50 +00:00
Juraj Vijtiuk
89a1238132 isisd: fix router capability TLV parsing issues
isis_tlvs.c would fail at multiple places if incorrect TLVs were
received causing stream assertion violations.
This patch fixes the issues by adding missing length checks, missing
consumed length updates and handling malformed Segment Routing subTLVs.

Signed-off-by: Juraj Vijtiuk <juraj.vijtiuk@sartura.hr>

Small adjustments by Igor Ryzhov:
- fix incorrect replacement of srgb by srlb on lines 3052 and 3054
- add length check for ISIS_SUBTLV_ALGORITHM
- fix conflict in fuzzing data during rebase

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit 9ba865f54d)
2022-02-09 10:49:32 +00:00
Donald Sharp
21ab672e6c lib: Update hash.h documentation to warn of a possible crash
Multiple deletions from the hash_walk or hash_iteration calls
during a single invocation of the passed in function can and
will cause the program to crash.  Warn against doing such a
thing.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 341743ac5b)
2022-02-09 10:46:33 +00:00
Donald Sharp
c32c32c931 zebra: Ensure zebra_nhg_sweep_table accounts for double deletes
I'm seeing this crash in various forms:
Program terminated with signal SIGSEGV, Segmentation fault.
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
[Current thread is 1 (Thread 0x7f418efbc7c0 (LWP 3580253))]
(gdb) bt
(gdb) f 4
267 (*func)(hb, arg);
(gdb) p hb
$1 = (struct hash_bucket *) 0x558cdaafb250
(gdb) p *hb
$2 = {len = 0, next = 0x0, key = 0, data = 0x0}
(gdb)

I've also seen a crash where data is 0x03.

My suspicion is that hash_iterate is calling zebra_nhg_sweep_entry which
does delete the particular entry we are looking at as well as possibly other
entries when the ref count for those entries gets set to 0 as well.

Then we have this loop in hash_iterate.c:

   for (i = 0; i < hash->size; i++)
            for (hb = hash->index[i]; hb; hb = hbnext) {
                    /* get pointer to next hash bucket here, in case (*func)
                     * decides to delete hb by calling hash_release
                     */
                    hbnext = hb->next;
                    (*func)(hb, arg);
            }
Suppose in the previous loop hbnext is set to hb->next and we call
zebra_nhg_sweep_entry. This deletes the previous entry and also
happens to cause the hbnext entry to be deleted as well, because of nhg
refcounts. At this point in time the memory pointed to by hbnext is
not owned by the pthread anymore and we can end up on a state where
it's overwritten by another pthread in zebra with data for other incoming events.

What to do?  Let's change the sweep function to a hash_walk and have
it stop iterating and to start over if there is a possible double
delete operation.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 07b9ebca65)
2022-02-09 10:46:33 +00:00
Jafar Al-Gharaibeh
e3e7df1d35
Merge pull request #10538 from FRRouting/mergify/bp/dev/8.2/pr-10445
tools: Stop disabled daemons when doing reload (backport #10445)
2022-02-08 21:22:36 -06:00
Donatas Abraitis
378fb0fae4 tools: Stop disabled daemons when doing reload
After:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
0
```

Before:
```
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=no
root@exit1-debian-11:~# pgrep -f ripngd -c
0
root@exit1-debian-11:~# sed -i 's/ripngd=no/ripngd=yes/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
root@exit1-debian-11:~# pgrep -f ripngd -c
2
root@exit1-debian-11:~# grep ripngd= /etc/frr/daemons
ripngd=yes
root@exit1-debian-11:~# sed -i 's/ripngd=yes/ripngd=no/' /etc/frr/daemons
root@exit1-debian-11:~# /usr/lib/frr/frrinit.sh reload
Stopped watchfrr.
Started watchfrr.
Stopped ripngd.
root@exit1-debian-11:~# pgrep -f ripngd -c
1 <<<<<< ripngd is running, while watchfrr skips it
```

Signed-off-by: Donatas Abraitis <donatas.abraitis@gmail.com>
(cherry picked from commit dc3bae68a2)
2022-02-08 21:13:23 +00:00
Igor Ryzhov
d614044189 bgpd: avoid memcmp comparison of struct nexthop
Using memcmp is wrong because struct nexthop may contain unitialized
padding bytes that should not be compared.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
(cherry picked from commit e4190ca4ab)
2022-02-08 19:41:05 +00:00
Donald Sharp
c3a60e8854
Merge pull request #10528 from FRRouting/mergify/bp/dev/8.2/pr-10504
babeld: fix the checks for truncated packets (backport #10504)
2022-02-08 13:26:31 -05:00
qingkaishi
8d451431b0 babeld: fix #10502 #10503 by repairing the checks on length
This patch repairs the checking conditions on length in four functions:
babel_packet_examin, parse_hello_subtlv, parse_ihu_subtlv, and parse_update_subtlv

Signed-off-by: qingkaishi <qingkaishi@gmail.com>
(cherry picked from commit c3793352a8)
2022-02-08 15:11:45 +00:00
Donatas Abraitis
ba7be1e119
Merge pull request #10526 from FRRouting/mergify/bp/dev/8.2/pr-10524
pimd: Modify `show ip pim assert` to only show interesting bits (backport #10524)
2022-02-08 08:57:08 +02:00
Jafar Al-Gharaibeh
af052252b0
Merge pull request #10521 from FRRouting/mergify/bp/dev/8.2/pr-9926
zebra: Fix v6 route replace failure turned into success (backport #9926)
2022-02-08 00:10:06 -06:00
Jafar Al-Gharaibeh
0f8011e47c
Merge pull request #10522 from FRRouting/mergify/bp/dev/8.2/pr-10441
pimd: Only remove bsr NHT if we actually have tracked something (backport #10441)
2022-02-07 22:48:04 -06:00
Donald Sharp
7b1d921456 pimd: Modify show ip pim assert to only show interesting bits
`show ip pim assert` shows S,G ifchannel information even when
there is no information available about the assert process.

Fix the code to not dump non-interesting cases.

Fixes: 10462
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 35e5ef55f1)
2022-02-08 04:46:07 +00:00
Donald Sharp
03a097c32d pim: Use INADDR_ANY for current_bsr checking is valid yet
In all places that pim_nht_bsr_del is called, the code
needs to not unregister if the current_bsr is INADDR_ANY.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
(cherry picked from commit 5f010b1205)
2022-02-07 20:50:24 +00:00