Skip to content

Commit

Permalink
Add missing locator info
Browse files Browse the repository at this point in the history
Signed-off-by: Carmine Scarpitta <[email protected]>
  • Loading branch information
cscarpitta committed Sep 15, 2024
1 parent de0e358 commit 13c154a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 2 deletions.
30 changes: 28 additions & 2 deletions bgpd/bgp_mplsvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,12 @@ void vpn_leak_zebra_vrf_sid_update_per_af(struct bgp *bgp, afi_t afi)
if (!vrf)
return;

if (bgp->vpn_policy[afi].tovpn_sid_locator) {
ctx.block_len = bgp->vpn_policy[afi].tovpn_sid_locator->block_bits_length;
ctx.node_len = bgp->vpn_policy[afi].tovpn_sid_locator->node_bits_length;
ctx.function_len = bgp->vpn_policy[afi].tovpn_sid_locator->function_bits_length;
ctx.argument_len = bgp->vpn_policy[afi].tovpn_sid_locator->argument_bits_length;
}
ctx.table = vrf->data.l.table_id;
act = afi == AFI_IP ? ZEBRA_SEG6_LOCAL_ACTION_END_DT4
: ZEBRA_SEG6_LOCAL_ACTION_END_DT6;
Expand Down Expand Up @@ -441,6 +447,12 @@ void vpn_leak_zebra_vrf_sid_update_per_vrf(struct bgp *bgp)
if (!vrf)
return;

if (bgp->tovpn_sid_locator) {
ctx.block_len = bgp->tovpn_sid_locator->block_bits_length;
ctx.node_len = bgp->tovpn_sid_locator->node_bits_length;
ctx.function_len = bgp->tovpn_sid_locator->function_bits_length;
ctx.argument_len = bgp->tovpn_sid_locator->argument_bits_length;
}
ctx.table = vrf->data.l.table_id;
act = ZEBRA_SEG6_LOCAL_ACTION_END_DT46;
zclient_send_localsid(zclient, tovpn_sid, bgp->vrf_id, act, &ctx);
Expand Down Expand Up @@ -477,6 +489,7 @@ void vpn_leak_zebra_vrf_sid_update(struct bgp *bgp, afi_t afi)
void vpn_leak_zebra_vrf_sid_withdraw_per_af(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)
Expand All @@ -489,9 +502,15 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_af(struct bgp *bgp, afi_t afi)
zlog_debug("%s: deleting sid for vrf %s afi (id=%d)", __func__,
bgp->name_pretty, bgp->vrf_id);

if (bgp->vpn_policy[afi].tovpn_sid_locator) {
seg6localctx.block_len = bgp->vpn_policy[afi].tovpn_sid_locator->block_bits_length;
seg6localctx.node_len = bgp->vpn_policy[afi].tovpn_sid_locator->node_bits_length;
seg6localctx.function_len = bgp->vpn_policy[afi].tovpn_sid_locator->function_bits_length;
seg6localctx.argument_len = bgp->vpn_policy[afi].tovpn_sid_locator->argument_bits_length;
}
zclient_send_localsid(zclient,
bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent,
bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, NULL);
bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC, &seg6localctx);
XFREE(MTYPE_BGP_SRV6_SID,
bgp->vpn_policy[afi].tovpn_zebra_vrf_sid_last_sent);
}
Expand All @@ -503,6 +522,7 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_af(struct bgp *bgp, afi_t afi)
void vpn_leak_zebra_vrf_sid_withdraw_per_vrf(struct bgp *bgp)
{
int debug = BGP_DEBUG(vpn, VPN_LEAK_LABEL);
struct seg6local_context seg6localctx = {};

if (bgp->vrf_id == VRF_UNKNOWN) {
if (debug)
Expand All @@ -516,9 +536,15 @@ void vpn_leak_zebra_vrf_sid_withdraw_per_vrf(struct bgp *bgp)
zlog_debug("%s: deleting sid for vrf %s (id=%d)", __func__,
bgp->name_pretty, bgp->vrf_id);

if (bgp->tovpn_sid_locator) {
seg6localctx.block_len = bgp->tovpn_sid_locator->block_bits_length;
seg6localctx.node_len = bgp->tovpn_sid_locator->node_bits_length;
seg6localctx.function_len = bgp->tovpn_sid_locator->function_bits_length;
seg6localctx.argument_len = bgp->tovpn_sid_locator->argument_bits_length;
}
zclient_send_localsid(zclient, bgp->tovpn_zebra_vrf_sid_last_sent,
bgp->vrf_id, ZEBRA_SEG6_LOCAL_ACTION_UNSPEC,
NULL);
&seg6localctx);
XFREE(MTYPE_BGP_SRV6_SID, bgp->tovpn_zebra_vrf_sid_last_sent);
}

Expand Down
4 changes: 4 additions & 0 deletions lib/srv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,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 {
Expand Down
6 changes: 6 additions & 0 deletions zebra/subdir.am
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,12 @@ module_LTLIBRARIES += zebra/dplane_fpm_nl.la
zebra_dplane_fpm_nl_la_SOURCES = zebra/dplane_fpm_nl.c
zebra_dplane_fpm_nl_la_LDFLAGS = $(MODULE_LDFLAGS)
zebra_dplane_fpm_nl_la_LIBADD =

module_LTLIBRARIES += zebra/dplane_fpm_sonic.la

zebra_dplane_fpm_sonic_la_SOURCES = zebra/dplane_fpm_sonic.c
zebra_dplane_fpm_sonic_la_LDFLAGS = $(MODULE_LDFLAGS)
zebra_dplane_fpm_sonic_la_LIBADD =
endif

if NETLINK_DEBUG
Expand Down

0 comments on commit 13c154a

Please sign in to comment.