Commit Graph

29651 Commits

Author SHA1 Message Date
Donatas Abraitis
918f64980a bgpd: Thread is already done, drop useless assignment t_rmap_update to NULL
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-12 04:42:41 +03:00
Donatas Abraitis
d3822e7983 lib: Replace route_map_clear_updated to void
Return status not used at all.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-12 04:42:41 +03:00
Donatas Abraitis
9f9f3bfb62
Merge pull request #11903 from sri-mohan1/sri-bfd-dbg1
bfd: changes for code maintainability
2022-09-11 05:23:55 +02:00
Donatas Abraitis
61adcf71be bgpd: Fix memory leak for conf_copy() - SoO ecommunity
==1179738== 48 (40 direct, 8 indirect) bytes in 1 blocks are definitely lost in loss record 13 of 29
==1179738==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==1179738==    by 0x493C8D5: qcalloc (memory.c:116)
==1179738==    by 0x208F0C: ecommunity_dup (bgp_ecommunity.c:267)
==1179738==    by 0x2B300C: conf_copy (bgp_updgrp.c:170)
==1179738==    by 0x2B35BF: peer2_updgrp_copy (bgp_updgrp.c:277)
==1179738==    by 0x2B5189: update_group_find (bgp_updgrp.c:826)
==1179738==    by 0x2B70D0: update_group_adjust_peer (bgp_updgrp.c:1769)
==1179738==    by 0x23DB7D: update_group_adjust_peer_afs (bgp_updgrp.h:519)
==1179738==    by 0x243B21: bgp_establish (bgp_fsm.c:2129)
==1179738==    by 0x244B94: bgp_event_update (bgp_fsm.c:2597)
==1179738==    by 0x26B0E6: bgp_process_packet (bgp_packet.c:2895)
==1179738==    by 0x498F5FD: thread_call (thread.c:2008)
==1179738==    by 0x49253DA: frr_run (libfrr.c:1198)
==1179738==    by 0x1EEC38: main (bgp_main.c:520)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-10 18:13:45 +03:00
Donatas Abraitis
bbe7bc46f1 bgpd: Fix memory leak for as-override
==536197== 400 (160 direct, 240 indirect) bytes in 4 blocks are definitely lost in loss record 19 of 21
==536197==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==536197==    by 0x491C753: qcalloc (memory.c:116)
==536197==    by 0x303FA9: aspath_dup (bgp_aspath.c:698)
==536197==    by 0x304B2A: aspath_replace_specific_asn (bgp_aspath.c:1219)
==536197==    by 0x256840: bgp_peer_as_override (bgp_route.c:1781)
==536197==    by 0x256840: subgroup_announce_check (bgp_route.c:2216)
==536197==    by 0x258345: subgroup_process_announce_selected (bgp_route.c:2804)
==536197==    by 0x27F2CA: group_announce_route_walkcb (bgp_updgrp_adv.c:199)
==536197==    by 0x4905A51: hash_walk (hash.c:285)
==536197==    by 0x27E8D1: update_group_af_walk (bgp_updgrp.c:1866)
==536197==    by 0x2809D3: group_announce_route (bgp_updgrp_adv.c:1022)
==536197==    by 0x257DC4: bgp_process_main_one (bgp_route.c:3189)
==536197==    by 0x257DC4: bgp_process_main_one (bgp_route.c:2975)
==536197==    by 0x2581F7: bgp_process_wq (bgp_route.c:3330)
==536197==    by 0x4961787: work_queue_run (workqueue.c:285)
==536197==    by 0x4957745: thread_call (thread.c:2008)
==536197==    by 0x4910B77: frr_run (libfrr.c:1198)
==536197==    by 0x1ED6AC: main (bgp_main.c:520)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-10 06:56:01 +03:00
Donatas Abraitis
7462dbb0c2 tests: Validate the routes using polling for bgp_remove_private_as
Do not fail at the first shot.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-10 06:51:25 +03:00
Donatas Abraitis
67a9da92a1 bgpd: Fix memory leak for set as-path replace route-map command
==1174993== 252 (120 direct, 132 indirect) bytes in 3 blocks are definitely lost in loss record 77 of 100
==1174993==    at 0x483AB65: calloc (vg_replace_malloc.c:760)
==1174993==    by 0x493C8D5: qcalloc (memory.c:116)
==1174993==    by 0x378E38: aspath_dup (bgp_aspath.c:698)
==1174993==    by 0x2A39E2: route_set_aspath_replace (bgp_routemap.c:2259)
==1174993==    by 0x4965C71: route_map_apply_ext (routemap.c:2664)
==1174993==    by 0x27BCC8: bgp_input_modifier (bgp_route.c:1657)
==1174993==    by 0x281AB9: bgp_update (bgp_route.c:3992)
==1174993==    by 0x286368: bgp_nlri_parse_ip (bgp_route.c:5890)
==1174993==    by 0x264D20: bgp_nlri_parse (bgp_packet.c:347)
==1174993==    by 0x2682FE: bgp_update_receive (bgp_packet.c:1921)
==1174993==    by 0x26AA67: bgp_process_packet (bgp_packet.c:2822)
==1174993==    by 0x498F5FD: thread_call (thread.c:2008)
==1174993==    by 0x49253DA: frr_run (libfrr.c:1198)
==1174993==    by 0x1EEC38: main (bgp_main.c:520)

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-10 02:14:45 +03:00
Donald Sharp
db391f7d06
Merge pull request #11922 from anlancs/fix/zebra-broken-evpn
zebra: fix broken evpn
2022-09-09 07:58:29 -04:00
Donald Sharp
a50c13d4c0
Merge pull request #11909 from opensourcerouting/fix/a_couple_nits
bgpd: bgp_dest_unlock_node fixes
2022-09-09 07:55:13 -04:00
Mark Stapp
71ca5b09bc bgpd: avoid notify race between io and main pthreads
The "bgp_notify_" apis in bgp_packet.c generate a notification
to a peer, usually during error handling. The io pthread wants
to send notifications in a couple of cases during early
received-packet validation - but the existing api interacts
with the peer struct itself, and that's not safe.

