Commit Graph

37380 Commits

Author SHA1 Message Date
David Lamparter
cf4fc9c484 tools: remove strncpy() use
`checkpatch` has sufficiently annoyed me to fix this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 14:53:52 +02:00
David Lamparter
4606612abe lib: remove strncpy() use
`checkpatch` has sufficiently annoyed me to fix this.

Includes free overflow guard in CSV code.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 14:51:25 +02:00
David Lamparter
84fd92c80e tests: remove strncpy() use
`checkpatch` has sufficiently annoyed me to fix this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 14:51:25 +02:00
Donatas Abraitis
60eff2e5e3 bgpd: Handle non-transitive opaque extended communities also for eBGP peers
Fixes: 765a0855f1ffec68ed42f2fac8afcaaeed99fd1a ("bgpd: Rework extended community transitiviness")

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:02:50 +03:00
Donatas Abraitis
51b2dcd007 bgpd: Check transivity flag for node target extended community with CHECK_FLAG()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:02:50 +03:00
Donatas Abraitis
b4e72bc198 bgpd: Rework extended community transitiviness
Extended communities can be transitive or non-transitive.

Like other attributes (e.g., MED) non-transitive extended communities SHOULD
be sent to the direct peer, but not forward them to eBGP peers next.

Before this patch, we never send non-transitive extended attributes to the
direct peers at all.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:02:49 +03:00
Donatas Abraitis
5ca4656ad7 bgpd: Add a function to strip non-transitive extended communities
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:01:04 +03:00
Donatas Abraitis
8a4d336d38 bgpd: Print ipv6 extended communities if debug updates is turned on
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:01:04 +03:00
Donatas Abraitis
601db6d4a6 bgpd: Check for the extended community size before setting the flag
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:01:04 +03:00
Donatas Abraitis
524627216a tests: Check if non-transitive link-bandwidth communities are sent/received correctly
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:01:04 +03:00
Donatas Abraitis
d33585cb4d bgpd: Handle non-transitive extended communities for link-bandwidth
If we received a non-transitive extended community (in this case it was
extended link-bandwidth), we treated it as unknown because we didn't check for
the transitive flag correctly.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-22 09:01:04 +03:00
Donatas Abraitis
fd6f46e9fd
Merge pull request #17168 from enkechen-panw/aigp-fix3
bgpd: fix AIGP calculation in route advertisement
2024-10-22 08:39:35 +03:00
Shbinging
baf604770e ospfd:fix the bug that the empty area was not free after no area range command was executed
When we use the no area X.X.X.X range A.B.C.D/M command, if the area no longer has an interface to which it belongs, then the area should be deleted from the LSDB. This processing logic is consistent with instructions such as no network area and no area authentication.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-22 05:34:36 +00:00
baozhen-H3C
e2e4894940 isisd: fix 'show isis route' and 'show isis fast-reroute summary' errors with vrf
When the VRF does not exist, the command will display results for the 'default' VRF.
1.before the commit:
sonic# show vrf
vrf Vrf1 id 41 table 1001
sonic# show isis vrf abc route level-1
Area 10:
IS-IS L1 IPv4 routing table:

Prefix          Metric  Interface  Nexthop   Label(s)
-------------------------------------------------------
0.0.0.0/0       5       Ethernet0  10.1.1.2  -
6.6.6.6/32      10      -          -         -

sonic# show isis vrf abc fast-reroute summary level-1
Area 10:
IS-IS L1 IPv4 Fast ReRoute summary:

Protection \ Priority     Critical  High      Medium    Low       Total
--------------------------------------------------------------------------
Classic LFA               0         0         2         3         5
Remote LFA                0         0         0         0         0
Topology Independent LFA  0         0         0         0         0
ECMP                      0         0         0         0         0
Unprotected               0         0         2         2         4
Protection coverage       0.00%     0.00%     50.00%    60.00%    55.56%

2.after the commit:
sonic# show vrf
vrf Vrf1 id 41 table 1001
sonic# show isis vrf abc route level-1
sonic# show isis vrf abc fast-reroute summary level-1

What I do:
    Move 'ISIS_FIND_VRF_ARGS(argv, argc, idx, vrf_name, all_vrf);' to the front, otherwise changing 'idx' while searching for other parameters may result in failing to find the vrf parameter.

Signed-off-by: baozhen-H3C <bao.zhen@h3c.com>
2024-10-22 09:35:50 +08:00
anlan_cs
96192f6aee zebra: drop NEWLINK event handling in the main thread
NEWLINK is only registered by the dplane thread, the main thread
doesn't care about it. So remove the real process of `netlink_link_change()`
for NEWLINK event in main thread.

And move NEWLINK/DELLINK event to the block where the dplane messages
are kept together.

Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-10-22 09:05:00 +08:00
Enke Chen
fc82d7750f bgpd: fix AIGP calculation in route advertisement
Currently the AIGP is always incremented when a route with the
attribute is advertised. That is incorrect when the nexthop is
unchanged, as is commonly the case in route reflection.

