Skip to content

Commit

Permalink
bgpd: fix route installation whereas nexthop group is uninstalled
Browse files Browse the repository at this point in the history
The test bgp_multi_vrf_topo2 testfails, because BGP fails to install
2 selected BGP routes in the ZEBRA FIB:

> r2# show bgp vrf RED_A
> [..]
> *>i 1::1/128         ::ffff:a00:11            0    100      0 500 ?
> *>i 1::2/128         ::ffff:a00:11            0    100      0 500 ?

There are 2 nexthops groups associated to the BGP paths:

> # show bgp vrf RED_A nexthop-group details
> [..]
> ID: 75757653, #paths 2
>   Flags: 0x0003 (allowRecursion, internalBgp)
>   State: 0x0000
>            via ::ffff:a00:11 (vrf RED_A) inactive, weight 1
>           dependents 75757655
>   Paths:
>     2/1 1::2/128 VRF RED_A flags 0x418
>     2/1 1::1/128 VRF RED_A flags 0x418
> ID: 75757655, #paths 2
>   Flags: 0x000b (allowRecursion, internalBgp, TypeGroup)
>   State: 0x0000
>           depends count 1
>           depends 75757653
>   Paths:
>     2/1 1::2/128 VRF RED_A flags 0x418
>     2/1 1::1/128 VRF RED_A flags 0x418

The nexthop groups could not be installed. When ZEBRA received the
NHG_ADD message for ::ffff:a00:11, it failed to install a dependent
nexthop:

> 2024/03/28 10:36:45 ZEBRA: [VKWCR-QB19H] zebra_nhg_free: nhe 0x562597764120 (75757649[]), refcnt 0, NH ::ffff:a00:11, via r2-r1-eth0
> 2024/03/28 10:36:45 ZEBRA: [WVJCK-PPMGD][EC 4043309093] netlink-dp (NS 0) error: No route to host, type=RTM_NEWNEXTHOP(104), seq=558, pid=4061791196
> [..]
> 2024/03/28 10:36:45 ZEBRA: [J7K9Z-9M7DT] Nexthop dplane ctx 0x5625977757a0, op NH_INSTALL, nexthop ID (109), result FAILURE
> 2024/03/28 10:36:45 ZEBRA: [X5XE1-RS0SW][EC 4043309074] Failed to install Nexthop (109[::ffff:a00:11 if 2 vrfid 6]) into the kernel

Actually, BGP tried to install an IPv6 mapped ipv4 address, whereas
there are no ipv6 routes to that address. Adding to this, it is not
possible to attach an IPv6 route to an IPv4 nexthop. Let us BGP use
the regular ROUTE_ADD facility.

Signed-off-by: Philippe Guibert <[email protected]>
  • Loading branch information
pguibert6WIND committed Mar 28, 2024
1 parent 025834a commit 5a81ede
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions bgpd/bgp_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -2592,6 +2592,7 @@ void bgp_debug_init(void)
/* debug bgp nexthop group */
install_element(ENABLE_NODE, &debug_bgp_nexthop_group_cmd);
install_element(CONFIG_NODE, &debug_bgp_nexthop_group_cmd);

}

/* Return true if this prefix is on the per_prefix_list of prefixes to debug
Expand Down
6 changes: 6 additions & 0 deletions bgpd/bgp_zebra.c
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,12 @@ void bgp_zebra_announce_parse_nexthop(struct bgp_path_info *info,
bgp_nhg_path_unlink(p_mpinfo[i]);
return;
}
if (api->nexthops[i].type == NEXTHOP_TYPE_IPV6 &&
IS_MAPPED_IPV6(&api->nexthops[i].gate.ipv6)) {
for (i = 0; i < *valid_nh_count; i++)
bgp_nhg_path_unlink(p_mpinfo[i]);
return;
}
if (p_mpinfo[i] && p_mpinfo[i]->nexthop &&
p_mpinfo[i]->nexthop->nexthop &&
p_mpinfo[i]->nexthop->nexthop->type ==
Expand Down

0 comments on commit 5a81ede

Please sign in to comment.