Add a new api for use by the io pthread, and adjust the main
notify api so that it can avoid touching the peer struct.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-09-08 16:14:36 -04:00
Donatas Abraitis
6a26823c88
Merge pull request #11896 from AbhishekNR/issue_11891
pim6d: Adding additional details for "show ipv6 mld interface [ifname] json" command.
2022-09-08 16:35:44 +02:00
Donatas Abraitis
8a59ae5ebc
Merge pull request #11887 from SaiGomathiN/igmptogm
pimd, pim6d: Changing IGMP to GM in debug macros
2022-09-08 16:34:26 +02:00
anlan_cs
f09428e472 zebra: fix broken evpn
To resolve link dependencies of unordered interfaces, the commit
`520ebf72b27c2462ce8b0dc5a1d4cb83956df69c` has separated assignment of
`zif->link_ifindex` and `zif->link` from `netlink_interface()` during startup.
The fixup stage of `zebra_if_update_all_links()` goes into the last of
`interface_lookup_netlink()`, it can't be executed in the case of error in
above `netlink_parse_info()`s.

`RTM_GETTUNNEL` is not supported in linux kernel until 5.18, so
`netlink_parse_info()` will throw error with the previous versions.

If two conditions are met, (it is a common case)
1. Interfaces are created before frr restart/start
2. Linux kernel version < 5.18

the link dependencies will not be done, then evpn feature will be broken.
IMO we should just ignore this error.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-09-08 06:27:01 -04:00
Jafar Al-Gharaibeh
3f069ea90b
Merge pull request #11913 from mjstapp/fix_rcu_bgp_keepalive
bgpd: release rcu lock in bgp keepalive pthread
2022-09-08 00:22:28 -05:00
Donald Sharp
97a0bfc5ca
Merge pull request #11915 from opensourcerouting/topotests-collect
topotests: ignore env for pytest --collect-only
2022-09-07 12:59:26 -04:00
Donald Sharp
27e8358522
Merge pull request #11916 from leonshaw/fix/conf-vrf-netns
zebra: Reconfiguring netns for vrf is not a failure
2022-09-07 12:58:39 -04:00
Donald Sharp
bdf57638ee
Merge pull request #11914 from anlancs/fix/cleanup-lib-name
lib: replace one path with macro
2022-09-07 12:54:38 -04:00
Donatas Abraitis
f66624f5c0 bgpd: Fix aggregate-address summary-only matching-MED-only
Before it worked only when configured initially via CLI. Later, when we
receive a new route, that should match a decent MED, we just skip it, because
MED mismatch is not recalculated.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-07 14:39:19 +03:00
Xiao Liang
d61e157a47 zebra: Reconfiguring netns for vrf is not a failure
When using namespace VRF backend, and frr.conf contains:

    vrf test
      netns /run/netns/test
    exit-vrf

FRR fails to start:

    line 11: Failure to communicate[13] to zebra, line:  netns /run/netns/test

