Commit Graph

37380 Commits

Author SHA1 Message Date
Donald Sharp
1bbbcf043b zebra: Properly note that a nhg's nexthop has gone down
Current code when a link is set down is to just mark the
nexthop group as not properly setup.  Leaving situations
where when an interface goes down and show output is
entered we see incorrect state.  This is true for anything
that would be checking those flags at that point in time.

Modify the interface down nexthop group code to notice the
nexthops appropriately ( and I mean set the appropriate flags )
and to allow a `show ip route` command to actually display
what is going on with the nexthops.

eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
  Known via "sharp", distance 150, metric 0, best
  Last update 00:00:06 ago
  * 192.168.44.33, via dummy1, weight 1
  * 192.168.45.33, via dummy2, weight 1

sharpd@eva:~/frr1$ sudo ip link set dummy2 down

eva# show ip route 1.0.0.0
Routing entry for 1.0.0.0/32
  Known via "sharp", distance 150, metric 0, best
  Last update 00:00:12 ago
  * 192.168.44.33, via dummy1, weight 1
    192.168.45.33, via dummy2 inactive, weight 1

Notice now that the 1.0.0.0/32 route now correctly
displays the route for the nexthop group entry.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-16 09:34:05 -04:00
Donald Sharp
5a589217f8 tests: When finding nexthops ensure that they are active
Do not accept a nexthop as valid unless it is marked as being
active.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-09-16 09:34:05 -04:00
Donald Sharp
aab2946088
Merge pull request #16828 from enkechen-panw/print-rnh
zebra: include the prefix in nht show command
2024-09-16 09:30:53 -04:00
Louis Scalbert
cfd050a0e5 tests: update isisd fuzz test
Since the previous commit, if a router capability subTLV is not
readable, the previously read subTLVs are kept.

Update of the ISIS fuzz test.

> $ wuschl rebuild tests/isisd/test_fuzz_isis_tlv
> $ gzip -9 tests/isisd/test_fuzz_isis_tlv_tests.h

