Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dplane_fpm_sonic]: Fix for SRv6 SIDs learnt from the kernel #21534

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions src/sonic-frr/dplane_fpm_sonic/dplane_fpm_sonic.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@
*/
#define FPM_HEADER_SIZE 4

/* Default SRv6 SID format values */
DEFAULT_SRV6_LOCALSID_FORMAT_BLOCK_LEN = 32;
DEFAULT_SRV6_LOCALSID_FORMAT_NODE_LEN = 16;
DEFAULT_SRV6_LOCALSID_FORMAT_FUNCTION_LEN = 16;
DEFAULT_SRV6_LOCALSID_FORMAT_ARGUMENT_LEN = 0;

/**
* Custom Netlink TLVs
*/
Expand Down Expand Up @@ -951,6 +957,7 @@ static ssize_t netlink_srv6_localsid_msg_encode(int cmd,
vrf_id_t vrf_id;
uint32_t table_id;
uint32_t action;
uint32_t block_len, node_len, func_len, arg_len;

struct {
struct nlmsghdr n;
Expand Down Expand Up @@ -1035,28 +1042,44 @@ static ssize_t netlink_srv6_localsid_msg_encode(int cmd,
nl_attr_nest(&req->n, datalen,
FPM_SRV6_LOCALSID_FORMAT);

block_len = nexthop->nh_srv6->seg6local_ctx.block_len;
node_len = nexthop->nh_srv6->seg6local_ctx.node_len;
func_len = nexthop->nh_srv6->seg6local_ctx.function_len;
arg_len = nexthop->nh_srv6->seg6local_ctx.argument_len;

/*
* If block/node/func/arg length are not provided by the srv6 nexthop,
* then we use the default values
*/
if (block_len == 0 && node_len == 0 && func_len == 0 && arg_len == 0) {
block_len = DEFAULT_SRV6_LOCALSID_FORMAT_BLOCK_LEN;
node_len = DEFAULT_SRV6_LOCALSID_FORMAT_NODE_LEN;
func_len = DEFAULT_SRV6_LOCALSID_FORMAT_FUNCTION_LEN;
arg_len = DEFAULT_SRV6_LOCALSID_FORMAT_ARGUMENT_LEN;
}

if (!nl_attr_put8(
&req->n, datalen,
FPM_SRV6_LOCALSID_FORMAT_BLOCK_LEN,
nexthop->nh_srv6->seg6local_ctx.block_len))
block_len))
return -1;

if (!nl_attr_put8(
&req->n, datalen,
FPM_SRV6_LOCALSID_FORMAT_NODE_LEN,
nexthop->nh_srv6->seg6local_ctx.node_len))
node_len))
return -1;

if (!nl_attr_put8(
&req->n, datalen,
FPM_SRV6_LOCALSID_FORMAT_FUNC_LEN,
nexthop->nh_srv6->seg6local_ctx.function_len))
func_len))
return -1;

if (!nl_attr_put8(
&req->n, datalen,
FPM_SRV6_LOCALSID_FORMAT_ARG_LEN,
nexthop->nh_srv6->seg6local_ctx.argument_len))
arg_len))
return -1;

nl_attr_nest_end(&req->n, nest);
Expand Down
Loading