Commit Graph

35139 Commits

Author SHA1 Message Date
Donatas Abraitis
4d0a0b3727
Merge pull request #15003 from donaldsharp/vrf_all_data
bgpd: Have `show bgp vrf all ipv4 uni summ` display vrf NAME
2023-12-13 09:27:34 +02:00
Chirag Shah
8a5c6e4389 tools: fix frr-reload multiple no description cmds
Ensure to change description for index 0 from the list.

Ticket: #3628756
Testing Done:

After fix:
start with three interfaces description delete in lines_to_del:
(Pdb) lines_to_del
[(('interface swp1',), "description swp1 -> sp1's swp1"),
(('interface swp2',), "description swp2 -> sp2's swp
1"), (('interface swp3',), "description swp3 -> sp3's swp1")]

After first iteration swp1:
(Pdb) index
0
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
"description swp2 -> sp2's swp1"), (('interface swp
1s2',), "description swp3 -> sp3's swp1")]

After second iteration swp2:
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
'description'), (('interface swp3',), "description
swp3 -> sp3's swp1")]

After third iteration swp3 fix
(Pdb) lines_to_del
[(('interface swp1',), 'description'), (('interface swp2',),
'description'), (('interface swp3',), 'description'
)]

Signed-off-by: Chirag Shah <chirag@nvidia.com>
2023-12-12 17:47:00 -08:00
Donald Sharp
5be4ee9634 bgpd: Have show bgp vrf all ipv4 uni summ display vrf NAME
The vrf name was not being displayed in this output.
New output:

eva# show bgp vrf all ipv4 uni summ
BGP router identifier 0.0.0.0, local AS number 99 VRF RED vrf-id 14
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 1, using 20 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.119.1   4          0         0         0        0    0    0    never       Active        0 N/A

Total number of neighbors 1
BGP router identifier 0.0.0.0, local AS number 99 VRF GREEN vrf-id 15
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 1, using 20 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.119.1   4          0         0         0        0    0    0    never       Active        0 N/A

Total number of neighbors 1
BGP router identifier 192.168.122.1, local AS number 99 VRF default vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 1, using 20 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.119.1   4          0         0         0        0    0    0    never       Active        0 N/A

Total number of neighbors 1
BGP router identifier 0.0.0.0, local AS number 99 VRF GrEEn vrf-id -1
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 1, using 20 KiB of memory

Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
192.168.119.1   4          0         0         0        0    0    0    never         Idle        0 N/A

Total number of neighbors 1
eva#

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-12 18:26:14 -05:00
Donald Sharp
dcaba9ca93 bgpd: When receiving a label, store it
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-12 15:29:49 -05:00
Russ White
c45a9dabe2
Merge pull request #14982 from donaldsharp/bgp_suppress_fib_clear_peers
bgpd: Make `suppress-fib-pending` clear peering
2023-12-12 14:31:37 -05:00
Donald Sharp
bdb5ae8bce bgpd: Make suppress-fib-pending clear peering
When a peer has come up and already started installing
routes into the rib and `suppress-fib-pending` is either
turned on or off.  BGP is left with some routes that
may need to be withdrawn from peers and routes that
it does not know the status of.  Clear the BGP peers
for the interesting parties and let's let us come
up to speed as needed.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-12 13:48:10 -05:00
Donald Sharp
8fcacf6803 zebra: Don't leak memory in rtadv.c code on shutdown
The adata variable was being leaked on shutdown since
it was calloc'ed.  There is no need to make this dynamic
memory.  Just choose a size and use that.  Add a bit
of code to ensure that if it's not large enough,
it will just stop and the developer will fix it.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-12 13:29:47 -05:00
Donald Sharp
9393d36690 zebra: On shutdown, free up srv6 list data
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-12 12:04:14 -05:00
Russ White
315262cab3
Merge pull request #14992 from opensourcerouting/fix/oad_missing_parts
bgpd: Recent OAD fixes
2023-12-12 11:04:34 -05:00
Russ White
d28bfc3791
Merge pull request #14984 from pguibert6WIND/bgp_l3nhg_to_bgp_nhg
bgpd: move l3nhg functions in separate bgp_nhg.[ch] file
2023-12-12 11:03:39 -05:00
Russ White
39ab18f1fd
Merge pull request #14966 from opensourcerouting/fix/bgpd_route-map_default_originate_peer-group
tests: Check if default-originate works combined with peer-groups + route-maps
2023-12-12 10:54:34 -05:00
Donatas Abraitis
f17cd4587d
Merge pull request #14985 from donaldsharp/zebra_delete_memory_problems
Zebra delete memory problems
2023-12-12 16:31:52 +02:00
Donatas Abraitis
54625f5f94
Merge pull request #14986 from LabNConsulting/chopps/fix-asan-odr
lib: fix the ASAN OneDefinitionRule violation.
2023-12-12 15:55:41 +02:00
Donatas Abraitis
7685ffda19 bgpd: Update sub_sort when handling doppelganger connections
This is important especially for OPEN messages. Without this, we can't send
software-version capability which relies on OAD too.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-12 11:55:10 +02:00
Donatas Abraitis
bc53667dc7 bgpd: Use sub_sort also when creating a hash key for update-groups
If OAD is not set or set at least for one peer in peer-group, then split, and
create a separate update-group for those peers.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-12 11:38:23 +02:00
Donatas Abraitis
29d33bd57d bgpd: Add sub_sort for update group debug logging
When added OAD support, it's handy to know peer->sub_sort also when printing
update-group debug messages.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-12 11:34:29 +02:00
Donatas Abraitis
5077b6a025
Merge pull request #14983 from donaldsharp/dplane_fpm_nl_deleted
zebra: The dplane_fpm_nl return path leaks memory
2023-12-12 08:44:37 +02:00
Christian Hopps
29340e6b06 lib: fix the ASAN OneDefinitionRule violation.
Rename global client pointer variables and make the linkage static.

Signed-off-by: Christian Hopps <chopps@labn.net>
2023-12-11 19:53:03 -05:00
Donald Sharp
3d1f0c467b zebra: On shutdown properly free up ns memory
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-11 15:44:26 -05:00
Donald Sharp
f77095430d zebra: Cleanup linked list on shutdown in label manager
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-11 15:26:20 -05:00
Donald Sharp
7cabd9361c zebra: Properly unregister hook on shutdown
the zebra pseudo wire code was registering a callback
per vrf.  These callbacks are not per vrf based.  They
are vrf agnostic so this was a mistake.  Modify the code
to on startup register once and on shutdown unregister once.

Finally rename the zebra_pw_init and zebra_pw_exit functions
to more properly reflect when they are called.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-11 15:22:07 -05:00
Philippe Guibert
9cb66bdceb bgpd: move l3nhg functions in separate bgp_nhg.[ch] file
This rework separates l3nhg functionality from the nexthop
tracking code, by introducing two bgp_nhg.[ch] files. The
calling functions are renamed from bgp_l3nhg* to bgp_nhg*.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-12-11 21:03:33 +01:00
Donald Sharp
c783d5b698
Merge pull request #14981 from opensourcerouting/fix/remove_depracated_code
bgpd: Remove deprecated code for bgpStatusCodes/bgpOriginCodes
2023-12-11 13:53:49 -05:00
Donald Sharp
7f9c5c7fa2 zebra: The dplane_fpm_nl return path leaks memory
The route entry created when using a ctx to pass route
entry data backup to the master pthread in zebra is
being leaked.  Prevent this from happening.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-11 13:44:06 -05:00
Donatas Abraitis
7e219a2188 bgpd: Remove deprecated code for bgpStatusCodes/bgpOriginCodes
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-11 14:53:33 +02:00
Donald Sharp
d41c757763
Merge pull request #14967 from opensourcerouting/fix/bgpd_enforce_first_as_peer-groups
bgpd: Respect enforce-first-as command for peer-groups according to the defaults
2023-12-10 14:32:46 -05:00
Donald Sharp
f6864ec67d
Merge pull request #14962 from Orange-OpenSource/ospf-te
ospfd: Correct SID check size
2023-12-10 14:31:40 -05:00
Donald Sharp
fff267e4ee
Merge pull request #14968 from opensourcerouting/fix/missing_whitespace
zebra: Add missing whitespace when printing route entry status
2023-12-10 14:30:27 -05:00
Donald Sharp
dabef024f1
Merge pull request #14971 from opensourcerouting/o6-hidden-area
ospf6d: remove hidden obsolete command
2023-12-10 14:29:42 -05:00
Donald Sharp
df3e5ca61c
Merge pull request #14976 from vjardin/fixUbuntuModprobe
docker: fix /sbin/modprobe missing
2023-12-10 08:36:33 -05:00
Vincent Jardin
aa2e50621b docker: fix /sbin/modprobe missing
kmod is needed in order to get modprobe

Signed-off-by: Vincent Jardin <vjardin@free.fr>
2023-12-09 23:45:22 +00:00
Donatas Abraitis
00b23f22c5
Merge pull request #14975 from imzyxwvu/tidy-aggregate-duplication
bgpd: Remove duplicated code in `bgp_aggregate_route`
2023-12-09 20:03:00 +02:00
zyxwvu Shi
c2d97a2733 bgpd: Remove duplicated code in bgp_aggregate_route
Signed-off-by: zyxwvu Shi <i@shiyc.cn>
2023-12-09 19:26:45 +08:00
Rafael Zalamena
28f59691fa ospf6d: remove hidden obsolete commands
These commands were hidden in FRR 8.1 for the transition period and
never removed.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-12-08 10:51:39 -03:00
Rafael Zalamena
9f1a7ba972 topotests: remove obsolete OSPFv3 area config
Don't use 'interface WORD area A.B.C.D' for enabling OSPFv3 areas on
interfaces and instead use the standardized 'ipv6 ospf6 area A.B.C.D'.

Signed-off-by: Rafael Zalamena <rzalamena@opensourcerouting.org>
2023-12-08 10:51:32 -03:00
Olivier Dugeon
397dbbcae6 ospfd: Correct SID check size
Segment Router Identifier (SID) could be an index (4 bytes) within a range
(SRGB or SRLB) or an MPLS label (3 bytes). Thus, before calling check_size
macro to verify SID TLVs size, it is mandatory to determine the SID type to
avoid wrong assert.

Signed-off-by: Olivier Dugeon <olivier.dugeon@orange.com>
2023-12-08 13:47:34 +01:00
Donald Sharp
4a2ece949e
Merge pull request #14964 from pguibert6WIND/nhg_del_in_queue
zebra: enqueue NHG_DEL in rib_nhg meta queue
2023-12-08 07:36:44 -05:00
Donatas Abraitis
162433cb2a zebra: Add missing whitespace when printing route entry status
Before:

```
status: Removed ReplacingInstalled
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-08 13:57:56 +02:00
Donatas Abraitis
ec2375e089 bgpd: Respect enforce-first-as command for peer-groups according to the defaults
This was missed for peer-groups. Moved this default handling from peer_create()
to peer_new() which is also used by peer_group_get().

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-08 13:00:08 +02:00
Donatas Abraitis
8009047698 tests: Check if default-originate works combined with peer-groups + route-maps
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-08 12:41:44 +02:00
Donatas Abraitis
087d64a7d9 bgpd: Convert variable withdraw integer to bool
It holds only 0/1.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2023-12-08 11:58:59 +02:00
Donatas Abraitis
c659e1c349
Merge pull request #14963 from donaldsharp/bgp_nht_fix
bgpd: Ensure BGP does not stop monitoring nexthops
2023-12-08 11:40:37 +02:00
Donatas Abraitis
6b79b560ab
Merge pull request #14889 from fdumontet6WIND/snmpv2
bgpd: add multiple paths support for draft ietf bgp4v2 in nlriTable
2023-12-08 06:55:52 +02:00
Donald Sharp
2df4683af0
Merge pull request #14936 from LabNConsulting/chopps/mgmt-dbg-improve
Chopps/mgmt dbg improve
2023-12-07 11:20:54 -05:00
Philippe Guibert
4d60d9e2b4 zebra: enqueue NHG_DEL in rib_nhg meta queue
The NHG_DEL operation is done directly from ZAPI call, whereas
the NHG_ADD operation is done in the rib_nhg meta queue.

This may be problematic when ADD is followed by DEL. Imagine a
scenarion with two protocol NHIDs. <NH1> depends of <NH2> and
<NH3>. The deletion of <NH3> at the protocol level will trigger
2 messages to ZEBRA: NHG_ADD(<NH1>) and NHG_DEL(<NH3>).

Those operations are properly enqueued in ZAPI, but in the end,
the NHG_DEL is executed first. This causes NHG_ADD to unlink an
already freed NHG.

Fix this by consistently enqueuing NHG_DEL and NHG_ADD operations.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2023-12-07 17:20:20 +01:00
Mark Stapp
2648661ed5
Merge pull request #14795 from donaldsharp/zebra_notify_admin_lost
zebra: Fix non-notification of better admin won
2023-12-07 08:30:00 -05:00
Donatas Abraitis
24869b4a99
Merge pull request #14957 from donaldsharp/zebra_noprefixroute
Add ability to handle `noprefixroute` to zebra
2023-12-07 15:24:10 +02:00
Donald Sharp
40dd3946a6 bgpd: Ensure BGP does not stop monitoring nexthops
In some cases BGP can be monitoring the same prefix
in both the nexthop and import check tables.  If this
is the case, when unregistering one bnc from one table
make sure we are not still registered in the other

Example of the problem:

r1(config-router)# address-family ipv4 uni
r1(config-router-af)# no network 192.168.100.41/32
r1(config-router-af)# exit

r1# show bgp import-check-table
Current BGP import check cache:
r1# show bgp nexthop
Current BGP nexthop cache:
 192.168.100.41 valid [IGP metric 0], #paths 1, peer 192.168.100.41
  if r1-eth0
  Last update: Wed Dec  6 11:01:40 2023

BGP now believes it is only watching 192.168.100.41 in the nexthop
cache, but zebra doesn't have anything:

r1# show ip import-check
VRF default:
 Resolve via default: on
r1# show ip nht
VRF default:
 Resolve via default: on

So if anything happens to the route that is being matched for
192.168.100.41 bgp is no longer going to be notified about this.

The source of this problem is that zebra has dropped the two different
tables into 1 table, while bgp has 2 tables to track this.  The solution
to this problem (other than the rewrite that is being done ) is to have
BGP have a bit of smarts about looking in both tables for the bnc and
if found in both don't send the delete of the prefix tracking to zebra.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-06 11:42:01 -05:00
Donald Sharp
0d5c5472c9 tests: Add a noprefixroute test
Add a simple test case to ensure that the noprefixroute
code stays working in the future.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-06 09:27:52 -05:00
Donald Sharp
8a574840a4 zebra: Add connected with noprefixroute
Add ability for the connected routes to know
if they are a prefix route or not.

sharpd@eva:/work/home/sharpd/frr1$ ip addr show dev dummy1
13: dummy1: <BROADCAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN group default qlen 1000
    link/ether aa:93:ce:ce:3f:62 brd ff:ff:ff:ff:ff:ff
    inet 192.168.55.1/24 scope global noprefixroute dummy1
       valid_lft forever preferred_lft forever
    inet 192.168.56.1/24 scope global dummy1
       valid_lft forever preferred_lft forever
    inet6 fe80::a893:ceff:fece:3f62/64 scope link
       valid_lft forever preferred_lft forever

sharpd@eva:/work/home/sharpd/frr1$ sudo vtysh -c "show int dummy1"
Interface dummy1 is up, line protocol is up
  Link ups:       0    last: (never)
  Link downs:     0    last: (never)
  vrf: default
  index 13 metric 0 mtu 1500 speed 0 txqlen 1000
  flags: <UP,BROADCAST,RUNNING,NOARP>
  Type: Ethernet
  HWaddr: aa:93:ce:ce:3f:62
  inet 192.168.55.1/24 noprefixroute
  inet 192.168.56.1/24
  inet6 fe80::a893:ceff:fece:3f62/64
  Interface Type Other
  Interface Slave Type None
  protodown: off

sharpd@eva:/work/home/sharpd/frr1$ sudo vtysh -c "show ip route"
Codes: K - kernel route, C - connected, L - local, S - static,
       R - RIP, O - OSPF, I - IS-IS, B - BGP, E - EIGRP, N - NHRP,
       T - Table, v - VNC, V - VNC-Direct, A - Babel, D - SHARP,
       F - PBR, f - OpenFabric, t - Table-Direct,
       > - 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.119.1, enp13s0, 00:00:08
K>* 169.254.0.0/16 [0/1000] is directly connected, virbr2 linkdown, 00:00:08
L>* 192.168.44.1/32 is directly connected, dummy2, 00:00:08
L>* 192.168.55.1/32 is directly connected, dummy1, 00:00:08
C>* 192.168.56.0/24 is directly connected, dummy1, 00:00:08
L>* 192.168.56.1/32 is directly connected, dummy1, 00:00:08
L>* 192.168.119.205/32 is directly connected, enp13s0, 00:00:08

sharpd@eva:/work/home/sharpd/frr1$ ip route show
default via 192.168.119.1 dev enp13s0 proto dhcp metric 100
169.254.0.0/16 dev virbr2 scope link metric 1000 linkdown
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
192.168.45.0/24 dev virbr2 proto kernel scope link src 192.168.45.1 linkdown
192.168.56.0/24 dev dummy1 proto kernel scope link src 192.168.56.1
192.168.119.0/24 dev enp13s0 proto kernel scope link src 192.168.119.205 metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

sharpd@eva:/work/home/sharpd/frr1$ ip route show table 255
local 127.0.0.0/8 dev lo proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo proto kernel scope link src 127.0.0.1
local 172.17.0.1 dev docker0 proto kernel scope host src 172.17.0.1
broadcast 172.17.255.255 dev docker0 proto kernel scope link src 172.17.0.1 linkdown
local 192.168.44.1 dev dummy2 proto kernel scope host src 192.168.44.1
broadcast 192.168.44.255 dev dummy2 proto kernel scope link src 192.168.44.1
local 192.168.45.1 dev virbr2 proto kernel scope host src 192.168.45.1
broadcast 192.168.45.255 dev virbr2 proto kernel scope link src 192.168.45.1 linkdown
local 192.168.55.1 dev dummy1 proto kernel scope host src 192.168.55.1
broadcast 192.168.55.255 dev dummy1 proto kernel scope link src 192.168.55.1
local 192.168.56.1 dev dummy1 proto kernel scope host src 192.168.56.1
broadcast 192.168.56.255 dev dummy1 proto kernel scope link src 192.168.56.1
local 192.168.119.205 dev enp13s0 proto kernel scope host src 192.168.119.205
broadcast 192.168.119.255 dev enp13s0 proto kernel scope link src 192.168.119.205
local 192.168.122.1 dev virbr0 proto kernel scope host src 192.168.122.1
broadcast 192.168.122.255 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown

Fixes: #14952
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2023-12-06 09:27:52 -05:00