> $ ./test_fuzz_isis_tlv 2>/dev/null | grep failed
> Test 139 failed, output differs.
> Test 150 failed, output differs.
> 2 of 405 tests failed.
>
> $ ./test_fuzz_isis_tlv 139 2>/dev/null
> Test 139 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Received output:
> Unpack log:
> Unpacking 564 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 193 and len 13.
>     Skipping unknown TLV 193 (13 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 0 and len 0.
>     Skipping unknown TLV 0 (0 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Router Capability: 253.212.128.242 , D:1, S:1
>
> $ ./test_fuzz_isis_tlv 150 2>/dev/null
> Test 150 failed, output differs.
> Expected output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Received output:
> Unpack log:
> Unpacking 403 bytes of TLVs...
>   Unpacking TLV...
>     Found TLV of type 129 and len 13.
>     Unpacking Protocols Supported TLV...
>       Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
>   Unpacking TLV...
>     Found TLV of type 11 and len 11.
>     Skipping unknown TLV 11 (11 bytes)
>   Unpacking TLV...
>     Found TLV of type 242 and len 12.
>     Unpacking Router Capability TLV...
>     WARNING: Router Capability subTLV length too large compared to expected size
> Unpacked TLVs:
> Protocols Supported: 73, 16, 255, 255, 255, 101, 10, 11, 11, 11, 11, 11, 11
> Router Capability: 253.212.128.242 , D:1, S:1

Link: https://pypi.org/project/wuschl/
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-09-16 14:53:03 +02:00
Louis Scalbert
d61758140d isisd: fix rcap tlv double-free crash
A double-free crash happens when a subTLV of the "Router Capability"
TLV is not readable and a previous "Router Capability" TLV was read.

rcap was supposed to be freed later by isis_free_tlvs() ->
free_tlv_router_cap(). In 78774bbcd5 ("isisd: add isis flex-algo lsp
advertisement"), this was not the case because rcap was not saved to
tlvs->router_cap when the function returned early because of a subTLV
length issue.

Always set tlvs->router_cap to free the memory.

Note that this patch has the consequence that in case of subTLV error,
the previously read "Router Capability" subTLVs are kept in memory.

Fixes: 49efc80d34 ("isisd: Ensure rcap is freed in error case")
Fixes: 78774bbcd5 ("isisd: add isis flex-algo lsp advertisement")
Reported-by: Iggy Frankovic <iggyfran@amazon.com>
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-09-16 14:47:38 +02:00
Andrew Cooks
b2526ddc3f ospf6d: apply CI style suggestions
Apply formatting changes suggested by CI frrbot.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:17 +10:00
Andrew Cooks
9eef5e6483 ospf6d: use nth_prefix() in ospf6_intra_prefix_lsa_get_prefix_str()
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:17 +10:00
Andrew Cooks
6a7751b38a ospf6d: use nth_prefix() in ospf6_link_lsa_get_prefix_str()
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:17 +10:00
Andrew Cooks
554350abe0 ospf6d: add nth_prefix()
Add utility function to find the Nth prefix in a link LSA or Intra
Prefix LSA.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:17 +10:00
Andrew Cooks
b3f72964f2 ospf6d: use nth_lsdesc() in ospf6_router_lsa_get_nbr_id()
Improves code readability by reducing pointer casting and arithmetic,
and intendation.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
8ea50a44b5 ospf6d: use nth_lsdesc() in ospf6_network_lsa_get_ar_id()
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
cd6d36fd82 ospf6d: add nth_lsdesc()
Add utility function to find the Nth router lsdesc or network lsdesc in
an LSA.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
d0366de57c ospf6d: replace TLV_HDR_TOP macro with lsdesc_start function
The original TLV_HDR_TOP implementation only worked for Graceful Restart
LSAs, because they had no "LSA body".

This change introduces a body size lookup table and changes the
macro to a function that accounts for the LSA body for all LSA types,
and provides type checking on the provided pointer before arithmetic.

It also removes the open type casting and pointer arithmetic.

The introduced lsdesc_start() is used to find the start of a descriptor,
and will be used for TLVs in E-LSAs as well as old LSA.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
1bb4955371 ospf6d: use lsa_after_header pointer arithmetic
Replaces open type casting and pointer arithmetic for readability.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
1b64893e23 ospf6d: replace ospf6_lsa_header_end()
The void * return type of the replacement enables the removal of a
cast at every point of use, and the name no longer suggests that it
points to the last byte of the header.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
1290a06f5f ospf6d: cleanup Router-LSAs Options bit order
Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
33f90a5a1a ospf6d: add space between multi-line macros
For readability

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
89e18bfad1 ospf6d: move lsa structs to ospf6_lsa.h
It will be cleaner to have the LSAs in a single header and the future
TLVs in a single header.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Andrew Cooks
7c9a79f182 ospf6d: factor out generic TLV handling
In preperation for Extended LSA types and their TLVs, factor out the TLV
handling from the Gracefull Restart functionality.

Signed-off-by: Andrew Cooks <acooks.at.bda@gmail.com>
2024-09-16 18:38:16 +10:00
Donatas Abraitis
81db47a175
Merge pull request #16835 from cscarpitta/add-sid-structure-to-seg6local-nh
bgpd, lib: Include SID structure in seg6local nexthop
2024-09-16 10:25:56 +03:00
Carmine Scarpitta
1587169214 bgpd: Include structure when removing End.DT46 SID
Include SID structure information when removing an SRv6 End.DT46 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-15 21:35:13 +02:00
Carmine Scarpitta
a764fb9bd8 bgpd: Include structure when removing End.DT4/6 SID
Include SID structure information when removing an SRv6 End.DT4 or End.DT6 SID
from the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-15 21:35:10 +02:00
Carmine Scarpitta
949ea04c2b bgpd: Include structure when installing End.DT46 SID
Include SID structure information when installing an SRv6 End.DT46 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-15 21:35:06 +02:00
Carmine Scarpitta
6343fe346e bgpd: Include structure when installing End.DT4/6 SID
Include SID structure information when installing an SRv6 End.DT6 or End.DT4 SID
in the forwarding plane.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-15 21:35:02 +02:00
Carmine Scarpitta
04025514ed lib: Include SID structure in seg6local nexthop
Include SID structure information in seg6local nexthop data structure.

Signed-off-by: Carmine Scarpitta <cscarpit@cisco.com>
2024-09-15 17:23:34 +02:00
Enke Chen
f6e28717ec zebra: include the prefix in nht show command
Include the prefix in "show ip nht" and "show ipv6 nht".

Signed-off-by: Enke Chen <enchen@paloaltonetworks.com>
2024-09-14 23:47:00 -07:00
Jafar Al-Gharaibeh
84c50356f1
Merge pull request #16827 from LabNConsulting/chopps/fix-on-error-with-xdist
improvements for xdist mode
2024-09-14 17:36:42 -05:00
Donald Sharp
f80b967302
Merge pull request #16829 from Jafaral/vty-json
pimd: use vty_json
2024-09-14 11:30:13 -04:00
Christian Hopps
98aaeab23c tests: fix spawning shells/vtysh on error in xdist mode
- Also fix the above and CLI when running in munet native mode

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-14 10:05:24 -04:00
Christian Hopps
68f25a1b74 tests: update munet 0.14.14, 0.14.15
- improvement to remote CLI
- 0.14.15 fixed a small bug in 0.14.14

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-14 10:05:19 -04:00
Jafar Al-Gharaibeh
fe0d1ede9d pimd: use vty_json
Signed-off-by: Jafar Al-Gharaibeh <jafar@atcorp.com>
2024-09-13 23:32:56 -05:00
Christian Hopps
45e42c15df tests: update munet 0.14.13
- Improve remote CLI operation [improves xdist mode]

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-13 21:21:13 -04:00
Christian Hopps
bac68aba6c tests: update munet 0.14.12
- Adds retry_sleep (i.e., interval) parameter to native @retry decorator
- Fix --stdout and --stderr munet CLI args

Signed-off-by: Christian Hopps <chopps@labn.net>
2024-09-13 21:21:13 -04:00
Donald Sharp
f3fc33e17b
Merge pull request #16438 from Jafaral/pim-10.1-cand-rp
PIM candidate BSR/RP support
2024-09-13 19:45:57 -04:00
Jafar Al-Gharaibeh
38bd668b31
Merge pull request #16818 from ak503/ospf_gr
ospfd: missing '[no]ip ospf graceful-restart hello-delay <N>' commands
2024-09-13 11:57:56 -04:00
Donald Sharp
5074633d05
Merge pull request #16815 from opensourcerouting/fix/adjust_wait_count_default_timers_if_too_low
tests: Adjust minimum wait/count timers for run_and_expect() if they are too low
2024-09-13 11:27:19 -04:00
Jafar Al-Gharaibeh
53a0724446
Merge pull request #16808 from garyachy/nhrp_duplicate_authentication_extension_field
nhrpd: fixes duplicate auth extension
2024-09-13 10:50:40 -04:00
Dmitrii Turlupov
69e31a547f ospfd: fix missing '[no]ip ospf graceful-restart hello-delay <N>' commands
Signed-off-by: Dmitrii Turlupov <turlupov@bk.ru>
2024-09-13 16:26:04 +03:00
Donatas Abraitis
e229b5bad3 tests: Test neighbor X no-prepend replace-as dual-as
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-13 11:28:09 +03:00
Donatas Abraitis
573fa26bc7 doc: Document neighbox X local-as Y replace-as no-prepend dual-as
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-13 10:59:30 +03:00
Donatas Abraitis
cadfa693d6 bgpd: Implement BGP dual-as feature
This is helpful for migrations, etc.

The neighbor is configured with:

```
router bgp 65000
 neighbor X local-as 65001 no-prepend replace-as dual-as
```

Neighbor X can use either 65000, or 65001 to peer with.

Closes: https://github.com/FRRouting/frr/issues/13928

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-13 10:51:41 +03:00
Donatas Abraitis
7cc6c9325e tests: Adjust minimum wait/count timers for run_and_expect() if they are too low
If the developer pass way too low timers, we end up with most likely false-positive
situations for random tests under a high load of the system.

It would be better to fallback to the minimum default values for such a cases.

E.g.:

```
WARNING: topo: Waiting time is too small (count=1, wait=0.5), using default values (count=20, wait=3)
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2024-09-13 10:23:51 +03:00
Donatas Abraitis
b916ed358c
Merge pull request #16779 from louis-6wind/fix-as-path-exclude
bgpd: fix as-path exclude modify crash
2024-09-13 09:38:15 +03:00
Donatas Abraitis
4ab9b850a8
Merge pull request #16792 from sri-mohan1/srib-24-frr-a
bgpd: changes for code maintainability
2024-09-13 09:00:31 +03:00
Donald Sharp
916c90f503
Merge pull request #16799 from LabNConsulting/aceelindem/ospf-delay-reflooding-ack-fix
ospfd: An OSPF Ack should be sent when P2MP reflooding is delayed
2024-09-12 16:17:30 -04:00
Acee Lindem
d1e8903a37 ospfd: An OSPF Ack should be sent when P2MP reflooding is delayed.
When "ip ospf network point-to-multipoint delayed-reflooding" is configured,
LSAs received on an OSPF P2MP network are not reflooded. Since LSA reflooding
would normally serve as an implied LSA acknowledgment, an explicit OSPF ack
should be sent to avoid retransmission by the neighbor which orginally flooded
the LSA on the P2MP network.

Signed-off-by: Acee Lindem <acee@lindem.com>
2024-09-12 16:14:52 +00:00
Philippe Guibert
37702ca080 bgpd: fix 'nexthop_set failed' error message often displayed
The 'nexthop_set failed, resetting connection - intf' log message
is often seen when peering with BGP peers. This message has been
displayed by introducing a recent fix that extracts the IP/port
information of outgoing connections when peering is not yet
established.

Fix this by separating the update of the socket information from
the call to bgp_zebra_nexthop_set().

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2024-09-12 16:14:27 +02:00
Mark Stapp
afe37c8698
Merge pull request #16807 from louis-6wind/fix-isis_lsp_bits_topo1-race
tests: fix isis_lsp_bits_topo1 race condition
2024-09-12 09:46:42 -04:00
Donald Sharp
084858722c
Merge pull request #16810 from anlancs/fix/pimd-interface-crash-commands
pimd: fix crash for two commands
2024-09-12 08:19:11 -04:00
anlan_cs
27b682aae0 pimd: fix crash for two commands
Need "pim-enable" the interface for the two commands, otherwise it will crash.

```
PIM: lib_interface_pim_address_family_bsm_modify+0x68     561aa37a406c     7ffcc7b4cbd0 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: nb_callback_modify+0xdc            7f6200961aac     7ffcc7b4cc00 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_callback_configuration+0x14e     7f6200962740     7ffcc7b4cc90 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_transaction_process+0x68        7f6200962c79     7ffcc7b4d120 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_candidate_commit_apply+0x36     7f620096144f     7ffcc7b4d170 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_candidate_commit+0x96           7f6200961585     7ffcc7b4d1b0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_classic_commit+0x9e         7f6200967c4f     7ffcc7b4d200 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_apply_changes_internal+0x1fd     7f62009681ef     7ffcc7b4f250 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: nb_cli_apply_changes+0x2a9         7f6200968554     7ffcc7b51290 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: pim_process_no_bsm_cmd+0x4a        561aa378b7b6     7ffcc7b51b90 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: no_ip_pim_bsm+0x23                 561aa37d8487     7ffcc7b51bb0 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: cmd_execute_command_real+0x35a     7f62008f83c6     7ffcc7b51be0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: cmd_execute_command+0x12f          7f62008f8527     7ffcc7b51c70 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: cmd_execute+0x95                   7f62008f8a75     7ffcc7b51cd0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vty_command+0x1b8                  7f62009b621a     7ffcc7b51d20 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vty_execute+0x59                   7f62009b7fb3     7ffcc7b53db0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: vtysh_read+0x1f6                   7f62009ba136     7ffcc7b53de0 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: event_call+0xd6                    7f62009af5df     7ffcc7b54040 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: frr_run+0x240                      7f6200935177     7ffcc7b54100 /usr/lib/x86_64-linux-gnu/frr/libfrr.so.0 (mapped at 0x7f6200864000)
PIM: main+0x12e                         561aa37e7950     7ffcc7b54210 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
PIM: __libc_start_main+0xea             7f6200681d0a     7ffcc7b54250 /lib/x86_64-linux-gnu/libc.so.6 (mapped at 0x7f620065b000)
PIM: _start+0x2a                        561aa377c42a     7ffcc7b54320 /usr/lib/frr/pimd (mapped at 0x561aa3726000)
```

Signed-off-by: anlan_cs <anlan_cs@tom.com>
2024-09-12 17:22:53 +08:00