Adjust the AIGP for propagation only when the nexthop is set
to ourselves.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-21 18:03:08 -07:00
Enke Chen
7e7f65cc00 tests: add a topotest bgp_aigp_rr
In this topotest, the route reflector advertises a route with the
aigp attribute to its client, some with the nexthop unchanged and
some with the nexthp changed. Different aigp values are sent to
the clients depending on the nexthop setting.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-21 17:49:19 -07:00
Jafar Al-Gharaibeh
cf1da3e679
Merge pull request #17172 from opensourcerouting/fix/doc_unified_config
doc: Require unified config for all new topotests
2024-10-21 13:40:48 -05:00
Donatas Abraitis
d155d62785 doc: Require unified config for all new topotests
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-21 09:10:13 +03:00
Donatas Abraitis
2f84a26634
Merge pull request #17169 from enkechen-panw/aigp-fix4
bgpd: allow value 0 in aigp-metric setting
2024-10-21 08:18:17 +03:00
Enke Chen
e07f38a43f bgpd: allow value 0 in aigp-metric setting
The value of 0 is accepted from peers, and can also be set by the
route-map "set aigp-metric igp-metric". For coonsistency, it should
be allowed in "set aigp-metric <value>" as well.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-20 12:26:56 -07:00
Donatas Abraitis
5d5da525b9
Merge pull request #17157 from LabNConsulting/liambrady/topotest-masked-logging
tests: logger masked in topotest.py
2024-10-20 20:35:04 +03:00
Donatas Abraitis
fa291ddca4
Merge pull request #17167 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
2024-10-20 13:39:17 +03:00
sri-mohan1
67d072055f bgpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-10-19 15:04:36 +05:30
anlan_cs
5829fea1b5 zebra: remove useless code
Signed-off-by: anlan_cs <anlan_cs@126.com>
2024-10-19 13:32:53 +08:00
Mark Stapp
0952110a29
Merge pull request #17164 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
2024-10-18 16:17:16 -04:00
Donatas Abraitis
7eaec540ec tests: Check if BGP no-export community is passed to BGP OAD peers
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-18 22:51:37 +03:00
Donatas Abraitis
e63b1520f1 bgpd: Do not filter no-export community for BGP OAD (one administration domain)
OAD is treated as an _internal_ BGP peer, and some of the rules (including BGP
attributes) can be relaxed.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-18 22:35:28 +03:00
David Lamparter
841f7a4687
Merge pull request #17025 from donaldsharp/ppoll_fix 2024-10-18 19:28:09 +02:00
sri-mohan1
97f3dd3c26 bgpd: changes for code maintainability
these changes are for improving the code maintainability and readability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2024-10-18 22:21:01 +05:30
Louis Scalbert
6cdc82b21b zebra: fix showing nexthop vrf for ipv6 blackhole
For some reasons the Linux kernel associates the ipv6 blackhole of non
default table the lo interface.

> root@r1# ip -6 route show table 100
> root@r1# ip -6 route add unreachable default metric 4278198272 table 100
> root@r1# ip -6 route show table 100
> unreachable default dev lo metric 4278198272 pref medium

As a consequence, the VRF default that owns the lo interface is shown as
the nexthop VRF:

> r1# show ipv6 route table 20
> Table 20:
> K>* ::/0 [255/8192] unreachable (ICMP unreachable) (vrf default), 00:18:12

Do not display the nexthop VRF of a blackhole. It does not make sense
for a blackhole and it was not displayed in the past.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-18 14:45:50 +02:00
Donatas Abraitis
1fe1f8d87c lib, zebra: Keep zebra on-rib-process script in frr.conf
After the change:

