diff options
| author | Donatas Abraitis <donatas@opensourcerouting.org> | 2024-10-29 14:25:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:25:00 +0200 |
| commit | cf77ed96b8edc7641496a465e1b663ffba1bc6ab (patch) | |
| tree | d104c4e327dc31413f89621ec4da0766a4e02217 | |
| parent | c7f55e189bad3671fea8d0867dc9496b09845f97 (diff) | |
| parent | 38653edbf53ef91e4c0c81bdcd075aa4ed1e0493 (diff) | |
Merge pull request #17213 from cscarpitta/fix/backport_add-sid-structure-to-seg6local-nh_for_8.4
bgpd, lib: Include SID structure in seg6local nexthop (backport for 8.4)
| -rw-r--r-- | bgpd/bgp_mplsvpn.c | 20 | ||||
| -rw-r--r-- | lib/srv6.h | 4 |
2 files changed, 21 insertions, 3 deletions
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 5d7aefa736..7f3559bf0f 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -395,6 +395,12 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi) if (!vrf) return; + if (bgp->vpn_policy[afi].tovpn_sid_locator) { + ctx.block_len = BGP_PREFIX_SID_SRV6_LOCATOR_BLOCK_LENGTH; + ctx.node_len = BGP_PREFIX_SID_SRV6_LOCATOR_NODE_LENGTH; + ctx.function_len = BGP_PREFIX_SID_SRV6_FUNCTION_LENGTH; + ctx.argument_len = BGP_PREFIX_SID_SRV6_ARGUMENT_LENGTH; + } ctx.table = vrf->data.l.table_id; act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4 : ZEBRA_SEG6_LOCAL_ACTION_END_DT6; @@ -412,6 +418,7 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi) void vpn_leak_zebra_vrf_sid_withdraw(struct bgp *bgp, afi_t afi) { int debug = BGP_DEBUG(vpn, VPN_LEAK_LABEL); + struct seg6local_context seg6localctx = {}; if (bgp->vrf_id == VRF_UNKNOWN) { if (debug) @@ -424,9 +431,16 @@ void vpn_leak_zebra_vrf_sid_withdraw(struct bgp *bgp, afi_t afi) zlog_debug("%s: deleting sid for vrf %s afi (id=%d)", __func__, bgp->name_pretty, bgp->vrf_id); - zclient_send_localsid(zclient, - bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent, - bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, NULL); + if (bgp->vpn_policy[afi].tovpn_sid_locator) { + seg6localctx.block_len = + BGP_PREFIX_SID_SRV6_LOCATOR_BLOCK_LENGTH; + seg6localctx.node_len = BGP_PREFIX_SID_SRV6_LOCATOR_NODE_LENGTH; + seg6localctx.function_len = BGP_PREFIX_SID_SRV6_FUNCTION_LENGTH; + seg6localctx.argument_len = BGP_PREFIX_SID_SRV6_ARGUMENT_LENGTH; + } + zclient_send_localsid( + zclient, bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent, + bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, &seg6localctx); XFREE(MTYPE_BGP_SRV6_SID, bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent); } diff --git a/lib/srv6.h b/lib/srv6.h index e0db30cd13..e5cd727235 100644 --- a/lib/srv6.h +++ b/lib/srv6.h @@ -71,6 +71,10 @@ struct seg6local_context { struct in_addr nh4; struct in6_addr nh6; uint32_t table; + uint8_t block_len; + uint8_t node_len; + uint8_t function_len; + uint8_t argument_len; }; struct srv6_locator { |
