summaryrefslogtreecommitdiff
path: root/staticd/static_zebra.c
diff options
context:
space:
mode:
Diffstat (limited to 'staticd/static_zebra.c')
-rw-r--r--staticd/static_zebra.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/staticd/static_zebra.c b/staticd/static_zebra.c
index 3faeb3d37a..a6521cccc6 100644
--- a/staticd/static_zebra.c
+++ b/staticd/static_zebra.c
@@ -706,12 +706,24 @@ void static_zebra_srv6_sid_install(struct static_srv6_sid *sid)
return;
}
break;
+ case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+ action = ZEBRA_SEG6_LOCAL_ACTION_END_X;
+ ctx.nh6 = sid->attributes.nh6;
+ ifp = if_lookup_by_name(sid->attributes.ifname, VRF_DEFAULT);
+ if (!ifp) {
+ zlog_warn("Failed to install SID %pFX: failed to get interface %s",
+ &sid->addr, sid->attributes.ifname);
+ return;
+ }
+ SET_SRV6_FLV_OP(ctx.flv.flv_ops, ZEBRA_SEG6_LOCAL_FLV_OP_NEXT_CSID);
+ ctx.flv.lcblock_len = sid->locator->block_bits_length;
+ ctx.flv.lcnode_func_len = sid->locator->node_bits_length;
+ break;
case SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_X:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD:
- case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_OPAQUE:
@@ -834,12 +846,20 @@ void static_zebra_srv6_sid_uninstall(struct static_srv6_sid *sid)
return;
}
break;
+ case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+ ctx.nh6 = sid->attributes.nh6;
+ ifp = if_lookup_by_name(sid->attributes.ifname, VRF_DEFAULT);
+ if (!ifp) {
+ zlog_warn("Failed to install SID %pFX: failed to get interface %s",
+ &sid->addr, sid->attributes.ifname);
+ return;
+ }
+ break;
case SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_X:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD:
- case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_OPAQUE:
@@ -894,6 +914,7 @@ extern void static_zebra_request_srv6_sid(struct static_srv6_sid *sid)
struct srv6_sid_ctx ctx = {};
int ret = 0;
struct vrf *vrf;
+ struct interface *ifp;
if (!sid)
return;
@@ -945,12 +966,22 @@ extern void static_zebra_request_srv6_sid(struct static_srv6_sid *sid)
}
break;
+ case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+ ctx.behavior = ZEBRA_SEG6_LOCAL_ACTION_END_X;
+ ctx.nh6 = sid->attributes.nh6;
+ ifp = if_lookup_by_name(sid->attributes.ifname, VRF_DEFAULT);
+ if (!ifp) {
+ zlog_warn("Failed to request SRv6 SID %pFX: interface %s does not exist",
+ &sid->addr, sid->attributes.ifname);
+ return;
+ }
+ ctx.ifindex = ifp->ifindex;
+ break;
case SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_X:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD:
- case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_OPAQUE:
@@ -970,6 +1001,7 @@ extern void static_zebra_release_srv6_sid(struct static_srv6_sid *sid)
struct srv6_sid_ctx ctx = {};
struct vrf *vrf;
int ret = 0;
+ struct interface *ifp;
if (!sid || !CHECK_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_VALID))
return;
@@ -1021,12 +1053,22 @@ extern void static_zebra_release_srv6_sid(struct static_srv6_sid *sid)
}
break;
+ case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
+ ctx.behavior = ZEBRA_SEG6_LOCAL_ACTION_END_X;
+ ctx.nh6 = sid->attributes.nh6;
+ ifp = if_lookup_by_name(sid->attributes.ifname, VRF_DEFAULT);
+ if (!ifp) {
+ zlog_warn("Failed to request SRv6 SID %pFX: interface %s does not exist",
+ &sid->addr, sid->attributes.ifname);
+ return;
+ }
+ ctx.ifindex = ifp->ifindex;
+ break;
case SRV6_ENDPOINT_BEHAVIOR_END_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_END_X:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_PSP_USD:
- case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP:
case SRV6_ENDPOINT_BEHAVIOR_END_X_NEXT_CSID_PSP_USD:
case SRV6_ENDPOINT_BEHAVIOR_OPAQUE:
@@ -1244,6 +1286,9 @@ static int static_zebra_srv6_sid_notify(ZAPI_CALLBACK_ARGS)
return 0;
}
+ if (!IPV6_ADDR_SAME(&ctx.nh6, &in6addr_any))
+ sid->attributes.nh6 = ctx.nh6;
+
SET_FLAG(sid->flags, STATIC_FLAG_SRV6_SID_VALID);
/*