Fix this by returning CMD_WARNING rather than CMD_WARNING_CONFIG_FAILED
when the same netns path is configured.

Signed-off-by: Xiao Liang <shaw.leon@gmail.com>
2022-09-07 17:52:09 +08:00
anlan_cs
b5d1433e6d lib: replace one path with macro
Replace all of the path name with macro, only the two places.

Signed-off-by: anlan_cs <vic.lan@pica8.com>
2022-09-07 01:10:14 -04:00
Jafar Al-Gharaibeh
1762461ca8
Merge pull request #11911 from mruprich/ospf-api
ospfd: Adding SUPPORT_OSPF_API define in ospf_spf.c
2022-09-06 22:55:58 -05:00
Rafael Zalamena
340ed5f9e2
Merge pull request #11823 from pguibert6WIND/bgp_vpnv4_gre_ebgp
Bgp vpnv4 convey without transport label
2022-09-06 13:37:19 -03:00
David Lamparter
3d80bd11aa topotests: ignore env for pytest --collect-only
`--collect-only` does not run any tests, so bypass env checks for it.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
2022-09-06 17:43:26 +02:00
Donatas Abraitis
cbe4fd18fc
Merge pull request #11864 from manojvn/clis
ospfd: Added clis to change default timers for LSA refresh and maxage remove delay.
2022-09-06 18:32:56 +03:00
Russ White
dd57a2c78e
Merge pull request #11882 from opensourcerouting/fix/increase_peer_af_flags_to_u64
bgpd: Increase peer af_flags to uint64_t
2022-09-06 11:24:39 -04:00
Russ White
f82192c8ad
Merge pull request #11754 from Orange-OpenSource/isisd
isisd: Correct Valgrind errors
2022-09-06 09:51:18 -04:00
Mark Stapp
85ba04f389 bgpd: release rcu lock in bgp keepalive pthread
Don't hold the rcu lock in the bgp keepalive pthread: it
blocks the rcu pthread and prevents log-file deletion.

Signed-off-by: Mark Stapp <mstapp@nvidia.com>
2022-09-06 09:07:07 -04:00
Michal Ruprich
ec3bb054c3 ospfd: Adding SUPPORT_OSPF_API define in ospf_spf.c
It is not possible to build ospf_spf.c file with --disable-ospfapi because
ospf_apiserver.c has SUPPORT_OSPF_API around all function definitions and
that results in an undefined reference to the ospf_apiserver_notify_reachable
function error while building.

Signed-off-by: Michal Ruprich <mruprich@redhat.com>
2022-09-06 12:34:15 +02:00
Francois Dumontet
98654f4258 pathd: nai adjacency fix query type f for IPV6
This commit is dedicated to fix some issues in path_ted_query_type_f
function. Issues are related to IPv6 implementation.
-key is not based on the pertinent part of IPv6 address.
-test on memcmp return value is mismatch.
-wrong flag value tested (ipv4 against ipv6).
-return adj_sid was the wrong one.

