From 07090ccf5a3c81f650faef914a646f0e31a26fc8 Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Wed, 12 Jun 2024 18:48:02 -0400 Subject: [PATCH 01/81] lib: fix incorrect use of error checking macro Signed-off-by: Christian Hopps --- lib/yang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/yang.c b/lib/yang.c index 702fcf436d..44459df4a5 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -897,7 +897,7 @@ char *yang_convert_lyd_format(const char *data, size_t data_len, assert(out_format != LYD_LYB); - if (in_format != LYD_LYB && !MGMT_MSG_VALIDATE_NUL_TERM(data, data_len)) { + if (in_format != LYD_LYB && (!data_len || data[data_len - 1] != 0)) { zlog_err("Corrupt input data, no NUL terminating byte"); return NULL; } From 6d1023a712f9d46f0d085367b63b9793c2cf4494 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 14 Jun 2024 13:36:51 -0400 Subject: [PATCH 02/81] zebra: Prevent starvation in dplane_thread_loop When removing a large number of routes, the linux kernel can take the cpu for an extended amount of time, leaving a situation where FRR detects a starvation event. r1# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10 2024-06-14 12:55:49.365 [NTFY] sharpd: [M7Q4P-46WDR] vty[5]@# sharp install routes 10.0.0.0 nexthop 192.168.44.33 1000000 repeat 10 2024-06-14 12:55:49.365 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes 2024-06-14 12:55:57.256 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.890085 2024-06-14 12:55:57.256 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes 2024-06-14 12:56:07.802 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 7078ms (cpu time 220ms) 2024-06-14 12:56:25.039 [DEBG] sharpd: [WTN53-GK9Y5] Removed all Items 27.783668 2024-06-14 12:56:25.039 [DEBG] sharpd: [YP4TQ-01TYK] Inserting 1000000 routes 2024-06-14 12:56:32.783 [DEBG] sharpd: [TPHKD-3NYSB] Installed All Items 7.743524 2024-06-14 12:56:32.783 [DEBG] sharpd: [YJ486-NX5R1] Removing 1000000 routes 2024-06-14 12:56:41.447 [WARN] zebra: [QH9AB-Y4XMZ][EC 100663314] STARVATION: task dplane_thread_loop (634377bc8f9e) ran for 5175ms (cpu time 179ms) Let's modify the loop in dplane_thread_loop such that after a provider has been run, check to see if the event should yield, if so, stop and reschedule this for the future. Signed-off-by: Donald Sharp (cherry picked from commit 6faad863f30d29157e4c675ad956e3ccd38991a7) --- zebra/zebra_dplane.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/zebra/zebra_dplane.c b/zebra/zebra_dplane.c index 06b34da209..3944876439 100644 --- a/zebra/zebra_dplane.c +++ b/zebra/zebra_dplane.c @@ -7441,6 +7441,11 @@ static void dplane_thread_loop(struct event *event) zlog_debug("dplane dequeues %d completed work from provider %s", counter, dplane_provider_get_name(prov)); + if (event_should_yield(event)) { + reschedule = true; + break; + } + /* Locate next provider */ prov = dplane_prov_list_next(&zdplane_info.dg_providers, prov); } From 7749253e8c23a7394ef3254e817810ef715f174c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20Kwa=C5=9Bny?= Date: Mon, 27 May 2024 11:03:30 +0200 Subject: [PATCH 03/81] bgpd: fixed failing remove of vrf if there is a stale l3vni Problem statement: ================== When a vrf is deleted from the kernel, before its removed from the FRR config, zebra gets to delete the the vrf and assiciated state. It does so by sending a request to delete the l3 vni associated with the vrf followed by a request to delete the vrf itself. 2023/10/06 06:22:18 ZEBRA: [JAESH-BABB8] Send L3_VNI_DEL 1001 VRF testVRF1001 to bgp 2023/10/06 06:22:18 ZEBRA: [XC3P3-1DG4D] MESSAGE: ZEBRA_VRF_DELETE testVRF1001 The zebra client communication is asynchronous and about 1/5 cases the bgp client process them in a different order. 2023/10/06 06:22:18 BGP: [VP18N-HB5R6] VRF testVRF1001(766) is to be deleted. 2023/10/06 06:22:18 BGP: [RH4KQ-X3CYT] VRF testVRF1001(766) is to be disabled. 2023/10/06 06:22:18 BGP: [X8ZE0-9TS5H] VRF disable testVRF1001 id 766 2023/10/06 06:22:18 BGP: [X67AQ-923PR] Deregistering VRF 766 2023/10/06 06:22:18 BGP: [K52W0-YZ4T8] VRF Deletion: testVRF1001(4294967295) .. and a bit later : 2023/10/06 06:22:18 BGP: [MRXGD-9MHNX] DJERNAES: process L3VNI 1001 DEL 2023/10/06 06:22:18 BGP: [NCEPE-BKB1G][EC 33554467] Cannot process L3VNI 1001 Del - Could not find BGP instance When the bgp vrf config is removed later it fails on the sanity check if l3vni is removed. if (bgp->l3vni) { vty_out(vty, "%% Please unconfigure l3vni %u\n", bgp->l3vni); return CMD_WARNING_CONFIG_FAILED; } Solution: ========= The solution is to make bgp cleanup the l3vni a bgp instance is going down. The fix: ======== The fix is to add a function in bgp_evpn.c to be responsible for for deleting the local vni, if it should be needed, and call the function from bgp_instance_down(). Testing: ======== Created a test, which can run in container lab that remove the vrf on the host before removing the vrf and the bgp config form frr. Running this test in a loop trigger the problem 18 times of 100 runs. After the fix it did not fail. To verify the fix a log message (which is not in the code any longer) were used when we had a stale l3vni and needed to call bgp_evpn_local_l3vni_del() to do the cleanup. This were hit 20 times in 100 test runs. Signed-off-by: Kacper Kwasny bgpd: braces {} are not necessary for single line block Signed-off-by: Kacper Kwasny (cherry picked from commit 171d2583d0373b456335477dea6688d2e9e95db7) --- bgpd/bgp_evpn.c | 11 +++++++++++ bgpd/bgp_evpn.h | 1 + bgpd/bgpd.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 5ce5b19b18..5d6a5a59f5 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -6983,6 +6983,17 @@ int bgp_evpn_local_l3vni_del(vni_t l3vni, vrf_id_t vrf_id) return 0; } +/* + * When bgp instance goes down also clean up what might have been left over + * from evpn. + */ +void bgp_evpn_instance_down(struct bgp *bgp) +{ + /* If we have a stale local vni, delete it */ + if (bgp->l3vni) + bgp_evpn_local_l3vni_del(bgp->l3vni, bgp->vrf_id); +} + /* * Handle del of a local VNI. */ diff --git a/bgpd/bgp_evpn.h b/bgpd/bgp_evpn.h index 223f18a177..dc82bcfba9 100644 --- a/bgpd/bgp_evpn.h +++ b/bgpd/bgp_evpn.h @@ -153,6 +153,7 @@ extern int bgp_evpn_local_l3vni_add(vni_t vni, vrf_id_t vrf_id, struct in_addr originator_ip, int filter, ifindex_t svi_ifindex, bool is_anycast_mac); extern int bgp_evpn_local_l3vni_del(vni_t vni, vrf_id_t vrf_id); +extern void bgp_evpn_instance_down(struct bgp *bgp); extern int bgp_evpn_local_vni_del(struct bgp *bgp, vni_t vni); extern int bgp_evpn_local_vni_add(struct bgp *bgp, vni_t vni, struct in_addr originator_ip, diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 81506f4410..e4848cc204 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3875,6 +3875,9 @@ void bgp_instance_down(struct bgp *bgp) struct listnode *node; struct listnode *next; + /* Cleanup evpn instance state */ + bgp_evpn_instance_down(bgp); + /* Stop timers. */ if (bgp->t_rmap_def_originate_eval) EVENT_OFF(bgp->t_rmap_def_originate_eval); From 7bb66b83b0a400ed5abc5d310f74307409f9ecda Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Thu, 20 Jun 2024 18:02:26 +0200 Subject: [PATCH 04/81] bgpd: fix do not use api.backup_nexthop in ZAPI message The backup_nexthop entry list has been populated by mistake, and should not. Fix this by reverting the introduced behavior. Fixes: 237ebf8d4503 ("bgpd: rework bgp_zebra_announce() function, separate nexthop handling") Signed-off-by: Philippe Guibert (cherry picked from commit d4390fc21795b09b84a6b95b1f8fa1ac2b3dcda9) --- bgpd/bgp_zebra.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 8fab0d1c05..6f8f4610ca 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1331,10 +1331,7 @@ static void bgp_zebra_announce_parse_nexthop( &nh_weight)) continue; } - if (CHECK_FLAG(info->flags, BGP_PATH_SELECTED)) - api_nh = &api->nexthops[*valid_nh_count]; - else - api_nh = &api->backup_nexthops[*valid_nh_count]; + api_nh = &api->nexthops[*valid_nh_count]; api_nh->srte_color = bgp_attr_get_color(info->attr); From e33bdc00f719435222b120936d9a4b1b377b11a6 Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Tue, 18 Jun 2024 17:21:49 -0700 Subject: [PATCH 05/81] zebra: fix evpn mh bond member proto reinstall In case of EVPN MH bond, a member port going in protodown state due to external reason (one case being linkflap), frr updates the state correctly but upon manually clearing external reason trigger FRR to reinstate protodown without any reason code. Fix is to ensure if the protodown reason was external and new state is to have protodown 'off' then do no reinstate protodown. Ticket: #3947432 Testing: switch:#ip link show swp1 4: swp1: mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff protodown on protodown_reason switch:#ip link set swp1 protodown off protodown_reason linkflap off switch:#ip link show swp1 4: swp1: mtu 9216 qdisc pfifo_fast master bond1 state DOWN mode DEFAULT group default qlen 1000 link/ether 1c:34:da:2c:aa:68 brd ff:ff:ff:ff:ff:ff Signed-off-by: Chirag Shah (cherry picked from commit e4d843b438ae7cbae89ae47af0754fb1db153c6c) --- zebra/interface.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index b824977f9e..f1f24cc29f 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1656,8 +1656,10 @@ static void interface_if_protodown(struct interface *ifp, bool protodown, uint32_t rc_bitfield) { struct zebra_if *zif = ifp->info; - bool old_protodown; + bool old_protodown, reason_extern; + reason_extern = !!CHECK_FLAG(zif->protodown_rc, + ZEBRA_PROTODOWN_EXTERNAL); /* * Set our reason code to note it wasn't us. * If the reason we got from the kernel is ONLY frr though, don't @@ -1673,8 +1675,8 @@ static void interface_if_protodown(struct interface *ifp, bool protodown, return; if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_DPLANE) - zlog_debug("interface %s dplane change, protodown %s", - ifp->name, protodown ? "on" : "off"); + zlog_debug("interface %s dplane change, protodown %s curr reason_extern %u", + ifp->name, protodown ? "on" : "off", reason_extern); /* Set protodown, respectively */ COND_FLAG(zif->flags, ZIF_FLAG_PROTODOWN, protodown); @@ -1699,6 +1701,13 @@ static void interface_if_protodown(struct interface *ifp, bool protodown, return; } + if (!protodown && reason_extern) { + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL) + zlog_debug("bond member %s has protodown reason external and clear the reason, skip reinstall.", + ifp->name); + return; + } + if (IS_ZEBRA_DEBUG_EVPN_MH_ES || IS_ZEBRA_DEBUG_KERNEL) zlog_debug( "bond mbr %s reinstate protodown %s in the dplane", From 348063bbdec806d8a600f1ae6881bc72d33dc549 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 19 Jun 2024 14:09:00 +0300 Subject: [PATCH 06/81] bgpd: Set last reset reason to admin shutdown if it was manually Before this patch, we always printed the last reason "Waiting for OPEN", but if it's a manual shutdown, then we technically are not waiting for OPEN. Signed-off-by: Donatas Abraitis (cherry picked from commit c25c7e929d550c2faca3af74a29593b8c0b75db3) --- bgpd/bgpd.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index e4848cc204..1949ede124 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -4826,6 +4826,8 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg) /* iterate through peers of BGP instance */ for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) { + peer->last_reset = PEER_DOWN_USER_SHUTDOWN; + /* continue, if peer is already in administrative shutdown. */ if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)) continue; @@ -4880,8 +4882,10 @@ void bgp_shutdown_disable(struct bgp *bgp) /* clear the BGP instances shutdown flag */ UNSET_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN); - for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) + for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) { bgp_timer_set(peer->connection); + peer->last_reset = PEER_DOWN_WAITING_OPEN; + } } /* Change specified peer flag. */ @@ -4953,6 +4957,10 @@ static int peer_flag_modify(struct peer *peer, uint64_t flag, int set) bgp_zebra_terminate_radv(peer->bgp, peer); } + if (flag == PEER_FLAG_SHUTDOWN) + peer->last_reset = set ? PEER_DOWN_USER_SHUTDOWN + : PEER_DOWN_WAITING_OPEN; + /* Execute flag action on peer. */ if (action.type == peer_change_reset) peer_flag_modify_action(peer, flag); @@ -4988,6 +4996,10 @@ static int peer_flag_modify(struct peer *peer, uint64_t flag, int set) set ? bgp_zebra_initiate_radv(member->bgp, member) : bgp_zebra_terminate_radv(member->bgp, member); + if (flag == PEER_FLAG_SHUTDOWN) + member->last_reset = set ? PEER_DOWN_USER_SHUTDOWN + : PEER_DOWN_WAITING_OPEN; + /* Execute flag action on peer-group member. */ if (action.type == peer_change_reset) peer_flag_modify_action(member, flag); From dc980370159a2ed43e64c5d19981adf36b38f0bb Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 19 Jun 2024 14:32:16 +0300 Subject: [PATCH 07/81] bgpd: Remove redundant whitespace before printing the reason of the failed peer Before: ``` Neighbor EstdCnt DropCnt ResetTime Reason 127.0.0.1 0 0 never Waiting for peer OPEN (n/a) ``` After: ``` Neighbor EstdCnt DropCnt ResetTime Reason 127.0.0.1 0 0 never Waiting for peer OPEN (n/a) ``` Signed-off-by: Donatas Abraitis (cherry picked from commit b5bd626a82b2541bee8e3120139e19ba05e444c8) --- bgpd/bgp_vty.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index fbe1db9d2a..230fedf4ec 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -11661,10 +11661,9 @@ static void bgp_show_peer_reset(struct vty * vty, struct peer *peer, BGP_NOTIFY_CEASE_HARD_RESET) : ""); } else { - vty_out(vty, " %s (%s)\n", + vty_out(vty, " %s (%s)\n", peer_down_str[(int)peer->last_reset], - peer->soft_version ? peer->soft_version - : "n/a"); + peer->soft_version ? peer->soft_version : "n/a"); } } } From 9f1e1eb14271971c1835a72ec5dd9e6a1a2d13b8 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 12 Jun 2024 22:54:45 +0300 Subject: [PATCH 08/81] bgpd: Check if we have really enough data before doing memcpy for software version If we receive CAPABILITY message (software-version), we SHOULD check if we really have enough data before doing memcpy(), that could also lead to buffer overflow. (data + len > end) is not enough, because after this check we do data++ and later memcpy(..., data, len). That means we have one more byte. Hit this through fuzzing by ``` 0 0xaaaaaadf872c in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x35872c) (BuildId: 9c6e455d0d9a20f5a4d2f035b443f50add9564d7) 1 0xaaaaab06bfbc in bgp_dynamic_capability_software_version /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3713:3 2 0xaaaaab05ccb4 in bgp_capability_msg_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3839:4 3 0xaaaaab05c074 in bgp_capability_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3980:9 4 0xaaaaab05e48c in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4109:11 5 0xaaaaaae36150 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3 ``` Hit this again by Iggy \m/ Reported-by: Iggy Frankovic Signed-off-by: Donatas Abraitis (cherry picked from commit 5d7af51c4f7980507135babd94d392ca179c1bf7) --- bgpd/bgp_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 3f38790cbd..5d97894326 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -3694,7 +3694,7 @@ static void bgp_dynamic_capability_software_version(uint8_t *pnt, int action, char soft_version[BGP_MAX_SOFT_VERSION + 1] = {}; if (action == CAPABILITY_ACTION_SET) { - if (data + len > end) { + if (data + len + 1 > end) { zlog_err("%pBP: Received invalid Software Version capability length %d", peer, len); return; From b98a3a1fa8420ee84a67160b8d365a076002b5d4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 13 Jun 2024 08:12:10 +0300 Subject: [PATCH 09/81] bgpd: Check if we have really enough data before doing memcpy for FQDN capability We advance data pointer (data++), but we do memcpy() with the length that is 1-byte over, which is technically heap overflow. ``` ==411461==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50600011da1a at pc 0xc4f45a9786f0 bp 0xffffed1e2740 sp 0xffffed1e1f30 READ of size 4 at 0x50600011da1a thread T0 0 0xc4f45a9786ec in __asan_memcpy (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x3586ec) (BuildId: e794c5f796eee20c8973d7efb9bf5735e54d44cd) 1 0xc4f45abf15f8 in bgp_dynamic_capability_fqdn /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3457:4 2 0xc4f45abdd408 in bgp_capability_msg_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3911:4 3 0xc4f45abdbeb4 in bgp_capability_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:3980:9 4 0xc4f45abde2cc in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4109:11 5 0xc4f45a9b6110 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3 ``` Found by fuzzing. Reported-by: Iggy Frankovic Signed-off-by: Donatas Abraitis (cherry picked from commit b685ab5e1bdec0848502c20e9596b9716b236639) --- bgpd/bgp_packet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index 3f38790cbd..e54766aa39 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -3437,7 +3437,7 @@ static void bgp_dynamic_capability_fqdn(uint8_t *pnt, int action, } len = *data; - if (data + len > end) { + if (data + len + 1 > end) { zlog_err("%pBP: Received invalid FQDN capability length (host name) %d", peer, hdr->length); return; @@ -3468,7 +3468,7 @@ static void bgp_dynamic_capability_fqdn(uint8_t *pnt, int action, /* domainname */ len = *data; - if (data + len > end) { + if (data + len + 1 > end) { zlog_err("%pBP: Received invalid FQDN capability length (domain name) %d", peer, len); return; From 3bc367453ded2765f3ca561e8eaaeac8025c1841 Mon Sep 17 00:00:00 2001 From: Sindhu Parvathi Gopinathan Date: Wed, 19 Jun 2024 07:35:31 -0700 Subject: [PATCH 10/81] zebra: clear evpn dup-addr return error-msg when there is no vni clear evpn dup-addr cli returns error-msg for below conditions, - If evpn is not enabled & - If there is no VNI exists. supported command: ``` clear evpn dup-addr vni ``` Ticket: #3495573 Testing: bharat# clear evpn dup-addr vni all Error type: validation Error description: % EVPN not enabled bharat# clear evpn dup-addr vni 20 Error type: validation Error description: % VNI 20 does not exist Signed-off-by: Sindhu Parvathi Gopinathan's Signed-off-by: Chirag Shah (cherry picked from commit 56c16ee529b546058c8d1fabbb701d8ed2fded75) --- zebra/zebra_nb_rpcs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/zebra/zebra_nb_rpcs.c b/zebra/zebra_nb_rpcs.c index 938193df2f..744ba620f2 100644 --- a/zebra/zebra_nb_rpcs.c +++ b/zebra/zebra_nb_rpcs.c @@ -12,6 +12,8 @@ #include "zebra/zebra_router.h" #include "zebra/zebra_vrf.h" #include "zebra/zebra_vxlan.h" +#include "zebra/zebra_vxlan_if.h" +#include "zebra/zebra_evpn.h" /* * XPath: /frr-zebra:clear-evpn-dup-addr @@ -21,6 +23,11 @@ int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args) struct zebra_vrf *zvrf; int ret = NB_OK; + if (!is_evpn_enabled()) { + snprintf(args->errmsg, args->errmsg_len, + "%% EVPN not enabled\n"); + return NB_ERR_VALIDATION; + } zvrf = zebra_vrf_get_evpn(); if (yang_dnode_exists(args->input, "all-vnis")) { @@ -30,6 +37,12 @@ int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args) struct ipaddr host_ip = {.ipa_type = IPADDR_NONE}; struct ethaddr mac; + if (!zebra_evpn_lookup(vni)) { + snprintf(args->errmsg, args->errmsg_len, + "%% VNI %u does not exist\n", vni); + return NB_ERR_VALIDATION; + } + if (yang_dnode_exists(args->input, "mac-addr")) { yang_dnode_get_mac(&mac, args->input, "mac-addr"); ret = zebra_vxlan_clear_dup_detect_vni_mac(zvrf, vni, From c05a11df9e1a4f79328a7d8b9a1a350d200a0866 Mon Sep 17 00:00:00 2001 From: Francois Dumontet Date: Tue, 23 Apr 2024 11:16:24 +0200 Subject: [PATCH 11/81] bgpd: fix "bgp as-pah access-list" with "set aspath exclude" set/unset issues whith the following config router bgp 65001 no bgp ebgp-requires-policy neighbor 192.168.1.2 remote-as external neighbor 192.168.1.2 timers 3 10 ! address-family ipv4 unicast neighbor 192.168.1.2 route-map r2 in exit-address-family exit ! bgp as-path access-list FIRST seq 5 permit ^65 bgp as-path access-list SECOND seq 5 permit 2$ ! route-map r2 permit 6 match ip address prefix-list p2 set as-path exclude as-path-access-list SECOND exit ! route-map r2 permit 10 match ip address prefix-list p1 set as-path exclude 65003 exit ! route-map r2 permit 20 match ip address prefix-list p3 set as-path exclude all exit making some no bgp as-path access-list SECOND permit 2$ bgp as-path access-list SECOND permit 3$ clear bgp * no bgp as-path access-list SECOND permit 3$ bgp as-path access-list SECOND permit 2$ clear bgp * will induce some crashes thus we rework the links between aslists and aspath_exclude Signed-off-by: Francois Dumontet (cherry picked from commit 094dcc3cdac19d3da65b38effc45aa88d960909f) --- bgpd/bgp_aspath.c | 47 ++++++++++++++++++++++++++++++++++++ bgpd/bgp_aspath.h | 7 ++++++ bgpd/bgp_filter.c | 41 +++++++++++++++++++------------ bgpd/bgp_filter.h | 13 +++++----- bgpd/bgp_routemap.c | 59 ++++++++++++++++++--------------------------- 5 files changed, 108 insertions(+), 59 deletions(-) diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index 9dcd0ad1d6..4c1615a5c6 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -77,6 +77,9 @@ static struct hash *ashash; /* Stream for SNMP. See aspath_snmp_pathseg */ static struct stream *snmp_stream; +/* as-path orphan exclude list */ +static struct as_list_list_head as_exclude_list_orphan; + /* Callers are required to initialize the memory */ static as_t *assegment_data_new(int num) { @@ -1558,6 +1561,38 @@ struct aspath *aspath_prepend(struct aspath *as1, struct aspath *as2) /* Not reached */ } +/* insert aspath exclude in head of orphan exclude list*/ +void as_exclude_set_orphan(struct aspath_exclude *ase) +{ + ase->exclude_aspath_acl = NULL; + as_list_list_add_head(&as_exclude_list_orphan, ase); +} + +void as_exclude_remove_orphan(struct aspath_exclude *ase) +{ + if (as_list_list_count(&as_exclude_list_orphan)) + as_list_list_del(&as_exclude_list_orphan, ase); +} + +/* currently provide only one exclude, not a list */ +struct aspath_exclude *as_exclude_lookup_orphan(const char *acl_name) +{ + struct aspath_exclude *ase = NULL; + char *name = NULL; + + frr_each (as_list_list, &as_exclude_list_orphan, ase) { + if (ase->exclude_aspath_acl_name) { + name = ase->exclude_aspath_acl_name; + if (!strcmp(name, acl_name)) + break; + } + } + if (ase) + as_exclude_remove_orphan(ase); + + return ase; +} + /* Iterate over AS_PATH segments and wipe all occurrences of the * listed AS numbers. Hence some segments may lose some or even * all data on the way, the operation is implemented as a smarter @@ -2236,14 +2271,26 @@ void aspath_init(void) { ashash = hash_create_size(32768, aspath_key_make, aspath_cmp, "BGP AS Path"); + + as_list_list_init(&as_exclude_list_orphan); } void aspath_finish(void) { + struct aspath_exclude *ase; + hash_clean_and_free(&ashash, (void (*)(void *))aspath_free); if (snmp_stream) stream_free(snmp_stream); + + while ((ase = as_list_list_pop(&as_exclude_list_orphan))) { + aspath_free(ase->aspath); + if (ase->exclude_aspath_acl_name) + XFREE(MTYPE_TMP, ase->exclude_aspath_acl_name); + XFREE(MTYPE_ROUTE_MAP_COMPILED, ase); + } + as_list_list_fini(&as_exclude_list_orphan); } /* return and as path value */ diff --git a/bgpd/bgp_aspath.h b/bgpd/bgp_aspath.h index 2a831c3a55..f7e57fd66d 100644 --- a/bgpd/bgp_aspath.h +++ b/bgpd/bgp_aspath.h @@ -9,6 +9,7 @@ #include "lib/json.h" #include "bgpd/bgp_route.h" #include "bgpd/bgp_filter.h" +#include /* AS path segment type. */ #define AS_SET 1 @@ -67,11 +68,14 @@ struct aspath { /* `set as-path exclude ASn' */ struct aspath_exclude { + struct as_list_list_item exclude_list; struct aspath *aspath; bool exclude_all; char *exclude_aspath_acl_name; struct as_list *exclude_aspath_acl; }; +DECLARE_DLIST(as_list_list, struct aspath_exclude, exclude_list); + /* Prototypes. */ extern void aspath_init(void); @@ -83,6 +87,9 @@ extern struct aspath *aspath_parse(struct stream *s, size_t length, extern struct aspath *aspath_dup(struct aspath *aspath); extern struct aspath *aspath_aggregate(struct aspath *as1, struct aspath *as2); extern struct aspath *aspath_prepend(struct aspath *as1, struct aspath *as2); +extern void as_exclude_set_orphan(struct aspath_exclude *ase); +extern void as_exclude_remove_orphan(struct aspath_exclude *ase); +extern struct aspath_exclude *as_exclude_lookup_orphan(const char *acl_name); extern struct aspath *aspath_filter_exclude(struct aspath *source, struct aspath *exclude_list); extern struct aspath *aspath_filter_exclude_all(struct aspath *source); diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index a85117965a..002f054f5e 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -16,7 +16,7 @@ #include "bgpd/bgp_aspath.h" #include "bgpd/bgp_regex.h" -/* List of AS filter list. */ +/* List of AS list. */ struct as_list_list { struct as_list *head; struct as_list *tail; @@ -205,14 +205,6 @@ static struct as_list *as_list_new(void) static void as_list_free(struct as_list *aslist) { - struct aspath_exclude_list *cur_bp = aslist->exclude_list; - struct aspath_exclude_list *next_bp = NULL; - - while (cur_bp) { - next_bp = cur_bp->next; - XFREE(MTYPE_ROUTE_MAP_COMPILED, cur_bp); - cur_bp = next_bp; - } XFREE (MTYPE_AS_STR, aslist->name); XFREE (MTYPE_AS_LIST, aslist); @@ -299,7 +291,6 @@ static void as_list_delete(struct as_list *aslist) { struct as_list_list *list; struct as_filter *filter, *next; - struct aspath_exclude_list *cur_bp; for (filter = aslist->head; filter; filter = next) { next = filter->next; @@ -318,12 +309,6 @@ static void as_list_delete(struct as_list *aslist) else list->head = aslist->next; - cur_bp = aslist->exclude_list; - while (cur_bp) { - cur_bp->bp_as_excl->exclude_aspath_acl = NULL; - cur_bp = cur_bp->next; - } - as_list_free(aslist); } @@ -431,6 +416,7 @@ DEFUN(as_path, bgp_as_path_cmd, enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; + struct aspath_exclude *ase; regex_t *regex; char *regstr; int64_t seqnum = ASPATH_SEQ_NUMBER_AUTO; @@ -482,6 +468,22 @@ DEFUN(as_path, bgp_as_path_cmd, else as_list_filter_add(aslist, asfilter); + /* init the exclude rule list*/ + as_list_list_init(&aslist->exclude_rule); + + /* get aspath orphan exclude that are using this acl */ + ase = as_exclude_lookup_orphan(alname); + if (ase) { + as_list_list_add_head(&aslist->exclude_rule, ase); + /* set reverse pointer */ + ase->exclude_aspath_acl = aslist; + /* set list of aspath excludes using that acl */ + while ((ase = as_exclude_lookup_orphan(alname))) { + as_list_list_add_head(&aslist->exclude_rule, ase); + ase->exclude_aspath_acl = aslist; + } + } + return CMD_SUCCESS; } @@ -502,6 +504,7 @@ DEFUN(no_as_path, no_bgp_as_path_cmd, enum as_filter_type type; struct as_filter *asfilter; struct as_list *aslist; + struct aspath_exclude *ase; char *regstr; regex_t *regex; @@ -556,6 +559,12 @@ DEFUN(no_as_path, no_bgp_as_path_cmd, XFREE(MTYPE_TMP, regstr); + /* put aspath exclude list into orphan */ + if (as_list_list_count(&aslist->exclude_rule)) + while ((ase = as_list_list_pop(&aslist->exclude_rule))) + as_exclude_set_orphan(ase); + + as_list_list_fini(&aslist->exclude_rule); as_list_filter_delete(aslist, asfilter); return CMD_SUCCESS; diff --git a/bgpd/bgp_filter.h b/bgpd/bgp_filter.h index 2d9f07ce84..77a3f3c2f7 100644 --- a/bgpd/bgp_filter.h +++ b/bgpd/bgp_filter.h @@ -6,11 +6,12 @@ #ifndef _QUAGGA_BGP_FILTER_H #define _QUAGGA_BGP_FILTER_H +#include + #define ASPATH_SEQ_NUMBER_AUTO -1 enum as_filter_type { AS_FILTER_DENY, AS_FILTER_PERMIT }; - /* Element of AS path filter. */ struct as_filter { struct as_filter *next; @@ -25,11 +26,7 @@ struct as_filter { int64_t seq; }; -struct aspath_exclude_list { - struct aspath_exclude_list *next; - struct aspath_exclude *bp_as_excl; -}; - +PREDECL_DLIST(as_list_list); /* AS path filter list. */ struct as_list { char *name; @@ -39,7 +36,9 @@ struct as_list { struct as_filter *head; struct as_filter *tail; - struct aspath_exclude_list *exclude_list; + + /* Changes in AS path */ + struct as_list_list_head exclude_rule; }; diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index 9b0ca72e4c..97ae92c899 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2322,7 +2322,7 @@ static const struct route_map_rule_cmd route_set_aspath_prepend_cmd = { static void *route_aspath_exclude_compile(const char *arg) { struct aspath_exclude *ase; - struct aspath_exclude_list *ael; + struct as_list *aux_aslist; const char *str = arg; static const char asp_acl[] = "as-path-access-list"; @@ -2334,44 +2334,37 @@ static void *route_aspath_exclude_compile(const char *arg) while (*str == ' ') str++; ase->exclude_aspath_acl_name = XSTRDUP(MTYPE_TMP, str); - ase->exclude_aspath_acl = as_list_lookup(str); + aux_aslist = as_list_lookup(str); + if (!aux_aslist) + /* new orphan filter */ + as_exclude_set_orphan(ase); + else + as_list_list_add_head(&aux_aslist->exclude_rule, ase); + + ase->exclude_aspath_acl = aux_aslist; } else ase->aspath = aspath_str2aspath(str, bgp_get_asnotation(NULL)); - if (ase->exclude_aspath_acl) { - ael = XCALLOC(MTYPE_ROUTE_MAP_COMPILED, - sizeof(struct aspath_exclude_list)); - ael->bp_as_excl = ase; - ael->next = ase->exclude_aspath_acl->exclude_list; - ase->exclude_aspath_acl->exclude_list = ael; - } - return ase; } static void route_aspath_exclude_free(void *rule) { struct aspath_exclude *ase = rule; - struct aspath_exclude_list *cur_ael = NULL; - struct aspath_exclude_list *prev_ael = NULL; + struct as_list *acl; + + /* manage references to that rule*/ + if (ase->exclude_aspath_acl) { + acl = ase->exclude_aspath_acl; + as_list_list_del(&acl->exclude_rule, ase); + } else { + /* no ref to acl, this aspath exclude is orphan */ + as_exclude_remove_orphan(ase); + } aspath_free(ase->aspath); if (ase->exclude_aspath_acl_name) XFREE(MTYPE_TMP, ase->exclude_aspath_acl_name); - if (ase->exclude_aspath_acl) - cur_ael = ase->exclude_aspath_acl->exclude_list; - while (cur_ael) { - if (cur_ael->bp_as_excl == ase) { - if (prev_ael) - prev_ael->next = cur_ael->next; - else - ase->exclude_aspath_acl->exclude_list = NULL; - XFREE(MTYPE_ROUTE_MAP_COMPILED, cur_ael); - break; - } - prev_ael = cur_ael; - cur_ael = cur_ael->next; - } XFREE(MTYPE_ROUTE_MAP_COMPILED, ase); } @@ -2406,16 +2399,10 @@ route_set_aspath_exclude(void *rule, const struct prefix *dummy, void *object) else if (ase->exclude_all) path->attr->aspath = aspath_filter_exclude_all(new_path); - else if (ase->exclude_aspath_acl_name) { - if (!ase->exclude_aspath_acl) - ase->exclude_aspath_acl = - as_list_lookup(ase->exclude_aspath_acl_name); - if (ase->exclude_aspath_acl) - path->attr->aspath = - aspath_filter_exclude_acl(new_path, - ase->exclude_aspath_acl); - } - + else if (ase->exclude_aspath_acl) + path->attr->aspath = + aspath_filter_exclude_acl(new_path, + ase->exclude_aspath_acl); return RMAP_OKAY; } From 1488b47e84e652cb2cc86656c3bcebb06360c1fa Mon Sep 17 00:00:00 2001 From: Francois Dumontet Date: Wed, 24 Apr 2024 14:34:48 +0200 Subject: [PATCH 12/81] tests: improve tests for aspath exclude and bgp access list add some match in route map rules add some set unset bgp access path list add another prefix for better tests discrimination update expected results Signed-off-by: Francois Dumontet (cherry picked from commit 0df2e149970beff39915d0095614d56d5859f3ff) --- .../bgp_set_aspath_exclude/r1/bgpd.conf | 9 +++ .../bgp_set_aspath_exclude/r3/zebra.conf | 1 + .../test_bgp_set_aspath_exclude.py | 70 +++++++++++++++---- 3 files changed, 67 insertions(+), 13 deletions(-) diff --git a/tests/topotests/bgp_set_aspath_exclude/r1/bgpd.conf b/tests/topotests/bgp_set_aspath_exclude/r1/bgpd.conf index 9bef24f931..c70b4934a0 100644 --- a/tests/topotests/bgp_set_aspath_exclude/r1/bgpd.conf +++ b/tests/topotests/bgp_set_aspath_exclude/r1/bgpd.conf @@ -8,10 +8,19 @@ router bgp 65001 exit-address-family ! ip prefix-list p1 seq 5 permit 172.16.255.31/32 +ip prefix-list p2 seq 5 permit 172.16.255.32/32 +ip prefix-list p3 seq 5 permit 172.16.255.30/32 ! +bgp as-path access-list FIRST permit ^65 +bgp as-path access-list SECOND permit 2$ + +route-map r2 permit 6 + match ip address prefix-list p2 + set as-path exclude as-path-access-list SECOND route-map r2 permit 10 match ip address prefix-list p1 set as-path exclude 65003 route-map r2 permit 20 + match ip address prefix-list p3 set as-path exclude all ! diff --git a/tests/topotests/bgp_set_aspath_exclude/r3/zebra.conf b/tests/topotests/bgp_set_aspath_exclude/r3/zebra.conf index 3fa6c64484..56893158a4 100644 --- a/tests/topotests/bgp_set_aspath_exclude/r3/zebra.conf +++ b/tests/topotests/bgp_set_aspath_exclude/r3/zebra.conf @@ -1,5 +1,6 @@ ! int lo + ip address 172.16.255.30/32 ip address 172.16.255.31/32 ip address 172.16.255.32/32 ! diff --git a/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py b/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py index d373a749fe..85e7b9676d 100644 --- a/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py +++ b/tests/topotests/bgp_set_aspath_exclude/test_bgp_set_aspath_exclude.py @@ -64,29 +64,33 @@ def teardown_module(mod): expected_1 = { "routes": { + "172.16.255.30/32": [{"path": ""}], "172.16.255.31/32": [{"path": "65002"}], - "172.16.255.32/32": [{"path": ""}], + "172.16.255.32/32": [{"path": "65003"}], } } expected_2 = { "routes": { - "172.16.255.31/32": [{"path": ""}], + "172.16.255.30/32": [{"path": ""}], + "172.16.255.31/32": [{"path": "65002"}], "172.16.255.32/32": [{"path": ""}], } } expected_3 = { "routes": { - "172.16.255.31/32": [{"path": "65003"}], - "172.16.255.32/32": [{"path": "65003"}], + "172.16.255.30/32": [{"path": ""}], + "172.16.255.31/32": [{"path": "65002"}], + "172.16.255.32/32": [{"path": "65002 65003"}], } } expected_4 = { "routes": { - "172.16.255.31/32": [{"path": "65002 65003"}], - "172.16.255.32/32": [{"path": "65002 65003"}], + "172.16.255.30/32": [{"path": ""}], + "172.16.255.31/32": [{"path": "65002"}], + "172.16.255.32/32": [{"path": "65002"}], } } @@ -117,34 +121,42 @@ def test_bgp_set_aspath_exclude_access_list(): rname = "r1" r1 = tgen.gears[rname] + # tgen.mininet_cli() r1.vtysh_cmd( """ conf bgp as-path access-list FIRST permit ^65 route-map r2 permit 6 + no set as-path exclude as-path-access-list SECOND set as-path exclude as-path-access-list FIRST """ ) + # tgen.mininet_cli() + r1.vtysh_cmd( + """ +clear bgp * + """ + ) test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_2) _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) - assert result is None, "Failed overriding incoming AS-PATH with regex 1 route-map" + assert result is None, "Failed change of exclude rule in route map" r1.vtysh_cmd( """ conf - bgp as-path access-list SECOND permit 2 route-map r2 permit 6 + no set as-path exclude as-path-access-list FIRST set as-path exclude as-path-access-list SECOND """ ) # tgen.mininet_cli() - test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3) + test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_1) _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) - assert result is None, "Failed overriding incoming AS-PATH with regex 2 route-map" + assert result is None, "Failed reverting exclude rule in route map" def test_no_bgp_set_aspath_exclude_access_list(): @@ -159,15 +171,28 @@ def test_no_bgp_set_aspath_exclude_access_list(): r1.vtysh_cmd( """ conf - no bgp as-path access-list SECOND permit 2 + no bgp as-path access-list SECOND permit 2$ + """ + ) + + r1.vtysh_cmd( + """ +clear bgp * """ ) test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3) _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) - assert result is None, "Failed removing bgp as-path access-list" + assert result is None, "Failed to removing current accesslist" + # tgen.mininet_cli() + r1.vtysh_cmd( + """ +conf + bgp as-path access-list SECOND permit 3$ + """ + ) r1.vtysh_cmd( """ clear bgp * @@ -177,7 +202,26 @@ def test_no_bgp_set_aspath_exclude_access_list(): test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_4) _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) - assert result is None, "Failed to renegotiate with peers" + assert result is None, "Failed to renegotiate with peers 2" + + r1.vtysh_cmd( + """ +conf + route-map r2 permit 6 + no set as-path exclude as-path-access-list SECOND + """ + ) + + r1.vtysh_cmd( + """ +clear bgp * + """ + ) + + test_func = functools.partial(bgp_converge, tgen.gears["r1"], expected_3) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=0.5) + + assert result is None, "Failed to renegotiate with peers 2" if __name__ == "__main__": From 26fd1f816799729bf112db176cb2b180d9607887 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Mon, 24 Jun 2024 20:16:16 +0300 Subject: [PATCH 13/81] bgpd: Relax OAD (One-Administration-Domain) for RFC8212 RFC 8212 defines leak prevention for eBGP peers, but BGP-OAD defines a new peering type One Administrative Domain (OAD), where multiple ASNs could be used inside a single administrative domain. OAD allows sending non-transitive attributes, so this prevention should be relaxed too. Signed-off-by: Donatas Abraitis (cherry picked from commit 3b98ddf5018cf7526b50c15018cbaf71a38fa752) --- bgpd/bgp_route.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 94c21e1861..766b4e0751 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -6342,7 +6342,7 @@ void bgp_set_stale_route(struct peer *peer, afi_t afi, safi_t safi) bool bgp_outbound_policy_exists(struct peer *peer, struct bgp_filter *filter) { - if (peer->sort == BGP_PEER_IBGP) + if (peer->sort == BGP_PEER_IBGP || peer->sub_sort == BGP_PEER_EBGP_OAD) return true; if (peer->sort == BGP_PEER_EBGP && @@ -6355,7 +6355,7 @@ bool bgp_outbound_policy_exists(struct peer *peer, struct bgp_filter *filter) bool bgp_inbound_policy_exists(struct peer *peer, struct bgp_filter *filter) { - if (peer->sort == BGP_PEER_IBGP) + if (peer->sort == BGP_PEER_IBGP || peer->sub_sort == BGP_PEER_EBGP_OAD) return true; if (peer->sort == BGP_PEER_EBGP From c105f9acd97b37463d8c8bbefc064e1f7a28ec16 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 13 Jun 2024 08:43:21 +0300 Subject: [PATCH 14/81] bgpd: Adjust the length of tunnel encap sub-tlv by sub-tlv type Fixes: 79563af564ad0fe5b9c8d95bf080d570f87b1859 ("bgpd: Get 1 or 2 octets for Sub-TLV length (Tunnel Encap attr)") Signed-off-by: Donatas Abraitis (cherry picked from commit 34b209f0ae2caca0d1ebcde9d4095375ac31b562) --- bgpd/bgp_attr.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index da4701d069..9f377589e9 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2728,10 +2728,13 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) if (BGP_ATTR_ENCAP == type) { subtype = stream_getc(BGP_INPUT(peer)); - sublength = (subtype < 128) - ? stream_getc(BGP_INPUT(peer)) - : stream_getw(BGP_INPUT(peer)); - length -= 2; + if (subtype < 128) { + sublength = stream_getc(BGP_INPUT(peer)); + length -= 2; + } else { + sublength = stream_getw(BGP_INPUT(peer)); + length -= 3; + } #ifdef ENABLE_BGP_VNC } else { subtype = stream_getw(BGP_INPUT(peer)); From c01d60b037f0417ff1515dee5652f4115cc88ed5 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 13 Jun 2024 09:00:21 +0300 Subject: [PATCH 15/81] bgpd: Check if we have real stream data for tunnel encapsulation sub-tlvs When the packet is malformed it can use whatever values it wants. Let's check what the real data we have in a stream instead of relying on malformed values. Reported-by: Iggy Frankovic Signed-off-by: Donatas Abraitis (cherry picked from commit 9929486d6bdb28469a5b626a17d5bc9991c83ce3) --- bgpd/bgp_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 9f377589e9..18c7b13535 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2721,7 +2721,7 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) } } - while (length >= 4) { + while (STREAM_READABLE(BGP_INPUT(peer)) >= 4) { uint16_t subtype = 0; uint16_t sublength = 0; struct bgp_attr_encap_subtlv *tlv; From 73b18210f284684e3be2553269c389383f871a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Sang?= Date: Wed, 19 Jun 2024 16:19:22 +0200 Subject: [PATCH 16/81] bgpd: avoid clearing routes for peers that were never established MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Under heavy system load with many peers in passive mode and a large number of routes, bgpd can enter an infinite loop. This occurs while processing timeout BGP_OPEN messages, which prevents it from accepting new connections. The following log entries illustrate the issue: >bgpd[6151]: [VX6SM-8YE5W][EC 33554460] 3.3.2.224: nexthop_set failed, resetting connection - intf 0x0 >bgpd[6151]: [P790V-THJKS][EC 100663299] bgp_open_receive: bgp_getsockname() failed for peer: 3.3.2.224 >bgpd[6151]: [HTQD2-0R1WR][EC 33554451] bgp_process_packet: BGP OPEN receipt failed for peer: 3.3.2.224 ... repeating The issue occurs when bgpd handles a massive number of routes in the RIB while receiving numerous BGP_OPEN packets. If bgpd is overloaded, it fails to process these packets promptly, leading the remote peer to close the connection and resend BGP_OPEN packets. When bgpd eventually starts processing these timeout BGP_OPEN packets, it finds the TCP connection closed by the remote peer, resulting in "bgp_stop()" being called. For each timeout peer, bgpd must iterate through the routing table, which is time-consuming and causes new incoming BGP_OPEN packets to timeout, perpetuating the infinite loop. To address this issue, the code is modified to check if the peer has been established at least once before calling "bgp_clear_route_all()". This ensures that routes are only cleared for peers that had a successful session, preventing unnecessary iterations over the routing table for peers that never established a connection. With this change, BGP_OPEN timeout messages may still occur, but in the worst case, bgpd will stabilize. Before this patch, bgpd could enter a loop where it was unable to accpet any new connections. Signed-off-by: Loïc Sang (cherry picked from commit e0ae285eb8beeef7b43bdadc073d8ae346eaeb6c) --- bgpd/bgp_fsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 15cc5dbe2e..d41ef8abba 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -1241,7 +1241,7 @@ void bgp_fsm_change_status(struct peer_connection *connection, /* Transition into Clearing or Deleted must /always/ clear all routes.. * (and must do so before actually changing into Deleted.. */ - if (status >= Clearing) { + if (status >= Clearing && (peer->established || peer == bgp->peer_self)) { bgp_clear_route_all(peer); /* If no route was queued for the clear-node processing, From 5bd66b695dbfae167817dbaf865e90ddeabb7521 Mon Sep 17 00:00:00 2001 From: Piotr Suchy Date: Wed, 22 May 2024 10:41:52 +0200 Subject: [PATCH 17/81] bgpd: Ignore routes from evpn if VRF is unknown Fix for a bug, where FRR fails to install route received for an unknown but later-created VRF - detailed description can be found here https://github.com/FRRouting/frr/issues/13708 Signed-off-by: Piotr Suchy (cherry picked from commit 8044d733009dd428c291460eb8b0e539b53b78fa) --- bgpd/bgp_evpn.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 5d6a5a59f5..6680b54f76 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -3037,6 +3037,9 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf, vrf_id_to_name(bgp_vrf->vrf_id), evp, parent_pi, parent_pi->flags); + if (bgp_vrf->vrf_id == VRF_UNKNOWN) + return -1; + /* Create (or fetch) route within the VRF. */ /* NOTE: There is no RD here. */ if (is_evpn_prefix_ipaddr_v4(evp)) { From 8eb7d0ac1a61ac32894af790e99f0e145a5bbcf4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 27 Jun 2024 22:46:58 +0300 Subject: [PATCH 18/81] bgpd: Ignore RFC8212 for BGP Confederations RFC 8212 should be restricted for eBGP peers. Signed-off-by: Donatas Abraitis (cherry picked from commit fa2cc09d45d3f843564f7bd1e02346373c5741a8) --- bgpd/bgp_route.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 766b4e0751..f6fe87e352 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -6342,7 +6342,8 @@ void bgp_set_stale_route(struct peer *peer, afi_t afi, safi_t safi) bool bgp_outbound_policy_exists(struct peer *peer, struct bgp_filter *filter) { - if (peer->sort == BGP_PEER_IBGP || peer->sub_sort == BGP_PEER_EBGP_OAD) + if (peer->sort == BGP_PEER_CONFED || peer->sort == BGP_PEER_IBGP || + peer->sub_sort == BGP_PEER_EBGP_OAD) return true; if (peer->sort == BGP_PEER_EBGP && @@ -6355,7 +6356,8 @@ bool bgp_outbound_policy_exists(struct peer *peer, struct bgp_filter *filter) bool bgp_inbound_policy_exists(struct peer *peer, struct bgp_filter *filter) { - if (peer->sort == BGP_PEER_IBGP || peer->sub_sort == BGP_PEER_EBGP_OAD) + if (peer->sort == BGP_PEER_CONFED || peer->sort == BGP_PEER_IBGP || + peer->sub_sort == BGP_PEER_EBGP_OAD) return true; if (peer->sort == BGP_PEER_EBGP From 57dec1cfe5299331cd1ff31ba2c0c7a8a8b72931 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Thu, 27 Jun 2024 22:53:24 +0300 Subject: [PATCH 19/81] tests: Test if RFC 8212 is not involved for BGP confederations Signed-off-by: Donatas Abraitis (cherry picked from commit dd6a679e3a0e9415827643942bcc103c48a89adb) --- tests/topotests/bgp_confed1/r2/bgpd.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/topotests/bgp_confed1/r2/bgpd.conf b/tests/topotests/bgp_confed1/r2/bgpd.conf index fe13dfe729..ba2da4160e 100644 --- a/tests/topotests/bgp_confed1/r2/bgpd.conf +++ b/tests/topotests/bgp_confed1/r2/bgpd.conf @@ -4,7 +4,6 @@ !debug bgp updates out ! router bgp 200 - no bgp ebgp-requires-policy bgp confederation identifier 300 bgp confederation peers 300 neighbor 192.0.2.1 remote-as 100 @@ -12,7 +11,9 @@ router bgp 200 ! address-family ipv4 unicast network 203.0.113.16/28 + neighbor 192.0.2.1 route-map any in + neighbor 192.0.2.1 route-map any out neighbor 192.0.2.18 default-originate exit-address-family ! - +route-map any permit 10 From 46eb2c32fe74dcb9bd69198f9c828cef1e1fc310 Mon Sep 17 00:00:00 2001 From: T-Nicolas Date: Mon, 17 Jun 2024 15:05:58 +0200 Subject: [PATCH 20/81] ripd: Change the start value of sequence 1 to 0 Signed-off-by: T-Nicolas (cherry picked from commit 1a64fe4254759245a67fb279d67478922e00255e) --- ripd/ripd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ripd/ripd.c b/ripd/ripd.c index b8a140c9ca..ab4ffe5a92 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -1051,7 +1051,7 @@ static size_t rip_auth_md5_ah_write(struct stream *s, struct rip_interface *ri, /* RFC2080: The value used in the sequence number is arbitrary, but two suggestions are the time of the message's creation or a simple message counter. */ - stream_putl(s, ++seq); + stream_putl(s, seq++); /* Reserved field must be zero. */ stream_putl(s, 0); From 12e24ca567aa88a368bb25345e8796eec13c767a Mon Sep 17 00:00:00 2001 From: zhou-run Date: Thu, 27 Jun 2024 11:51:02 +0800 Subject: [PATCH 21/81] isisd: fix crash when obtaining the next hop to calculate LFA on LAN links When a neighbor connection is disconnected, it may trigger LSP re-generation as a timer task, but this process may be delayed. As a result, the list of neighbors in area->adjacency_list may be inconsistent with the neighbors in lsp->tlvs->oldstyle_reach/extended_reach. For example, the area->adjacency_list may lack certain neighbors even though they are present in the LSP. When computing SPF, the call to isis_spf_build_adj_list() generates the spftree->sadj_list, which reflects the real neighbors in the area->adjacency_list. However, in the case of LAN links, spftree->sadj_list may include additional pseudo neighbors. The pre-loading of tents through the call to isis_spf_preload_tent involves two steps: 1. isis_spf_process_lsp() is called to generate real neighbor vertices based on the root LSP and pseudo LSP. 2. isis_spf_add_local() is called to add corresponding next hops to the vertex->Adj_N list for the real neighbor vertices. In the case of LAN links, the absence of corresponding real neighbors in the spftree->sadj_list prevents the execution of the second step. Consequently, the vertex->Adj_N list for the real neighbor vertices lacks corresponding next hops. This leads to a null pointer access when isis_lfa_compute() is called to calculate LFA. As for P2P links, since there are no pseudo neighbors, only the second step is executed, which does not create real neighbor vertices and therefore does not encounter this issue. The backtrace is as follows: (gdb) bt #0 0x00007fd065277fe1 in raise () from /lib/x86_64-linux-gnu/libpthread.so.0 #1 0x00007fd065398972 in core_handler (signo=11, siginfo=0x7ffc5c0636b0, context=0x7ffc5c063580) at ../lib/sigevent.c:261 #2 #3 0x00005564d82f8408 in isis_lfa_compute (area=0x5564d8b143f0, circuit=0x5564d8b21d10, spftree=0x5564d8b06bf0, resource=0x7ffc5c064410) at ../isisd/isis_lfa.c:2134 #4 0x00005564d82f8d78 in isis_spf_run_lfa (area=0x5564d8b143f0, spftree=0x5564d8b06bf0) at ../isisd/isis_lfa.c:2344 #5 0x00005564d8315964 in isis_run_spf_with_protection (area=0x5564d8b143f0, spftree=0x5564d8b06bf0) at ../isisd/isis_spf.c:1827 #6 0x00005564d8315c15 in isis_run_spf_cb (thread=0x7ffc5c064590) at ../isisd/isis_spf.c:1889 #7 0x00007fd0653b1f04 in thread_call (thread=0x7ffc5c064590) at ../lib/thread.c:1990 #8 0x00007fd06534a97b in frr_run (master=0x5564d88103c0) at ../lib/libfrr.c:1198 #9 0x00005564d82e7d5d in main (argc=5, argv=0x7ffc5c0647b8, envp=0x7ffc5c0647e8) at ../isisd/isis_main.c:273 (gdb) f 3 #3 0x00005564d82f8408 in isis_lfa_compute (area=0x5564d8b143f0, circuit=0x5564d8b21d10, spftree=0x5564d8b06bf0, resource=0x7ffc5c064410) at ../isisd/isis_lfa.c:2134 2134 ../isisd/isis_lfa.c: No such file or directory. (gdb) p vadj_primary $1 = (struct isis_vertex_adj *) 0x0 (gdb) p vertex->Adj_N->head $2 = (struct listnode *) 0x0 (gdb) p (struct isis_vertex *)spftree->paths->l.list->head->next->next->next->next->data $8 = (struct isis_vertex *) 0x5564d8b5b240 (gdb) p $8->type $9 = VTYPE_NONPSEUDO_TE_IS (gdb) p $8->N.id $10 = "\000\000\000\000\000\002" (gdb) p $8->Adj_N->count $11 = 0 (gdb) p (struct isis_vertex *)spftree->paths->l.list->head->next->next->next->next->next->data $12 = (struct isis_vertex *) 0x5564d8b73dd0 (gdb) p $12->type $13 = VTYPE_NONPSEUDO_TE_IS (gdb) p $12->N.id $14 = "\000\000\000\000\000\003" (gdb) p $12->Adj_N->count $15 = 0 (gdb) p area->adjacency_list->count $16 = 0 The backtrace provided above pertains to version 8.5.4, but it seems that the same issue exists in the code of the master branch as well. The scenario where a vertex has no next hop is normal. For example, the "clear isis neighbor" command invokes isis_vertex_adj_del() to delete the next hop of a vertex. Upon reviewing all the instances where the vertex->Adj_N list is used, I found that only isis_lfa_compute() lacks a null check. Therefore, I believe that modifying this part will be sufficient. Additionally, the vertex->parents list for IP vertices is guaranteed not to be empty. Test scenario: Setting up LFA for LAN links and executing the "clear isis neighbor" command easily reproduces the issue. Signed-off-by: zhou-run (cherry picked from commit a970bb51b5fe32335c783860a03bb02ce74a49aa) --- isisd/isis_lfa.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/isisd/isis_lfa.c b/isisd/isis_lfa.c index 4eb57aefb0..dc8f0b96c0 100644 --- a/isisd/isis_lfa.c +++ b/isisd/isis_lfa.c @@ -2126,9 +2126,16 @@ void isis_lfa_compute(struct isis_area *area, struct isis_circuit *circuit, } vadj_primary = listnode_head(vertex->Adj_N); + if (!vadj_primary) { + if (IS_DEBUG_LFA) + zlog_debug( + "ISIS-LFA: skipping computing LFAs due to no adjacencies"); + continue; + } sadj_primary = vadj_primary->sadj; parent_vertex = listnode_head(vertex->parents); + assert(parent_vertex); prefix_metric = vertex->d_N - parent_vertex->d_N; /* From 6b7c9f0ba5271586da8657bbfcd429ac2f51752d Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Sat, 15 Jun 2024 20:34:20 +0800 Subject: [PATCH 22/81] ldpd: fix wrong gtsm count In linux networking stack, the received mpls packets will be processed by the host *twice*, one as mpls packet, the other as ip packet, so its ttl decreased 1. So, we need release the `IP_MINTTL` value if gtsm is enabled, it is for the mpls packets of neighbor session caused by the command: `label local advertise explicit-null`. This change makes the gtsm mechanism a bit deviation. Fix PR #8313 Signed-off-by: anlan_cs (cherry picked from commit 1919df3a64d3fe6d4084c1d0b050b3e368860170) --- ldpd/neighbor.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index d40728b043..2596c79481 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -681,6 +681,18 @@ nbr_gtsm_setup(int fd, int af, struct nbr_params *nbrp) if (nbrp && CHECK_FLAG(nbrp->flags, F_NBRP_GTSM_HOPS)) ttl = 256 - nbrp->gtsm_hops; + /* + * In linux networking stack, the received mpls packets + * will be processed by the host twice, one as mpls packet, + * the other as ip packet, so its ttl will be decreased 1. + * This behavior is based on the new kernel (5.10 and 6.1), + * and older versions may behave differently. + * + * Here, decrease 1 for IP_MINTTL if GTSM is enabled. + * And this workaround makes the GTSM mechanism a bit deviation. + */ + ttl -= 1; + switch (af) { case AF_INET: if (sock_set_ipv4_minttl(fd, ttl) == -1) From 7ac9e7f96dbe7c66150b3747b25badc464c024cd Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Wed, 10 Jul 2024 14:18:51 -0500 Subject: [PATCH 23/81] tests: tweak timers to avoid frequent failures on slow CI hardware Signed-off-by: Jafar Al-Gharaibeh (cherry picked from commit ad7a1f9487edc75fbfaf932e929a008c8bcbc4f9) --- .../ospf_metric_propagation/r1/frr.conf | 6 +++--- .../r1/show_ip_route-1.json | 19 +------------------ .../r1/show_ip_route-2.json | 19 +------------------ .../r1/show_ip_route-3.json | 19 +------------------ .../r1/show_ip_route-4.json | 19 +------------------ .../r1/show_ip_route-5.json | 19 +------------------ .../r1/show_ip_route-6.json | 19 +------------------ .../ospf_metric_propagation/r2/frr.conf | 6 +++--- .../ospf_metric_propagation/r3/frr.conf | 6 +++--- .../ospf_metric_propagation/r4/frr.conf | 6 +++--- .../ospf_metric_propagation/ra/frr.conf | 6 +++--- .../ospf_metric_propagation/rb/frr.conf | 6 +++--- .../ospf_metric_propagation/rc/frr.conf | 4 ++-- .../test_ospf_metric_propagation.py | 12 ++++++------ 14 files changed, 32 insertions(+), 134 deletions(-) diff --git a/tests/topotests/ospf_metric_propagation/r1/frr.conf b/tests/topotests/ospf_metric_propagation/r1/frr.conf index 85230494dd..4966e6a9da 100644 --- a/tests/topotests/ospf_metric_propagation/r1/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r1/frr.conf @@ -8,18 +8,18 @@ interface r1-eth0 ip address 10.0.1.1/24 ip ospf cost 100 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r1-eth1 vrf blue ip address 10.0.10.1/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! ! interface r1-eth2 vrf green ip address 10.0.91.1/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! ! router ospf diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-1.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-1.json index 4f1ced81fb..2392b40fa9 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-1.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-1.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":34, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.10.5", - "afi":"ipv4", "interfaceName":"r1-eth1", - "vrf":"blue", - "active":true, - "weight":1 + "vrf":"blue" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-2.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-2.json index 882d3ca4f0..9a3d3d87b7 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-2.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-2.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":136, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.1.2", - "afi":"ipv4", "interfaceName":"r1-eth0", - "vrf":"default", - "active":true, - "weight":1 + "vrf":"default" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-3.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-3.json index cd528459ab..5f0331f3cd 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-3.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-3.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":1138, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.1.2", - "afi":"ipv4", "interfaceName":"r1-eth0", - "vrf":"default", - "active":true, - "weight":1 + "vrf":"default" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-4.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-4.json index 133f37549e..f312291e86 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-4.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-4.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":1218, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.1.2", - "afi":"ipv4", "interfaceName":"r1-eth0", - "vrf":"default", - "active":true, - "weight":1 + "vrf":"default" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-5.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-5.json index 5d80509021..e88c037174 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-5.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-5.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":238, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.1.2", - "afi":"ipv4", "interfaceName":"r1-eth0", - "vrf":"default", - "active":true, - "weight":1 + "vrf":"default" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-6.json b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-6.json index 1b59707b98..f1fec860a9 100644 --- a/tests/topotests/ospf_metric_propagation/r1/show_ip_route-6.json +++ b/tests/topotests/ospf_metric_propagation/r1/show_ip_route-6.json @@ -2,32 +2,15 @@ "10.0.94.0/24":[ { "prefix":"10.0.94.0/24", - "prefixLen":24, "protocol":"bgp", "vrfName":"green", - "selected":true, - "destSelected":true, - "distance":20, "metric":136, "installed":true, - "table":12, - "internalStatus":16, - "internalFlags":8, - "internalNextHopNum":1, - "internalNextHopActiveNum":1, - "nexthopGroupId":"*", - "installedNexthopGroupId":"*", - "uptime":"*", "nexthops":[ { - "flags":3, - "fib":true, "ip":"10.0.10.5", - "afi":"ipv4", "interfaceName":"r1-eth1", - "vrf":"blue", - "active":true, - "weight":1 + "vrf":"blue" } ] } diff --git a/tests/topotests/ospf_metric_propagation/r2/frr.conf b/tests/topotests/ospf_metric_propagation/r2/frr.conf index e67a374ff5..0ac5001b1b 100644 --- a/tests/topotests/ospf_metric_propagation/r2/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r2/frr.conf @@ -8,18 +8,18 @@ interface r2-eth0 ip address 10.0.1.2/24 ip ospf cost 100 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r2-eth1 vrf blue ip address 10.0.20.2/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r2-eth2 vrf green ip address 10.0.70.2/24 ip ospf cost 1000 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.2 diff --git a/tests/topotests/ospf_metric_propagation/r3/frr.conf b/tests/topotests/ospf_metric_propagation/r3/frr.conf index 175851d427..0859173f79 100644 --- a/tests/topotests/ospf_metric_propagation/r3/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r3/frr.conf @@ -8,18 +8,18 @@ interface r3-eth0 ip address 10.0.3.3/24 ip ospf cost 100 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r3-eth1 vrf blue ip address 10.0.30.3/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r3-eth2 vrf green ip address 10.0.80.3/24 ip ospf cost 1000 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.3 diff --git a/tests/topotests/ospf_metric_propagation/r4/frr.conf b/tests/topotests/ospf_metric_propagation/r4/frr.conf index 70a47e34fa..743da27272 100644 --- a/tests/topotests/ospf_metric_propagation/r4/frr.conf +++ b/tests/topotests/ospf_metric_propagation/r4/frr.conf @@ -8,17 +8,17 @@ interface r4-eth0 ip address 10.0.3.4/24 ip ospf cost 100 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r4-eth1 vrf blue ip address 10.0.40.4/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface r4-eth2 vrf green ip address 10.0.94.4/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.4 diff --git a/tests/topotests/ospf_metric_propagation/ra/frr.conf b/tests/topotests/ospf_metric_propagation/ra/frr.conf index 7be9e5c33e..2434faeabc 100644 --- a/tests/topotests/ospf_metric_propagation/ra/frr.conf +++ b/tests/topotests/ospf_metric_propagation/ra/frr.conf @@ -7,17 +7,17 @@ ip forwarding interface ra-eth0 ip address 10.0.50.5/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface ra-eth1 ip address 10.0.10.5/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface ra-eth2 ip address 10.0.20.5/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.5 diff --git a/tests/topotests/ospf_metric_propagation/rb/frr.conf b/tests/topotests/ospf_metric_propagation/rb/frr.conf index a7dbf82278..b83532a840 100644 --- a/tests/topotests/ospf_metric_propagation/rb/frr.conf +++ b/tests/topotests/ospf_metric_propagation/rb/frr.conf @@ -7,17 +7,17 @@ ip forwarding interface rb-eth0 ip address 10.0.50.6/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface rb-eth1 ip address 10.0.30.6/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface rb-eth2 ip address 10.0.40.6/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.6 diff --git a/tests/topotests/ospf_metric_propagation/rc/frr.conf b/tests/topotests/ospf_metric_propagation/rc/frr.conf index f5a2ed7c4f..dd8077c394 100644 --- a/tests/topotests/ospf_metric_propagation/rc/frr.conf +++ b/tests/topotests/ospf_metric_propagation/rc/frr.conf @@ -7,12 +7,12 @@ ip forwarding interface rc-eth0 ip address 10.0.70.7/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! interface rc-eth1 ip address 10.0.80.7/24 ip ospf hello-interval 1 - ip ospf dead-interval 30 + ip ospf dead-interval 40 ! router ospf ospf router-id 10.0.255.7 diff --git a/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py b/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py index 085eb1f9c1..ea96265176 100644 --- a/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py +++ b/tests/topotests/ospf_metric_propagation/test_ospf_metric_propagation.py @@ -283,7 +283,7 @@ def test_link_1_2_3_4_down(): assert result is None, assertmsg -def test_link_1_2_4_down(): +def test_link_1_2_4_down_3_up(): "Test path R1 -> R2 -> Rc -> R3 -> R4" tgen = get_topogen() @@ -305,7 +305,7 @@ def test_link_1_2_4_down(): assert result is None, assertmsg -def test_link_1_4_down(): +def test_link_1_4_down_2_up(): "Test path R1 -> R2 -> Ra -> Rb -> R3 -> R4" tgen = get_topogen() @@ -321,13 +321,13 @@ def test_link_1_4_down(): test_func = partial( topotest.router_json_cmp, r1, "show ip route vrf green 10.0.94.2 json", expected ) - _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) + _, result = topotest.run_and_expect(test_func, None, count=120, wait=2) assertmsg = "r1 JSON output mismatches" assert result is None, assertmsg -def test_link_4_down(): +def test_link_4_down_1_up(): "Test path R1 -> Ra -> Rb -> R3 -> R4" tgen = get_topogen() @@ -343,7 +343,7 @@ def test_link_4_down(): test_func = partial( topotest.router_json_cmp, r1, "show ip route vrf green 10.0.94.2 json", expected ) - _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) + _, result = topotest.run_and_expect(test_func, None, count=120, wait=2) assertmsg = "r1 JSON output mismatches" assert result is None, assertmsg @@ -365,7 +365,7 @@ def test_link_1_2_3_4_up(): test_func = partial( topotest.router_json_cmp, r1, "show ip route vrf green 10.0.94.2 json", expected ) - _, result = topotest.run_and_expect(test_func, None, count=60, wait=1) + _, result = topotest.run_and_expect(test_func, None, count=120, wait=2) assertmsg = "r1 JSON output mismatches" assert result is None, assertmsg From 09bfdc3f8199d7559f7bf192d39a67176b504a21 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Fri, 5 Jul 2024 16:02:12 -0700 Subject: [PATCH 24/81] zebra: Fix to avoid two Vrfs with same table ids During internal testing, when the following sequence is followed, two non default vrfs end up pointing to the same table-id - Initially vrf201 has table id 1002 - ip link add dev vrf202 type vrf table 1002 - ip link set dev vrf202 up - ip link set dev master vrf202 This will ideally lead to zebra exit since this is a misconfiguration as expected. However if we perform a restart frr.service at this point, we end up having two vrfs pointing to same table-id and bad things can happen. This is because in the interface_vrf_change, we incorrectly check for vrf_lookup_by_id() to evaluate if there is a misconfig. This works well for a non restart case but not for the startup case. root@mlx-3700-20:mgmt:/var/log/frr# sudo vtysh -c "sh vrf" vrf mgmt id 37 table 1001 vrf vrf201 id 46 table 1002 vrf vrf202 id 59 table 1002 >>>> Fix: in all cases of misconfiguration, exit zebra as expected. Ticket :#3970414 Signed-off-by: Donald Sharp Signed-off-by: Rajasekar Raja (cherry picked from commit c77e15710d6a3a9be71f41a9ce608f06b2795dfb) --- zebra/interface.c | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/zebra/interface.c b/zebra/interface.c index f1f24cc29f..b3adc4483e 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1483,23 +1483,27 @@ static void interface_vrf_change(enum dplane_op_e op, ifindex_t ifindex, "DPLANE_OP_INTF_UPDATE for VRF %s(%u) table %u", name, ifindex, tableid); - if (!vrf_lookup_by_id((vrf_id_t)ifindex)) { - vrf_id_t exist_id; - - exist_id = zebra_vrf_lookup_by_table(tableid, ns_id); - if (exist_id != VRF_DEFAULT) { - vrf = vrf_lookup_by_id(exist_id); - - if (vrf) - flog_err(EC_ZEBRA_VRF_MISCONFIGURED, - "VRF %s id %u table id overlaps existing vrf %s(%d), misconfiguration exiting", - name, ifindex, vrf->name, - vrf->vrf_id); - else - flog_err(EC_ZEBRA_VRF_NOT_FOUND, - "VRF %s id %u does not exist", - name, ifindex); + /* + * For a given tableid, if there already exists a vrf and it + * is different from the current vrf to be operated, then there + * is a misconfiguration and zebra will exit. + */ + vrf_id_t exist_id = zebra_vrf_lookup_by_table(tableid, ns_id); + + if (exist_id != VRF_DEFAULT) { + vrf = vrf_lookup_by_id(exist_id); + + if (!vrf_lookup_by_id((vrf_id_t)ifindex) && !vrf) { + flog_err(EC_ZEBRA_VRF_NOT_FOUND, + "VRF %s id %u does not exist", name, + ifindex); + exit(-1); + } + if (vrf && strcmp(name, vrf->name)) { + flog_err(EC_ZEBRA_VRF_MISCONFIGURED, + "VRF %s id %u table id overlaps existing vrf %s(%d), misconfiguration exiting", + name, ifindex, vrf->name, vrf->vrf_id); exit(-1); } } From 11812ec93ba656f28b157e4da6c6ca6eebca7ac2 Mon Sep 17 00:00:00 2001 From: anlan_cs Date: Fri, 12 Jul 2024 17:03:03 +0800 Subject: [PATCH 25/81] zebra: fix missing static routes Use `vtysh` with this input file: ``` ip route A nh1 ip route A nh2 ip route B nh1 ip route B nh2 ``` When running "ip route B" with "nh1" and "nh2", the procedure maybe is: 1) Create the two nexthops: "nh1" and "nh2". 2) Register "nh1" with `static_zebra_nht_register()`, then the states of both "nh1" and "nht2" are set to "STATIC_SENT_TO_ZEBRA". 3) Register "nh2" with `static_zebra_nht_register()`, then only the routes with nexthop of "STATIC_START" will be sent to zebra. So, send the routes with the nexthop of "STATIC_SENT_TO_ZEBRA" to zebra. Signed-off-by: anlan_cs (cherry picked from commit 4518d386f7683289b079708fcdb0c42ced4754d9) --- staticd/static_zebra.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c index c4efc14a9d..420ed7903b 100644 --- a/staticd/static_zebra.c +++ b/staticd/static_zebra.c @@ -341,7 +341,8 @@ void static_zebra_nht_register(struct static_nexthop *nh, bool reg) /* refresh with existing data */ afi_t afi = prefix_afi(&lookup.nh); - if (nh->state == STATIC_NOT_INSTALLED) + if (nh->state == STATIC_NOT_INSTALLED || + nh->state == STATIC_SENT_TO_ZEBRA) nh->state = STATIC_START; static_nht_update(&rn->p, &nhtd->nh, nhtd->nh_num, afi, si->safi, nh->nh_vrf_id); From f727c63790606055979d9d4bd98d0ba3a04abbd0 Mon Sep 17 00:00:00 2001 From: zhou-run Date: Thu, 11 Jul 2024 11:35:34 +0800 Subject: [PATCH 26/81] isisd: fix crash when calculating the neighbor spanning tree based on the fragmented LSP 1. When the root IS regenerates an LSP, it calls lsp_build() -> lsp_clear_data() to free the TLV memory of the first fragment and all other fragments. If the number of fragments in the regenerated LSP decreases or if no fragmentation is needed, the extra LSP fragments are not immediately deleted. Instead, lsp_seqno_update() -> lsp_purge() is called to set the remaining time to zero and start aging, while also notifying other IS nodes to age these fragments. lsp_purge() usually does not reset lsp->hdr.seqno to zero because the LSP might recover during the aging process. 2. When other IS nodes receive an LSP, they always call process_lsp() -> isis_unpack_tlvs() to allocate TLV memory for the LSP. This does not differentiate whether the received LSP has a remaining lifetime of zero. Therefore, it is rare for an LSP of a non-root IS to have empty TLVs. Of course, if an LSP with a remaining time of zero and already corrupted is received, lsp_update() -> lsp_purge() will be called to free the TLV memory of the LSP, but this scenario is rare. 3. In LFA calculations, neighbors of the root IS are traversed, and each neighbor is taken as a new root to compute the neighbor SPT. During this process, the old root IS will serve as a neighbor of the new root IS, triggering a call to isis_spf_process_lsp() to parse the LSP of the old root IS and obtain its IP vertices and neighboring IS vertices. However, isis_spf_process_lsp() only checks whether the TLVs in the first fragment of the LSP exist, and does not check the TLVs in the fragmented LSP. If the TLV memory of the fragmented LSP of the old root IS has been freed, it can lead to a null pointer access, causing the current crash. Additionally, for the base SPT, there are only two places where the LSP of the root IS is parsed: 1. When obtaining the UP neighbors of the root IS via spf_adj_list_parse_lsp(). 2. When preloading the IP vertices of the root IS via isis_lsp_iterate_ip_reach(). Both of these checks ensure that frag->tlvs is not null, and they do not subsequently call isis_spf_process_lsp() to parse the root IS's LSP. It is very rare for non-root IS LSPs to have empty TLVs unless they are corrupted LSPs awaiting deletion. If it happens, a crash will occur. The backtrace is as follows: (gdb) bt #0 0x00007f3097281fe1 in raise () from /lib/x86_64-linux-gnu/libpthread.so.0 #1 0x00007f30973a2972 in core_handler (signo=11, siginfo=0x7ffce66c2870, context=0x7ffce66c2740) at ../lib/sigevent.c:261 #2 #3 0x000055dfa805512b in isis_spf_process_lsp (spftree=0x55dfa950eee0, lsp=0x55dfa94cb590, cost=10, depth=1, root_sysid=0x55dfa950ef6c "", parent=0x55dfa952fca0) at ../isisd/isis_spf.c:898 #4 0x000055dfa805743b in isis_spf_loop (spftree=0x55dfa950eee0, root_sysid=0x55dfa950ef6c "") at ../isisd/isis_spf.c:1688 #5 0x000055dfa805784f in isis_run_spf (spftree=0x55dfa950eee0) at ../isisd/isis_spf.c:1808 #6 0x000055dfa8037ff5 in isis_spf_run_neighbors (spftree=0x55dfa9474440) at ../isisd/isis_lfa.c:1259 #7 0x000055dfa803ac17 in isis_spf_run_lfa (area=0x55dfa9477510, spftree=0x55dfa9474440) at ../isisd/isis_lfa.c:2300 #8 0x000055dfa8057964 in isis_run_spf_with_protection (area=0x55dfa9477510, spftree=0x55dfa9474440) at ../isisd/isis_spf.c:1827 #9 0x000055dfa8057c15 in isis_run_spf_cb (thread=0x7ffce66c38e0) at ../isisd/isis_spf.c:1889 #10 0x00007f30973bbf04 in thread_call (thread=0x7ffce66c38e0) at ../lib/thread.c:1990 #11 0x00007f309735497b in frr_run (master=0x55dfa91733c0) at ../lib/libfrr.c:1198 #12 0x000055dfa8029d5d in main (argc=5, argv=0x7ffce66c3b08, envp=0x7ffce66c3b38) at ../isisd/isis_main.c:273 (gdb) f 3 #3 0x000055dfa805512b in isis_spf_process_lsp (spftree=0x55dfa950eee0, lsp=0x55dfa94cb590, cost=10, depth=1, root_sysid=0x55dfa950ef6c "", parent=0x55dfa952fca0) at ../isisd/isis_spf.c:898 898 ../isisd/isis_spf.c: No such file or directory. (gdb) p te_neighs $1 = (struct isis_item_list *) 0x120 (gdb) p lsp->tlvs $2 = (struct isis_tlvs *) 0x0 (gdb) p lsp->hdr $3 = {pdu_len = 27, rem_lifetime = 0, lsp_id = "\000\000\000\000\000\001\000\001", seqno = 4, checksum = 59918, lsp_bits = 1 '\001'} The backtrace provided above pertains to version 8.5.4, but it seems that the same issue exists in the code of the master branch as well. I have reviewed the process for calculating the SPT based on the LSP, and isis_spf_process_lsp() is the only function that does not check whether the TLVs in the fragments are empty. Therefore, I believe that modifying this function alone should be sufficient. If the TLVs of the current fragment are already empty, we do not need to continue processing subsequent fragments. This is consistent with the behavior where we do not process fragments if the TLVs of the first fragment are empty. Of course, one could argue that lsp_purge() should still retain the TLV memory, freeing it and then reallocating it if needed. However, this is a debatable point because in some scenarios, it is permissible for the LSP to have empty TLVs. For example, after receiving an SNP (Sequence Number PDU) message, an empty LSP (with lsp->hdr.seqno = 0) might be created by calling lsp_new. If the corresponding LSP message is discarded due to domain or area authentication failure, the TLV memory wouldn't be allocated. Test scenario: In an LFA network, importing a sufficient number of static routes to cause LSP fragmentation, and then rolling back the imported static routes so that the LSP is no longer fragmented, can easily result in this issue. Signed-off-by: zhou-run (cherry picked from commit e905177a8c9d67713682d46934c7a87a0913c250) --- isisd/isis_spf.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c index e349373372..1197f8c372 100644 --- a/isisd/isis_spf.c +++ b/isisd/isis_spf.c @@ -873,6 +873,9 @@ static int isis_spf_process_lsp(struct isis_spftree *spftree, || (mt_router_info && !mt_router_info->overload)); lspfragloop: + if (!lsp->tlvs) + return ISIS_OK; + if (lsp->hdr.seqno == 0) { zlog_warn("%s: lsp with 0 seq_num - ignore", __func__); return ISIS_WARNING; From 6c573ce3050792382974d2c0b5146eec04a61fab Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Fri, 12 Jul 2024 17:09:16 +0300 Subject: [PATCH 27/81] bgpd: Mark VRF instance as auto created if import vrf is configured for this instance If we create a new BGP instance (in this case VRF instance), it MUST be marked as auto created, to avoid bgpd changing VRF instance's ASN to the default VRF's. That's because of the ordering when FRR reload is happening. Signed-off-by: Donatas Abraitis (cherry picked from commit 80a4f87c9a38d5e893f7e24da11cc0c885db682e) --- bgpd/bgp_vty.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 230fedf4ec..4c394b6770 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -10435,12 +10435,20 @@ DEFPY(bgp_imexport_vrf, bgp_imexport_vrf_cmd, vrf_bgp = bgp_lookup_by_name(import_name); if (!vrf_bgp) { - if (strcmp(import_name, VRF_DEFAULT_NAME) == 0) + if (strcmp(import_name, VRF_DEFAULT_NAME) == 0) { vrf_bgp = bgp_default; - else + } else { /* Auto-create assuming the same AS */ ret = bgp_get_vty(&vrf_bgp, &as, import_name, bgp_type, NULL, ASNOTATION_UNDEFINED); + + /* Auto created VRF instances should be marked + * properly, otherwise we have a state after bgpd + * restart where VRF instance has default VRF's ASN. + */ + SET_FLAG(vrf_bgp->vrf_flags, BGP_VRF_AUTO); + } + if (ret) { vty_out(vty, "VRF %s is not configured as a bgp instance\n", From 906711c8f6c1bd26c47dce5ff81b5b0272d57a65 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sat, 13 Jul 2024 12:43:31 +0300 Subject: [PATCH 28/81] tests: Check if multiple VRF instances can have different ASNs Signed-off-by: Donatas Abraitis (cherry picked from commit 7540364e58b08da7442927c1a9ffbd535d94fc46) --- .../bgp_vrf_different_asn/__init__.py | 0 .../bgp_vrf_different_asn/r1/frr.conf | 18 ++++ .../test_bgp_vrf_different_asn.py | 89 +++++++++++++++++++ 3 files changed, 107 insertions(+) create mode 100644 tests/topotests/bgp_vrf_different_asn/__init__.py create mode 100644 tests/topotests/bgp_vrf_different_asn/r1/frr.conf create mode 100644 tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py diff --git a/tests/topotests/bgp_vrf_different_asn/__init__.py b/tests/topotests/bgp_vrf_different_asn/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/topotests/bgp_vrf_different_asn/r1/frr.conf b/tests/topotests/bgp_vrf_different_asn/r1/frr.conf new file mode 100644 index 0000000000..b325dfb7f0 --- /dev/null +++ b/tests/topotests/bgp_vrf_different_asn/r1/frr.conf @@ -0,0 +1,18 @@ +! +vrf vrf100 + vni 10100 +exit-vrf +! +interface r1-eth0 vrf vrf100 + ip address 192.168.1.1/24 +! +router bgp 65000 + address-family ipv4 unicast + import vrf vrf100 + exit-address-family +! +router bgp 65100 vrf vrf100 + address-family ipv4 unicast + redistribute connected + exit-address-family +! diff --git a/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py b/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py new file mode 100644 index 0000000000..7334305ae4 --- /dev/null +++ b/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py @@ -0,0 +1,89 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: ISC + +# +# Copyright (c) 2024 by +# Donatas Abraitis +# + +import os +import sys +import json +import pytest +import functools + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen + +pytestmark = [pytest.mark.bgpd] + + +def build_topo(tgen): + for routern in range(1, 2): + tgen.add_router("r{}".format(routern)) + + switch = tgen.add_switch("s1") + switch.add_link(tgen.gears["r1"]) + + +def setup_module(mod): + tgen = Topogen(build_topo, mod.__name__) + tgen.start_topology() + + r1 = tgen.gears["r1"] + r1.run("ip link add vrf100 type vrf table 1001") + r1.run("ip link set up dev vrf100") + r1.run("ip link set r1-eth0 master vrf100") + + router_list = tgen.routers() + + for _, (rname, router) in enumerate(router_list.items(), 1): + router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname))) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def test_bgp_vrf_different_asn(): + tgen = get_topogen() + + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + def _bgp_check_imported_route(): + output = json.loads( + tgen.gears["r1"].vtysh_cmd("show ip route 192.168.1.0/24 json") + ) + expected = { + "192.168.1.0/24": [ + { + "installed": True, + "selected": True, + "nexthops": [ + { + "interfaceName": "vrf100", + "vrf": "vrf100", + "active": True, + } + ], + } + ] + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_check_imported_route) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert result is None, "Can't see 192.168.1.0/24 being imported into a default VRF" + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) From b5db1e7352de7b581d9f485b5cffa373c3e66ebf Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sat, 13 Jul 2024 23:19:57 +0300 Subject: [PATCH 29/81] bgpd: Skip automatically created BGP instances for show CMDs When using e.g. `adverise-all-vni`, and/or `import vrf ...`, the VRF instance is created with a default's VRF ASN and tagged as AUTO_VRF. We MUST skip them here also. Signed-off-by: Donatas Abraitis (cherry picked from commit 03c086866bdee9daf55420b88593345b9eb6be15) --- bgpd/bgp_vty.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 4c394b6770..082dcdeba5 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -12621,6 +12621,9 @@ static void bgp_show_all_instances_summary_vty(struct vty *vty, afi_t afi, vty_out(vty, "{\n"); for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + nbr_output = true; if (use_json) { if (!is_first) @@ -16002,6 +16005,9 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty, vty_out(vty, "{\n"); for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + nbr_output = true; if (use_json) { if (!(json = json_object_new_object())) { @@ -16561,6 +16567,9 @@ static int bgp_show_all_instance_route_leak_vty(struct vty *vty, afi_t afi, if (bgp->inst_type != BGP_INSTANCE_TYPE_DEFAULT) vrf_name = bgp->name; + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + if (use_json) { json_vrf = json_object_new_object(); } else { @@ -16651,6 +16660,9 @@ static void bgp_show_all_instances_updgrps_vty(struct vty *vty, afi_t afi, struct bgp *bgp; for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + if (!uj) vty_out(vty, "\nInstance %s:\n", (bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT) From 19a0e3d5445d01b8d6aa3017d4347f39ab6b9c2e Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sat, 13 Jul 2024 13:14:33 +0300 Subject: [PATCH 30/81] tests: Check if VRF instance has a different ASN than a default VRF Signed-off-by: Donatas Abraitis (cherry picked from commit c6c0403c61c157a9507781c332e152a2b220da52) --- .../test_bgp_vrf_different_asn.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py b/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py index 7334305ae4..9a1a9ec766 100644 --- a/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py +++ b/tests/topotests/bgp_vrf_different_asn/test_bgp_vrf_different_asn.py @@ -58,6 +58,24 @@ def test_bgp_vrf_different_asn(): if tgen.routers_have_failure(): pytest.skip(tgen.errors) + def _bgp_check_instances(): + output = json.loads(tgen.gears["r1"].vtysh_cmd("show bgp vrf all json")) + expected = { + "default": { + "vrfName": "default", + "localAS": 65000, + }, + "vrf100": { + "vrfName": "vrf100", + "localAS": 65100, + }, + } + return topotest.json_cmp(output, expected) + + test_func = functools.partial(_bgp_check_instances) + _, result = topotest.run_and_expect(test_func, None, count=30, wait=1) + assert result is None, "Can't see vrf100 to be under 65100 ASN" + def _bgp_check_imported_route(): output = json.loads( tgen.gears["r1"].vtysh_cmd("show ip route 192.168.1.0/24 json") From 2ab249e5806b1f5fc2f8d74293005e4825681542 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Mon, 15 Jul 2024 16:20:31 +0300 Subject: [PATCH 31/81] bgpd: Skip empty (auto created) VRF instances when deleting a default BGP instance Auto created VRF instances does not have any config, so it's not relevant depending on them. Signed-off-by: Donatas Abraitis (cherry picked from commit bfedb38110e8d3e5471718a0f9abe8836ffc7143) --- bgpd/bgp_vty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 082dcdeba5..38c335f75a 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1701,6 +1701,10 @@ DEFUN (no_router_bgp, for (ALL_LIST_ELEMENTS_RO(bm->bgp, node, tmp_bgp)) { if (tmp_bgp->inst_type != BGP_INSTANCE_TYPE_VRF) continue; + + if (CHECK_FLAG(tmp_bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + if (CHECK_FLAG( tmp_bgp->af_flags[AFI_IP] [SAFI_UNICAST], From 9f9c0bc2447e3a878c1edfda8266c14ff0c9f287 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Wed, 10 Jul 2024 16:46:29 -0700 Subject: [PATCH 32/81] bgpd: backpressure - fix to properly remove dest for bgp under deletion In case of imported routes (L3vni/vrf leaks), when a bgp instance is being deleted, the peer->bgp comparision with the incoming bgp to remove the dest from the pending fifo is wrong. This can lead to the fifo having stale entries resulting in crash. Two changes are done here. - Instead of pop/push items in list if the struct bgp doesnt match, simply iterate the list and remove the expected ones. - Corrected the way bgp is fetched from dest rather than relying on path_info->peer so that it works for all kinds of routes. Ticket :#3980988 Signed-off-by: Chirag Shah Signed-off-by: Rajasekar Raja (cherry picked from commit 4395fcd8e120958a91d3a11f918e9071b1cb5619) --- bgpd/bgp_evpn.c | 12 ++++++------ bgpd/bgpd.c | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 6680b54f76..9a796ef91b 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -6332,16 +6332,16 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni, void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn) { struct bgp_dest *dest = NULL; - uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head); + struct bgp_dest *dest_next = NULL; - while (ann_count) { - dest = zebra_announce_pop(&bm->zebra_announce_head); - ann_count--; + for (dest = zebra_announce_first(&bm->zebra_announce_head); dest; + dest = dest_next) { + dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); if (dest->za_vpn == vpn) { bgp_path_info_unlock(dest->za_bgp_pi); bgp_dest_unlock_node(dest); - } else - zebra_announce_add_tail(&bm->zebra_announce_head, dest); + zebra_announce_del(&bm->zebra_announce_head, dest); + } } bgp_evpn_remote_ip_hash_destroy(vpn); diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 1949ede124..a5ba540135 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3913,19 +3913,25 @@ int bgp_delete(struct bgp *bgp) safi_t safi; int i; struct bgp_dest *dest = NULL; + struct bgp_dest *dest_next = NULL; + struct bgp_table *dest_table = NULL; struct graceful_restart_info *gr_info; - uint32_t ann_count = zebra_announce_count(&bm->zebra_announce_head); assert(bgp); - while (ann_count) { - dest = zebra_announce_pop(&bm->zebra_announce_head); - ann_count--; - if (dest->za_bgp_pi->peer->bgp == bgp) { + /* + * Iterate the pending dest list and remove all the dest pertaininig to + * the bgp under delete. + */ + for (dest = zebra_announce_first(&bm->zebra_announce_head); dest; + dest = dest_next) { + dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); + dest_table = bgp_dest_table(dest); + if (dest_table->bgp == bgp) { bgp_path_info_unlock(dest->za_bgp_pi); bgp_dest_unlock_node(dest); - } else - zebra_announce_add_tail(&bm->zebra_announce_head, dest); + zebra_announce_del(&bm->zebra_announce_head, dest); + } } bgp_soft_reconfig_table_task_cancel(bgp, NULL, NULL); From 25d515cb2597a2d7963393b6c6b7aa6c8f43e067 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Wed, 10 Jul 2024 20:17:14 -0700 Subject: [PATCH 33/81] bgpd: backpressure - Improve debuggability Improve debuggability in backpressure code. Ticket :#3980988 Signed-off-by: Rajasekar Raja (cherry picked from commit 186db96c06e4f44b4450fcba88f0fa680ee0b92d) --- bgpd/bgpd.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index a5ba540135..08d1268e9e 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3916,6 +3916,7 @@ int bgp_delete(struct bgp *bgp) struct bgp_dest *dest_next = NULL; struct bgp_table *dest_table = NULL; struct graceful_restart_info *gr_info; + uint32_t cnt_before, cnt_after; assert(bgp); @@ -3923,6 +3924,7 @@ int bgp_delete(struct bgp *bgp) * Iterate the pending dest list and remove all the dest pertaininig to * the bgp under delete. */ + cnt_before = zebra_announce_count(&bm->zebra_announce_head); for (dest = zebra_announce_first(&bm->zebra_announce_head); dest; dest = dest_next) { dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); @@ -3934,6 +3936,11 @@ int bgp_delete(struct bgp *bgp) } } + cnt_after = zebra_announce_count(&bm->zebra_announce_head); + if (BGP_DEBUG(zebra, ZEBRA)) + zlog_debug("Zebra Announce Fifo cleanup count before %u and after %u during BGP %s deletion", + cnt_before, cnt_after, bgp->name_pretty); + bgp_soft_reconfig_table_task_cancel(bgp, NULL, NULL); /* make sure we withdraw any exported routes */ From f1e664fc787b279b44d54cd011f8647778d22d4a Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Mon, 22 Jul 2024 07:52:10 -0400 Subject: [PATCH 34/81] lib: move non-error from __log_err to __dbg Additionally, print `errmsg_if_any` in successful debug messages if non-NULL. fixes #16386 #16043 Signed-off-by: Christian Hopps (cherry picked from commit 7afd7d99f2fa39be073625c630d46f96e5dd66a5) --- lib/vty.c | 15 +++++++++------ mgmtd/mgmt_txn.c | 6 +++--- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/vty.c b/lib/vty.c index 0dcd118a97..ecb5383a53 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -3591,8 +3591,9 @@ static void vty_mgmt_set_config_result_notified( vty_out(vty, "%s\n", errmsg_if_any); } else { debug_fe_client("SET_CONFIG request for client 0x%" PRIx64 - " req-id %" PRIu64 " was successfull", - client_id, req_id); + " req-id %" PRIu64 " was successfull%s%s", + client_id, req_id, errmsg_if_any ? ": " : "", + errmsg_if_any ?: ""); } if (implicit_commit) { @@ -3624,8 +3625,9 @@ static void vty_mgmt_commit_config_result_notified( vty_out(vty, "%s\n", errmsg_if_any); } else { debug_fe_client("COMMIT_CONFIG request for client 0x%" PRIx64 - " req-id %" PRIu64 " was successfull", - client_id, req_id); + " req-id %" PRIu64 " was successfull%s%s", + client_id, req_id, errmsg_if_any ? ": " : "", + errmsg_if_any ?: ""); if (errmsg_if_any) vty_out(vty, "MGMTD: %s\n", errmsg_if_any); } @@ -3656,8 +3658,9 @@ static int vty_mgmt_get_data_result_notified( } debug_fe_client("GET_DATA request succeeded, client 0x%" PRIx64 - " req-id %" PRIu64, - client_id, req_id); + " req-id %" PRIu64 "%s%s", + client_id, req_id, errmsg_if_any ? ": " : "", + errmsg_if_any ?: ""); if (req_id != mgmt_last_req_id) { mgmt_last_req_id = req_id; diff --git a/mgmtd/mgmt_txn.c b/mgmtd/mgmt_txn.c index 0a80b3bbf7..0f0cccbbd4 100644 --- a/mgmtd/mgmt_txn.c +++ b/mgmtd/mgmt_txn.c @@ -980,8 +980,8 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, } if (!chg_clients) - __log_err("No connected daemon is interested in XPATH %s", - xpath); + __dbg("Daemons interested in XPATH are not currently connected: %s", + xpath); cmtcfg_req->clients |= chg_clients; @@ -992,7 +992,7 @@ static int mgmt_txn_create_config_batches(struct mgmt_txn_req *txn_req, if (!num_chgs) { (void)mgmt_txn_send_commit_cfg_reply(txn_req->txn, MGMTD_NO_CFG_CHANGES, - "No changes found to commit!"); + "No connected daemons interested in changes"); return -1; } From 4e652de70341b4ba4847cafb1bd21a69641281ea Mon Sep 17 00:00:00 2001 From: Louis Scalbert Date: Fri, 28 Jun 2024 13:22:36 +0200 Subject: [PATCH 35/81] pimd: fix crash on non-existent interface Fix the following crash when pim options are (un)configured on an non-existent interface. > r1(config)# int fgljdsf > r1(config-if)# no ip pim unicast-bsm > vtysh: error reading from pimd: Connection reset by peer (104)Warning: closing connection to pimd because of an I/O error! > #0 raise (sig=) at ../sysdeps/unix/sysv/linux/raise.c:50 > #1 0x00007f70c8f32249 in core_handler (signo=11, siginfo=0x7fffff88e4f0, context=0x7fffff88e3c0) at lib/sigevent.c:258 > #2 > #3 0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910 > #4 0x00007f70c8efdcb5 in nb_callback_modify (context=0x556d00032b60, nb_node=0x556cffeeb9b0, event=NB_EV_APPLY, dnode=0x556d00031670, resource=0x556d00032b48, errmsg=0x7fffff88f710 "", errmsg_len=8192) > at lib/northbound.c:1538 > #5 0x00007f70c8efe949 in nb_callback_configuration (context=0x556d00032b60, event=NB_EV_APPLY, change=0x556d00032b10, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1888 > #6 0x00007f70c8efee82 in nb_transaction_process (event=NB_EV_APPLY, transaction=0x556d00032b60, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:2016 > #7 0x00007f70c8efd658 in nb_candidate_commit_apply (transaction=0x556d00032b60, save_transaction=true, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1356 > #8 0x00007f70c8efd78e in nb_candidate_commit (context=..., candidate=0x556cffeb0e80, save_transaction=true, comment=0x0, transaction_id=0x0, errmsg=0x7fffff88f710 "", errmsg_len=8192) at lib/northbound.c:1389 > #9 0x00007f70c8f03e58 in nb_cli_classic_commit (vty=0x556d00025a80) at lib/northbound_cli.c:51 > #10 0x00007f70c8f043f8 in nb_cli_apply_changes_internal (vty=0x556d00025a80, > xpath_base=0x7fffff893bb0 "/frr-interface:lib/interface[name='fgljdsf']/frr-pim:pim/address-family[address-family='frr-routing:ipv4']", clear_pending=false) at lib/northbound_cli.c:178 > #11 0x00007f70c8f0475d in nb_cli_apply_changes (vty=0x556d00025a80, xpath_base_fmt=0x556cfdde9fe0 "./frr-pim:pim/address-family[address-family='%s']") at lib/northbound_cli.c:234 > #12 0x0000556cfdd8298f in pim_process_no_unicast_bsm_cmd (vty=0x556d00025a80) at pimd/pim_cmd_common.c:3493 > #13 0x0000556cfddcf782 in no_ip_pim_ucast_bsm (self=0x556cfde40b20 , vty=0x556d00025a80, argc=4, argv=0x556d00031500) at pimd/pim_cmd.c:4950 > #14 0x00007f70c8e942f0 in cmd_execute_command_real (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, up_level=0) at lib/command.c:1002 > #15 0x00007f70c8e94451 in cmd_execute_command (vline=0x556d00032070, vty=0x556d00025a80, cmd=0x0, vtysh=0) at lib/command.c:1061 > #16 0x00007f70c8e9499f in cmd_execute (vty=0x556d00025a80, cmd=0x556d00030320 "no ip pim unicast-bsm", matched=0x0, vtysh=0) at lib/command.c:1227 > #17 0x00007f70c8f51e44 in vty_command (vty=0x556d00025a80, buf=0x556d00030320 "no ip pim unicast-bsm") at lib/vty.c:616 > #18 0x00007f70c8f53bdd in vty_execute (vty=0x556d00025a80) at lib/vty.c:1379 > #19 0x00007f70c8f55d59 in vtysh_read (thread=0x7fffff896600) at lib/vty.c:2374 > #20 0x00007f70c8f4b209 in event_call (thread=0x7fffff896600) at lib/event.c:2011 > #21 0x00007f70c8ed109e in frr_run (master=0x556cffdb4ea0) at lib/libfrr.c:1217 > #22 0x0000556cfdddec12 in main (argc=2, argv=0x7fffff896828, envp=0x7fffff896840) at pimd/pim_main.c:165 > (gdb) f 3 > #3 0x0000556cfdd9b16d in lib_interface_pim_address_family_unicast_bsm_modify (args=0x7fffff88f130) at pimd/pim_nb_config.c:1910 > 1910 pim_ifp->ucast_bsm_accept = > (gdb) list > 1905 case NB_EV_ABORT: > 1906 break; > 1907 case NB_EV_APPLY: > 1908 ifp = nb_running_get_entry(args->dnode, NULL, true); > 1909 pim_ifp = ifp->info; > 1910 pim_ifp->ucast_bsm_accept = > 1911 yang_dnode_get_bool(args->dnode, NULL); > 1912 > 1913 break; > 1914 } > (gdb) p pim_ifp > $1 = (struct pim_interface *) 0x0 Fixes: 3bb513c399 ("lib: adapt to version 2 of libyang") Signed-off-by: Louis Scalbert (cherry picked from commit 6952bea5cdd38057bf8c0a5e9c0fbe916dc73953) --- pimd/pim_nb_config.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pimd/pim_nb_config.c b/pimd/pim_nb_config.c index 4f1a4a1852..be0be8588b 100644 --- a/pimd/pim_nb_config.c +++ b/pimd/pim_nb_config.c @@ -1504,11 +1504,19 @@ int routing_control_plane_protocols_control_plane_protocol_pim_address_family_re */ int lib_interface_pim_address_family_create(struct nb_cb_create_args *args) { + struct interface *ifp; + switch (args->event) { case NB_EV_VALIDATE: - case NB_EV_PREPARE: - case NB_EV_ABORT: case NB_EV_APPLY: + case NB_EV_ABORT: + break; + case NB_EV_PREPARE: + ifp = nb_running_get_entry(args->dnode, NULL, true); + if (ifp->info) + return NB_OK; + + pim_if_new(ifp, false, false, false, false); break; } From 4c68489d2f3122eab6e7c345a8135d5c90d1a939 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Mon, 22 Jul 2024 10:13:19 -0700 Subject: [PATCH 36/81] bgpd: backpressure - Avoid use after free Coverity complains there is a use after free (1598495 and 1598496) At this point, most likely dest->refcount cannot go 1 and free up the dest, but there might be some code path where this can happen. Fixing this with a simple order change (no harm fix). Ticket :#4001204 Signed-off-by: Rajasekar Raja (cherry picked from commit 40965e599975b019bbe6f4b1dfb3ff22d8980876) --- bgpd/bgp_evpn.c | 2 +- bgpd/bgpd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 9a796ef91b..0485bbac64 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -6338,9 +6338,9 @@ void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn) dest = dest_next) { dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); if (dest->za_vpn == vpn) { + zebra_announce_del(&bm->zebra_announce_head, dest); bgp_path_info_unlock(dest->za_bgp_pi); bgp_dest_unlock_node(dest); - zebra_announce_del(&bm->zebra_announce_head, dest); } } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index 08d1268e9e..894226adac 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -3930,9 +3930,9 @@ int bgp_delete(struct bgp *bgp) dest_next = zebra_announce_next(&bm->zebra_announce_head, dest); dest_table = bgp_dest_table(dest); if (dest_table->bgp == bgp) { + zebra_announce_del(&bm->zebra_announce_head, dest); bgp_path_info_unlock(dest->za_bgp_pi); bgp_dest_unlock_node(dest); - zebra_announce_del(&bm->zebra_announce_head, dest); } } From ef873b1b33756dc41725212164ae97220b5b5757 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Wed, 7 Feb 2024 14:56:15 -0500 Subject: [PATCH 37/81] 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 (cherry picked from commit 266b0619942edd8d838235e14dc0cb71a772f585) --- .../rt5/step10/show_ip_route.ref | 3 +- zebra/zebra_nhg.c | 28 ++++++++++++++++++- zebra/zebra_vty.c | 2 +- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/tests/topotests/isis_tilfa_topo1/rt5/step10/show_ip_route.ref b/tests/topotests/isis_tilfa_topo1/rt5/step10/show_ip_route.ref index 06f432c455..ff8ace25be 100644 --- a/tests/topotests/isis_tilfa_topo1/rt5/step10/show_ip_route.ref +++ b/tests/topotests/isis_tilfa_topo1/rt5/step10/show_ip_route.ref @@ -457,8 +457,7 @@ "fib":true, "ip":"10.0.8.6", "afi":"ipv4", - "interfaceName":"eth-rt6", - "active":true + "interfaceName":"eth-rt6" } ] } diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 1246e4dba2..9971b19836 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -1050,8 +1050,27 @@ static void zebra_nhg_set_valid(struct nhg_hash_entry *nhe, bool valid) } /* Update validity of nexthops depending on it */ - frr_each(nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep) + frr_each (nhg_connected_tree, &nhe->nhg_dependents, rb_node_dep) { + if (!valid) { + /* + * Grab the first nexthop from the depending nexthop group + * then let's find the nexthop in that group that matches + * my individual nexthop and mark it as no longer ACTIVE + */ + struct nexthop *nexthop = rb_node_dep->nhe->nhg.nexthop; + + while (nexthop) { + if (nexthop_same(nexthop, nhe->nhg.nexthop)) + break; + + nexthop = nexthop->next; + } + + if (nexthop) + UNSET_FLAG(nexthop->flags, NEXTHOP_FLAG_ACTIVE); + } zebra_nhg_set_valid(rb_node_dep->nhe, valid); + } } void zebra_nhg_check_valid(struct nhg_hash_entry *nhe) @@ -1059,6 +1078,13 @@ void zebra_nhg_check_valid(struct nhg_hash_entry *nhe) struct nhg_connected *rb_node_dep = NULL; bool valid = false; + /* + * If I have other nhe's depending on me, then this is a + * singleton nhe so set this nexthops flag as appropriate. + */ + if (nhg_connected_tree_count(&nhe->nhg_depends)) + UNSET_FLAG(nhe->nhg.nexthop->flags, NEXTHOP_FLAG_ACTIVE); + /* If anthing else in the group is valid, the group is valid */ frr_each(nhg_connected_tree, &nhe->nhg_depends, rb_node_dep) { if (CHECK_FLAG(rb_node_dep->nhe->flags, NEXTHOP_GROUP_VALID)) { diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index c31218a7c3..ae82d20141 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -215,7 +215,7 @@ static char re_status_output_char(const struct route_entry *re, if (is_fib) { star_p = !!CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_FIB); - } else + } else if (CHECK_FLAG(nhop->flags, NEXTHOP_FLAG_ACTIVE)) star_p = true; } From f34dfab8051d43b65140b837f17e3687dbd75216 Mon Sep 17 00:00:00 2001 From: Christian Breunig Date: Sat, 13 Jul 2024 08:43:36 +0200 Subject: [PATCH 38/81] ospfd: fix internal ldp-sync state flags when feature is disabled When enabling "mpls ldp-sync" under "router ospf" ospfd configures SET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG) so internally knowing that the ldp-sync feature is enabled. However the flag is not cleared when turning of the feature using "nompls ldp-sync"! https://github.com/FRRouting/frr/issues/16375 Signed-off-by: Christian Breunig (cherry picked from commit 5a70378a47f541b0354fbb96770dd0a65ec552b8) --- ospfd/ospf_ldp_sync.c | 2 +- tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync.ref | 4 ++-- .../r2/show_ospf_ldp_sync_r1_eth1_shutdown.ref | 4 ++-- .../r2/show_ospf_ldp_sync_r2_eth1_shutdown.ref | 4 ++-- tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync.ref | 4 ++-- .../r3/show_ospf_ldp_sync_r1_eth1_shutdown.ref | 4 ++-- .../r3/show_ospf_ldp_sync_r2_eth1_shutdown.ref | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ospfd/ospf_ldp_sync.c b/ospfd/ospf_ldp_sync.c index d1ef85c9a6..496ae5b4bd 100644 --- a/ospfd/ospf_ldp_sync.c +++ b/ospfd/ospf_ldp_sync.c @@ -901,7 +901,7 @@ DEFPY (no_mpls_ldp_sync, * stop holddown timer if running * restore ospf cost */ - SET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG); + UNSET_FLAG(ldp_sync_info->flags, LDP_SYNC_FLAG_IF_CONFIG); ldp_sync_info->enabled = LDP_IGP_SYNC_DEFAULT; ldp_sync_info->state = LDP_IGP_SYNC_STATE_NOT_REQUIRED; EVENT_OFF(ldp_sync_info->t_holddown); diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync.ref b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync.ref index 6c27a10427..846be5b849 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync.ref @@ -5,8 +5,8 @@ "ldpIgpSyncState":"Sync achieved" }, "r2-eth2":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" } } diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r1_eth1_shutdown.ref b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r1_eth1_shutdown.ref index 889f69ed7f..ad3b8b5ca4 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r1_eth1_shutdown.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r1_eth1_shutdown.ref @@ -5,8 +5,8 @@ "ldpIgpSyncState":"Holding down until Sync" }, "r2-eth2":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" } } diff --git a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r2_eth1_shutdown.ref b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r2_eth1_shutdown.ref index d9036e124b..d5e4b88d07 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r2_eth1_shutdown.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r2/show_ospf_ldp_sync_r2_eth1_shutdown.ref @@ -1,7 +1,7 @@ { "r2-eth2":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" } } diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync.ref b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync.ref index b417ab040a..5b9542d5a9 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync.ref @@ -1,8 +1,8 @@ { "r3-eth1":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" }, "r3-eth2":{ "ldpIgpSyncEnabled":true, diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r1_eth1_shutdown.ref b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r1_eth1_shutdown.ref index b417ab040a..5b9542d5a9 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r1_eth1_shutdown.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r1_eth1_shutdown.ref @@ -1,8 +1,8 @@ { "r3-eth1":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" }, "r3-eth2":{ "ldpIgpSyncEnabled":true, diff --git a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r2_eth1_shutdown.ref b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r2_eth1_shutdown.ref index b417ab040a..5b9542d5a9 100644 --- a/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r2_eth1_shutdown.ref +++ b/tests/topotests/ldp_sync_ospf_topo1/r3/show_ospf_ldp_sync_r2_eth1_shutdown.ref @@ -1,8 +1,8 @@ { "r3-eth1":{ - "ldpIgpSyncEnabled":false, + "ldpIgpSyncEnabled":true, "holdDownTimeInSec":50, - "ldpIgpSyncState":"Sync not required" + "ldpIgpSyncState":"Sync achieved" }, "r3-eth2":{ "ldpIgpSyncEnabled":true, From d4c307d0753d61918fc279c1b5f7a0b4b8836a63 Mon Sep 17 00:00:00 2001 From: Y Bharath Date: Mon, 22 Jul 2024 16:47:54 +0530 Subject: [PATCH 39/81] yang: Added missed prefix to the yang file Corrected warning by including the module Signed-off-by: y-bharath14 (cherry picked from commit ed832b70ec0ea7ad0cf22a844de2151592b5b0e8) --- yang/ietf/frr-deviations-ietf-routing.yang | 3 +++ 1 file changed, 3 insertions(+) diff --git a/yang/ietf/frr-deviations-ietf-routing.yang b/yang/ietf/frr-deviations-ietf-routing.yang index 15ceb6b929..5c0ae30bea 100644 --- a/yang/ietf/frr-deviations-ietf-routing.yang +++ b/yang/ietf/frr-deviations-ietf-routing.yang @@ -6,6 +6,9 @@ module frr-deviations-ietf-routing { import ietf-routing { prefix ietf-routing; } + import ietf-rip { + prefix ietf-rip; + } organization "FRRouting"; From 609a84f4fd35ea441d88b31f9ef4a9566c80c65e Mon Sep 17 00:00:00 2001 From: Christian Hopps Date: Tue, 23 Jul 2024 17:42:07 -0400 Subject: [PATCH 40/81] lib: mgmtd: fix too early daemon detach of mgmtd Correct FRR startup counts on a daemon's vty socket to be open when the parent process exits. The parent process waits for `frr_check_detach()` to be called by the child before exiting. The problem is when the `FRR_MANUAL_VTY_START` flag is set the vty socket was not opened but `frr_check_detach()` was called anyway. Instead add a bool option for `frr_check_detach()` to be called when the socket is opened with `frr_vty_serv_start()`, and do so when "manually" calling said function (i.e., when FRR_MANUAL_VTY_START is set). The `FRR_MANUAL_VTY_START` flag is only set by mgmtd. The reason we wait to open the vty socket is so that mgmtd can parse the various daemon specific config files it has taken over, after the event loop has started, but before we receive any possible new config from `vtysh`. fixes #16362 Signed-off-by: Christian Hopps (cherry picked from commit be9a6fc0ea8180a4aaa558c5402ea543427e2e7e) --- lib/libfrr.c | 30 +++++++++++++++++------------- lib/libfrr.h | 2 +- lib/vty.c | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/libfrr.c b/lib/libfrr.c index 876efe23a8..cc60cfb829 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -1040,7 +1040,17 @@ void frr_config_fork(void) zlog_tls_buffer_init(); } -void frr_vty_serv_start(void) +static void frr_check_detach(void) +{ + if (nodetach_term || nodetach_daemon) + return; + + if (daemon_ctl_sock != -1) + close(daemon_ctl_sock); + daemon_ctl_sock = -1; +} + +void frr_vty_serv_start(bool check_detach) { /* allow explicit override of vty_path in the future * (not currently set anywhere) */ @@ -1063,6 +1073,9 @@ void frr_vty_serv_start(void) } vty_serv_start(di->vty_addr, di->vty_port, di->vty_path); + + if (check_detach) + frr_check_detach(); } void frr_vty_serv_stop(void) @@ -1073,16 +1086,6 @@ void frr_vty_serv_stop(void) unlink(di->vty_path); } -static void frr_check_detach(void) -{ - if (nodetach_term || nodetach_daemon) - return; - - if (daemon_ctl_sock != -1) - close(daemon_ctl_sock); - daemon_ctl_sock = -1; -} - static void frr_terminal_close(int isexit) { int nullfd; @@ -1168,7 +1171,7 @@ void frr_run(struct event_loop *master) char instanceinfo[64] = ""; if (!(di->flags & FRR_MANUAL_VTY_START)) - frr_vty_serv_start(); + frr_vty_serv_start(false); if (di->instance) snprintf(instanceinfo, sizeof(instanceinfo), "instance %u ", @@ -1206,7 +1209,8 @@ void frr_run(struct event_loop *master) close(nullfd); } - frr_check_detach(); + if (!(di->flags & FRR_MANUAL_VTY_START)) + frr_check_detach(); } /* end fixed stderr startup logging */ diff --git a/lib/libfrr.h b/lib/libfrr.h index 77d70448a9..d52ee9aefe 100644 --- a/lib/libfrr.h +++ b/lib/libfrr.h @@ -200,7 +200,7 @@ extern void frr_config_fork(void); extern void frr_run(struct event_loop *master); extern void frr_detach(void); -extern void frr_vty_serv_start(void); +extern void frr_vty_serv_start(bool check_detach); extern void frr_vty_serv_stop(void); extern bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len, diff --git a/lib/vty.c b/lib/vty.c index ecb5383a53..d0bbf0e61a 100644 --- a/lib/vty.c +++ b/lib/vty.c @@ -3502,7 +3502,7 @@ static void vty_mgmt_server_connected(struct mgmt_fe_client *client, /* Start or stop listening for vty connections */ if (connected) - frr_vty_serv_start(); + frr_vty_serv_start(true); else frr_vty_serv_stop(); } From b239c90c763ed382da97f921c46d8b8d8155069a Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 25 Jul 2024 07:50:32 -0400 Subject: [PATCH 41/81] pimd: Fix msdp setting of sa->rp The code is clearly incorrect. After consultation with the original author this is the decided change. Signed-off-by: Donald Sharp (cherry picked from commit c4b4c242ec8cfcdb23f0f90faaa0ff76577e1364) --- pimd/pim_msdp.c | 8 +++----- tests/topotests/msdp_topo1/test_msdp_topo1.py | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pimd/pim_msdp.c b/pimd/pim_msdp.c index 623c14bb03..ea8c84cca5 100644 --- a/pimd/pim_msdp.c +++ b/pimd/pim_msdp.c @@ -411,12 +411,10 @@ void pim_msdp_sa_ref(struct pim_instance *pim, struct pim_msdp_peer *mp, pim_addr_to_prefix(&grp, sa->sg.grp); rp_info = pim_rp_find_match_group(pim, &grp); if (rp_info) { - sa->rp = rp_info->rp.rpf_addr; - } else - { - sa->rp = pim->msdp.originator_id; + sa->rp = rp_info->rp.rpf_addr; + } else { + sa->rp = pim->msdp.originator_id; } - sa->rp = pim->msdp.originator_id; pim_msdp_pkt_sa_tx_one(sa); } sa->flags &= ~PIM_MSDP_SAF_STALE; diff --git a/tests/topotests/msdp_topo1/test_msdp_topo1.py b/tests/topotests/msdp_topo1/test_msdp_topo1.py index 1af58b0a01..2fbff440f5 100755 --- a/tests/topotests/msdp_topo1/test_msdp_topo1.py +++ b/tests/topotests/msdp_topo1/test_msdp_topo1.py @@ -359,7 +359,7 @@ def test_msdp(): "192.168.10.100": { "source": "192.168.10.100", "group": "229.1.2.3", - "rp": "192.168.1.1", + "rp": "10.254.254.1", "local": "no", "sptSetup": "no", } @@ -394,7 +394,7 @@ def test_msdp(): "192.168.10.100": { "source": "192.168.10.100", "group": "229.1.2.3", - "rp": "192.168.1.1", + "rp": "10.254.254.1", "local": "no", "sptSetup": "yes", } From f9a9d424f9fbc319ab84de529770f93bc0586680 Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Tue, 16 Jul 2024 23:34:15 -0700 Subject: [PATCH 42/81] bgpd: backpressure - fix ret value evpn_route_select_install The return value of evpn_route_select_install is ignored in all cases except during vni route table install/uninstall and based on the returned value, an error is logged. Fixing this. Ticket :#3992392 Signed-off-by: Rajasekar Raja --- bgpd/bgp_evpn.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index 0485bbac64..e660ca5c16 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -1487,11 +1487,12 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, && !bgp_addpath_is_addpath_used(&bgp->tx_addpath, afi, safi)) { if (bgp_zebra_has_route_changed(old_select)) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) - evpn_zebra_install(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix( - dest), - old_select); + ret = evpn_zebra_install(bgp, vpn, + (const struct prefix_evpn + *) + bgp_dest_get_prefix( + dest), + old_select); else bgp_zebra_route_install(dest, old_select, bgp, true, vpn, false); @@ -1529,10 +1530,11 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, && (new_select->sub_type == BGP_ROUTE_IMPORTED || bgp_evpn_attr_is_sync(new_select->attr))) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS)) - evpn_zebra_install(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix(dest), - new_select); + ret = evpn_zebra_install(bgp, vpn, + (const struct prefix_evpn *) + bgp_dest_get_prefix( + dest), + new_select); else bgp_zebra_route_install(dest, new_select, bgp, true, vpn, false); @@ -1556,11 +1558,12 @@ int evpn_route_select_install(struct bgp *bgp, struct bgpevpn *vpn, old_select->sub_type == BGP_ROUTE_IMPORTED) { if (CHECK_FLAG(bgp->flags, BGP_FLAG_DELETE_IN_PROGRESS) || CHECK_FLAG(bgp->flags, BGP_FLAG_VNI_DOWN)) - evpn_zebra_uninstall(bgp, vpn, - (const struct prefix_evpn *) - bgp_dest_get_prefix( - dest), - old_select, false); + ret = evpn_zebra_uninstall(bgp, vpn, + (const struct prefix_evpn + *) + bgp_dest_get_prefix( + dest), + old_select, false); else bgp_zebra_route_install(dest, old_select, bgp, false, vpn, false); From d4e8279adcafc61b1015b4c380ac12c316fc42bd Mon Sep 17 00:00:00 2001 From: Rajasekar Raja Date: Thu, 18 Jul 2024 22:23:23 -0700 Subject: [PATCH 43/81] bgpd: backpressure - log error for evpn when route install to zebra fails. log error for evpn in case route install to zebra fails. Ticket :#3992392 Signed-off-by: Rajasekar Raja --- bgpd/bgp_zebra.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 6f8f4610ca..c4a55348ea 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1789,6 +1789,7 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) struct bgp_table *table = NULL; enum zclient_send_status status = ZCLIENT_SEND_SUCCESS; bool install; + const struct prefix_evpn *evp = NULL; while (count < ZEBRA_ANNOUNCEMENTS_LIMIT) { dest = zebra_announce_pop(&bm->zebra_announce_head); @@ -1798,8 +1799,11 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) table = bgp_dest_table(dest); install = CHECK_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_INSTALL); - if (table->afi == AFI_L2VPN && table->safi == SAFI_EVPN) + if (table->afi == AFI_L2VPN && table->safi == SAFI_EVPN) { is_evpn = true; + evp = (const struct prefix_evpn *)bgp_dest_get_prefix( + dest); + } if (BGP_DEBUG(zebra, ZEBRA)) zlog_debug("BGP %s route %pBD(%s) with dest %p and flags 0x%x to zebra", @@ -1836,6 +1840,17 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) UNSET_FLAG(dest->flags, BGP_NODE_SCHEDULE_FOR_DELETE); } + if (is_evpn && status == ZCLIENT_SEND_FAILURE) + flog_err(EC_BGP_EVPN_FAIL, + "%s (%u): Failed to %s EVPN %pFX %s route in VNI %u", + vrf_id_to_name(table->bgp->vrf_id), + table->bgp->vrf_id, + install ? "install" : "uninstall", evp, + evp->prefix.route_type == BGP_EVPN_MAC_IP_ROUTE + ? "MACIP" + : "IMET", + dest->za_vpn->vni); + bgp_path_info_unlock(dest->za_bgp_pi); dest->za_bgp_pi = NULL; dest->za_vpn = NULL; From 36a70b5d203da6c4581cb1d4e071dc8cc58d744f Mon Sep 17 00:00:00 2001 From: Chirag Shah Date: Mon, 17 Jun 2024 13:58:03 -0700 Subject: [PATCH 44/81] bgpd: backpressure - fix evpn route sync to zebra In scaled EVPN + ipv4/ipv6 uni route sync to zebra, some of the ipv4/ipv6 routes skipped reinstallation due to incorrect local variable's stale value. Once the local variable value reset in each loop iteration all skipped routes synced to zebra properly. Ticket: #3948828 Signed-off-by: Rajasekar Raja Signed-off-by: Chirag Shah --- bgpd/bgp_zebra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c4a55348ea..5bb177b2f7 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -1792,6 +1792,8 @@ static void bgp_handle_route_announcements_to_zebra(struct event *e) const struct prefix_evpn *evp = NULL; while (count < ZEBRA_ANNOUNCEMENTS_LIMIT) { + is_evpn = false; + dest = zebra_announce_pop(&bm->zebra_announce_head); if (!dest) From 6485e39417a9b7422fb8234122a70d8c51e89747 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Sun, 28 Jul 2024 14:26:13 +0300 Subject: [PATCH 45/81] bgpd: Do not process VRF import/export to/from auto created VRF instances Fixes the crash: ``` (gdb) bt 0 __pthread_kill_implementation (no_tid=0, signo=11, threadid=124583315603008) at ./nptl/pthread_kill.c:44 1 __pthread_kill_internal (signo=11, threadid=124583315603008) at ./nptl/pthread_kill.c:78 2 __GI___pthread_kill (threadid=124583315603008, signo=signo@entry=11) at ./nptl/pthread_kill.c:89 3 0x0000714ed0242476 in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26 4 0x0000714ed074cfb7 in core_handler (signo=11, siginfo=0x7ffe6d9792b0, context=0x7ffe6d979180) at lib/sigevent.c:258 5 6 0x000060f55e33ffdd in route_table_get_info (table=0x0) at ./lib/table.h:177 7 0x000060f55e340053 in bgp_dest_table (dest=0x60f56dabb840) at ./bgpd/bgp_table.h:156 8 0x000060f55e340c9f in is_route_injectable_into_vpn (pi=0x60f56dbc4a60) at ./bgpd/bgp_mplsvpn.h:331 9 0x000060f55e34507c in vpn_leak_from_vrf_update (to_bgp=0x60f56da52070, from_bgp=0x60f56da75af0, path_vrf=0x60f56dbc4a60) at bgpd/bgp_mplsvpn.c:1575 10 0x000060f55e346657 in vpn_leak_from_vrf_update_all (to_bgp=0x60f56da52070, from_bgp=0x60f56da75af0, afi=AFI_IP) at bgpd/bgp_mplsvpn.c:2028 11 0x000060f55e340c10 in vpn_leak_postchange (direction=BGP_VPN_POLICY_DIR_TOVPN, afi=AFI_IP, bgp_vpn=0x60f56da52070, bgp_vrf=0x60f56da75af0) at ./bgpd/bgp_mplsvpn.h:310 12 0x000060f55e34a692 in vpn_leak_postchange_all () at bgpd/bgp_mplsvpn.c:3737 13 0x000060f55e3d91fc in router_bgp (self=0x60f55e5cbc20 , vty=0x60f56e2d7660, argc=3, argv=0x60f56da19830) at bgpd/bgp_vty.c:1601 14 0x0000714ed069ddf5 in cmd_execute_command_real (vline=0x60f56da32a80, vty=0x60f56e2d7660, cmd=0x0, up_level=0) at lib/command.c:1002 15 0x0000714ed069df6e in cmd_execute_command (vline=0x60f56da32a80, vty=0x60f56e2d7660, cmd=0x0, vtysh=0) at lib/command.c:1061 16 0x0000714ed069e51e in cmd_execute (vty=0x60f56e2d7660, cmd=0x60f56dbf07d0 "router bgp 100\n", matched=0x0, vtysh=0) at lib/command.c:1227 17 0x0000714ed076faa0 in vty_command (vty=0x60f56e2d7660, buf=0x60f56dbf07d0 "router bgp 100\n") at lib/vty.c:616 18 0x0000714ed07719c4 in vty_execute (vty=0x60f56e2d7660) at lib/vty.c:1379 19 0x0000714ed07740f0 in vtysh_read (thread=0x7ffe6d97c700) at lib/vty.c:2374 20 0x0000714ed07685c4 in event_call (thread=0x7ffe6d97c700) at lib/event.c:1995 21 0x0000714ed06e3351 in frr_run (master=0x60f56d1d2e40) at lib/libfrr.c:1232 22 0x000060f55e2c4b44 in main (argc=7, argv=0x7ffe6d97c978) at bgpd/bgp_main.c:555 (gdb) ``` Fixes https://github.com/FRRouting/frr/issues/16484 Signed-off-by: Donatas Abraitis (cherry picked from commit 04f9372409a11a59dafbbf8423f0cf832b99cf0e) --- bgpd/bgp_mplsvpn.c | 6 ++++++ bgpd/bgp_vty.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 90881621b3..1bc1a47c69 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -3730,6 +3730,9 @@ void vpn_leak_postchange_all(void) if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF) continue; + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + vpn_leak_postchange( BGP_VPN_POLICY_DIR_TOVPN, AFI_IP, @@ -3749,6 +3752,9 @@ void vpn_leak_postchange_all(void) if (bgp->inst_type != BGP_INSTANCE_TYPE_VRF) continue; + if (CHECK_FLAG(bgp->vrf_flags, BGP_VRF_AUTO)) + continue; + vpn_leak_postchange( BGP_VPN_POLICY_DIR_FROMVPN, AFI_IP, diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 38c335f75a..1a87799ad2 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -1703,7 +1703,7 @@ DEFUN (no_router_bgp, continue; if (CHECK_FLAG(tmp_bgp->vrf_flags, BGP_VRF_AUTO)) - continue; + bgp_delete(tmp_bgp); if (CHECK_FLAG( tmp_bgp->af_flags[AFI_IP] From b29169073bf38ff98fcfdd1e115a64203be13073 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 31 Jul 2024 08:35:14 +0300 Subject: [PATCH 46/81] bgpd: Check the actual remaining stream length before taking TLV value ``` 0 0xb50b9f898028 in __sanitizer_print_stack_trace (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x368028) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7) 1 0xb50b9f7ed8e4 in fuzzer::PrintStackTrace() (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x2bd8e4) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7) 2 0xb50b9f7d4d9c in fuzzer::Fuzzer::CrashCallback() (/home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/.libs/bgpd+0x2a4d9c) (BuildId: 3292703ed7958b20076550c967f879db8dc27ca7) 3 0xe0d12d7469cc (linux-vdso.so.1+0x9cc) (BuildId: 1a77697e9d723fe22246cfd7641b140c427b7e11) 4 0xe0d12c88f1fc in __pthread_kill_implementation nptl/pthread_kill.c:43:17 5 0xe0d12c84a678 in gsignal signal/../sysdeps/posix/raise.c:26:13 6 0xe0d12c83712c in abort stdlib/abort.c:79:7 7 0xe0d12d214724 in _zlog_assert_failed /home/ubuntu/frr-public/frr_public_private-libfuzzer/lib/zlog.c:789:2 8 0xe0d12d1285e4 in stream_get /home/ubuntu/frr-public/frr_public_private-libfuzzer/lib/stream.c:324:3 9 0xb50b9f8e47c4 in bgp_attr_encap /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:2758:3 10 0xb50b9f8dcd38 in bgp_attr_parse /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_attr.c:3783:10 11 0xb50b9faf74b4 in bgp_update_receive /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:2383:20 12 0xb50b9faf1dcc in bgp_process_packet /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_packet.c:4075:11 13 0xb50b9f8c90d0 in LLVMFuzzerTestOneInput /home/ubuntu/frr-public/frr_public_private-libfuzzer/bgpd/bgp_main.c:582:3 ``` Reported-by: Iggy Frankovic Signed-off-by: Donatas Abraitis (cherry picked from commit 0998b38e4d61179441f90dd7e7fd6a3a8b7bd8c5) --- bgpd/bgp_attr.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 18c7b13535..e4ee589a38 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -2751,6 +2751,14 @@ static int bgp_attr_encap(struct bgp_attr_parser_args *args) args->total); } + if (STREAM_READABLE(BGP_INPUT(peer)) < sublength) { + zlog_err("Tunnel Encap attribute sub-tlv length %d exceeds remaining stream length %zu", + sublength, STREAM_READABLE(BGP_INPUT(peer))); + return bgp_attr_malformed(args, + BGP_NOTIFY_UPDATE_OPT_ATTR_ERR, + args->total); + } + /* alloc and copy sub-tlv */ /* TBD make sure these are freed when attributes are released */ tlv = XCALLOC(MTYPE_ENCAP_TLV, From 588b8fe7e3f0bec7fca311f2b70edadc7835922e Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Wed, 31 Jul 2024 23:31:57 -0500 Subject: [PATCH 47/81] debian, redhat: updating changelog for 10.1 release Signed-off-by: Jafar Al-Gharaibeh --- debian/changelog | 6 +++--- redhat/frr.spec.in | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index 96c66db89b..a556f00f41 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -frr (10.1~dev-1) UNRELEASED; urgency=medium +frr (10.1-0) unstable; urgency=medium - * FRR Dev 10.1 + * New upstream release FRR 10.1 - -- Jafar Al-Gharaibeh Tue, 26 Mar 2024 02:00:00 -0600 + -- Jafar Al-Gharaibeh Fri, 26 Jul 2024 02:00:00 -0600 frr (10.0-0) unstable; urgency=medium diff --git a/redhat/frr.spec.in b/redhat/frr.spec.in index f42079cd50..9f1588507f 100644 --- a/redhat/frr.spec.in +++ b/redhat/frr.spec.in @@ -805,7 +805,20 @@ sed -i 's/ -M rpki//' %{_sysconfdir}/frr/daemons %changelog -* Mon Mar 25 2024 Jafar Al-Gharaibeh - %{version} +* Fri Jul 26 2024 Jafar Al-Gharaibeh - %{version} + +* Fri Jul 26 2024 Jafar Al-Gharaibeh - 10.1 +- Breaking changes +- Enable BGP dynamic capability by default for datacenter profile +- Split BGP `rpki cache` command into separate per SSH/TCP +- Add deprecation cycle for OSPF `router-info X [A.B.C.D]` command +- Major highlights: +- BGP dampening per-neighbor support +- BMP send-experimental stats +- Implement extended link-bandwidth for BGP +- Paths Limit for Multiple Paths in BGP +- New command for OSPFv2 `ip ospf neighbor-filter NAME [A.B.C.D]` +- Implement non-broadcast support for point-to-multipoint networks * Mon Mar 25 2024 Jafar Al-Gharaibeh - 10.0 - Major highlights: From 14c29f83a0dfbc4023cdfff34ed38cf43dca409c Mon Sep 17 00:00:00 2001 From: Jafar Al-Gharaibeh Date: Wed, 31 Jul 2024 23:32:17 -0500 Subject: [PATCH 48/81] FRR Release 10.1 Release Overview: * Breaking changes - Enable BGP dynamic capability by default for datacenter profile - Split BGP `rpki cache` command into separate per SSH/TCP - Add deprecation cycle for OSPF `router-info X [A.B.C.D]` command * Features - BGP dampening per-neighbor support - BMP send-experimental stats - Implement extended link-bandwidth for BGP - Paths Limit for Multiple Paths in BGP - New command for OSPFv2 `ip ospf neighbor-filter NAME [A.B.C.D]` - Implement non-broadcast support for point-to-multipoint networks * Other significant changes bgpd - Fix route leaking from the default l3vrf - Fix `match peer` when switching between IPv4/IPv6/interface - Fix dynamic peer graceful restart race condition - Fix colored routes not installed after a switchover - Fix crash when deleting the SRv6 locator - Fix `no set as-path prepend ASNUM...` - Fix negative commands for Graceful-Restart operations - Fix ipv4-mapped ipv6 on non 6pe - Fix show run of network route-distinguisher - Fix display when using `missing-as-worst` - Fix `show bgp neighbors` output - Fix error handling for MP/GR capabilities as a dynamic capability - Fix error handling when receiving BGP Prefix-SID attribute - Fix route-target display with a dotted format - Fix `no bgp as-path access-list` - Fix `no` form for `neighbor X capability software-version` - Check against extended community unit size for link bandwidth - Make sure we have enough data to handle extended link bandwidth - Check if FQDN capability length is in valid ranges - Allow using different ASNs per VRF instances - Send End-of-RIB not only if Graceful-Restart capability is received - Implement backpressure to avoid CPU hog - Ignore validating the attribute flags if path-attribute is configured - Prevent deletion of BGP peer groups associated with `bgp listen range` - Inherit some peer flags from the peer-group - Allow specification of AS 0 for RPKI commands - Allow using `maximum-prefix` for EVPN - Increase install/uninstall speed of EVPN VNIs - Update default-originate route-map actual map structure - Include `unsuppress-map` as a valid outgoing eBGP policy - Allow dynamically disable graceful-restart/long-lived graceful-restart - Unset advertised capabilities if the capability is disabled - Aggregated summary-only remove suppressed from EVPN isisd - Fix crash when deactivating ISIS adjacency on the interface - Fix `show isis database [detail] json` - Fix `show isis algorithm` - Fix crash when configuring the circuit type for the interface - Fix IP/IPv6 reachability TLVs - When the metric-type is configured as "wide", the IS-IS generates incorrect metric values for IPv4 directly connected routes - Add link state support for SRv6 adjacencies - The hold time of hello packets on a P2P link does not match the sending interval mgmtd - Implement YANG RPC/action support ospfd - Fix crash in OSPF TE parsing - Fix the bug where ip_ospf_dead-interval_minimal_hello-multiplier did not reset the hello timer - Fix `no write-multiplier` command - Fix `no maximum-paths` command - Solved crash in RI parsing with OSPF TE - Assure OSPF AS External routes are installed after the link flap - Send LS Updates in response to LS Request as unicast ospf6d - Handle topo change in Graceful-Restart Helper mode for max-age LSAs - Prevent heap-buffer-overflow with an unknown type - Redistribute metric for AS-external route - Fix next-hop computation for inter-area multi-ABR ECMP - Fix interface type vs. connected routes updates pathd - Retry synchronous label-manager ZAPI connection pimd - Fix null register before aging out reg-stop - Fix dr-priority range - Fix crash unconfiguring rp keepalive timer lib - Fix keychain NB crash - Do not convert EVPN prefixes into IPv4/IPv6 if not needed ripd - Fix `clear ip rip` command ripngd - Fix `clear ipv6 ripng` command tools - Handle seq num for BGP as-path in frr-reload.py vtysh - Fix 'show ip[v6] prefix-list ... json' formatting by moving it to vtysh - Fix `show route-map` command when calling via `do` - Show `ip ospf network ...` even if it's not the same as the interface type zebra - Fix `mpls label bind` command - Fix excessive `exit` commands - Fix static SRv6 segment-list SID order - Fix JSON output for `show route summary json` - Fix malformed json output for multiple vrfs in command `show ip route vrf all json` - Fix crash if MAC-VLAN link in another netns - Fix crash on MAC-VLAN link down/up - Deny the routes if ip protocol CLI refers to an undefined route-map - Bridge flap handle VLAN membership update - Add `show fpm status [json]` command --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index cad8ea12c0..7a9b80489e 100644 --- a/configure.ac +++ b/configure.ac @@ -7,7 +7,7 @@ ## AC_PREREQ([2.69]) -AC_INIT([frr], [10.1-dev], [https://github.com/frrouting/frr/issues]) +AC_INIT([frr], [10.1], [https://github.com/frrouting/frr/issues]) PACKAGE_URL="https://frrouting.org/" AC_SUBST([PACKAGE_URL]) PACKAGE_FULLNAME="FRRouting" From 6c5c46f9319cab606a2703279c5b212aea596cf4 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 8 Aug 2024 01:17:11 +0300 Subject: [PATCH 49/81] lib: fix crash on distribute-list delete The destroy callback must be executed only once on APPLY stage. Fixes #16528 Signed-off-by: Igor Ryzhov (cherry picked from commit 2b12d62e38bf41648b2703b5a5c48e47eb01edc7) --- lib/distribute.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/distribute.c b/lib/distribute.c index ccd1f1379e..90a73c3635 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -458,6 +458,8 @@ int group_distribute_list_create_helper( int group_distribute_list_destroy(struct nb_cb_destroy_args *args) { + if (args->event != NB_EV_APPLY) + return NB_OK; nb_running_unset_entry(args->dnode); return NB_OK; } From d2e2d69477b9ae1e4bf6f484b4d822a91d9ef7ec Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 8 Aug 2024 01:25:02 +0300 Subject: [PATCH 50/81] ripd: fix show run output for distribute-list CLI show callbacks should be defined in frr_ripd_cli_info instead of frr_ripd_info, because only the former is loaded by mgmtd and only its callbacks are getting called for config output. Signed-off-by: Igor Ryzhov (cherry picked from commit 25d94ec3eedca978ce7c37359105b0518dcf0f5f) --- ripd/rip_cli.c | 16 ++++++++++++++++ ripd/rip_nb.c | 4 ---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/ripd/rip_cli.c b/ripd/rip_cli.c index 7066485be0..5712a0b825 100644 --- a/ripd/rip_cli.c +++ b/ripd/rip_cli.c @@ -1374,6 +1374,22 @@ const struct frr_yang_module_info frr_ripd_cli_info = { .xpath = "/frr-ripd:ripd/instance/non-passive-interface", .cbs.cli_show = cli_show_rip_non_passive_interface, }, + { + .xpath = "/frr-ripd:ripd/instance/distribute-list/in/access-list", + .cbs.cli_show = group_distribute_list_ipv4_cli_show, + }, + { + .xpath = "/frr-ripd:ripd/instance/distribute-list/out/access-list", + .cbs.cli_show = group_distribute_list_ipv4_cli_show, + }, + { + .xpath = "/frr-ripd:ripd/instance/distribute-list/in/prefix-list", + .cbs.cli_show = group_distribute_list_ipv4_cli_show, + }, + { + .xpath = "/frr-ripd:ripd/instance/distribute-list/out/prefix-list", + .cbs.cli_show = group_distribute_list_ipv4_cli_show, + }, { .xpath = "/frr-ripd:ripd/instance/redistribute", .cbs.cli_show = cli_show_rip_redistribute, diff --git a/ripd/rip_nb.c b/ripd/rip_nb.c index d5df5916ad..231099d3ac 100644 --- a/ripd/rip_nb.c +++ b/ripd/rip_nb.c @@ -143,7 +143,6 @@ const struct frr_yang_module_info frr_ripd_info = { .cbs = { .modify = group_distribute_list_ipv4_modify, .destroy = group_distribute_list_ipv4_destroy, - .cli_show = group_distribute_list_ipv4_cli_show, } }, { @@ -151,7 +150,6 @@ const struct frr_yang_module_info frr_ripd_info = { .cbs = { .modify = group_distribute_list_ipv4_modify, .destroy = group_distribute_list_ipv4_destroy, - .cli_show = group_distribute_list_ipv4_cli_show, } }, { @@ -159,7 +157,6 @@ const struct frr_yang_module_info frr_ripd_info = { .cbs = { .modify = group_distribute_list_ipv4_modify, .destroy = group_distribute_list_ipv4_destroy, - .cli_show = group_distribute_list_ipv4_cli_show, } }, { @@ -167,7 +164,6 @@ const struct frr_yang_module_info frr_ripd_info = { .cbs = { .modify = group_distribute_list_ipv4_modify, .destroy = group_distribute_list_ipv4_destroy, - .cli_show = group_distribute_list_ipv4_cli_show, } }, { From 06bf5bc161e6a8aff66e53a8ce5abbf2c3693325 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 8 Aug 2024 00:40:51 +0300 Subject: [PATCH 51/81] mgmtd: don't add implicit state data when reading config from file When mgmt reads configuration from file, it shouldn't add implicit state data to the candidate datastore. Configuration datastores like candidate should never store state, otherwise they fail validation. Fixes #15814 Signed-off-by: Igor Ryzhov (cherry picked from commit 61e8d5e0b9f0ccb7647a04974f7134ede67fedd8) --- mgmtd/mgmt_ds.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mgmtd/mgmt_ds.c b/mgmtd/mgmt_ds.c index eaf52dfb29..dabae4afd1 100644 --- a/mgmtd/mgmt_ds.c +++ b/mgmtd/mgmt_ds.c @@ -127,7 +127,8 @@ static int mgmt_ds_load_cfg_from_file(const char *filepath, *dnode = NULL; ret = lyd_parse_data_path(ly_native_ctx, filepath, LYD_JSON, - LYD_PARSE_STRICT, 0, dnode); + LYD_PARSE_NO_STATE | LYD_PARSE_STRICT, + LYD_VALIDATE_NO_STATE, dnode); if (ret != LY_SUCCESS) { if (*dnode) From a0bcf644d698c4ad78df5909de33ed559288f2bc Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sat, 10 Aug 2024 19:43:08 -0400 Subject: [PATCH 52/81] zebra: Ensure non-equal id's are not same nhg's The function zebra_nhg_hash_equal is only used as a hash function for storage of NHG's and retrieval. If you have say two nhg's: 31 (25/26) 32 (25/26) This function would return them as being equal. Which of course leads to the problem when you attempt to hash_release 32 but release 31 from the hash. Then later when you attempt to do hash comparisons 32 has actually been freed leaving to use after free situations and shit goes down hill fast. This hash is only used as part of the hash comparison function for nexthop group storage. Since this is so let's always return the 31/32 nhg's are not equal at all. We possibly have a different problem where we are creating 31 and 32 ( when 31 should have just been used instead of 32 ) but we need to prevent any type of hash release problem at all. This supercedes any other issue( that should be tracked down on it's own ). Since you can have use after free situation that leads to a crash -vs- some possible nexthop group duplication which is very minor in comparison. Signed-off-by: Donald Sharp (cherry picked from commit 5a1b61aeba1b83825e1656a047aab35be0c1db55) --- zebra/zebra_nhg.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/zebra/zebra_nhg.c b/zebra/zebra_nhg.c index 9971b19836..6235ecada4 100644 --- a/zebra/zebra_nhg.c +++ b/zebra/zebra_nhg.c @@ -525,9 +525,18 @@ bool zebra_nhg_hash_equal(const void *arg1, const void *arg2) struct nexthop *nexthop1; struct nexthop *nexthop2; - /* No matter what if they equal IDs, assume equal */ - if (nhe1->id && nhe2->id && (nhe1->id == nhe2->id)) - return true; + /* If both NHG's have id's then we can just know that + * they are either identical or not. This comparison + * is only ever used for hash equality. NHE's id + * is sufficient to distinguish them. This is especially + * true if NHG's are owned by an upper level protocol. + */ + if (nhe1->id && nhe2->id) { + if (nhe1->id == nhe2->id) + return true; + + return false; + } if (nhe1->type != nhe2->type) return false; From c1ee987adaae9e51d574469b637f5e7dc7110302 Mon Sep 17 00:00:00 2001 From: Mark Stapp Date: Fri, 9 Aug 2024 10:08:21 -0400 Subject: [PATCH 53/81] isisd: fix memory handling in isis_adj_process_threeway() The adj_process_threeway() api may call the adj_state_change() api, which may delete the adj struct being examined. Change the signature so that callers pass a ptr-to-ptr so that they will see that deletion. Signed-off-by: Mark Stapp (cherry picked from commit 3eb7d1641166872591554519607483f6d77657f5) --- isisd/isis_adjacency.c | 8 ++++---- isisd/isis_adjacency.h | 2 +- isisd/isis_pdu.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/isisd/isis_adjacency.c b/isisd/isis_adjacency.c index 430bee92bf..c04f8155ba 100644 --- a/isisd/isis_adjacency.c +++ b/isisd/isis_adjacency.c @@ -231,11 +231,12 @@ static void isis_adj_route_switchover(struct isis_adjacency *adj) } } -void isis_adj_process_threeway(struct isis_adjacency *adj, +void isis_adj_process_threeway(struct isis_adjacency **padj, struct isis_threeway_adj *tw_adj, enum isis_adj_usage adj_usage) { enum isis_threeway_state next_tw_state = ISIS_THREEWAY_DOWN; + struct isis_adjacency *adj = *padj; if (tw_adj && !adj->circuit->disable_threeway_adj) { if (tw_adj->state == ISIS_THREEWAY_DOWN) { @@ -265,14 +266,13 @@ void isis_adj_process_threeway(struct isis_adjacency *adj, fabricd_initial_sync_hello(adj->circuit); if (next_tw_state == ISIS_THREEWAY_DOWN) { - isis_adj_state_change(&adj, ISIS_ADJ_DOWN, - "Neighbor restarted"); + isis_adj_state_change(padj, ISIS_ADJ_DOWN, "Neighbor restarted"); return; } if (next_tw_state == ISIS_THREEWAY_UP) { if (adj->adj_state != ISIS_ADJ_UP) { - isis_adj_state_change(&adj, ISIS_ADJ_UP, NULL); + isis_adj_state_change(padj, ISIS_ADJ_UP, NULL); adj->adj_usage = adj_usage; } } diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h index b5c7dd8d73..0ad36e4c5f 100644 --- a/isisd/isis_adjacency.h +++ b/isisd/isis_adjacency.h @@ -111,7 +111,7 @@ struct isis_adjacency *isis_adj_find(const struct isis_area *area, int level, struct isis_adjacency *isis_new_adj(const uint8_t *id, const uint8_t *snpa, int level, struct isis_circuit *circuit); void isis_delete_adj(void *adj); -void isis_adj_process_threeway(struct isis_adjacency *adj, +void isis_adj_process_threeway(struct isis_adjacency **padj, struct isis_threeway_adj *tw_adj, enum isis_adj_usage adj_usage); DECLARE_HOOK(isis_adj_state_change_hook, (struct isis_adjacency *adj), (adj)); diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c index 5be317018e..23238d314a 100644 --- a/isisd/isis_pdu.c +++ b/isisd/isis_pdu.c @@ -281,14 +281,14 @@ static int process_p2p_hello(struct iih_info *iih) if (iih->calculated_type == IS_LEVEL_1) { switch (iih->circ_type) { case IS_LEVEL_1: - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); break; case IS_LEVEL_1_AND_2: if ((adj->adj_state != ISIS_ADJ_UP) || (adj->adj_usage == ISIS_ADJ_LEVEL1) || (adj->adj_usage == ISIS_ADJ_LEVEL1AND2)) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } break; @@ -301,7 +301,7 @@ static int process_p2p_hello(struct iih_info *iih) case IS_LEVEL_1: if (adj->adj_state != ISIS_ADJ_UP || adj->adj_usage == ISIS_ADJ_LEVEL1) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL2) || (adj->adj_usage == @@ -315,7 +315,7 @@ static int process_p2p_hello(struct iih_info *iih) case IS_LEVEL_2: if (adj->adj_state != ISIS_ADJ_UP || adj->adj_usage == ISIS_ADJ_LEVEL2) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) || (adj->adj_usage == @@ -329,7 +329,7 @@ static int process_p2p_hello(struct iih_info *iih) case IS_LEVEL_1_AND_2: if (adj->adj_state != ISIS_ADJ_UP || adj->adj_usage == ISIS_ADJ_LEVEL1AND2) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) || (adj->adj_usage == ISIS_ADJ_LEVEL2)) { @@ -349,12 +349,12 @@ static int process_p2p_hello(struct iih_info *iih) if (adj->adj_state != ISIS_ADJ_UP || adj->adj_usage == ISIS_ADJ_LEVEL2 || adj->adj_usage == ISIS_ADJ_LEVEL1AND2) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } break; case IS_LEVEL_2: - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); break; } @@ -401,7 +401,7 @@ static int process_p2p_hello(struct iih_info *iih) case IS_LEVEL_2: if (adj->adj_state != ISIS_ADJ_UP || adj->adj_usage == ISIS_ADJ_LEVEL2) { - isis_adj_process_threeway(adj, tw_adj, + isis_adj_process_threeway(&adj, tw_adj, iih->calculated_type); } else if (adj->adj_usage == ISIS_ADJ_LEVEL1) { /* (7) down - wrong system */ From c3cc4b4edea6589fcb232c6474fadd4e335958d2 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Sat, 10 Aug 2024 01:32:55 +0300 Subject: [PATCH 54/81] lib: fix distribute-list deletion When a whole distribute-list is deleted (can be done only using API), all its children must be cleaned up manually. Fixes #16538 Signed-off-by: Igor Ryzhov (cherry picked from commit 8fad4f317ebd3de7677d7600e7a024f713b20d70) --- lib/distribute.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/lib/distribute.c b/lib/distribute.c index 90a73c3635..c0693b0849 100644 --- a/lib/distribute.c +++ b/lib/distribute.c @@ -456,10 +456,43 @@ int group_distribute_list_create_helper( * XPath: /frr-ripd:ripd/instance/distribute-lists/distribute-list/{in,out}/{access,prefix}-list */ +static int distribute_list_leaf_update(const struct lyd_node *dnode, + int ip_version, bool no); + int group_distribute_list_destroy(struct nb_cb_destroy_args *args) { + struct lyd_node *dnode; + if (args->event != NB_EV_APPLY) return NB_OK; + + /* + * We don't keep the IP version of distribute-list anywhere, so we're + * trying to remove both. If one doesn't exist, it's simply skipped by + * the remove function. + */ + + dnode = yang_dnode_get(args->dnode, "in/access-list"); + if (dnode) { + distribute_list_leaf_update(dnode, 4, true); + distribute_list_leaf_update(dnode, 6, true); + } + dnode = yang_dnode_get(args->dnode, "in/prefix-list"); + if (dnode) { + distribute_list_leaf_update(dnode, 4, true); + distribute_list_leaf_update(dnode, 6, true); + } + dnode = yang_dnode_get(args->dnode, "out/access-list"); + if (dnode) { + distribute_list_leaf_update(dnode, 4, true); + distribute_list_leaf_update(dnode, 6, true); + } + dnode = yang_dnode_get(args->dnode, "out/prefix-list"); + if (dnode) { + distribute_list_leaf_update(dnode, 4, true); + distribute_list_leaf_update(dnode, 6, true); + } + nb_running_unset_entry(args->dnode); return NB_OK; } From 88c6471720650a0563e55fc3ebf8982171b4a171 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:13:44 +0300 Subject: [PATCH 55/81] Revert "bgpd: fix sending ipv6 local nexthop if global present" This reverts commit 424fe0bf809c1d84f16aba3f5e5f8249af29083b. --- bgpd/bgp_zebra.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 5bb177b2f7..e72a739798 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -303,12 +303,11 @@ static int bgp_ifp_down(struct interface *ifp) static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) { - struct connected *ifc, *connected; + struct connected *ifc; struct bgp *bgp; struct peer *peer; struct prefix *addr; struct listnode *node, *nnode; - bool v6_ll_in_nh_global; afi_t afi; safi_t safi; @@ -343,27 +342,6 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) addr = ifc->address; for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - v6_ll_in_nh_global = false; - - if (IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)) { - frr_each (if_connected, ifc->ifp->connected, - connected) { - if (connected->address->family != - AF_INET6) - continue; - if (!IPV6_ADDR_SAME(&connected->address - ->u.prefix6, - &peer->nexthop - .v6_global)) - continue; - /* peer->nexthop.v6_global contains a link-local address - * that needs to be replaced by the global address. - */ - v6_ll_in_nh_global = true; - break; - } - } - /* * If the Peer's interface name matches the * interface name for which BGP received the @@ -374,11 +352,10 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) * into peer's v6_global and send updates out * with new nexthop addr. */ - if (v6_ll_in_nh_global || - (peer->conf_if && - strcmp(peer->conf_if, ifc->ifp->name) == 0 && - (IS_MAPPED_IPV6(&peer->nexthop.v6_global) || - IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)))) { + if ((peer->conf_if && + (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && + ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || + IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { if (bgp_debug_zebra(ifc->address)) { zlog_debug("Update peer %pBP's current intf global addr from %pI6 to %pI6 and send updates", peer, From e85077c69d01e3ab9a2309734fcea00760d6a97b Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:12 +0300 Subject: [PATCH 56/81] Revert "bgpd: log new ipv6 global in bgp_interface_address_add" This reverts commit b083885198157555bbb916ecae9809c5d67a567b. --- bgpd/bgp_zebra.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index e72a739798..c407008d57 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -357,10 +357,9 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { if (bgp_debug_zebra(ifc->address)) { - zlog_debug("Update peer %pBP's current intf global addr from %pI6 to %pI6 and send updates", + zlog_debug("Update peer %pBP's current intf addr %pI6 and send updates", peer, - &peer->nexthop.v6_global, - &addr->u.prefix6); + &peer->nexthop.v6_global); } memcpy(&peer->nexthop.v6_global, &addr->u.prefix6, IPV6_MAX_BYTELEN); From 0a7e9711878074ba6c223238bb1c130be28cb1d4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:16 +0300 Subject: [PATCH 57/81] Revert "bgpd: reduce bgp_interface_address_add indentation" This reverts commit 778e0df87b7a846f46d84f61ea889a32fe578e49. --- bgpd/bgp_zebra.c | 84 ++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c407008d57..79bb43bda9 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -325,47 +325,53 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if (!bgp) return 0; - if (!if_is_operative(ifc->ifp)) - return 0; - - bgp_connected_add(bgp, ifc); - - /* If we have learnt of any neighbors on this interface, - * check to kick off any BGP interface-based neighbors, - * but only if this is a link-local address. - */ - if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) && - !list_isempty(ifc->ifp->nbr_connected)) - bgp_start_interface_nbrs(bgp, ifc->ifp); - else if (ifc->address->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { - addr = ifc->address; + if (if_is_operative(ifc->ifp)) { + bgp_connected_add(bgp, ifc); - for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - /* - * If the Peer's interface name matches the - * interface name for which BGP received the - * update and if the received interface address - * is a globalV6 and if the peer is currently - * using a v4-mapped-v6 addr or a link local - * address, then copy the Rxed global v6 addr - * into peer's v6_global and send updates out - * with new nexthop addr. - */ - if ((peer->conf_if && - (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && - ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || - IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { - if (bgp_debug_zebra(ifc->address)) { - zlog_debug("Update peer %pBP's current intf addr %pI6 and send updates", - peer, - &peer->nexthop.v6_global); + /* If we have learnt of any neighbors on this interface, + * check to kick off any BGP interface-based neighbors, + * but only if this is a link-local address. + */ + if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) + && !list_isempty(ifc->ifp->nbr_connected)) + bgp_start_interface_nbrs(bgp, ifc->ifp); + else if (ifc->address->family == AF_INET6 && + !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { + addr = ifc->address; + + for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { + /* + * If the Peer's interface name matches the + * interface name for which BGP received the + * update and if the received interface address + * is a globalV6 and if the peer is currently + * using a v4-mapped-v6 addr or a link local + * address, then copy the Rxed global v6 addr + * into peer's v6_global and send updates out + * with new nexthop addr. + */ + if ((peer->conf_if && + (strcmp(peer->conf_if, ifc->ifp->name) == + 0)) && + ((IS_MAPPED_IPV6( + &peer->nexthop.v6_global)) || + IN6_IS_ADDR_LINKLOCAL( + &peer->nexthop.v6_global))) { + + if (bgp_debug_zebra(ifc->address)) { + zlog_debug( + "Update peer %pBP's current intf addr %pI6 and send updates", + peer, + &peer->nexthop + .v6_global); + } + memcpy(&peer->nexthop.v6_global, + &addr->u.prefix6, + IPV6_MAX_BYTELEN); + FOREACH_AFI_SAFI (afi, safi) + bgp_announce_route(peer, afi, + safi, true); } - memcpy(&peer->nexthop.v6_global, - &addr->u.prefix6, IPV6_MAX_BYTELEN); - FOREACH_AFI_SAFI (afi, safi) - bgp_announce_route(peer, afi, safi, - true); } } } From 8a7c4c023e2a4cbecfd93ad0b680a773c2964e37 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:20 +0300 Subject: [PATCH 58/81] Revert "bgpd: optimize bgp_interface_address_add" This reverts commit 8599fe2b5e34b2ac1a46a14983ddcc2336e9116d. --- bgpd/bgp_zebra.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 79bb43bda9..00013b1e7a 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -335,11 +335,13 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) && !list_isempty(ifc->ifp->nbr_connected)) bgp_start_interface_nbrs(bgp, ifc->ifp); - else if (ifc->address->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { + else { addr = ifc->address; for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { + if (addr->family == AF_INET) + continue; + /* * If the Peer's interface name matches the * interface name for which BGP received the @@ -353,6 +355,7 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if ((peer->conf_if && (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && + !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6) && ((IS_MAPPED_IPV6( &peer->nexthop.v6_global)) || IN6_IS_ADDR_LINKLOCAL( From efd8f613f97480a0aeb90f0446c78bf87f6442f4 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:55 +0300 Subject: [PATCH 59/81] Revert "topotests: update bgp_vrf_leaking_5549_routes" This reverts commit f1b8364ab3784cebfc0689883efdb21ac7d06213. --- .../pe1/results/vrf10_ipv4_unicast.json | 7 +++---- .../pe1/results/vrf20_ipv4_unicast.json | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json index f664bb6b52..768bffbe9d 100644 --- a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json +++ b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json @@ -15,16 +15,15 @@ "origin": "incomplete", "nexthops": [ { - "ip": "::ffff:c000:202", "hostname": "ce1", "afi": "ipv6", - "scope": "global" + "scope": "global", + "used": true }, { "hostname": "ce1", "afi": "ipv6", - "scope": "link-local", - "used": true + "scope": "link-local" } ] } diff --git a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json index 3498ed4326..1e93715270 100644 --- a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json +++ b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json @@ -17,16 +17,15 @@ "nhVrfName": "vrf10", "nexthops": [ { - "ip": "::ffff:c000:202", "hostname": "pe1", "afi": "ipv6", - "scope": "global" + "scope": "global", + "used": true }, { "hostname": "pe1", "afi": "ipv6", - "scope": "link-local", - "used": true + "scope": "link-local" } ] } From 863da18d1e15b1538438f1e15b59419094ecd797 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:59 +0300 Subject: [PATCH 60/81] Revert "bgpd: prefer link-local to a ipv4-mapped ipv6 global" This reverts commit 5dd731af8421e8b3070eec0b3af4ad234c95c6bb. --- bgpd/bgp_nht.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 8ce45558e9..dc6dc54a3b 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -320,6 +320,11 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, afi = BGP_ATTR_MP_NEXTHOP_LEN_IP6(pi->attr) ? AFI_IP6 : AFI_IP; + /* Validation for the ipv4 mapped ipv6 nexthop. */ + if (IS_MAPPED_IPV6(&pi->attr->mp_nexthop_global)) { + afi = AFI_IP; + } + /* This will return true if the global IPv6 NH is a link local * addr */ if (make_prefix(afi, pi, &p) < 0) @@ -1035,11 +1040,19 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) p->u.prefix4 = p_orig->u.prefix4; p->prefixlen = p_orig->prefixlen; } else { - if (p_orig->family == AF_EVPN) - p->u.prefix4 = pi->attr->mp_nexthop_global_in; - else - p->u.prefix4 = pi->attr->nexthop; - p->prefixlen = IPV4_MAX_BITLEN; + if (IS_MAPPED_IPV6(&pi->attr->mp_nexthop_global)) { + ipv4_mapped_ipv6_to_ipv4( + &pi->attr->mp_nexthop_global, &ipv4); + p->u.prefix4 = ipv4; + p->prefixlen = IPV4_MAX_BITLEN; + } else { + if (p_orig->family == AF_EVPN) + p->u.prefix4 = + pi->attr->mp_nexthop_global_in; + else + p->u.prefix4 = pi->attr->nexthop; + p->prefixlen = IPV4_MAX_BITLEN; + } } break; case AFI_IP6: @@ -1055,7 +1068,6 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) /* If we receive MP_REACH nexthop with ::(LL) * or LL(LL), use LL address as nexthop cache. */ - p->prefixlen = IPV6_MAX_BITLEN; if (pi->attr && pi->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL && @@ -1070,22 +1082,15 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) pi->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) { if (CHECK_FLAG(pi->attr->nh_flags, - BGP_ATTR_NH_MP_PREFER_GLOBAL)) { - if (IS_MAPPED_IPV6( - &pi->attr->mp_nexthop_global)) { - ipv4_mapped_ipv6_to_ipv4( - &pi->attr->mp_nexthop_global, - &ipv4); - p->u.prefix4 = ipv4; - p->prefixlen = IPV4_MAX_BITLEN; - } else - p->u.prefix6 = - pi->attr->mp_nexthop_global; - } else + BGP_ATTR_NH_MP_PREFER_GLOBAL)) + p->u.prefix6 = + pi->attr->mp_nexthop_global; + else p->u.prefix6 = pi->attr->mp_nexthop_local; } else p->u.prefix6 = pi->attr->mp_nexthop_global; + p->prefixlen = IPV6_MAX_BITLEN; } break; default: From 8dffec1c4e0ee4c2e26486b345b086c8fb1a1ced Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:04 +0300 Subject: [PATCH 61/81] Revert "bgpd: set ipv4-mapped ipv6 for ipv4 with ipv6 nexthop" This reverts commit fc5a738409eac9ca938cbb398872ea77d9cc5023. --- bgpd/bgp_updgrp_packet.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 6e30d4f846..7c92bbd514 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -523,13 +523,11 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, gnh_modified = 1; } - if (peer->nexthop.v4.s_addr != INADDR_ANY && - (IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg) || - (IN6_IS_ADDR_LINKLOCAL(mod_v6nhg) && - peer->connection->su.sa.sa_family == AF_INET6 && - paf->afi == AFI_IP))) { - ipv4_to_ipv4_mapped_ipv6(mod_v6nhg, peer->nexthop.v4); - gnh_modified = 1; + if (IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg)) { + if (peer->nexthop.v4.s_addr != INADDR_ANY) { + ipv4_to_ipv4_mapped_ipv6(mod_v6nhg, + peer->nexthop.v4); + } } if (IS_MAPPED_IPV6(&peer->nexthop.v6_global)) { From 9a5c3b931e0c4cf6f8bf7f9b2e31a04ea96250af Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:08 +0300 Subject: [PATCH 62/81] Revert "tests: ipv6 global removal in bgp_nexthop_mp_ipv4_6" This reverts commit 04c220bedb63334a65677a46ef84938cc812221f. --- .../r1/bgp_ipv6_step2.json | 90 ------------------- .../r2/bgp_ipv6_step2.json | 48 ---------- .../r3/bgp_ipv6_step2.json | 48 ---------- .../r4/bgp_ipv6_step2.json | 49 ---------- .../r5/bgp_ipv6_step2.json | 49 ---------- .../r6/bgp_ipv6_step2.json | 48 ---------- .../r7/bgp_ipv6_step2.json | 48 ---------- .../r8/bgp_ipv6_step2.json | 48 ---------- .../rr1/bgp_ipv6_step2.json | 62 ------------- .../test_nexthop_mp_ipv4_6.py | 52 ----------- 10 files changed, 542 deletions(-) delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json deleted file mode 100755 index f7c5c7c3b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json deleted file mode 100644 index 21f36089b6..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json deleted file mode 100644 index 21f36089b6..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json deleted file mode 100755 index 7d0786c0ef..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json deleted file mode 100755 index 7d0786c0ef..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json deleted file mode 100644 index 55912dd74c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json deleted file mode 100644 index 8fe5f7c1de..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json deleted file mode 100644 index 20f4940328..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json deleted file mode 100644 index 4ab0e1c2ae..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::3", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py index 911a6d757f..4da13b16d1 100644 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py @@ -226,58 +226,6 @@ def test_bgp_ping_ok_step1(): check_ping("h1", "fd00:800::1", True, 5, 1) -def test_bgp_ipv6_nexthop_step2(): - """ - Remove IPv6 global on r1 and r7 - Assert that BGP has correct ipv6 nexthops. - """ - - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - tgen.gears["r1"].vtysh_cmd( - """ -configure -interface eth-r2 - no ipv6 address fd00:0:1::1/64 -! -interface eth-r3 - no ipv6 address fd00:0:2::1/64 -""" - ) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv6_step2.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv6 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv6 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ping_ok_step2(): - "Check that h1 pings h2 and h3" - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - check_ping("h1", "192.168.7.1", True, 5, 1) - check_ping("h1", "fd00:700::1", True, 5, 1) - check_ping("h1", "192.168.8.1", True, 5, 1) - check_ping("h1", "fd00:800::1", True, 5, 1) - - if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) From 3e7094e2b19459c81aac40fa00b4ea0812c1902e Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:13 +0300 Subject: [PATCH 63/81] Revert "bgpd: fix "used" json key on link-local nexthop" This reverts commit 2de4dfc97adfec788e45e148b4204196d612c81c. --- bgpd/bgp_route.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f6fe87e352..9e40e165fa 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9659,7 +9659,10 @@ void route_vty_out(struct vty *vty, const struct prefix *p, json_object_string_add(json_nexthop_ll, "scope", "link-local"); - if (!CHECK_FLAG(attr->nh_flags, + if ((IPV6_ADDR_CMP(&attr->mp_nexthop_global, + &attr->mp_nexthop_local) != + 0) && + !CHECK_FLAG(attr->nh_flags, BGP_ATTR_NH_MP_PREFER_GLOBAL)) json_object_boolean_true_add( json_nexthop_ll, "used"); From 2fd44b1bbbca9e3f9554a8bf2530619f646e7f34 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:18 +0300 Subject: [PATCH 64/81] Revert "bgpd: fix removing ipv6 global nexhop" This reverts commit ee0378cdbb458f9d3710f1fb557368ace8d72477. --- bgpd/bgp_zebra.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 00013b1e7a..d4a0209ea2 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -385,12 +385,10 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct listnode *node, *nnode; - struct connected *ifc, *connected; + struct connected *ifc; struct peer *peer; struct bgp *bgp; struct prefix *addr; - struct in6_addr *v6_global = NULL; - struct in6_addr *v6_local = NULL; afi_t afi; safi_t safi; @@ -412,17 +410,7 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) addr = ifc->address; if (bgp && addr->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6)) { - /* find another IPv6 global if possible and find the IPv6 link-local */ - frr_each (if_connected, ifc->ifp->connected, connected) { - if (connected->address->family != AF_INET6) - continue; - if (IN6_IS_ADDR_LINKLOCAL(&connected->address->u.prefix6)) - v6_local = &connected->address->u.prefix6; - else - v6_global = &connected->address->u.prefix6; - } - + !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix)) { /* * When we are using the v6 global as part of the peering * nexthops and we are removing it, then we need to @@ -433,15 +421,8 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { if (IPV6_ADDR_SAME(&peer->nexthop.v6_global, &addr->u.prefix6)) { - if (v6_global) - IPV6_ADDR_COPY(&peer->nexthop.v6_global, - v6_global); - else if (v6_local) - IPV6_ADDR_COPY(&peer->nexthop.v6_global, - v6_local); - else - memset(&peer->nexthop.v6_global, 0, - IPV6_MAX_BYTELEN); + memset(&peer->nexthop.v6_global, 0, + IPV6_MAX_BYTELEN); FOREACH_AFI_SAFI (afi, safi) bgp_announce_route(peer, afi, safi, true); From 72b4ca50d06b18a24eb9855d5dfc8d4973117977 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:22 +0300 Subject: [PATCH 65/81] Revert "bgpd: optimize bgp_interface_address_del" This reverts commit fc1dd2e5060b6e470daa203080bdb9473a637407. --- bgpd/bgp_zebra.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index d4a0209ea2..c3b93adc26 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -389,8 +389,6 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) struct peer *peer; struct bgp *bgp; struct prefix *addr; - afi_t afi; - safi_t safi; bgp = bgp_lookup_by_vrf_id(vrf_id); @@ -409,8 +407,7 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) addr = ifc->address; - if (bgp && addr->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix)) { + if (bgp) { /* * When we are using the v6 global as part of the peering * nexthops and we are removing it, then we need to @@ -419,10 +416,17 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) * we do not want the peering to bounce. */ for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - if (IPV6_ADDR_SAME(&peer->nexthop.v6_global, - &addr->u.prefix6)) { - memset(&peer->nexthop.v6_global, 0, - IPV6_MAX_BYTELEN); + afi_t afi; + safi_t safi; + + if (addr->family == AF_INET) + continue; + + if (!IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6) + && memcmp(&peer->nexthop.v6_global, + &addr->u.prefix6, 16) + == 0) { + memset(&peer->nexthop.v6_global, 0, 16); FOREACH_AFI_SAFI (afi, safi) bgp_announce_route(peer, afi, safi, true); From 9e3aa8c1ac2c2fe13fe3c31b62a85b6d96768b6d Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:28:13 +0300 Subject: [PATCH 66/81] Revert "topotests: add bgp_nexthop_mp_ipv4_6 test" This reverts commit 62913cb15d8195c41229c2f6090d7e189e04646e. Signed-off-by: Donatas Abraitis --- .../bgp_nexthop_mp_ipv4_6/__init__.py | 0 .../bgp_nexthop_mp_ipv4_6/h1/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/h2/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/h3/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json | 70 ------ .../r1/bgp_ipv6_step1.json | 90 ------- .../bgp_nexthop_mp_ipv4_6/r1/bgpd.conf | 23 -- .../bgp_nexthop_mp_ipv4_6/r1/zebra.conf | 16 -- .../bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json | 46 ---- .../r2/bgp_ipv6_step1.json | 53 ---- .../bgp_nexthop_mp_ipv4_6/r2/bgpd.conf | 11 - .../bgp_nexthop_mp_ipv4_6/r2/isisd.conf | 24 -- .../bgp_nexthop_mp_ipv4_6/r2/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json | 46 ---- .../r3/bgp_ipv6_step1.json | 53 ---- .../bgp_nexthop_mp_ipv4_6/r3/bgpd.conf | 11 - .../bgp_nexthop_mp_ipv4_6/r3/isisd.conf | 24 -- .../bgp_nexthop_mp_ipv4_6/r3/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json | 46 ---- .../r4/bgp_ipv6_step1.json | 49 ---- .../bgp_nexthop_mp_ipv4_6/r4/bgpd.conf | 13 - .../bgp_nexthop_mp_ipv4_6/r4/isisd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/r4/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json | 46 ---- .../r5/bgp_ipv6_step1.json | 49 ---- .../bgp_nexthop_mp_ipv4_6/r5/bgpd.conf | 13 - .../bgp_nexthop_mp_ipv4_6/r5/isisd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/r5/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json | 46 ---- .../r6/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r6/bgpd.conf | 17 -- .../bgp_nexthop_mp_ipv4_6/r6/isisd.conf | 31 --- .../bgp_nexthop_mp_ipv4_6/r6/zebra.conf | 16 -- .../bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json | 46 ---- .../r7/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r7/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/r7/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json | 46 ---- .../r8/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r8/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/r8/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json | 58 ----- .../rr1/bgp_ipv6_step1.json | 62 ----- .../bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/rr1/isisd.conf | 40 --- .../bgp_nexthop_mp_ipv4_6/rr1/zebra.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/rs1/isisd.conf | 36 --- .../bgp_nexthop_mp_ipv4_6/rs1/zebra.conf | 8 - .../test_nexthop_mp_ipv4_6.py | 231 ------------------ 50 files changed, 1716 deletions(-) delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf deleted file mode 100644 index 9b19b2cfbd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:100::2 -ip route 0.0.0.0/0 192.168.1.2 -interface eth-r1 - ip address 192.168.1.1/24 - ipv6 address fd00:100::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf deleted file mode 100644 index 2bf4a66680..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:700::2 -ip route 0.0.0.0/0 192.168.7.2 -interface eth-r7 - ip address 192.168.7.1/24 - ipv6 address fd00:700::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf deleted file mode 100644 index e8b6ac6e26..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:800::2 -ip route 0.0.0.0/0 192.168.8.2 -interface eth-r8 - ip address 192.168.8.1/24 - ipv6 address fd00:800::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json deleted file mode 100755 index 12fecee39f..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "172.16.1.3", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "172.16.0.2", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "172.16.1.3", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "172.16.0.2", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json deleted file mode 100755 index f7c5c7c3b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf deleted file mode 100644 index 23b986d130..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf +++ /dev/null @@ -1,23 +0,0 @@ -router bgp 65100 - no bgp ebgp-requires-policy - neighbor 172.16.0.2 remote-as external - neighbor 172.16.1.3 remote-as external - ! neighbor 172.16.0.2 capability extended-nexthop - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.16.0.2 activate - neighbor 172.16.1.3 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:100::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf deleted file mode 100644 index 79cbafb5b8..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf +++ /dev/null @@ -1,16 +0,0 @@ -! -interface eth-h1 - ip address 192.168.1.2/24 - ipv6 address fd00:100::2/64 -! -interface eth-r2 - ip address 172.16.0.1/24 - ipv6 address fd00:0:1::1/64 -! -interface eth-r3 - ip address 172.16.1.1/24 - ipv6 address fd00:0:2::1/64 -! -interface lo - ip address 192.0.2.1/32 - ipv6 address 2001:db8::1/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json deleted file mode 100644 index 4f86a1a648..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf deleted file mode 100644 index badb11cbeb..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf +++ /dev/null @@ -1,11 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - neighbor 172.16.0.1 remote-as external - ! neighbor 172.16.0.1 capability extended-nexthop - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.101 update-source 192.0.2.2 - ! - address-family ipv6 unicast - neighbor 172.16.0.1 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf deleted file mode 100644 index 16963798f8..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf +++ /dev/null @@ -1,24 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0002.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf deleted file mode 100644 index 8997115d87..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r1 - ip address 172.16.0.2/24 - ipv6 address fd00:0:1::2/64 -! -interface eth-rr1 - ip address 10.0.0.2/24 - ipv6 address fd00:0:3::2/64 -! -interface lo - ip address 192.0.2.2/32 - ipv6 address 2001:db8::2/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json deleted file mode 100644 index 0f18a43bf5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.1.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json deleted file mode 100644 index f44121c30e..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:2::1", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf deleted file mode 100644 index 4dec311f51..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf +++ /dev/null @@ -1,11 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - neighbor 172.16.1.1 remote-as external - ! neighbor 172.16.1.1 capability extended-nexthop - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.101 update-source 192.0.2.3 - ! - address-family ipv6 unicast - neighbor 172.16.1.1 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf deleted file mode 100644 index fe3e307b42..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf +++ /dev/null @@ -1,24 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0003.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf deleted file mode 100644 index 8074bbdcde..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r1 - ip address 172.16.1.3/24 - ipv6 address fd00:0:2::3/64 -! -interface eth-rr1 - ip address 10.0.1.3/24 - ipv6 address fd00:0:4::3/64 -! -interface lo - ip address 192.0.2.3/32 - ipv6 address 2001:db8::3/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json deleted file mode 100755 index 756a78e3b1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf deleted file mode 100644 index 2dbc4acddc..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.5 update-source 192.0.2.4 - neighbor 192.0.2.6 update-source 192.0.2.4 - neighbor 192.0.2.101 update-source 192.0.2.4 - ! - address-family ipv6 unicast - neighbor 192.0.2.5 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf deleted file mode 100644 index 21eb80f58b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf +++ /dev/null @@ -1,26 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r6 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0004.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf deleted file mode 100644 index c598b345e5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r6 - ip address 10.0.4.4/24 - ipv6 address fd00:0:7::4/64 -! -interface eth-rr1 - ip address 10.0.2.4/24 - ipv6 address fd00:0:5::4/64 -! -interface lo - ip address 192.0.2.4/32 - ipv6 address 2001:db8::4/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json deleted file mode 100755 index 756a78e3b1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf deleted file mode 100644 index 101edbd71b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.4 update-source 192.0.2.5 - neighbor 192.0.2.6 update-source 192.0.2.5 - neighbor 192.0.2.101 update-source 192.0.2.5 - ! - address-family ipv6 unicast - neighbor 192.0.2.4 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf deleted file mode 100644 index f998e805b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf +++ /dev/null @@ -1,26 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r6 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0005.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf deleted file mode 100644 index 7b43db0958..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r6 - ip address 10.0.5.5/24 - ipv6 address fd00:0:8::5/64 -! -interface eth-rr1 - ip address 10.0.3.5/24 - ipv6 address fd00:0:6::5/64 -! -interface lo - ip address 192.0.2.5/32 - ipv6 address 2001:db8::5/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json deleted file mode 100644 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json deleted file mode 100644 index 1a01ead2cd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf deleted file mode 100644 index e036a779ae..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf +++ /dev/null @@ -1,17 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 172.17.0.201 remote-as external - neighbor 192.0.2.4 update-source 192.0.2.6 - neighbor 192.0.2.5 update-source 192.0.2.6 - neighbor 192.0.2.101 update-source 192.0.2.6 - ! - address-family ipv6 unicast - neighbor 192.0.2.4 activate - neighbor 192.0.2.5 activate - neighbor 192.0.2.101 activate - neighbor 172.17.0.201 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf deleted file mode 100644 index b575290e9b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf +++ /dev/null @@ -1,31 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-sw1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0006.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf deleted file mode 100644 index fce74c146c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf +++ /dev/null @@ -1,16 +0,0 @@ -! -interface eth-r4 - ip address 10.0.4.6/24 - ipv6 address fd00:0:7::6/64 -! -interface eth-r5 - ip address 10.0.5.6/24 - ipv6 address fd00:0:8::6/64 -! -interface eth-sw1 - ip address 172.17.0.6/24 - ipv6 address fd00:0:9::6/64 -! -interface lo - ip address 192.0.2.6/32 - ipv6 address 2001:db8::6/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json deleted file mode 100644 index 72b0f03c51..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "172.17.0.6", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json deleted file mode 100644 index 8fe5f7c1de..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf deleted file mode 100644 index a707b23af0..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65700 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 172.17.0.201 remote-as external - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.17.0.201 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:700::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf deleted file mode 100644 index 75448297eb..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-h2 - ip address 192.168.7.2/24 - ipv6 address fd00:700::2/64 -! -interface eth-sw1 - ip address 172.17.0.7/24 - ipv6 address fd00:0:9::7/64 -! -interface lo - ip address 192.0.2.7/32 - ipv6 address 2001:db8::7/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json deleted file mode 100644 index 596ee4b40b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "172.17.0.6", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json deleted file mode 100644 index 20f4940328..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf deleted file mode 100644 index d57712dcdd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65800 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 172.17.0.201 remote-as external - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.17.0.201 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:800::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf deleted file mode 100644 index 7e2479b751..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-h3 - ip address 192.168.8.2/24 - ipv6 address fd00:800::2/64 -! -interface eth-sw1 - ip address 172.17.0.8/24 - ipv6 address fd00:0:9::8/64 -! -interface lo - ip address 192.0.2.8/32 - ipv6 address 2001:db8::8/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json deleted file mode 100644 index ac67fe069c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.1.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json deleted file mode 100644 index 4e359fd97f..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:2::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf deleted file mode 100644 index 9bbac8b68e..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf +++ /dev/null @@ -1,26 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.2 remote-as internal - neighbor 192.0.2.3 remote-as internal - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.2 update-source 192.0.2.101 - neighbor 192.0.2.3 update-source 192.0.2.101 - neighbor 192.0.2.4 update-source 192.0.2.101 - neighbor 192.0.2.5 update-source 192.0.2.101 - neighbor 192.0.2.6 update-source 192.0.2.101 - ! - address-family ipv4 unicast - neighbor 192.0.2.2 route-reflector-client - neighbor 192.0.2.3 route-reflector-client - - ! - address-family ipv6 unicast - neighbor 192.0.2.2 activate - neighbor 192.0.2.3 activate - neighbor 192.0.2.4 activate - neighbor 192.0.2.5 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.2 route-reflector-client - neighbor 192.0.2.3 route-reflector-client - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf deleted file mode 100644 index fe5bcfb9f1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf +++ /dev/null @@ -1,40 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r2 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r3 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0101.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf deleted file mode 100644 index 7f5c8d1c61..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf +++ /dev/null @@ -1,21 +0,0 @@ -! -interface eth-r2 - ip address 10.0.0.101/24 - ipv6 address fd00:0:3::101/64 -! -interface eth-r3 - ip address 10.0.1.101/24 - ipv6 address fd00:0:4::101/64 -! -interface eth-r4 - ip address 10.0.2.101/24 - ipv6 address fd00:0:5::101/64 -! -interface eth-r5 - ip address 10.0.3.101/24 - ipv6 address fd00:0:6::101/64 -! -interface lo - ip address 192.0.2.101/32 - ipv6 address 2001:db8::101/128 - diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf deleted file mode 100644 index 596cc3e25c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65200 view RS - bgp router-id 192.0.2.201 - no bgp ebgp-requires-policy - neighbor 172.17.0.6 remote-as external - neighbor 172.17.0.7 remote-as external - neighbor 172.17.0.8 remote-as external - ! - address-family ipv4 unicast - neighbor 172.17.0.6 route-server-client - neighbor 172.17.0.7 route-server-client - neighbor 172.17.0.8 route-server-client - - ! - address-family ipv6 unicast - neighbor 172.17.0.6 activate - neighbor 172.17.0.7 activate - neighbor 172.17.0.8 activate - neighbor 172.17.0.6 route-server-client - neighbor 172.17.0.7 route-server-client - neighbor 172.17.0.8 route-server-client - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf deleted file mode 100644 index 892b4e7b74..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf +++ /dev/null @@ -1,36 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r2 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r3 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -router isis 1 - net 49.0000.0000.0000.0101.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf deleted file mode 100644 index 75ee08363a..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf +++ /dev/null @@ -1,8 +0,0 @@ -interface eth-sw1 - ip address 172.17.0.201/24 - ipv6 address fd00:0:9::201/64 -! -interface lo - ip address 192.0.2.201/32 - ipv6 address 2001:db8::201/128 - diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py deleted file mode 100644 index 4da13b16d1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python -# SPDX-License-Identifier: ISC - -# -# Copyright (c) 2024 by 6WIND -# - -""" -Test BGP nexthop conformity with IPv4,6 MP-BGP over IPv4 peering -""" - -import os -import sys -import json -import functools -from functools import partial -import pytest - -# Save the Current Working Directory to find configuration files. -CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, "../")) - -# pylint: disable=C0413 -# Import topogen and topotest helpers -from lib import topotest -from lib.topogen import Topogen, TopoRouter, get_topogen -from lib.topolog import logger -from lib.checkping import check_ping -from lib.bgp import verify_bgp_convergence_from_running_config - -pytestmark = [pytest.mark.bgpd, pytest.mark.isisd] - - -def build_topo(tgen): - r""" - +---+ - | h1| - +---+ - | - +---+ - | r1| AS 65100 - +---+ - / \ _____________ - / \ - +---+ +---+ - | r2| | r3| rr1 is route-reflector - +---+ +---+ for r2 and r3 - \ / - \ / - +---+ - |rr1| AS 65000 - +---+ - / \ - / \ - +---+ +---+ - | r4| | r5| iBGP full-mesh between - +---+ +---+ rr1, r4, r5 and r6 - \ / - \ / - +---+ - | r6| - +---+ - | _____________ - | - | +---+ - [sw1]-----|rs1| AS 65200 - /\ +---+ rs1: route-server - / \ - / \ _____________ - +---+ +---+ - | r7| | r8| AS 65700 (r7) - +---+ +---+ AS 65800 (r8) - | | - +---+ +---+ - | h2| | h3| - +---+ +---+ - """ - - def connect_routers(tgen, left, right): - for rname in [left, right]: - if rname not in tgen.routers().keys(): - tgen.add_router(rname) - - switch = tgen.add_switch("s-{}-{}".format(left, right)) - switch.add_link(tgen.gears[left], nodeif="eth-{}".format(right)) - switch.add_link(tgen.gears[right], nodeif="eth-{}".format(left)) - - def connect_switchs(tgen, rname, switch): - if rname not in tgen.routers().keys(): - tgen.add_router(rname) - - switch.add_link(tgen.gears[rname], nodeif="eth-{}".format(switch.name)) - - connect_routers(tgen, "h1", "r1") - connect_routers(tgen, "r1", "r2") - connect_routers(tgen, "r1", "r3") - connect_routers(tgen, "r2", "rr1") - connect_routers(tgen, "r3", "rr1") - connect_routers(tgen, "rr1", "r4") - connect_routers(tgen, "rr1", "r5") - connect_routers(tgen, "r4", "r6") - connect_routers(tgen, "r5", "r6") - - sw1 = tgen.add_switch("sw1") - connect_switchs(tgen, "r6", sw1) - connect_switchs(tgen, "rs1", sw1) - connect_switchs(tgen, "r7", sw1) - connect_switchs(tgen, "r8", sw1) - - connect_routers(tgen, "r7", "h2") - connect_routers(tgen, "r8", "h3") - - -def setup_module(mod): - "Sets up the pytest environment" - - tgen = Topogen(build_topo, mod.__name__) - tgen.start_topology() - logger.info("setup_module") - - for rname, router in tgen.routers().items(): - router.load_config( - TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) - ) - if "h" in rname: - # hosts - continue - - router.load_config( - TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) - ) - - if rname in ["r1", "r7", "r8", "rs1"]: - # external routers - continue - - router.load_config( - TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname)) - ) - - # Initialize all routers. - tgen.start_router() - - -def teardown_module(_mod): - "Teardown the pytest environment" - tgen = get_topogen() - tgen.stop_topology() - - -def test_bgp_convergence(): - "Assert that BGP is converging." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - logger.info("waiting for bgp peers to go up") - - for rname in tgen.routers().keys(): - if "h" in rname: - # hosts - continue - result = verify_bgp_convergence_from_running_config(tgen, dut=rname) - assert result is True, "BGP is not converging on {}".format(rname) - - -def test_bgp_ipv4_nexthop_step1(): - "Assert that BGP has correct ipv4 nexthops." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv4.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv4 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv4 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ipv6_nexthop_step1(): - "Assert that BGP has correct ipv6 nexthops." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv6_step1.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv6 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv6 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ping_ok_step1(): - "Check that h1 pings h2 and h3" - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - check_ping("h1", "192.168.7.1", True, 5, 1) - check_ping("h1", "fd00:700::1", True, 5, 1) - check_ping("h1", "192.168.8.1", True, 5, 1) - check_ping("h1", "fd00:800::1", True, 5, 1) - - -if __name__ == "__main__": - args = ["-s"] + sys.argv[1:] - sys.exit(pytest.main(args)) From fd6638367e4e71f95930ead368cbbf7fb0c7caa9 Mon Sep 17 00:00:00 2001 From: Philippe Guibert Date: Wed, 14 Aug 2024 15:36:36 +0200 Subject: [PATCH 67/81] bgpd: fix memory type for static->prd_pretty A crash happens when executing the following command: > ubuntu2204hwe# conf > ubuntu2204hwe(config)# router bgp 65500 > ubuntu2204hwe(config-router)# ! > ubuntu2204hwe(config-router)# address-family ipv4 unicast > ubuntu2204hwe(config-router-af)# sid vpn export auto > ubuntu2204hwe(config-router-af)# exit-address-family > ubuntu2204hwe(config-router)# ! > ubuntu2204hwe(config-router)# address-family ipv4 vpn > ubuntu2204hwe(config-router-af)# network 4.4.4.4/32 rd 55:55 label 556 > ubuntu2204hwe(config-router-af)# network 5.5.5.5/32 rd 662:33 label 232 > ubuntu2204hwe(config-router-af)# exit-address-family > ubuntu2204hwe(config-router)# exit > ubuntu2204hwe(config)# ! > ubuntu2204hwe(config)# no router bgp The crash analysis indicates a memory item has been freed. > #6 0x000076066a629c15 in mt_count_free (mt=0x56b57be85e00 , ptr=0x60200038b4f0) > at lib/memory.c:73 > #7 mt_count_free (ptr=0x60200038b4f0, mt=0x56b57be85e00 ) at lib/memory.c:69 > #8 qfree (mt=mt@entry=0x56b57be85e00 , ptr=0x60200038b4f0) at lib/memory.c:129 > #9 0x000056b57bb09ce9 in bgp_free (bgp=) at bgpd/bgpd.c:4120 > #10 0x000056b57bb0aa73 in bgp_unlock (bgp=) at ./bgpd/bgpd.h:2513 > #11 peer_free (peer=0x62a000000200) at bgpd/bgpd.c:1313 > #12 0x000056b57bb0aca8 in peer_unlock_with_caller (name=, peer=) > at bgpd/bgpd.c:1344 > #13 0x000076066a6dbb2c in event_call (thread=thread@entry=0x7ffc8cae1d60) at lib/event.c:2011 > #14 0x000076066a60aa88 in frr_run (master=0x613000000040) at lib/libfrr.c:1214 > #15 0x000056b57b8b2c44 in main (argc=, argv=) at bgpd/bgp_main.c:543 Actually, the BGP_NAME item has not been used at allocation for static->prd_pretty, and this results in reaching 0 quicker at bgp deletion. Fix this by reassigning MTYPE_BGP_NAME to prd_pretty. Fixes: 16600df2c4f4 ("bgpd: fix show run of network route-distinguisher") Signed-off-by: Philippe Guibert (cherry picked from commit 64594f8a6830eec5cc20b9c8a8676d1f62a16bcd) --- bgpd/bgp_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f6fe87e352..714216c1f8 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -7165,7 +7165,7 @@ int bgp_static_set(struct vty *vty, bool negate, const char *ip_str, bgp_static->prd = prd; if (rd_str) - bgp_static->prd_pretty = XSTRDUP(MTYPE_BGP, + bgp_static->prd_pretty = XSTRDUP(MTYPE_BGP_NAME, rd_str); if (rmap) { From 91a0edb0c50f8c0c03a0c0c174cc4ac65105b33f Mon Sep 17 00:00:00 2001 From: Rodrigo Nardi Date: Thu, 15 Aug 2024 10:50:34 -0300 Subject: [PATCH 68/81] doc: bgp_vty fixing default name --- bgpd/bgp_vty.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 1a87799ad2..92c15b7d2c 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -2267,9 +2267,9 @@ static int bgp_global_update_delay_config_vty(struct vty *vty, * Note that we only need to check this if this is the first time * setting the global config. */ - if (bm->v_update_delay == BGP_UPDATE_DELAY_DEF) { + if (bm->v_update_delay == BGP_UPDATE_DELAY_DEFAULT) { for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { - if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEF) { + if (bgp->v_update_delay != BGP_UPDATE_DELAY_DEFAULT) { vty_out(vty, "%% update-delay configuration found in vrf %s\n", bgp->inst_type == BGP_INSTANCE_TYPE_DEFAULT @@ -2314,7 +2314,7 @@ static int bgp_global_update_delay_deconfig_vty(struct vty *vty) struct listnode *node, *nnode; struct bgp *bgp; - bm->v_update_delay = BGP_UPDATE_DELAY_DEF; + bm->v_update_delay = BGP_UPDATE_DELAY_DEFAULT; bm->v_establish_wait = bm->v_update_delay; for (ALL_LIST_ELEMENTS(bm->bgp, node, nnode, bgp)) { @@ -2368,7 +2368,7 @@ static int bgp_update_delay_deconfig_vty(struct vty *vty) "%%Failed: bgp update-delay configured globally. Delete per-vrf not permitted\n"); return CMD_WARNING_CONFIG_FAILED; } - bgp->v_update_delay = BGP_UPDATE_DELAY_DEF; + bgp->v_update_delay = BGP_UPDATE_DELAY_DEFAULT; bgp->v_establish_wait = bgp->v_update_delay; return CMD_SUCCESS; @@ -19194,7 +19194,7 @@ int bgp_config_write(struct vty *vty) vty_out(vty, "bgp route-map delay-timer %u\n", bm->rmap_update_timer); - if (bm->v_update_delay != BGP_UPDATE_DELAY_DEF) { + if (bm->v_update_delay != BGP_UPDATE_DELAY_DEFAULT) { vty_out(vty, "bgp update-delay %d", bm->v_update_delay); if (bm->v_update_delay != bm->v_establish_wait) vty_out(vty, " %d", bm->v_establish_wait); From e5030e5eee0e90bf85aa3e782eb40a94ec395c28 Mon Sep 17 00:00:00 2001 From: Rodrigo Nardi Date: Thu, 15 Aug 2024 11:18:02 -0300 Subject: [PATCH 69/81] doc: bgp_vty fixing default name --- bgpd/bgp_vty.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_vty.h b/bgpd/bgp_vty.h index f88f5c8125..6d86f6ba08 100644 --- a/bgpd/bgp_vty.h +++ b/bgpd/bgp_vty.h @@ -161,9 +161,8 @@ extern int bgp_vty_find_and_parse_afi_safi_bgp(struct vty *vty, int bgp_vty_find_and_parse_bgp(struct vty *vty, struct cmd_token **argv, int argc, struct bgp **bgp, bool use_json); extern int bgp_show_summary_vty(struct vty *vty, const char *name, afi_t afi, - safi_t safi, const char *neighbor, - enum peer_asn_type as_type, as_t as, - uint16_t show_flags); + safi_t safi, const char *neighbor, int as_type, + as_t as, uint16_t show_flags); extern bool peergroup_flag_check(struct peer *peer, uint64_t flag); extern bool peergroup_af_flag_check(struct peer *peer, afi_t afi, safi_t safi, uint64_t flag); From 66c9bb360db8ffd6a6cee1cf52e19f14a490d67a Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:13:44 +0300 Subject: [PATCH 70/81] Revert "bgpd: fix sending ipv6 local nexthop if global present" This reverts commit 424fe0bf809c1d84f16aba3f5e5f8249af29083b. --- bgpd/bgp_zebra.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 5bb177b2f7..e72a739798 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -303,12 +303,11 @@ static int bgp_ifp_down(struct interface *ifp) static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) { - struct connected *ifc, *connected; + struct connected *ifc; struct bgp *bgp; struct peer *peer; struct prefix *addr; struct listnode *node, *nnode; - bool v6_ll_in_nh_global; afi_t afi; safi_t safi; @@ -343,27 +342,6 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) addr = ifc->address; for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - v6_ll_in_nh_global = false; - - if (IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)) { - frr_each (if_connected, ifc->ifp->connected, - connected) { - if (connected->address->family != - AF_INET6) - continue; - if (!IPV6_ADDR_SAME(&connected->address - ->u.prefix6, - &peer->nexthop - .v6_global)) - continue; - /* peer->nexthop.v6_global contains a link-local address - * that needs to be replaced by the global address. - */ - v6_ll_in_nh_global = true; - break; - } - } - /* * If the Peer's interface name matches the * interface name for which BGP received the @@ -374,11 +352,10 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) * into peer's v6_global and send updates out * with new nexthop addr. */ - if (v6_ll_in_nh_global || - (peer->conf_if && - strcmp(peer->conf_if, ifc->ifp->name) == 0 && - (IS_MAPPED_IPV6(&peer->nexthop.v6_global) || - IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global)))) { + if ((peer->conf_if && + (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && + ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || + IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { if (bgp_debug_zebra(ifc->address)) { zlog_debug("Update peer %pBP's current intf global addr from %pI6 to %pI6 and send updates", peer, From 2910840240288a2c9c9e491c50ebde9fef970f0c Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:12 +0300 Subject: [PATCH 71/81] Revert "bgpd: log new ipv6 global in bgp_interface_address_add" This reverts commit b083885198157555bbb916ecae9809c5d67a567b. --- bgpd/bgp_zebra.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index e72a739798..c407008d57 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -357,10 +357,9 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { if (bgp_debug_zebra(ifc->address)) { - zlog_debug("Update peer %pBP's current intf global addr from %pI6 to %pI6 and send updates", + zlog_debug("Update peer %pBP's current intf addr %pI6 and send updates", peer, - &peer->nexthop.v6_global, - &addr->u.prefix6); + &peer->nexthop.v6_global); } memcpy(&peer->nexthop.v6_global, &addr->u.prefix6, IPV6_MAX_BYTELEN); From 64d6da59b22d8a12512170261649d902ead45622 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:16 +0300 Subject: [PATCH 72/81] Revert "bgpd: reduce bgp_interface_address_add indentation" This reverts commit 778e0df87b7a846f46d84f61ea889a32fe578e49. --- bgpd/bgp_zebra.c | 84 ++++++++++++++++++++++++++---------------------- 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index c407008d57..79bb43bda9 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -325,47 +325,53 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if (!bgp) return 0; - if (!if_is_operative(ifc->ifp)) - return 0; - - bgp_connected_add(bgp, ifc); - - /* If we have learnt of any neighbors on this interface, - * check to kick off any BGP interface-based neighbors, - * but only if this is a link-local address. - */ - if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) && - !list_isempty(ifc->ifp->nbr_connected)) - bgp_start_interface_nbrs(bgp, ifc->ifp); - else if (ifc->address->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { - addr = ifc->address; + if (if_is_operative(ifc->ifp)) { + bgp_connected_add(bgp, ifc); - for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - /* - * If the Peer's interface name matches the - * interface name for which BGP received the - * update and if the received interface address - * is a globalV6 and if the peer is currently - * using a v4-mapped-v6 addr or a link local - * address, then copy the Rxed global v6 addr - * into peer's v6_global and send updates out - * with new nexthop addr. - */ - if ((peer->conf_if && - (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && - ((IS_MAPPED_IPV6(&peer->nexthop.v6_global)) || - IN6_IS_ADDR_LINKLOCAL(&peer->nexthop.v6_global))) { - if (bgp_debug_zebra(ifc->address)) { - zlog_debug("Update peer %pBP's current intf addr %pI6 and send updates", - peer, - &peer->nexthop.v6_global); + /* If we have learnt of any neighbors on this interface, + * check to kick off any BGP interface-based neighbors, + * but only if this is a link-local address. + */ + if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) + && !list_isempty(ifc->ifp->nbr_connected)) + bgp_start_interface_nbrs(bgp, ifc->ifp); + else if (ifc->address->family == AF_INET6 && + !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { + addr = ifc->address; + + for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { + /* + * If the Peer's interface name matches the + * interface name for which BGP received the + * update and if the received interface address + * is a globalV6 and if the peer is currently + * using a v4-mapped-v6 addr or a link local + * address, then copy the Rxed global v6 addr + * into peer's v6_global and send updates out + * with new nexthop addr. + */ + if ((peer->conf_if && + (strcmp(peer->conf_if, ifc->ifp->name) == + 0)) && + ((IS_MAPPED_IPV6( + &peer->nexthop.v6_global)) || + IN6_IS_ADDR_LINKLOCAL( + &peer->nexthop.v6_global))) { + + if (bgp_debug_zebra(ifc->address)) { + zlog_debug( + "Update peer %pBP's current intf addr %pI6 and send updates", + peer, + &peer->nexthop + .v6_global); + } + memcpy(&peer->nexthop.v6_global, + &addr->u.prefix6, + IPV6_MAX_BYTELEN); + FOREACH_AFI_SAFI (afi, safi) + bgp_announce_route(peer, afi, + safi, true); } - memcpy(&peer->nexthop.v6_global, - &addr->u.prefix6, IPV6_MAX_BYTELEN); - FOREACH_AFI_SAFI (afi, safi) - bgp_announce_route(peer, afi, safi, - true); } } } From de1d794ec006ed110b38463d1420aabc5c3011d9 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:20 +0300 Subject: [PATCH 73/81] Revert "bgpd: optimize bgp_interface_address_add" This reverts commit 8599fe2b5e34b2ac1a46a14983ddcc2336e9116d. --- bgpd/bgp_zebra.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 79bb43bda9..00013b1e7a 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -335,11 +335,13 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if (IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6) && !list_isempty(ifc->ifp->nbr_connected)) bgp_start_interface_nbrs(bgp, ifc->ifp); - else if (ifc->address->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&ifc->address->u.prefix6)) { + else { addr = ifc->address; for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { + if (addr->family == AF_INET) + continue; + /* * If the Peer's interface name matches the * interface name for which BGP received the @@ -353,6 +355,7 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) if ((peer->conf_if && (strcmp(peer->conf_if, ifc->ifp->name) == 0)) && + !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6) && ((IS_MAPPED_IPV6( &peer->nexthop.v6_global)) || IN6_IS_ADDR_LINKLOCAL( From d10419ee7a444eda21a84d1cf591199496692613 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:55 +0300 Subject: [PATCH 74/81] Revert "topotests: update bgp_vrf_leaking_5549_routes" This reverts commit f1b8364ab3784cebfc0689883efdb21ac7d06213. --- .../pe1/results/vrf10_ipv4_unicast.json | 7 +++---- .../pe1/results/vrf20_ipv4_unicast.json | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json index f664bb6b52..768bffbe9d 100644 --- a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json +++ b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf10_ipv4_unicast.json @@ -15,16 +15,15 @@ "origin": "incomplete", "nexthops": [ { - "ip": "::ffff:c000:202", "hostname": "ce1", "afi": "ipv6", - "scope": "global" + "scope": "global", + "used": true }, { "hostname": "ce1", "afi": "ipv6", - "scope": "link-local", - "used": true + "scope": "link-local" } ] } diff --git a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json index 3498ed4326..1e93715270 100644 --- a/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json +++ b/tests/topotests/bgp_vrf_leaking_5549_routes/pe1/results/vrf20_ipv4_unicast.json @@ -17,16 +17,15 @@ "nhVrfName": "vrf10", "nexthops": [ { - "ip": "::ffff:c000:202", "hostname": "pe1", "afi": "ipv6", - "scope": "global" + "scope": "global", + "used": true }, { "hostname": "pe1", "afi": "ipv6", - "scope": "link-local", - "used": true + "scope": "link-local" } ] } From 4e2d8dbb292601f572d6b6bf5d033f622409f629 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:14:59 +0300 Subject: [PATCH 75/81] Revert "bgpd: prefer link-local to a ipv4-mapped ipv6 global" This reverts commit 5dd731af8421e8b3070eec0b3af4ad234c95c6bb. --- bgpd/bgp_nht.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index 8ce45558e9..dc6dc54a3b 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -320,6 +320,11 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, afi = BGP_ATTR_MP_NEXTHOP_LEN_IP6(pi->attr) ? AFI_IP6 : AFI_IP; + /* Validation for the ipv4 mapped ipv6 nexthop. */ + if (IS_MAPPED_IPV6(&pi->attr->mp_nexthop_global)) { + afi = AFI_IP; + } + /* This will return true if the global IPv6 NH is a link local * addr */ if (make_prefix(afi, pi, &p) < 0) @@ -1035,11 +1040,19 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) p->u.prefix4 = p_orig->u.prefix4; p->prefixlen = p_orig->prefixlen; } else { - if (p_orig->family == AF_EVPN) - p->u.prefix4 = pi->attr->mp_nexthop_global_in; - else - p->u.prefix4 = pi->attr->nexthop; - p->prefixlen = IPV4_MAX_BITLEN; + if (IS_MAPPED_IPV6(&pi->attr->mp_nexthop_global)) { + ipv4_mapped_ipv6_to_ipv4( + &pi->attr->mp_nexthop_global, &ipv4); + p->u.prefix4 = ipv4; + p->prefixlen = IPV4_MAX_BITLEN; + } else { + if (p_orig->family == AF_EVPN) + p->u.prefix4 = + pi->attr->mp_nexthop_global_in; + else + p->u.prefix4 = pi->attr->nexthop; + p->prefixlen = IPV4_MAX_BITLEN; + } } break; case AFI_IP6: @@ -1055,7 +1068,6 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) /* If we receive MP_REACH nexthop with ::(LL) * or LL(LL), use LL address as nexthop cache. */ - p->prefixlen = IPV6_MAX_BITLEN; if (pi->attr && pi->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL && @@ -1070,22 +1082,15 @@ static int make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p) pi->attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) { if (CHECK_FLAG(pi->attr->nh_flags, - BGP_ATTR_NH_MP_PREFER_GLOBAL)) { - if (IS_MAPPED_IPV6( - &pi->attr->mp_nexthop_global)) { - ipv4_mapped_ipv6_to_ipv4( - &pi->attr->mp_nexthop_global, - &ipv4); - p->u.prefix4 = ipv4; - p->prefixlen = IPV4_MAX_BITLEN; - } else - p->u.prefix6 = - pi->attr->mp_nexthop_global; - } else + BGP_ATTR_NH_MP_PREFER_GLOBAL)) + p->u.prefix6 = + pi->attr->mp_nexthop_global; + else p->u.prefix6 = pi->attr->mp_nexthop_local; } else p->u.prefix6 = pi->attr->mp_nexthop_global; + p->prefixlen = IPV6_MAX_BITLEN; } break; default: From 8beb5c4ca60ef2582b4d34c206f93f375d10db0e Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:04 +0300 Subject: [PATCH 76/81] Revert "bgpd: set ipv4-mapped ipv6 for ipv4 with ipv6 nexthop" This reverts commit fc5a738409eac9ca938cbb398872ea77d9cc5023. --- bgpd/bgp_updgrp_packet.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/bgpd/bgp_updgrp_packet.c b/bgpd/bgp_updgrp_packet.c index 6e30d4f846..7c92bbd514 100644 --- a/bgpd/bgp_updgrp_packet.c +++ b/bgpd/bgp_updgrp_packet.c @@ -523,13 +523,11 @@ struct stream *bpacket_reformat_for_peer(struct bpacket *pkt, gnh_modified = 1; } - if (peer->nexthop.v4.s_addr != INADDR_ANY && - (IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg) || - (IN6_IS_ADDR_LINKLOCAL(mod_v6nhg) && - peer->connection->su.sa.sa_family == AF_INET6 && - paf->afi == AFI_IP))) { - ipv4_to_ipv4_mapped_ipv6(mod_v6nhg, peer->nexthop.v4); - gnh_modified = 1; + if (IN6_IS_ADDR_UNSPECIFIED(mod_v6nhg)) { + if (peer->nexthop.v4.s_addr != INADDR_ANY) { + ipv4_to_ipv4_mapped_ipv6(mod_v6nhg, + peer->nexthop.v4); + } } if (IS_MAPPED_IPV6(&peer->nexthop.v6_global)) { From 163a65dee2129ba6530c684e4bdd8a533f055645 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:08 +0300 Subject: [PATCH 77/81] Revert "tests: ipv6 global removal in bgp_nexthop_mp_ipv4_6" This reverts commit 04c220bedb63334a65677a46ef84938cc812221f. --- .../r1/bgp_ipv6_step2.json | 90 ------------------- .../r2/bgp_ipv6_step2.json | 48 ---------- .../r3/bgp_ipv6_step2.json | 48 ---------- .../r4/bgp_ipv6_step2.json | 49 ---------- .../r5/bgp_ipv6_step2.json | 49 ---------- .../r6/bgp_ipv6_step2.json | 48 ---------- .../r7/bgp_ipv6_step2.json | 48 ---------- .../r8/bgp_ipv6_step2.json | 48 ---------- .../rr1/bgp_ipv6_step2.json | 62 ------------- .../test_nexthop_mp_ipv4_6.py | 52 ----------- 10 files changed, 542 deletions(-) delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json deleted file mode 100755 index f7c5c7c3b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json deleted file mode 100644 index 21f36089b6..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json deleted file mode 100644 index 21f36089b6..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json deleted file mode 100755 index 7d0786c0ef..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json deleted file mode 100755 index 7d0786c0ef..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json deleted file mode 100644 index 55912dd74c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json deleted file mode 100644 index 8fe5f7c1de..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json deleted file mode 100644 index 20f4940328..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json deleted file mode 100644 index 4ab0e1c2ae..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::2", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "2001:db8::3", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py index 911a6d757f..4da13b16d1 100644 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py @@ -226,58 +226,6 @@ def test_bgp_ping_ok_step1(): check_ping("h1", "fd00:800::1", True, 5, 1) -def test_bgp_ipv6_nexthop_step2(): - """ - Remove IPv6 global on r1 and r7 - Assert that BGP has correct ipv6 nexthops. - """ - - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - tgen.gears["r1"].vtysh_cmd( - """ -configure -interface eth-r2 - no ipv6 address fd00:0:1::1/64 -! -interface eth-r3 - no ipv6 address fd00:0:2::1/64 -""" - ) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv6_step2.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv6 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv6 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ping_ok_step2(): - "Check that h1 pings h2 and h3" - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - check_ping("h1", "192.168.7.1", True, 5, 1) - check_ping("h1", "fd00:700::1", True, 5, 1) - check_ping("h1", "192.168.8.1", True, 5, 1) - check_ping("h1", "fd00:800::1", True, 5, 1) - - if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) From 572b1c2e2051ce49dc92116507d04eec23df4dac Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:13 +0300 Subject: [PATCH 78/81] Revert "bgpd: fix "used" json key on link-local nexthop" This reverts commit 2de4dfc97adfec788e45e148b4204196d612c81c. --- bgpd/bgp_route.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 714216c1f8..8efcdaa7cc 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -9659,7 +9659,10 @@ void route_vty_out(struct vty *vty, const struct prefix *p, json_object_string_add(json_nexthop_ll, "scope", "link-local"); - if (!CHECK_FLAG(attr->nh_flags, + if ((IPV6_ADDR_CMP(&attr->mp_nexthop_global, + &attr->mp_nexthop_local) != + 0) && + !CHECK_FLAG(attr->nh_flags, BGP_ATTR_NH_MP_PREFER_GLOBAL)) json_object_boolean_true_add( json_nexthop_ll, "used"); From 63094de7b9a0cb3f285d453e1d1267d92b7d7d49 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:18 +0300 Subject: [PATCH 79/81] Revert "bgpd: fix removing ipv6 global nexhop" This reverts commit ee0378cdbb458f9d3710f1fb557368ace8d72477. --- bgpd/bgp_zebra.c | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index 00013b1e7a..d4a0209ea2 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -385,12 +385,10 @@ static int bgp_interface_address_add(ZAPI_CALLBACK_ARGS) static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) { struct listnode *node, *nnode; - struct connected *ifc, *connected; + struct connected *ifc; struct peer *peer; struct bgp *bgp; struct prefix *addr; - struct in6_addr *v6_global = NULL; - struct in6_addr *v6_local = NULL; afi_t afi; safi_t safi; @@ -412,17 +410,7 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) addr = ifc->address; if (bgp && addr->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6)) { - /* find another IPv6 global if possible and find the IPv6 link-local */ - frr_each (if_connected, ifc->ifp->connected, connected) { - if (connected->address->family != AF_INET6) - continue; - if (IN6_IS_ADDR_LINKLOCAL(&connected->address->u.prefix6)) - v6_local = &connected->address->u.prefix6; - else - v6_global = &connected->address->u.prefix6; - } - + !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix)) { /* * When we are using the v6 global as part of the peering * nexthops and we are removing it, then we need to @@ -433,15 +421,8 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { if (IPV6_ADDR_SAME(&peer->nexthop.v6_global, &addr->u.prefix6)) { - if (v6_global) - IPV6_ADDR_COPY(&peer->nexthop.v6_global, - v6_global); - else if (v6_local) - IPV6_ADDR_COPY(&peer->nexthop.v6_global, - v6_local); - else - memset(&peer->nexthop.v6_global, 0, - IPV6_MAX_BYTELEN); + memset(&peer->nexthop.v6_global, 0, + IPV6_MAX_BYTELEN); FOREACH_AFI_SAFI (afi, safi) bgp_announce_route(peer, afi, safi, true); From 8b537e08c20b3ab1840abc8a08d25c5af53ed4d0 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:15:22 +0300 Subject: [PATCH 80/81] Revert "bgpd: optimize bgp_interface_address_del" This reverts commit fc1dd2e5060b6e470daa203080bdb9473a637407. --- bgpd/bgp_zebra.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/bgpd/bgp_zebra.c b/bgpd/bgp_zebra.c index d4a0209ea2..c3b93adc26 100644 --- a/bgpd/bgp_zebra.c +++ b/bgpd/bgp_zebra.c @@ -389,8 +389,6 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) struct peer *peer; struct bgp *bgp; struct prefix *addr; - afi_t afi; - safi_t safi; bgp = bgp_lookup_by_vrf_id(vrf_id); @@ -409,8 +407,7 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) addr = ifc->address; - if (bgp && addr->family == AF_INET6 && - !IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix)) { + if (bgp) { /* * When we are using the v6 global as part of the peering * nexthops and we are removing it, then we need to @@ -419,10 +416,17 @@ static int bgp_interface_address_delete(ZAPI_CALLBACK_ARGS) * we do not want the peering to bounce. */ for (ALL_LIST_ELEMENTS(bgp->peer, node, nnode, peer)) { - if (IPV6_ADDR_SAME(&peer->nexthop.v6_global, - &addr->u.prefix6)) { - memset(&peer->nexthop.v6_global, 0, - IPV6_MAX_BYTELEN); + afi_t afi; + safi_t safi; + + if (addr->family == AF_INET) + continue; + + if (!IN6_IS_ADDR_LINKLOCAL(&addr->u.prefix6) + && memcmp(&peer->nexthop.v6_global, + &addr->u.prefix6, 16) + == 0) { + memset(&peer->nexthop.v6_global, 0, 16); FOREACH_AFI_SAFI (afi, safi) bgp_announce_route(peer, afi, safi, true); From 0b550c4b0fef5b53ecc14bd5ce3fbd5792c72ff2 Mon Sep 17 00:00:00 2001 From: Donatas Abraitis Date: Wed, 14 Aug 2024 20:28:13 +0300 Subject: [PATCH 81/81] Revert "topotests: add bgp_nexthop_mp_ipv4_6 test" This reverts commit 62913cb15d8195c41229c2f6090d7e189e04646e. Signed-off-by: Donatas Abraitis --- .../bgp_nexthop_mp_ipv4_6/__init__.py | 0 .../bgp_nexthop_mp_ipv4_6/h1/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/h2/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/h3/zebra.conf | 6 - .../bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json | 70 ------ .../r1/bgp_ipv6_step1.json | 90 ------- .../bgp_nexthop_mp_ipv4_6/r1/bgpd.conf | 23 -- .../bgp_nexthop_mp_ipv4_6/r1/zebra.conf | 16 -- .../bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json | 46 ---- .../r2/bgp_ipv6_step1.json | 53 ---- .../bgp_nexthop_mp_ipv4_6/r2/bgpd.conf | 11 - .../bgp_nexthop_mp_ipv4_6/r2/isisd.conf | 24 -- .../bgp_nexthop_mp_ipv4_6/r2/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json | 46 ---- .../r3/bgp_ipv6_step1.json | 53 ---- .../bgp_nexthop_mp_ipv4_6/r3/bgpd.conf | 11 - .../bgp_nexthop_mp_ipv4_6/r3/isisd.conf | 24 -- .../bgp_nexthop_mp_ipv4_6/r3/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json | 46 ---- .../r4/bgp_ipv6_step1.json | 49 ---- .../bgp_nexthop_mp_ipv4_6/r4/bgpd.conf | 13 - .../bgp_nexthop_mp_ipv4_6/r4/isisd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/r4/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json | 46 ---- .../r5/bgp_ipv6_step1.json | 49 ---- .../bgp_nexthop_mp_ipv4_6/r5/bgpd.conf | 13 - .../bgp_nexthop_mp_ipv4_6/r5/isisd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/r5/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json | 46 ---- .../r6/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r6/bgpd.conf | 17 -- .../bgp_nexthop_mp_ipv4_6/r6/isisd.conf | 31 --- .../bgp_nexthop_mp_ipv4_6/r6/zebra.conf | 16 -- .../bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json | 46 ---- .../r7/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r7/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/r7/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json | 46 ---- .../r8/bgp_ipv6_step1.json | 48 ---- .../bgp_nexthop_mp_ipv4_6/r8/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/r8/zebra.conf | 12 - .../bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json | 58 ----- .../rr1/bgp_ipv6_step1.json | 62 ----- .../bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf | 26 -- .../bgp_nexthop_mp_ipv4_6/rr1/isisd.conf | 40 --- .../bgp_nexthop_mp_ipv4_6/rr1/zebra.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf | 21 -- .../bgp_nexthop_mp_ipv4_6/rs1/isisd.conf | 36 --- .../bgp_nexthop_mp_ipv4_6/rs1/zebra.conf | 8 - .../test_nexthop_mp_ipv4_6.py | 231 ------------------ 50 files changed, 1716 deletions(-) delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json delete mode 100755 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf delete mode 100644 tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/__init__.py deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf deleted file mode 100644 index 9b19b2cfbd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h1/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:100::2 -ip route 0.0.0.0/0 192.168.1.2 -interface eth-r1 - ip address 192.168.1.1/24 - ipv6 address fd00:100::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf deleted file mode 100644 index 2bf4a66680..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h2/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:700::2 -ip route 0.0.0.0/0 192.168.7.2 -interface eth-r7 - ip address 192.168.7.1/24 - ipv6 address fd00:700::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf deleted file mode 100644 index e8b6ac6e26..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/h3/zebra.conf +++ /dev/null @@ -1,6 +0,0 @@ -ipv6 route ::/0 fd00:800::2 -ip route 0.0.0.0/0 192.168.8.2 -interface eth-r8 - ip address 192.168.8.1/24 - ipv6 address fd00:800::1/64 -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json deleted file mode 100755 index 12fecee39f..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv4.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "172.16.1.3", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "172.16.0.2", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "172.16.1.3", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "172.16.0.2", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json deleted file mode 100755 index f7c5c7c3b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step1.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65700", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "multipath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:2::3", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - }, - { - "valid": true, - "bestpath": true, - "path": "65000 65800", - "nexthops": [ - { - "ip": "fd00:0:1::2", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf deleted file mode 100644 index 23b986d130..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgpd.conf +++ /dev/null @@ -1,23 +0,0 @@ -router bgp 65100 - no bgp ebgp-requires-policy - neighbor 172.16.0.2 remote-as external - neighbor 172.16.1.3 remote-as external - ! neighbor 172.16.0.2 capability extended-nexthop - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.16.0.2 activate - neighbor 172.16.1.3 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:100::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf deleted file mode 100644 index 79cbafb5b8..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/zebra.conf +++ /dev/null @@ -1,16 +0,0 @@ -! -interface eth-h1 - ip address 192.168.1.2/24 - ipv6 address fd00:100::2/64 -! -interface eth-r2 - ip address 172.16.0.1/24 - ipv6 address fd00:0:1::1/64 -! -interface eth-r3 - ip address 172.16.1.1/24 - ipv6 address fd00:0:2::1/64 -! -interface lo - ip address 192.0.2.1/32 - ipv6 address 2001:db8::1/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json deleted file mode 100644 index 4f86a1a648..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf deleted file mode 100644 index badb11cbeb..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgpd.conf +++ /dev/null @@ -1,11 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - neighbor 172.16.0.1 remote-as external - ! neighbor 172.16.0.1 capability extended-nexthop - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.101 update-source 192.0.2.2 - ! - address-family ipv6 unicast - neighbor 172.16.0.1 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf deleted file mode 100644 index 16963798f8..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/isisd.conf +++ /dev/null @@ -1,24 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0002.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf deleted file mode 100644 index 8997115d87..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r1 - ip address 172.16.0.2/24 - ipv6 address fd00:0:1::2/64 -! -interface eth-rr1 - ip address 10.0.0.2/24 - ipv6 address fd00:0:3::2/64 -! -interface lo - ip address 192.0.2.2/32 - ipv6 address 2001:db8::2/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json deleted file mode 100644 index 0f18a43bf5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.1.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json deleted file mode 100644 index f44121c30e..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step1.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:2::1", - "afi": "ipv6", - "scope": "global" - }, - { - "afi": "ipv6", - "scope": "link-local", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf deleted file mode 100644 index 4dec311f51..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgpd.conf +++ /dev/null @@ -1,11 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - neighbor 172.16.1.1 remote-as external - ! neighbor 172.16.1.1 capability extended-nexthop - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.101 update-source 192.0.2.3 - ! - address-family ipv6 unicast - neighbor 172.16.1.1 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf deleted file mode 100644 index fe3e307b42..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/isisd.conf +++ /dev/null @@ -1,24 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0003.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf deleted file mode 100644 index 8074bbdcde..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r1 - ip address 172.16.1.3/24 - ipv6 address fd00:0:2::3/64 -! -interface eth-rr1 - ip address 10.0.1.3/24 - ipv6 address fd00:0:4::3/64 -! -interface lo - ip address 192.0.2.3/32 - ipv6 address 2001:db8::3/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json deleted file mode 100755 index 756a78e3b1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step1.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf deleted file mode 100644 index 2dbc4acddc..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.5 update-source 192.0.2.4 - neighbor 192.0.2.6 update-source 192.0.2.4 - neighbor 192.0.2.101 update-source 192.0.2.4 - ! - address-family ipv6 unicast - neighbor 192.0.2.5 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf deleted file mode 100644 index 21eb80f58b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/isisd.conf +++ /dev/null @@ -1,26 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r6 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0004.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf deleted file mode 100644 index c598b345e5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r6 - ip address 10.0.4.4/24 - ipv6 address fd00:0:7::4/64 -! -interface eth-rr1 - ip address 10.0.2.4/24 - ipv6 address fd00:0:5::4/64 -! -interface lo - ip address 192.0.2.4/32 - ipv6 address 2001:db8::4/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json deleted file mode 100755 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json deleted file mode 100755 index 756a78e3b1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step1.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf deleted file mode 100644 index 101edbd71b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgpd.conf +++ /dev/null @@ -1,13 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 192.0.2.4 update-source 192.0.2.5 - neighbor 192.0.2.6 update-source 192.0.2.5 - neighbor 192.0.2.101 update-source 192.0.2.5 - ! - address-family ipv6 unicast - neighbor 192.0.2.4 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.101 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf deleted file mode 100644 index f998e805b5..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/isisd.conf +++ /dev/null @@ -1,26 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-rr1 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r6 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0005.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf deleted file mode 100644 index 7b43db0958..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-r6 - ip address 10.0.5.5/24 - ipv6 address fd00:0:8::5/64 -! -interface eth-rr1 - ip address 10.0.3.5/24 - ipv6 address fd00:0:6::5/64 -! -interface lo - ip address 192.0.2.5/32 - ipv6 address 2001:db8::5/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json deleted file mode 100644 index 64dadf680c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json deleted file mode 100644 index 1a01ead2cd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf deleted file mode 100644 index e036a779ae..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgpd.conf +++ /dev/null @@ -1,17 +0,0 @@ -router bgp 65000 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.101 remote-as internal - neighbor 172.17.0.201 remote-as external - neighbor 192.0.2.4 update-source 192.0.2.6 - neighbor 192.0.2.5 update-source 192.0.2.6 - neighbor 192.0.2.101 update-source 192.0.2.6 - ! - address-family ipv6 unicast - neighbor 192.0.2.4 activate - neighbor 192.0.2.5 activate - neighbor 192.0.2.101 activate - neighbor 172.17.0.201 activate - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf deleted file mode 100644 index b575290e9b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/isisd.conf +++ /dev/null @@ -1,31 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-sw1 - ip router isis 1 - ipv6 router isis 1 - isis passive -! -router isis 1 - net 49.0000.0000.0000.0006.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf deleted file mode 100644 index fce74c146c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/zebra.conf +++ /dev/null @@ -1,16 +0,0 @@ -! -interface eth-r4 - ip address 10.0.4.6/24 - ipv6 address fd00:0:7::6/64 -! -interface eth-r5 - ip address 10.0.5.6/24 - ipv6 address fd00:0:8::6/64 -! -interface eth-sw1 - ip address 172.17.0.6/24 - ipv6 address fd00:0:9::6/64 -! -interface lo - ip address 192.0.2.6/32 - ipv6 address 2001:db8::6/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json deleted file mode 100644 index 72b0f03c51..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "172.17.0.6", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json deleted file mode 100644 index 8fe5f7c1de..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf deleted file mode 100644 index a707b23af0..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65700 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 172.17.0.201 remote-as external - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.17.0.201 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:700::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf deleted file mode 100644 index 75448297eb..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-h2 - ip address 192.168.7.2/24 - ipv6 address fd00:700::2/64 -! -interface eth-sw1 - ip address 172.17.0.7/24 - ipv6 address fd00:0:9::7/64 -! -interface lo - ip address 192.0.2.7/32 - ipv6 address 2001:db8::7/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json deleted file mode 100644 index 596ee4b40b..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv4.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "172.17.0.6", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "0.0.0.0", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json deleted file mode 100644 index 20f4940328..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step1.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65000 65100", - "nexthops": [ - { - "ip": "fd00:0:9::6", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "", - "nexthops": [ - { - "ip": "::", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf deleted file mode 100644 index d57712dcdd..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65800 - no bgp ebgp-requires-policy - no bgp enforce-first-as - neighbor 172.17.0.201 remote-as external - ! - address-family ipv4 unicast - redistribute connected route-map RMAP4 - ! - address-family ipv6 unicast - redistribute connected route-map RMAP6 - neighbor 172.17.0.201 activate - ! - -ip prefix-list RANGE4 seq 10 permit 192.168.0.0/16 le 24 -ipv6 prefix-list RANGE6 seq 10 permit fd00:800::0/64 - -route-map RMAP4 permit 10 - match ip address prefix-list RANGE4 -! -route-map RMAP6 permit 10 - match ipv6 address prefix-list RANGE6 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf deleted file mode 100644 index 7e2479b751..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/zebra.conf +++ /dev/null @@ -1,12 +0,0 @@ -! -interface eth-h3 - ip address 192.168.8.2/24 - ipv6 address fd00:800::2/64 -! -interface eth-sw1 - ip address 172.17.0.8/24 - ipv6 address fd00:0:9::8/64 -! -interface lo - ip address 192.0.2.8/32 - ipv6 address 2001:db8::8/128 diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json deleted file mode 100644 index ac67fe069c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv4.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "routes": { - "192.168.1.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.0.1", - "afi": "ipv4", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "172.16.1.1", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.7.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "172.17.0.7", - "afi": "ipv4", - "used": true - } - ] - } - ], - "192.168.8.0/24": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "172.17.0.8", - "afi": "ipv4", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json deleted file mode 100644 index 4e359fd97f..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step1.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "routes": { - "fd00:100::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:1::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - }, - { - "valid": true, - "multipath": true, - "path": "65100", - "nexthops": [ - { - "ip": "fd00:0:2::1", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:700::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65700", - "nexthops": [ - { - "ip": "fd00:0:9::7", - "afi": "ipv6", - "scope": "global", - "used": true - } - ] - } - ], - "fd00:800::/64": [ - { - "valid": true, - "bestpath": true, - "path": "65800", - "nexthops": [ - { - "ip": "fd00:0:9::8", - "scope": "global", - "afi": "ipv6", - "used": true - } - ] - } - ] - } -} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf deleted file mode 100644 index 9bbac8b68e..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgpd.conf +++ /dev/null @@ -1,26 +0,0 @@ -router bgp 65000 - neighbor 192.0.2.2 remote-as internal - neighbor 192.0.2.3 remote-as internal - neighbor 192.0.2.4 remote-as internal - neighbor 192.0.2.5 remote-as internal - neighbor 192.0.2.6 remote-as internal - neighbor 192.0.2.2 update-source 192.0.2.101 - neighbor 192.0.2.3 update-source 192.0.2.101 - neighbor 192.0.2.4 update-source 192.0.2.101 - neighbor 192.0.2.5 update-source 192.0.2.101 - neighbor 192.0.2.6 update-source 192.0.2.101 - ! - address-family ipv4 unicast - neighbor 192.0.2.2 route-reflector-client - neighbor 192.0.2.3 route-reflector-client - - ! - address-family ipv6 unicast - neighbor 192.0.2.2 activate - neighbor 192.0.2.3 activate - neighbor 192.0.2.4 activate - neighbor 192.0.2.5 activate - neighbor 192.0.2.6 activate - neighbor 192.0.2.2 route-reflector-client - neighbor 192.0.2.3 route-reflector-client - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf deleted file mode 100644 index fe5bcfb9f1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/isisd.conf +++ /dev/null @@ -1,40 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r2 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r3 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 - isis network point-to-point -! -router isis 1 - net 49.0000.0000.0000.0101.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf deleted file mode 100644 index 7f5c8d1c61..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/zebra.conf +++ /dev/null @@ -1,21 +0,0 @@ -! -interface eth-r2 - ip address 10.0.0.101/24 - ipv6 address fd00:0:3::101/64 -! -interface eth-r3 - ip address 10.0.1.101/24 - ipv6 address fd00:0:4::101/64 -! -interface eth-r4 - ip address 10.0.2.101/24 - ipv6 address fd00:0:5::101/64 -! -interface eth-r5 - ip address 10.0.3.101/24 - ipv6 address fd00:0:6::101/64 -! -interface lo - ip address 192.0.2.101/32 - ipv6 address 2001:db8::101/128 - diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf deleted file mode 100644 index 596cc3e25c..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/bgpd.conf +++ /dev/null @@ -1,21 +0,0 @@ -router bgp 65200 view RS - bgp router-id 192.0.2.201 - no bgp ebgp-requires-policy - neighbor 172.17.0.6 remote-as external - neighbor 172.17.0.7 remote-as external - neighbor 172.17.0.8 remote-as external - ! - address-family ipv4 unicast - neighbor 172.17.0.6 route-server-client - neighbor 172.17.0.7 route-server-client - neighbor 172.17.0.8 route-server-client - - ! - address-family ipv6 unicast - neighbor 172.17.0.6 activate - neighbor 172.17.0.7 activate - neighbor 172.17.0.8 activate - neighbor 172.17.0.6 route-server-client - neighbor 172.17.0.7 route-server-client - neighbor 172.17.0.8 route-server-client - ! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf deleted file mode 100644 index 892b4e7b74..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/isisd.conf +++ /dev/null @@ -1,36 +0,0 @@ -! -interface lo - ip router isis 1 - ipv6 router isis 1 - isis passive -! -interface eth-r2 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r3 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r4 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -interface eth-r5 - ip router isis 1 - ipv6 router isis 1 - isis hello-interval 1 - isis hello-multiplier 3 -! -router isis 1 - net 49.0000.0000.0000.0101.00 - is-type level-1 - lsp-gen-interval 1 - topology ipv6-unicast -! diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf b/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf deleted file mode 100644 index 75ee08363a..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/rs1/zebra.conf +++ /dev/null @@ -1,8 +0,0 @@ -interface eth-sw1 - ip address 172.17.0.201/24 - ipv6 address fd00:0:9::201/64 -! -interface lo - ip address 192.0.2.201/32 - ipv6 address 2001:db8::201/128 - diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py deleted file mode 100644 index 4da13b16d1..0000000000 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py +++ /dev/null @@ -1,231 +0,0 @@ -#!/usr/bin/env python -# SPDX-License-Identifier: ISC - -# -# Copyright (c) 2024 by 6WIND -# - -""" -Test BGP nexthop conformity with IPv4,6 MP-BGP over IPv4 peering -""" - -import os -import sys -import json -import functools -from functools import partial -import pytest - -# Save the Current Working Directory to find configuration files. -CWD = os.path.dirname(os.path.realpath(__file__)) -sys.path.append(os.path.join(CWD, "../")) - -# pylint: disable=C0413 -# Import topogen and topotest helpers -from lib import topotest -from lib.topogen import Topogen, TopoRouter, get_topogen -from lib.topolog import logger -from lib.checkping import check_ping -from lib.bgp import verify_bgp_convergence_from_running_config - -pytestmark = [pytest.mark.bgpd, pytest.mark.isisd] - - -def build_topo(tgen): - r""" - +---+ - | h1| - +---+ - | - +---+ - | r1| AS 65100 - +---+ - / \ _____________ - / \ - +---+ +---+ - | r2| | r3| rr1 is route-reflector - +---+ +---+ for r2 and r3 - \ / - \ / - +---+ - |rr1| AS 65000 - +---+ - / \ - / \ - +---+ +---+ - | r4| | r5| iBGP full-mesh between - +---+ +---+ rr1, r4, r5 and r6 - \ / - \ / - +---+ - | r6| - +---+ - | _____________ - | - | +---+ - [sw1]-----|rs1| AS 65200 - /\ +---+ rs1: route-server - / \ - / \ _____________ - +---+ +---+ - | r7| | r8| AS 65700 (r7) - +---+ +---+ AS 65800 (r8) - | | - +---+ +---+ - | h2| | h3| - +---+ +---+ - """ - - def connect_routers(tgen, left, right): - for rname in [left, right]: - if rname not in tgen.routers().keys(): - tgen.add_router(rname) - - switch = tgen.add_switch("s-{}-{}".format(left, right)) - switch.add_link(tgen.gears[left], nodeif="eth-{}".format(right)) - switch.add_link(tgen.gears[right], nodeif="eth-{}".format(left)) - - def connect_switchs(tgen, rname, switch): - if rname not in tgen.routers().keys(): - tgen.add_router(rname) - - switch.add_link(tgen.gears[rname], nodeif="eth-{}".format(switch.name)) - - connect_routers(tgen, "h1", "r1") - connect_routers(tgen, "r1", "r2") - connect_routers(tgen, "r1", "r3") - connect_routers(tgen, "r2", "rr1") - connect_routers(tgen, "r3", "rr1") - connect_routers(tgen, "rr1", "r4") - connect_routers(tgen, "rr1", "r5") - connect_routers(tgen, "r4", "r6") - connect_routers(tgen, "r5", "r6") - - sw1 = tgen.add_switch("sw1") - connect_switchs(tgen, "r6", sw1) - connect_switchs(tgen, "rs1", sw1) - connect_switchs(tgen, "r7", sw1) - connect_switchs(tgen, "r8", sw1) - - connect_routers(tgen, "r7", "h2") - connect_routers(tgen, "r8", "h3") - - -def setup_module(mod): - "Sets up the pytest environment" - - tgen = Topogen(build_topo, mod.__name__) - tgen.start_topology() - logger.info("setup_module") - - for rname, router in tgen.routers().items(): - router.load_config( - TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) - ) - if "h" in rname: - # hosts - continue - - router.load_config( - TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) - ) - - if rname in ["r1", "r7", "r8", "rs1"]: - # external routers - continue - - router.load_config( - TopoRouter.RD_ISIS, os.path.join(CWD, "{}/isisd.conf".format(rname)) - ) - - # Initialize all routers. - tgen.start_router() - - -def teardown_module(_mod): - "Teardown the pytest environment" - tgen = get_topogen() - tgen.stop_topology() - - -def test_bgp_convergence(): - "Assert that BGP is converging." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - logger.info("waiting for bgp peers to go up") - - for rname in tgen.routers().keys(): - if "h" in rname: - # hosts - continue - result = verify_bgp_convergence_from_running_config(tgen, dut=rname) - assert result is True, "BGP is not converging on {}".format(rname) - - -def test_bgp_ipv4_nexthop_step1(): - "Assert that BGP has correct ipv4 nexthops." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv4.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv4 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv4 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ipv6_nexthop_step1(): - "Assert that BGP has correct ipv6 nexthops." - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - for rname, router in tgen.routers().items(): - if "h" in rname: - # hosts - continue - if "rs1" in rname: - continue - ref_file = "{}/{}/bgp_ipv6_step1.json".format(CWD, rname) - expected = json.loads(open(ref_file).read()) - test_func = partial( - topotest.router_json_cmp, - router, - "show bgp ipv6 unicast json", - expected, - ) - _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) - assertmsg = "{}: BGP IPv6 Nexthop failure".format(rname) - assert res is None, assertmsg - - -def test_bgp_ping_ok_step1(): - "Check that h1 pings h2 and h3" - tgen = get_topogen() - if tgen.routers_have_failure(): - pytest.skip(tgen.errors) - - check_ping("h1", "192.168.7.1", True, 5, 1) - check_ping("h1", "fd00:700::1", True, 5, 1) - check_ping("h1", "192.168.8.1", True, 5, 1) - check_ping("h1", "fd00:800::1", True, 5, 1) - - -if __name__ == "__main__": - args = ["-s"] + sys.argv[1:] - sys.exit(pytest.main(args))