```
$ grep on-rib-process /etc/frr/frr.conf
zebra on-rib-process script script4

$ systemctl restart frr

$ vtysh -c 'show run' | grep on-rib-process
zebra on-rib-process script script4
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-10-18 15:36:52 +03:00
Donatas Abraitis
3f690542f5
Merge pull request #17134 from Shbinging/fix_no_area_nssa_command
ospfd: update ospf_asbr_status when using no_area_nssa command
2024-10-18 14:55:46 +03:00
Jafar Al-Gharaibeh
ba60b39f13
Merge pull request #17154 from donaldsharp/connected_coverity
zebra: Fix possible null deref discovered by coverity
2024-10-17 15:32:46 -05:00
Liam Brady
1b38f33041 tests: logger masked in topotest.py
a local logger masks the global logger and prevents errors from being
gracefully handled within topotest.py

Signed-off-by: Liam Brady <lbrady@labn.net>
2024-10-17 13:36:39 -04:00
Donald Sharp
d11ad98ffb lib: Correctly handle ppoll pfds.events == 0
The frrevent system is spitting out this message in bgpd:
20:40:15 mem1-roc-f2-b1-r5-t2-d4 bgpd[13166]: [XETTR-D5MR0][EC 100663316] Attempting to process an I/O event but for fd: 214(8) no thread to handle this!

This is because as each io event is processed, it is possible that a
.events is set to 0.  This can leave a situation where we ask
ppoll to handle anything that happens on a fd with a .events of 0,
in this situation ppoll can return POLLERR, which indicates that
something bad has happened on the fd.

Let's set the ppoll fds.fd value to -1 when there are no more
events to be processed.  ppoll specifically calls out that
it will just skip this particular one.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-17 11:07:55 -04:00
David Lamparter
b3e4007197 lib: refactor memstats logging, fix ACTIVEATEXIT
Move the various destinations handling into lib/memory.c, include
"normal" logging as target, and make `ACTIVEATEXIT` properly non-error
as it was intended to be.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-17 13:58:57 +02:00
David Lamparter
f177663631 lib: do not log_memstats() in crash handler
`log_memstats()` is not AS-safe.  It can hang the crash handler (or set
your PC on fire, or cause the sun to go supernova - according to POSIX
specs, anyway.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-17 13:58:57 +02:00
David Lamparter
e95fbc1d8c lib: zlog stays running on shutdown
No `zlog_fini()`, please.  Getting log messages until the end is more
important than leaking memory allocated for zlog targets.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-17 13:58:57 +02:00
David Lamparter
b7420c46de lib: actually propagate MGROUP args
Well, this was only checked for exit status, which we didn't really
observe... so, uh, yeah, not particularly noticeable it wasn't even
wired up...

clang-format off/on added to not get formatting wrecked on this.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-17 13:58:39 +02:00
Donald Sharp
5a2a9e3b89 zebra: Fix possible null deref discovered by coverity
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-17 07:42:47 -04:00
Donald Sharp
466efab870
Merge pull request #17136 from opensourcerouting/clang-sa-19
*: fix clang-19 SA
2024-10-17 07:38:28 -04:00
Louis Scalbert
e2db455c01 nhrpd: normalize sh ip nhrp opennhrp output
The command outputs too much "\n". Normalize it.

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-17 11:24:50 +02:00
Louis Scalbert
65d62d982e nhrpd: fix sh ip nhrp opennhrp json counter
"show ip nhrp opennhrp json" counter is incorrect.

> root@nhs1:/# vtysh -c 'sh ip nhrp opennhrp json' | jq .
> {
>   "attr": {
>     "status": "ok",
>     "entriesCount": 1 <=== NOK
>   },
>   "table": [
>     {
>       "type": "dynamic",
>       "up": true,
>       "used": false,
>       "protocolAddress": "172.16.1.4",
>       "protocolAddressSize": 32,
>       "nbmaAddress": "192.168.2.4"
>     },
>     {
>       "type": "dynamic",
>       "up": true,
>       "used": false,
>       "protocolAddress": "172.16.1.5",
>       "protocolAddressSize": 32,
>       "nbmaAddress": "192.168.2.5"
>     }
>   ]
> }
>

Fixes: 87b9e98203 ("nhrpd: add json support to show nhrp vty commands")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-17 11:24:50 +02:00
Shbinging
71aa5ab7f6 ospfd: update ospf_asbr_status when using no_area_nssa command
In the processing of nssa, if the number of areas that need to be translated is greater than 0, then abr will be regarded as asbr, and it will be marked (0x3) in the flag of router lsa. When a certain area is set from nssa to a normal area, the areas that need to be translated may be reduced. The asbr should be re-interpreted as abr when the translated area is 0.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-17 06:37:21 +00:00
Donatas Abraitis
5fecb1f425
Merge pull request #17065 from Shbinging/fix_some_ospf_commands
ospfd: fix some ospf commands
2024-10-17 09:01:30 +03:00
Donatas Abraitis
8d894e5df0
Merge pull request #17091 from enkechen-panw/aigp-fix1
bgpd: fix several issues in sourcing AIGP attribute
2024-10-17 08:55:03 +03:00
Enke Chen
51612593f7 tests: add a new topotest to bgp_aigp
Add a new topotest for getting the aigp from the "igp-metric"
for a redistributed route (ospf route in the test).

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-16 11:19:28 -07:00
Enke Chen
f65356d8bb bgpd: fix several issues in sourcing AIGP attribute
Fix several issues in sourcing AIGP attribute:

1) AIGP should not be set as default for a redistributed route or a
   static network. It should be set by config instead.

2) AIGP sourced by "set aigp-metric igp-metric" in a route-map does
   not set the correct value for a redistributed route.

3) When redistribute a connected route like loopback, the AGIP (with
   value 0) is sourced by "set aigp-metric igp-metric", but the
   attribute is not propagated as the attribute flag is not set.

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-10-16 11:15:28 -07:00
Russ White
75e34c032b
Merge pull request #16452 from louis-6wind/fix-ipv4-mapped-ipv6-display
lib, test: fix display ipv4 mapped ipv6 addresses
2024-10-16 13:01:52 -04:00