Signed-off-by: Francois Dumontet <francois.dumontet@6wind.com>
2022-09-06 12:03:04 +02:00
Donatas Abraitis
7e7f61ed49 bgpd: Unlock bgp_dest after bgp_table_subtree_lookup()
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-06 12:51:35 +03:00
Donatas Abraitis
a2af7147fe bgpd: Drop unused functions
bgp_node_match_ipv4
bgp_node_match_ipv6
bgp_table_iter_init
bgp_table_iter_next
bgp_table_iter_cleanup
bgp_table_iter_pause
bgp_table_iter_is_done
bgp_table_iter_started

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-06 12:51:35 +03:00
Donatas Abraitis
8c0044f323 bgpd: Unlock bgp_dest for some more cases
bgp_static_set()
bgp_aggregate_install()

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-06 12:51:35 +03:00
Donatas Abraitis
636632c32f bgpd: Reuse prep_for_rmap_apply() when applying route-map for show cmd
Include extra path attributes.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-06 12:51:34 +03:00
Donatas Abraitis
fd43ffd974 bgpd: Do not forget to unlock bgp_dest from update_advertise_vni_routes
If "unexpected" happens.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-06 11:49:08 +03:00
Sai Gomathi N
b40990228f pimd: Fixing alignment
Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-06 00:15:38 -07:00
Sai Gomathi N
d891fa78e4 pimd, pim6d: Changing IGMP to GM in debug macros
Changing
PIM_DO_DEBUG_IGMP_EVENTS to PIM_DO_DEBUG_GM_EVENTS
PIM_DO_DEBUG_IGMP_PACKETS to PIM_DO_DEBUG_GM_PACKETS
PIM_DO_DEBUG_IGMP_TRACE to PIM_DO_DEBUG_GM_TRACE
PIM_DO_DEBUG_IGMP_TRACE_DETAIL to PIM_DO_DEBUG_GM_TRACE_DETAIL
PIM_DONT_DEBUG_IGMP_EVENTS to PIM_DONT_DEBUG_GM_EVENTS
PIM_DONT_DEBUG_IGMP_PACKETS to PIM_DONT_DEBUG_GM_PACKETS
PIM_DONT_DEBUG_IGMP_TRACE to PIM_DONT_DEBUG_GM_TRACE
PIM_DONT_DEBUG_IGMP_TRACE_DETAIL to PIM_DONT_DEBUG_GM_TRACE_DETAIL
PIM_MASK_IGMP_EVENTS to PIM_MASK_GM_EVENTS
PIM_MASK_IGMP_PACKETS to PIM_MASK_GM_PACKETS
PIM_MASK_IGMP_TRACE to PIM_MASK_GM_TRACE
PIM_MASK_IGMP_TRACE_DETAIL to PIM_MASK_GM_TRACE_DETAIL
to be used for both IGMP and MLD debugs.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-06 00:15:38 -07:00
Abhishek N R
cb406d5cd7 pim6d: Adding additional details for "show ipv6 mld interface [ifname] json" command.
Added Robustness value, Query interval, Query response timer
and Last member query interval field in json output.

Issue: #11891

Signed-off-by: Abhishek N R <abnr@vmware.com>
2022-09-05 22:51:03 -07:00
Donatas Abraitis
451cebeec2
Merge pull request #11902 from SaiGomathiN/igmp-to-gm
pimd, pim6d: Changing IGMP to GM in debug macros
2022-09-06 08:40:43 +03:00
Philippe Guibert
6fc4929e09 bgpd: associate appropriate family for redistributed connected addresses
When redistributing connected addresses, the address family has
to be figured out. The calculation was not done, the next-hop
address length was not set, and as consequence, the nexthop
is displayed like if it was an ipv6 address, which is wrong for
ipv4 addresses.

Calculate the family for connected addresses.
Change the topotests accordingly.

Fixes: ("7226bc40d606") bgpd: ignore NEXT_HOP for MP_REACH_NLRI

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-05 22:26:33 +02:00
Philippe Guibert
b244203fcc topotests: add bgp_vpnv4_ebgp test with 'mpls bgp forwarding'
add bgp_vpnv4_ebgp using the 'mpls bgp forwarding' interface
command.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-05 22:26:33 +02:00
Philippe Guibert
4cd690ae4d bgpd: add 'mpls bgp forwarding' to ease mpls vpn ebgp peering
RFC4364 describes peerings between multiple AS domains, to ease
the continuity of VPN services across multiple SPs. This commit
implements a sub-set of IETF option b) described in chapter 10 b.

The ASBR to ASBR approach is taken, with an EBGP peering between
the two routers. The EBGP peering must be directly connected to
the outgoing interface used. In those conditions, the next hop
is directly connected, and there is no need to have a transport
label to convey the VPN label. A new vty command is added on a
per interface basis:

This command if enabled, will permit to convey BGP VPN labels
without any transport labels (i.e. with implicit-null label).

restriction:
this command is used only for EBGP directly connected peerings.
Other use cases are not covered.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-05 22:26:33 +02:00
Philippe Guibert
6e616738ca topotests: add bgp vpnv4 over gre test
This test ensures that MPLS VPN routes can be installed into a
gre interface with route-map l3vpn next-hop encapsulation command
set. On the other hand, if this command is not set, incoming bgp
routes are not considered as valid.

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-05 22:26:33 +02:00
Philippe Guibert
1bb550b63c bgpd: add resolution for l3vpn traffic over gre interfaces
When a route imported from l3vpn is analysed, the nexthop from default
VRF is looked up against a valid MPLS path. Generally, this is done on
backbones with a MPLS signalisation transport layer like LDP. Generally,
the BGP connection is multiple hops away. That scenario is already
working.

There is case where it is possible to run L3VPN over GRE interfaces, and
where there is no LSP path over that GRE interface: GRE is just here to
tunnel MPLS traffic. On that case, the nexthop given in the path does not
have MPLS path, but should be authorized to convey MPLS traffic provided
that the user permits it via a configuration command.

