mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-04-28 11:50:21 +00:00
lib: fix handle seg6local routes on default vrf
An L3VPN network can be configured on the main BGP instance, with an SRv6 SID. By declaring a network, a seg6local route is created but remains invalid. The below BGP VPN configuration the default VRF has been used: > router bgp 1 > address-family ipv6 unicast > sid vpn export auto > rd vpn export 1:30 > rt vpn both 77:77 > import vpn > export vpn > network 2001:7::/64 > exit-address-family The below seg6local route has been added: > # show ipv6 route > [..] > B 2001:db8:2:2:300::/128 [20/0] is directly connected, unknown inactive, seg6local End.DT6 table 254, seg6 ::, weight 1, 00:00:07 > When creating the seg6local route, an interface is used as nexthop. The interface index is obtained from the vrf identifier. This is true when using VRF interfaces, but is wrong when using the lo interface which usually has the '1' ifindex whereas the vrf id for the default VRF is 0. Get the appropriate index from the vrf identifier. The below seg6local route is visible: > # show ipv6 route > [..] > B>* 2001:db8:1:1:300::/128 [20/0] is directly connected, lo, seg6local End.DT6 table 254, seg6 ::, weight 1, 00:00:15 > Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
89f0982149
commit
c37812dd2a
@ -427,13 +427,18 @@ enum zclient_send_status zclient_send_vrf_label(struct zclient *zclient,
|
||||
}
|
||||
|
||||
enum zclient_send_status zclient_send_localsid(struct zclient *zclient,
|
||||
const struct in6_addr *sid, ifindex_t oif,
|
||||
const struct in6_addr *sid, vrf_id_t vrf_id,
|
||||
enum seg6local_action_t action,
|
||||
const struct seg6local_context *context)
|
||||
{
|
||||
struct prefix_ipv6 p = {};
|
||||
struct zapi_route api = {};
|
||||
struct zapi_nexthop *znh;
|
||||
struct interface *ifp;
|
||||
|
||||
ifp = if_get_vrf_loopback(vrf_id);
|
||||
if (ifp == NULL)
|
||||
return ZCLIENT_SEND_FAILURE;
|
||||
|
||||
p.family = AF_INET6;
|
||||
p.prefixlen = IPV6_MAX_BITLEN;
|
||||
@ -456,7 +461,7 @@ enum zclient_send_status zclient_send_localsid(struct zclient *zclient,
|
||||
memset(znh, 0, sizeof(*znh));
|
||||
|
||||
znh->type = NEXTHOP_TYPE_IFINDEX;
|
||||
znh->ifindex = oif;
|
||||
znh->ifindex = ifp->ifindex;
|
||||
SET_FLAG(znh->flags, ZAPI_NEXTHOP_FLAG_SEG6LOCAL);
|
||||
znh->seg6local_action = action;
|
||||
memcpy(&znh->seg6local_ctx, context, sizeof(struct seg6local_context));
|
||||
|
@ -901,7 +901,7 @@ zclient_send_vrf_label(struct zclient *zclient, vrf_id_t vrf_id, afi_t afi,
|
||||
|
||||
extern enum zclient_send_status
|
||||
zclient_send_localsid(struct zclient *zclient, const struct in6_addr *sid,
|
||||
ifindex_t oif, enum seg6local_action_t action,
|
||||
vrf_id_t vrf_id, enum seg6local_action_t action,
|
||||
const struct seg6local_context *context);
|
||||
|
||||
extern void zclient_send_reg_requests(struct zclient *, vrf_id_t);
|
||||
|
Loading…
Reference in New Issue
Block a user