Commit graph

37295 commits

Author SHA1 Message Date
Donatas Abraitis 91e157f3ae
Merge pull request #17162 from louis-6wind/fix-bh-nh-vrf
zebra: fix showing nexthop vrf for ipv6 blackhole
2024-10-23 17:34:44 +03:00
Donatas Abraitis a6aa6b5880
Merge pull request #17183 from Shbinging/fix_no_area_range_command_2
ospfd:fix the bug that the empty area was not free after no area range command was executed
2024-10-23 12:41:37 +03:00
Louis Scalbert 3225b778ca bgpd: fix uninitialized labels
Fix uninitialized labels that cause multiple valgrind issues.

> ==3729602== Use of uninitialised value of size 8
> ==3729602==    at 0x492B493: hash_get (hash.c:140)
> ==3729602==    by 0x2629D2: bgp_labels_intern (bgp_label.c:98)
> ==3729602==    by 0x2E6C92: bgp_adj_out_set_subgroup (bgp_updgrp_adv.c:622)
> ==3729602==    by 0x2A6810: subgroup_process_announce_selected (bgp_route.c:3340)
> ==3729602==    by 0x2E5FF6: group_announce_route_walkcb (bgp_updgrp_adv.c:260)
> ==3729602==    by 0x2E3E28: update_group_walkcb (bgp_updgrp.c:1759)
> ==3729602==    by 0x492B9A0: hash_walk (hash.c:270)
> ==3729602==    by 0x2E498C: update_group_af_walk (bgp_updgrp.c:2090)
> ==3729602==    by 0x2E7C0D: group_announce_route (bgp_updgrp_adv.c:1119)
> ==3729602==    by 0x2A796E: bgp_process_main_one (bgp_route.c:3865)
> ==3729602==    by 0x2A808A: bgp_process_wq (bgp_route.c:3991)
> ==3729602==    by 0x49CC7CF: work_queue_run (workqueue.c:282)
> ==3729602==    by 0x49BBF25: event_call (event.c:2019)
> ==3729602==    by 0x49413CA: frr_run (libfrr.c:1238)
> ==3729602==    by 0x1FD1D3: main (bgp_main.c:555)

> ==2604268== Use of uninitialised value of size 8
> ==2604268==    at 0x4943016: hash_get (hash.c:159)
> ==2604268==    by 0x26EFC1: bgp_labels_intern (bgp_label.c:97)
> ==2604268==    by 0x28077B: leak_update (bgp_mplsvpn.c:1298)
> ==2604268==    by 0x2824A3: vpn_leak_from_vrf_update (bgp_mplsvpn.c:1932)
> ==2604268==    by 0x2C281C: bgp_static_update (bgp_route.c:6974)
> ==2604268==    by 0x2C366F: bgp_static_set (bgp_route.c:7263)
> ==2604268==    by 0x2C435B: bgp_network_magic (bgp_route.c:7556)
> ==2604268==    by 0x2ACF09: bgp_network (bgp_route_clippy.c:86)
> ==2604268==    by 0x4914EE7: cmd_execute_command_real (command.c:1003)
> ==2604268==    by 0x4915060: cmd_execute_command (command.c:1062)
> ==2604268==    by 0x4915610: cmd_execute (command.c:1228)
> ==2604268==    by 0x49E7C32: vty_command (vty.c:625)
> ==2604268==    by 0x49E9B56: vty_execute (vty.c:1388)
> ==2604268==    by 0x49EC331: vtysh_read (vty.c:2400)
> ==2604268==    by 0x49E06F1: event_call (event.c:2001)
> ==2604268==    by 0x495AB8B: frr_run (libfrr.c:1238)
> ==2604268==    by 0x200C4B: main (bgp_main.c:555)

Fixes: ddb5b4880b ("bgpd: vpn-vrf route leaking")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-23 09:41:59 +02:00
Shbinging 03649ffde3 ospfd:fix syntax of some no commands
Fix syntax of the following no commands:
1. `no area virtual link A.B.C.D hello-interval <NUM>`, `<NUM>` can be omitted.
2. `no area nssa default-information-originate metric <NUM>`, `<NUM>` can be omitted.
3. `no area nssa range cost <NUM>`, `<NUM>` can be omitted.
4. `no area default cost <NUM>`, `<NUM>` can be omitted.
5. `no ospf write-multiplier <NUM>`, `<NUM>` can be omitted.
6. `no default-information originate metric <NUM>`, `<NUM>` can be omitted.
7. `no distance <NUM>`, `<NUM>` can be omitted.

Signed-off-by: Shbinging <bingshui@smail.nju.edu.cn>
2024-10-23 06:01:57 +00:00
baozhen-H3C 66ef3576af isisd: The command "'show isis vrf all summary json" has no output.
When input 'show isis vrf all summary', output is as follow:
sonic# show isis vrf all summary
vrf             : default
Process Id      : 55
System Id       : 0000.0000.0006
Symbolic name   : RouterA
Up time         : 4d01h52m ago
Number of areas : 1
Area 10:
  Net: 10.0000.0000.0006.00
  IS_name: RouterA
  TX counters per PDU type:
     L1 IIH: 365003
     L1 LSP: 20468
    L1 PSNP: 8
   LSP RXMT: 0
  RX counters per PDU type:
     L1 IIH: 361577
     L2 IIH: 434
     L1 LSP: 10492
    L1 CSNP: 114260
  Level-1:
    LSP0 regenerated: 4840
         LSPs purged: 0
    SPF:
      minimum interval  : 1
    IPv4 route computation:
      last run elapsed  : 00:01:02 ago
      last run duration : 327 usec
      run count         : 12053