That commit introduces a new command that can be activated in route-map:
 > set l3vpn next-hop encapsulation gre

That command authorizes the nexthop tracking engine to accept paths that
o have a GRE interface as output, independently of the presence of an LSP
path or not.

A configuration example is given below. When bgp incoming vpnv4 updates
are received, the nexthop of NLRI is 192.168.0.2. Based on nexthop
tracking service from zebra, BGP knows that the output interface to reach
192.168.0.2 is r1-gre0. Because that interface is not MPLS based, but is
a GRE tunnel, then the update will be using that nexthop to be installed.

    interface r1-gre0
     ip address 192.168.0.1/24
    exit
    router bgp 65500
     bgp router-id 1.1.1.1
     neighbor 192.168.0.2 remote-as 65500
     !
     address-family ipv4 unicast
      no neighbor 192.168.0.2 activate
     exit-address-family
     !
     address-family ipv4 vpn
      neighbor 192.168.0.2 activate
      neighbor 192.168.0.2 route-map rmap in
     exit-address-family
    exit
    !
    router bgp 65500 vrf vrf1
     bgp router-id 1.1.1.1
     no bgp network import-check
     !
     address-family ipv4 unicast
      network 10.201.0.0/24
      redistribute connected
      label vpn export 101
      rd vpn export 444:1
      rt vpn both 52:100
      export vpn
      import vpn
     exit-address-family
    exit
    !
    route-map rmap permit 1
     set l3vpn next-hop encapsulation gre
    exit

Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
2022-09-05 22:26:25 +02:00
sri-mohan1
9e5fc01f00 bfdd: changes for code maintainability
these changes are for improving the code maintainability

Signed-off-by: sri-mohan1 <sri.mohan@samsung.com>
2022-09-05 14:12:25 +05:30
Sai Gomathi N
55eb347de9 pimd,pim6d: Modifying IGMP to GM in PIM_DEBUG_IGMP_PACKETS to PIM_DEBUG_GM_PACKETS
Changing the macros to common so that it can be used for pimv6 debugs as well
to be used for both IGMP and MLD debugs.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-04 22:46:09 -07:00
Sai Gomathi N
95b13dc512 pimd,pim6d: Modifying IGMP to GM in PIM_DEBUG_IGMP_EVENTS to PIM_DEBUG_GM_EVENTS
Changing the macros to common so that it can be used for pimv6 debugs as well
to be used for both IGMP and MLD debugs.

Signed-off-by: Sai Gomathi N <nsaigomathi@vmware.com>
2022-09-04 22:46:09 -07:00
Sarita Patra
deda3f27d3 pim6d: Update last_member_query_interval and last_member_query_count
When there is update in the configuration of last_member_query_interval
and last_member_query_count, call gm_ifp_update().
This will update cur_query_intv_trig and cur_lmqc of gm_ifp structure.

Issue: #11901

Signed-off-by: Sarita Patra <saritap@vmware.com>
2022-09-04 16:53:03 -07:00
Donatas Abraitis
324e8b1f79 bgpd: Handle Origin Validation State extended community via route-map match
Add an ability to match via route-maps. An additional route-map command

`match rpki-extcommunity <invalid|notfound|valid>` added.

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-04 21:54:47 +03:00
Donatas Abraitis
7b27cf7bbd bgpd: Add Origin Validation State extended community
```
spine1-debian-11# sh ip bgp 100.100.100.101/32
BGP routing table entry for 100.100.100.101/32, version 21
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    fe80::ca5d:fd0d:cd8:1bb7 from eth3 (172.17.0.3)
    (fe80::ca5d:fd0d:cd8:1bb7) (used)
      Origin incomplete, metric 0, localpref 100, valid, internal, best (First path received)
      Extended Community: OVS:invalid
      Last update: Wed Aug 31 19:31:46 2022

spine1-debian-11# sh ip bgp 100.100.100.100/32
BGP routing table entry for 100.100.100.100/32, version 17
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Local
    fe80::ca5d:fd0d:cd8:1bb7 from eth3 (172.17.0.3)
    (fe80::ca5d:fd0d:cd8:1bb7) (used)
      Origin incomplete, metric 0, localpref 100, valid, internal, best (First path received)
      Extended Community: OVS:not-found
      Last update: Wed Aug 31 19:31:46 2022
spine1-debian-11#
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-04 21:23:59 +03:00
Donatas Abraitis
4880f5fa16 doc: Add rfc5668 to the list
Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
2022-09-04 21:23:59 +03:00