mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 09:20:25 +00:00
isisd: Add function to send SRv6 SID to zebra
Add a function to install/remove an SRv6 SID in the forwarding plane through Zebra. Signed-off-by: Carmine Scarpitta <carmine.scarpitta@uniroma2.it>
This commit is contained in:
parent
7064d8a727
commit
a239951dde
@ -823,6 +823,73 @@ static int isis_zebra_client_close_notify(ZAPI_CALLBACK_ARGS)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Send SRv6 SID to ZEBRA for installation or deletion.
|
||||||
|
*
|
||||||
|
* @param cmd ZEBRA_ROUTE_ADD or ZEBRA_ROUTE_DELETE
|
||||||
|
* @param sid SRv6 SID to install or delete
|
||||||
|
* @param prefixlen Prefix length
|
||||||
|
* @param oif Outgoing interface
|
||||||
|
* @param action SID action
|
||||||
|
* @param context SID context
|
||||||
|
*/
|
||||||
|
static void isis_zebra_send_localsid(int cmd, const struct in6_addr *sid,
|
||||||
|
uint16_t prefixlen, ifindex_t oif,
|
||||||
|
enum seg6local_action_t action,
|
||||||
|
const struct seg6local_context *context)
|
||||||
|
{
|
||||||
|
struct prefix_ipv6 p = {};
|
||||||
|
struct zapi_route api = {};
|
||||||
|
struct zapi_nexthop *znh;
|
||||||
|
|
||||||
|
if (cmd != ZEBRA_ROUTE_ADD && cmd != ZEBRA_ROUTE_DELETE) {
|
||||||
|
flog_warn(EC_LIB_DEVELOPMENT, "%s: wrong ZEBRA command",
|
||||||
|
__func__);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (prefixlen > IPV6_MAX_BITLEN) {
|
||||||
|
flog_warn(EC_LIB_DEVELOPMENT, "%s: wrong prefixlen %u",
|
||||||
|
__func__, prefixlen);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sr_debug(" |- %s SRv6 SID %pI6 behavior %s",
|
||||||
|
cmd == ZEBRA_ROUTE_ADD ? "Add" : "Delete", sid,
|
||||||
|
seg6local_action2str(action));
|
||||||
|
|
||||||
|
p.family = AF_INET6;
|
||||||
|
p.prefixlen = prefixlen;
|
||||||
|
p.prefix = *sid;
|
||||||
|
|
||||||
|
api.vrf_id = VRF_DEFAULT;
|
||||||
|
api.type = PROTO_TYPE;
|
||||||
|
api.instance = 0;
|
||||||
|
api.safi = SAFI_UNICAST;
|
||||||
|
memcpy(&api.prefix, &p, sizeof(p));
|
||||||
|
|
||||||
|
if (cmd == ZEBRA_ROUTE_DELETE)
|
||||||
|
return (void)zclient_route_send(ZEBRA_ROUTE_DELETE, zclient,
|
||||||
|
&api);
|
||||||
|
|
||||||
|
SET_FLAG(api.flags, ZEBRA_FLAG_ALLOW_RECURSION);
|
||||||
|
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
|
||||||
|
|
||||||
|
znh = &api.nexthops[0];
|
||||||
|
|
||||||
|
memset(znh, 0, sizeof(*znh));
|
||||||
|
|
||||||
|
znh->type = NEXTHOP_TYPE_IFINDEX;
|
||||||
|
znh->ifindex = oif;
|
||||||
|
SET_FLAG(znh->flags, ZAPI_NEXTHOP_FLAG_SEG6LOCAL);
|
||||||
|
znh->seg6local_action = action;
|
||||||
|
memcpy(&znh->seg6local_ctx, context, sizeof(struct seg6local_context));
|
||||||
|
|
||||||
|
api.nexthop_num = 1;
|
||||||
|
|
||||||
|
zclient_route_send(ZEBRA_ROUTE_ADD, zclient, &api);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback to process an SRv6 locator chunk received from SRv6 Manager (zebra).
|
* Callback to process an SRv6 locator chunk received from SRv6 Manager (zebra).
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user