However, json display is null.

After the commit:
sonic# show isis vrf all summary json
{
  "vrfs":[
    {
      "vrf":"default",
      "process-id":56,
      "system-id":"0000.0000.0007",
      "up-time":"20:40:33",
      "number-areas":1,
      "areas":[
        {
          "area":"10",
          "net":"10.0000.0000.0007.00",
          "tx-pdu-type":{
            "l1-iih":52234,
            "l1-lsp":1053,
            "l1-csnp":8269,
            "l1-psnp":1,
            "lsp-rxmt":0
          },
          "rx-pdu-type":{
            "l1-iih":52245,
            "l2-iih":26116,
            "l1-lsp":1388,
            "l1-csnp":8269
          },
          "levels":[
            {
              "id":1,
              "lsp0-regenerated":89,
              "lsp-purged":0,
              "spf":"no pending",
              "minimum-interval":1,
              "last-run-elapsed":"00:00:05",
              "last-run-duration-usec":192,
              "last-run-count":1454
            }
          ]
        }
      ]
    }
  ]
}

Signed-off-by: baozhen-H3C <bao.zhen@h3c.com>
2024-10-23 13:27:45 +08:00
Russ White a4ecc2f4d2
Merge pull request #17198 from donaldsharp/backout_stdout_changes
Revert "lib: Attach stdout to child only if --log=stdout and stdout F…
2024-10-22 16:35:05 -04:00
Russ White 8ccd538847
Merge pull request #17192 from donaldsharp/bgp_bmp_stream_leak
bgpd: Do not leak a stream with bmp code
2024-10-22 16:16:57 -04:00
David Lamparter 1530a35423 vtysh: fix find and list commands
I simply missed that `node->cmd_vector` is needed for `find` and `list`
to work correctly.

Fixes: #17043
Fixes: 4bc41193e8 ("vtysh, lib: preprocess CLI graphs")
Reported-by: Donald Sharp <sharpd@nvidia.com>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 20:43:59 +02:00
Louis Scalbert dd10379b3e bgpd: fix allocating uninitialized bgp_labels
Memory was not zeroed at allocation.

> ==2604268== Conditional jump or move depends on uninitialised value(s)
> ==2604268==    at 0x26F026: bgp_labels_unintern (bgp_label.c:116)
> ==2604268==    by 0x30000C: adj_free (bgp_updgrp_adv.c:81)
> ==2604268==    by 0x3019EE: bgp_adj_out_remove_subgroup (bgp_updgrp_adv.c:728)
> ==2604268==    by 0x30537C: subgroup_withdraw_packet (bgp_updgrp_packet.c:1042)
> ==2604268==    by 0x2970AF: bgp_generate_updgrp_packets (bgp_packet.c:508)
> ==2604268==    by 0x49E06F1: event_call (event.c:2001)
> ==2604268==    by 0x495AB8B: frr_run (libfrr.c:1238)
> ==2604268==    by 0x200C4B: main (bgp_main.c:555)

Fixes: 3c86f776f0 ("bgpd: add bgp_labels hash")
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
2024-10-22 18:24:04 +02:00
Jafar Al-Gharaibeh 0078472e19
Merge pull request #17180 from anlancs/zebra/review-move-dplane
zebra: drop NEWLINK event handling in the main thread
2024-10-22 10:29:49 -05:00
Donald Sharp 6a36b9ef49 Revert "lib: Attach stdout to child only if --log=stdout and stdout FD is a tty"
This reverts commit 0e3c5e8e59.
2024-10-22 11:13:07 -04:00
Russ White 98ec22ff59
Merge pull request #17174 from baozhen-H3C/202410180225
isisd: fix 'show isis route' and 'show isis fast-reroute summary' errors with vrf
2024-10-22 11:07:53 -04:00
Russ White 3152f4933e
Merge pull request #17166 from anlancs/zebra/review-remove-one
zebra: remove useless code
2024-10-22 11:06:50 -04:00
Russ White df0dd1b39e
Merge pull request #17165 from opensourcerouting/fix/bgp_community_no_export_oad
bgpd: Do not filter no-export community for BGP OAD
2024-10-22 11:05:38 -04:00
Russ White 56944a53f1
Merge pull request #17151 from opensourcerouting/fix/send_link_bw_as_non-transitive_to_ebgp
bgpd: Handle non-transitive extended communities
2024-10-22 11:03:00 -04:00
David Lamparter 24eed7c2d2 accords: guidelines/terms for FRRouting trademarks
This attempts to establish a little bit of clarifying restrictions
around the FRRouting "identifiers", mostly as a reaction to FRRouting
now functioning almost like a "seal of approval" in some cases.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2024-10-22 16:57:44 +02:00
Donald Sharp 9adcff1890 bgpd: Do not leak a stream with bmp code
Signed-off-by: Donald Sharp <sharpd@nvidia.com>
2024-10-22 10:10:46 -04:00
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