DEFINE_MTYPE_STATIC(ISISD, ISIS_SR_INFO, "ISIS segment routing information")
-static void isis_sr_prefix_uninstall(struct sr_prefix *srp);
-static void isis_sr_prefix_reinstall(struct sr_prefix *srp,
+static void sr_prefix_uninstall(struct sr_prefix *srp);
+static void sr_prefix_reinstall(struct sr_prefix *srp,
bool replace_semantics);
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/* Returns true if the interface/address pair corresponds to a Node-SID. */
-static bool isis_sr_prefix_is_node_sid(const struct interface *ifp,
- const struct prefix *prefix)
+static bool sr_prefix_is_node_sid(const struct interface *ifp,
+ const struct prefix *prefix)
{
return (if_is_loopback(ifp) && is_host_route(prefix));
}
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
frr_each (srdb_area_prefix,
&area->srdb.prefix_sids[level - 1], srp) {
- isis_sr_prefix_reinstall(srp, false);
+ sr_prefix_reinstall(srp, false);
}
}
/* Set the N-flag when appropriate. */
ifp = if_lookup_prefix(prefix, VRF_DEFAULT);
- if (ifp && isis_sr_prefix_is_node_sid(ifp, prefix))
+ if (ifp && sr_prefix_is_node_sid(ifp, prefix))
pcfg->node_sid = true;
/* Save prefix-sid configuration. */
/*----------------------------------------------------------------------------*/
-static struct sr_prefix *isis_sr_prefix_add(struct isis_area *area,
- struct sr_node *srn,
- union prefixconstptr prefix,
- bool local,
- const struct isis_prefix_sid *psid)
+static struct sr_prefix *sr_prefix_add(struct isis_area *area,
+ struct sr_node *srn,
+ union prefixconstptr prefix, bool local,
+ const struct isis_prefix_sid *psid)
{
struct sr_prefix *srp;
srp = XCALLOC(MTYPE_ISIS_SR_INFO, sizeof(*srp));
prefix_copy(&srp->prefix, prefix.p);
srp->sid = *psid;
- srp->local_label = MPLS_INVALID_LABEL;
+ srp->input_label = MPLS_INVALID_LABEL;
if (local) {
srp->type = ISIS_SR_PREFIX_LOCAL;
isis_sr_nexthop_reset(&srp->u.local.info);
return srp;
}
-static void isis_sr_prefix_del(struct isis_area *area, struct sr_node *srn,
- struct sr_prefix *srp)
+static void sr_prefix_del(struct isis_area *area, struct sr_node *srn,
+ struct sr_prefix *srp)
{
- isis_sr_prefix_uninstall(srp);
+ sr_prefix_uninstall(srp);
srdb_node_prefix_del(&srn->prefix_sids, srp);
srdb_area_prefix_del(&area->srdb.prefix_sids[srn->level - 1], srp);
XFREE(MTYPE_ISIS_SR_INFO, srp);
}
-static struct sr_prefix *isis_sr_prefix_find_area(struct isis_area *area,
- int level,
- union prefixconstptr prefix)
+static struct sr_prefix *sr_prefix_find_by_area(struct isis_area *area,
+ int level,
+ union prefixconstptr prefix)
{
struct sr_prefix srp = {};
&srp);
}
-static struct sr_prefix *isis_sr_prefix_find_node(struct sr_node *srn,
- union prefixconstptr prefix)
+static struct sr_prefix *sr_prefix_find_by_node(struct sr_node *srn,
+ union prefixconstptr prefix)
{
struct sr_prefix srp = {};
return srdb_node_prefix_find(&srn->prefix_sids, &srp);
}
-static struct sr_node *isis_sr_node_add(struct isis_area *area, int level,
- const uint8_t *sysid,
- const struct isis_router_cap *cap)
+static struct sr_node *sr_node_add(struct isis_area *area, int level,
+ const uint8_t *sysid,
+ const struct isis_router_cap *cap)
{
struct sr_node *srn;
return srn;
}
-static void isis_sr_node_del(struct isis_area *area, int level,
- struct sr_node *srn)
+static void sr_node_del(struct isis_area *area, int level, struct sr_node *srn)
{
/* Remove and uninstall Prefix-SIDs. */
while (srdb_node_prefix_count(&srn->prefix_sids) > 0) {
struct sr_prefix *srp;
srp = srdb_node_prefix_first(&srn->prefix_sids);
- isis_sr_prefix_del(area, srn, srp);
+ sr_prefix_del(area, srn, srp);
}
srdb_node_del(&area->srdb.sr_nodes[level - 1], srn);
XFREE(MTYPE_ISIS_SR_INFO, srn);
}
-static struct sr_node *isis_sr_node_find(struct isis_area *area, int level,
- const uint8_t *sysid)
+static struct sr_node *sr_node_find(struct isis_area *area, int level,
+ const uint8_t *sysid)
{
struct sr_node srn = {};
return srdb_node_find(&area->srdb.sr_nodes[level - 1], &srn);
}
-static void isis_sr_adj_srgb_update(struct isis_area *area, uint8_t *sysid,
- int level)
+static void sr_node_srgb_update(struct isis_area *area, int level,
+ uint8_t *sysid)
{
struct sr_prefix *srp;
- frr_each (srdb_area_prefix, &area->srdb.prefix_sids[level - 1],
- srp) {
+ frr_each (srdb_area_prefix, &area->srdb.prefix_sids[level - 1], srp) {
struct listnode *node;
struct isis_nexthop *nh;
* Reinstall all Prefix-SID nexthops using route replace
* semantics.
*/
- isis_sr_prefix_reinstall(srp, true);
+ sr_prefix_reinstall(srp, true);
break;
}
}
/*----------------------------------------------------------------------------*/
/* Lookup IS-IS route in the SPT. */
-static struct isis_route_info *
-isis_sr_prefix_lookup_route(struct isis_area *area, enum spf_tree_id tree_id,
- struct sr_prefix *srp)
+static struct isis_route_info *sr_prefix_lookup_route(struct isis_area *area,
+ enum spf_tree_id tree_id,
+ struct sr_prefix *srp)
{
struct route_node *rn;
int level = srp->srn->level;
}
/* Calculate Prefix-SID input label. */
-static mpls_label_t isis_sr_prefix_in_label(const struct sr_prefix *srp)
+static mpls_label_t sr_prefix_in_label(const struct sr_prefix *srp)
{
const struct sr_node *srn = srp->srn;
struct isis_area *area = srn->area;
}
/* Calculate Prefix-SID output label. */
-static mpls_label_t isis_sr_prefix_out_label(const struct sr_prefix *srp,
- const struct sr_node *srn_nexthop,
- const uint8_t *sysid)
+static mpls_label_t sr_prefix_out_label(const struct sr_prefix *srp,
+ const struct sr_node *srn_nexthop,
+ const uint8_t *sysid)
{
const struct sr_node *srn = srp->srn;
}
/* Process local Prefix-SID and install it if possible. */
-static int isis_sr_prefix_install_local(struct sr_prefix *srp)
+static int sr_prefix_install_local(struct sr_prefix *srp)
{
const struct sr_node *srn = srp->srn;
struct isis_area *area = srn->area;
- mpls_label_t local_label;
+ mpls_label_t input_label;
/*
* No need to install LSP to local Prefix-SID unless the
}
/* Calculate local label. */
- local_label = isis_sr_prefix_in_label(srp);
- if (local_label == MPLS_INVALID_LABEL)
+ input_label = sr_prefix_in_label(srp);
+ if (input_label == MPLS_INVALID_LABEL)
return -1;
/* Update internal state. */
- srp->local_label = local_label;
+ srp->input_label = input_label;
isis_sr_nexthop_update(&srp->u.local.info, MPLS_LABEL_IMPLICIT_NULL);
/* Install Prefix-SID in the forwarding plane. */
}
/* Process remote Prefix-SID and install it if possible. */
-static int isis_sr_prefix_install_remote(struct sr_prefix *srp)
+static int sr_prefix_install_remote(struct sr_prefix *srp)
{
const struct sr_node *srn = srp->srn;
struct isis_area *area = srn->area;
enum spf_tree_id tree_id;
struct listnode *node;
struct isis_nexthop *nexthop;
- mpls_label_t local_label;
+ mpls_label_t input_label;
size_t nexthop_num = 0;
/* Lookup associated IS-IS route. */
tree_id = (srp->prefix.family == AF_INET) ? SPFTREE_IPV4 : SPFTREE_IPV6;
- srp->u.remote.rinfo = isis_sr_prefix_lookup_route(area, tree_id, srp);
+ srp->u.remote.rinfo = sr_prefix_lookup_route(area, tree_id, srp);
if (!srp->u.remote.rinfo)
/* SPF hasn't converged for this route yet. */
return -1;
srp->sid.value, circuit_t2string(srn->level));
/* Calculate local label. */
- local_label = isis_sr_prefix_in_label(srp);
- if (local_label == MPLS_INVALID_LABEL)
+ input_label = sr_prefix_in_label(srp);
+ if (input_label == MPLS_INVALID_LABEL)
return -1;
for (ALL_LIST_ELEMENTS_RO(srp->u.remote.rinfo->nexthops, node,
nexthop)) {
struct sr_node *srn_nexthop;
- mpls_label_t remote_label;
+ mpls_label_t output_label;
/* Check if the nexthop advertised a SRGB. */
- srn_nexthop =
- isis_sr_node_find(area, srn->level, nexthop->sysid);
+ srn_nexthop = sr_node_find(area, srn->level, nexthop->sysid);
if (!srn_nexthop)
goto next;
&& !IS_SR_IPV6(srn_nexthop->cap.srgb)))
goto next;
- remote_label = isis_sr_prefix_out_label(srp, srn_nexthop,
+ output_label = sr_prefix_out_label(srp, srn_nexthop,
nexthop->sysid);
- if (remote_label == MPLS_INVALID_LABEL)
+ if (output_label == MPLS_INVALID_LABEL)
goto next;
if (IS_DEBUG_ISIS(DEBUG_SR)) {
inet_ntop(nexthop->family, &nexthop->ip, buf,
sizeof(buf));
- zlog_debug(" nexthop %s label %u", buf, remote_label);
+ zlog_debug(" nexthop %s label %u", buf, output_label);
}
- isis_sr_nexthop_update(&nexthop->sr, remote_label);
+ isis_sr_nexthop_update(&nexthop->sr, output_label);
nexthop_num++;
continue;
next:
}
/* Update internal state. */
- srp->local_label = local_label;
+ srp->input_label = input_label;
/* Install Prefix-SID in the forwarding plane. */
isis_zebra_install_prefix_sid(srp);
}
/* Process local or remote Prefix-SID and install it if possible. */
-static void isis_sr_prefix_install(struct sr_prefix *srp)
+static void sr_prefix_install(struct sr_prefix *srp)
{
const struct sr_node *srn = srp->srn;
struct isis_area *area = srn->area;
switch (srn->level) {
case ISIS_LEVEL1:
- srp_l2 = isis_sr_prefix_find_area(area, ISIS_LEVEL2,
- &srp->prefix);
+ srp_l2 = sr_prefix_find_by_area(area, ISIS_LEVEL2,
+ &srp->prefix);
if (srp_l2)
- isis_sr_prefix_uninstall(srp_l2);
+ sr_prefix_uninstall(srp_l2);
break;
case ISIS_LEVEL2:
- srp_l1 = isis_sr_prefix_find_area(area, ISIS_LEVEL1,
- &srp->prefix);
+ srp_l1 = sr_prefix_find_by_area(area, ISIS_LEVEL1,
+ &srp->prefix);
if (srp_l1)
return;
break;
}
if (srp->type == ISIS_SR_PREFIX_LOCAL)
- ret = isis_sr_prefix_install_local(srp);
+ ret = sr_prefix_install_local(srp);
else
- ret = isis_sr_prefix_install_remote(srp);
+ ret = sr_prefix_install_remote(srp);
if (ret != 0)
- isis_sr_prefix_uninstall(srp);
+ sr_prefix_uninstall(srp);
}
/* Uninstall local or remote Prefix-SID. */
-static void isis_sr_prefix_uninstall(struct sr_prefix *srp)
+static void sr_prefix_uninstall(struct sr_prefix *srp)
{
const struct sr_node *srn = srp->srn;
struct listnode *node;
struct isis_nexthop *nexthop;
- if (srp->local_label == MPLS_INVALID_LABEL)
+ if (srp->input_label == MPLS_INVALID_LABEL)
return;
if (IS_DEBUG_ISIS(DEBUG_SR))
isis_zebra_uninstall_prefix_sid(srp);
/* Reset internal state. */
- srp->local_label = MPLS_INVALID_LABEL;
+ srp->input_label = MPLS_INVALID_LABEL;
switch (srp->type) {
case ISIS_SR_PREFIX_LOCAL:
isis_sr_nexthop_reset(&srp->u.local.info);
}
/* Reinstall local or remote Prefix-SID. */
-static void isis_sr_prefix_reinstall(struct sr_prefix *srp,
- bool replace_semantics)
+static void sr_prefix_reinstall(struct sr_prefix *srp, bool replace_semantics)
{
/*
* Route replace semantics can be used only when we know for sure that
* reinstalling it.
*/
if (!replace_semantics)
- isis_sr_prefix_uninstall(srp);
+ sr_prefix_uninstall(srp);
- isis_sr_prefix_install(srp);
+ sr_prefix_install(srp);
}
/*----------------------------------------------------------------------------*/
/* Parse all SR-related information from the given Router Capabilities TLV. */
static struct sr_node *
-isis_sr_parse_router_cap_tlv(struct isis_area *area, int level,
- const uint8_t *sysid,
- const struct isis_router_cap *router_cap)
+parse_router_cap_tlv(struct isis_area *area, int level, const uint8_t *sysid,
+ const struct isis_router_cap *router_cap)
{
struct sr_node *srn;
if (!router_cap || router_cap->srgb.range_size == 0)
return NULL;
- srn = isis_sr_node_find(area, level, sysid);
+ srn = sr_node_find(area, level, sysid);
if (srn) {
if (memcmp(&srn->cap, router_cap, sizeof(srn->cap)) != 0) {
srn->cap = *router_cap;
} else
srn->state = SRDB_STATE_UNCHANGED;
} else {
- srn = isis_sr_node_add(area, level, sysid, router_cap);
+ srn = sr_node_add(area, level, sysid, router_cap);
srn->state = SRDB_STATE_NEW;
}
}
/* Parse list of Prefix-SID Sub-TLVs. */
-static void isis_sr_parse_prefix_sid_subtlvs(struct sr_node *srn,
- union prefixconstptr prefix,
- bool local,
- struct isis_item_list *prefix_sids)
+static void parse_prefix_sid_subtlvs(struct sr_node *srn,
+ union prefixconstptr prefix, bool local,
+ struct isis_item_list *prefix_sids)
{
struct isis_area *area = srn->area;
struct isis_item *i;
if (psid->algorithm != SR_ALGORITHM_SPF)
continue;
- srp = isis_sr_prefix_find_node(srn, prefix);
+ srp = sr_prefix_find_by_node(srn, prefix);
if (srp) {
if (srp->sid.flags != psid->flags
|| srp->sid.algorithm != psid->algorithm
} else
srp->state = SRDB_STATE_UNCHANGED;
} else {
- srp = isis_sr_prefix_add(area, srn, prefix, local,
- psid);
+ srp = sr_prefix_add(area, srn, prefix, local, psid);
srp->state = SRDB_STATE_NEW;
}
/*
}
/* Parse all SR-related information from the given LSP. */
-static void isis_sr_parse_lsp(struct isis_area *area, int level,
- struct sr_node **srn, struct isis_lsp *lsp)
+static void parse_lsp(struct isis_area *area, int level, struct sr_node **srn,
+ struct isis_lsp *lsp)
{
struct isis_item_list *items;
struct isis_item *i;
/* Parse the Router Capability TLV. */
if (*srn == NULL) {
- *srn = isis_sr_parse_router_cap_tlv(
+ *srn = parse_router_cap_tlv(
area, level, lsp->hdr.lsp_id, lsp->tlvs->router_cap);
if (!*srn)
return;
if (!ir->subtlvs)
continue;
- isis_sr_parse_prefix_sid_subtlvs(*srn, &ir->prefix, local,
- &ir->subtlvs->prefix_sids);
+ parse_prefix_sid_subtlvs(*srn, &ir->prefix, local,
+ &ir->subtlvs->prefix_sids);
}
/* Parse Multi Topology Reachable IPv6 Prefixes TLV. */
if (!ir->subtlvs)
continue;
- isis_sr_parse_prefix_sid_subtlvs(*srn, &ir->prefix, local,
- &ir->subtlvs->prefix_sids);
+ parse_prefix_sid_subtlvs(*srn, &ir->prefix, local,
+ &ir->subtlvs->prefix_sids);
}
}
/* Parse all SR-related information from the entire LSPDB. */
-static void isis_sr_parse_lspdb(struct isis_area *area)
+static void parse_lspdb(struct isis_area *area)
{
struct isis_lsp *lsp;
if (!lsp->tlvs)
continue;
- isis_sr_parse_lsp(area, level, &srn, lsp);
+ parse_lsp(area, level, &srn, lsp);
for (ALL_LIST_ELEMENTS_RO(lsp->lspu.frags, node, frag))
- isis_sr_parse_lsp(area, level, &srn, frag);
+ parse_lsp(area, level, &srn, frag);
}
}
}
/* Process any new/deleted/modified Prefix-SID in the LSPDB. */
-static void isis_sr_process_prefix_changes(struct sr_node *srn,
- struct sr_prefix *srp)
+static void process_prefix_changes(struct sr_node *srn, struct sr_prefix *srp)
{
struct isis_area *area = srn->area;
/* Install/reinstall/uninstall Prefix-SID if necessary. */
switch (srp->state) {
case SRDB_STATE_NEW:
- isis_sr_prefix_install(srp);
+ sr_prefix_install(srp);
break;
case SRDB_STATE_MODIFIED:
- isis_sr_prefix_reinstall(srp, false);
+ sr_prefix_reinstall(srp, false);
break;
case SRDB_STATE_UNCHANGED:
break;
default:
- isis_sr_prefix_del(area, srn, srp);
+ sr_prefix_del(area, srn, srp);
return;
}
}
/* Process any new/deleted/modified SRGB in the LSPDB. */
-static void isis_sr_process_node_changes(struct isis_area *area, int level,
- struct sr_node *srn)
+static void process_node_changes(struct isis_area *area, int level,
+ struct sr_node *srn)
{
struct sr_prefix *srp;
uint8_t sysid[ISIS_SYS_ID_LEN];
case SRDB_STATE_NEW:
case SRDB_STATE_MODIFIED:
if (adjacent)
- isis_sr_adj_srgb_update(area, sysid, level);
+ sr_node_srgb_update(area, sysid, level);
break;
case SRDB_STATE_UNCHANGED:
break;
default:
- isis_sr_node_del(area, level, srn);
+ sr_node_del(area, level, srn);
if (adjacent)
- isis_sr_adj_srgb_update(area, sysid, level);
+ sr_node_srgb_update(area, level, sysid);
return;
}
srn->state = SRDB_STATE_VALIDATED;
frr_each_safe (srdb_node_prefix, &srn->prefix_sids, srp)
- isis_sr_process_prefix_changes(srn, srp);
+ process_prefix_changes(srn, srp);
}
/* Parse and process all SR-related Sub-TLVs after running the SPF algorithm. */
return;
/* Parse LSPDB to detect new/deleted/modified SR (sub-)TLVs. */
- isis_sr_parse_lspdb(area);
+ parse_lspdb(area);
/* Process possible SR-related changes in the LDPSB. */
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
- frr_each_safe (srdb_node, &area->srdb.sr_nodes[level - 1],
- srn)
- isis_sr_process_node_changes(area, level, srn);
+ frr_each_safe (srdb_node, &area->srdb.sr_nodes[level - 1], srn)
+ process_node_changes(area, level, srn);
}
}
* Once a route is updated in the SPT, reinstall or uninstall its corresponding
* Prefix-SID (if any).
*/
-static int isis_sr_route_update(struct isis_area *area, struct prefix *prefix,
- struct isis_route_info *route_info)
+static int sr_route_update(struct isis_area *area, struct prefix *prefix,
+ struct isis_route_info *route_info)
{
struct sr_prefix *srp;
switch (area->is_type) {
case IS_LEVEL_1:
- srp = isis_sr_prefix_find_area(area, ISIS_LEVEL1, prefix);
+ srp = sr_prefix_find_by_area(area, ISIS_LEVEL1, prefix);
break;
case IS_LEVEL_2:
- srp = isis_sr_prefix_find_area(area, ISIS_LEVEL2, prefix);
+ srp = sr_prefix_find_by_area(area, ISIS_LEVEL2, prefix);
break;
case IS_LEVEL_1_AND_2:
- srp = isis_sr_prefix_find_area(area, ISIS_LEVEL1, prefix);
+ srp = sr_prefix_find_by_area(area, ISIS_LEVEL1, prefix);
if (!srp)
- srp = isis_sr_prefix_find_area(area, ISIS_LEVEL2,
- prefix);
+ srp = sr_prefix_find_by_area(area, ISIS_LEVEL2, prefix);
break;
default:
flog_err(EC_LIB_DEVELOPMENT, "%s: unknown area level",
return 0;
if (CHECK_FLAG(route_info->flag, ISIS_ROUTE_FLAG_ACTIVE)) {
- isis_sr_prefix_reinstall(srp, true);
+ sr_prefix_reinstall(srp, true);
srp->u.remote.rinfo = route_info;
} else {
- isis_sr_prefix_uninstall(srp);
+ sr_prefix_uninstall(srp);
srp->u.remote.rinfo = NULL;
}
/*----------------------------------------------------------------------------*/
/* Install or uninstall (LAN)-Adj-SID. */
-static void isis_sr_adj_sid_install_uninstall(bool install,
- const struct sr_adjacency *sra)
+static void sr_adj_sid_install_uninstall(bool install,
+ const struct sr_adjacency *sra)
{
struct zapi_labels zl;
struct zapi_nexthop *znh;
}
/* Add new local Adj-SID. */
-static void isis_sr_adj_sid_add_single(struct isis_adjacency *adj, int family,
- bool backup)
+static void sr_adj_sid_add_single(struct isis_adjacency *adj, int family,
+ bool backup)
{
struct isis_circuit *circuit = adj->circuit;
struct isis_area *area = circuit->area;
struct isis_lan_adj_sid *ladj_sid;
union g_addr nexthop = {};
uint8_t flags;
- mpls_label_t local_label;
+ mpls_label_t input_label;
switch (family) {
case AF_INET:
if (backup)
SET_FLAG(flags, EXT_SUBTLV_LINK_ADJ_SID_BFLG);
- local_label = isis_zebra_request_dynamic_label();
+ input_label = isis_zebra_request_dynamic_label();
if (circuit->ext == NULL)
circuit->ext = isis_alloc_ext_subtlvs();
inet_ntop(family, &nexthop, buf, sizeof(buf));
zlog_debug("ISIS-SR (%s) installing Adj-SID %s%%%s label %u",
area->area_tag, buf, circuit->interface->name,
- local_label);
+ input_label);
}
sra = XCALLOC(MTYPE_ISIS_SR_INFO, sizeof(*sra));
sra->type = backup ? ISIS_SR_LAN_BACKUP : ISIS_SR_ADJ_NORMAL;
sra->nexthop.family = family;
sra->nexthop.address = nexthop;
- sra->nexthop.label = local_label;
+ sra->nexthop.label = input_label;
switch (circuit->circ_type) {
case CIRCUIT_T_BROADCAST:
ladj_sid = XCALLOC(MTYPE_ISIS_SUBTLV, sizeof(*ladj_sid));
ladj_sid->weight = 0;
memcpy(ladj_sid->neighbor_id, adj->sysid,
sizeof(ladj_sid->neighbor_id));
- ladj_sid->sid = local_label;
+ ladj_sid->sid = input_label;
isis_tlvs_add_lan_adj_sid(circuit->ext, ladj_sid);
sra->u.ladj_sid = ladj_sid;
break;
adj_sid->family = family;
adj_sid->flags = flags;
adj_sid->weight = 0;
- adj_sid->sid = local_label;
+ adj_sid->sid = input_label;
isis_tlvs_add_adj_sid(circuit->ext, adj_sid);
sra->u.adj_sid = adj_sid;
break;
listnode_add(area->srdb.adj_sids, sra);
listnode_add(adj->adj_sids, sra);
- isis_sr_adj_sid_install_uninstall(true, sra);
+ sr_adj_sid_install_uninstall(true, sra);
}
-static void isis_sr_adj_sid_add(struct isis_adjacency *adj, int family)
+static void sr_adj_sid_add(struct isis_adjacency *adj, int family)
{
- isis_sr_adj_sid_add_single(adj, family, false);
- isis_sr_adj_sid_add_single(adj, family, true);
+ sr_adj_sid_add_single(adj, family, false);
+ sr_adj_sid_add_single(adj, family, true);
}
/* Delete local Adj-SID. */
-static void isis_sr_adj_sid_del(struct sr_adjacency *sra)
+static void sr_adj_sid_del(struct sr_adjacency *sra)
{
struct isis_circuit *circuit = sra->adj->circuit;
struct isis_area *area = circuit->area;
area->area_tag, buf, circuit->interface->name);
}
- isis_sr_adj_sid_install_uninstall(false, sra);
+ sr_adj_sid_install_uninstall(false, sra);
switch (circuit->circ_type) {
case CIRCUIT_T_BROADCAST:
}
/* Remove all Adj-SIDs associated to an adjacency that is going down. */
-static int isis_sr_adj_state_change(struct isis_adjacency *adj)
+static int sr_adj_state_change(struct isis_adjacency *adj)
{
struct sr_adjacency *sra;
struct listnode *node, *nnode;
return 0;
for (ALL_LIST_ELEMENTS(adj->adj_sids, node, nnode, sra))
- isis_sr_adj_sid_del(sra);
+ sr_adj_sid_del(sra);
return 0;
}
* Adjacency now has one or more IPv4/IPv6 addresses. Add new IPv4 or IPv6
* Adj-SID accordingly.
*/
-static int isis_sr_adj_ip_enabled(struct isis_adjacency *adj, int family)
+static int sr_adj_ip_enabled(struct isis_adjacency *adj, int family)
{
if (!adj->circuit->area->srdb.enabled)
return 0;
- isis_sr_adj_sid_add(adj, family);
+ sr_adj_sid_add(adj, family);
return 0;
}
* Adjacency doesn't have any IPv4 or IPv6 addresses anymore. Delete the
* corresponding Adj-SID(s) accordingly.
*/
-static int isis_sr_adj_ip_disabled(struct isis_adjacency *adj, int family)
+static int sr_adj_ip_disabled(struct isis_adjacency *adj, int family)
{
struct sr_adjacency *sra;
struct listnode *node, *nnode;
for (ALL_LIST_ELEMENTS(adj->adj_sids, node, nnode, sra))
if (sra->nexthop.family == family)
- isis_sr_adj_sid_del(sra);
+ sr_adj_sid_del(sra);
return 0;
}
-static int isis_sr_if_new_hook(struct interface *ifp)
+static int sr_if_new_hook(struct interface *ifp)
{
struct isis_circuit *circuit;
struct isis_area *area;
if (!pcfg)
continue;
- if (isis_sr_prefix_is_node_sid(ifp, &pcfg->prefix)
+ if (sr_prefix_is_node_sid(ifp, &pcfg->prefix)
&& !pcfg->node_sid) {
pcfg->node_sid = true;
lsp_regenerate_schedule(area, area->is_type, 0);
/*----------------------------------------------------------------------------*/
-static void isis_sr_show_prefix_sid_local(struct vty *vty, struct ttable *tt,
- const struct isis_area *area,
- const struct sr_prefix *srp)
+static void show_prefix_sid_local(struct vty *vty, struct ttable *tt,
+ const struct isis_area *area,
+ const struct sr_prefix *srp)
{
const struct sr_nexthop_info *srnh = &srp->u.local.info;
char buf_prefix[BUFSIZ];
char buf_rlabel[BUFSIZ];
char buf_uptime[BUFSIZ];
- if (srp->local_label != MPLS_INVALID_LABEL)
- label2str(srp->local_label, buf_llabel, sizeof(buf_llabel));
+ if (srp->input_label != MPLS_INVALID_LABEL)
+ label2str(srp->input_label, buf_llabel, sizeof(buf_llabel));
else
snprintf(buf_llabel, sizeof(buf_llabel), "-");
if (srnh->label != MPLS_INVALID_LABEL) {
srp->sid.value, buf_llabel, buf_rlabel, buf_uptime);
}
-static void isis_sr_show_prefix_sid_remote(struct vty *vty, struct ttable *tt,
- const struct isis_area *area,
- const struct sr_prefix *srp)
+static void show_prefix_sid_remote(struct vty *vty, struct ttable *tt,
+ const struct isis_area *area,
+ const struct sr_prefix *srp)
{
struct isis_nexthop *nexthop;
struct listnode *node;
bool first = true;
(void)prefix2str(&srp->prefix, buf_prefix, sizeof(buf_prefix));
- if (srp->local_label != MPLS_INVALID_LABEL)
- label2str(srp->local_label, buf_llabel, sizeof(buf_llabel));
+ if (srp->input_label != MPLS_INVALID_LABEL)
+ label2str(srp->input_label, buf_llabel, sizeof(buf_llabel));
else
snprintf(buf_llabel, sizeof(buf_llabel), "-");
}
}
-static void isis_sr_show_prefix_sids(struct vty *vty, struct isis_area *area,
- int level)
+static void show_prefix_sids(struct vty *vty, struct isis_area *area, int level)
{
struct sr_prefix *srp;
struct ttable *tt;
ttable_restyle(tt);
ttable_rowseps(tt, 0, BOTTOM, true, '-');
- frr_each (srdb_area_prefix, &area->srdb.prefix_sids[level - 1],
- srp) {
+ frr_each (srdb_area_prefix, &area->srdb.prefix_sids[level - 1], srp) {
switch (srp->type) {
case ISIS_SR_PREFIX_LOCAL:
- isis_sr_show_prefix_sid_local(vty, tt, area, srp);
+ show_prefix_sid_local(vty, tt, area, srp);
break;
case ISIS_SR_PREFIX_REMOTE:
- isis_sr_show_prefix_sid_remote(vty, tt, area, srp);
+ show_prefix_sid_remote(vty, tt, area, srp);
break;
}
}
area->area_tag ? area->area_tag : "null");
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
- isis_sr_show_prefix_sids(vty, area, level);
+ show_prefix_sids(vty, area, level);
}
return CMD_SUCCESS;
circuit->u.bc.adjdb[level - 1],
anode, adj)) {
if (adj->ipv4_address_count > 0)
- isis_sr_adj_sid_add(adj,
- AF_INET);
+ sr_adj_sid_add(adj, AF_INET);
if (adj->ipv6_address_count > 0)
- isis_sr_adj_sid_add(adj,
- AF_INET6);
+ sr_adj_sid_add(adj, AF_INET6);
}
}
break;
case CIRCUIT_T_P2P:
adj = circuit->u.p2p.neighbor;
if (adj && adj->ipv4_address_count > 0)
- isis_sr_adj_sid_add(adj, AF_INET);
+ sr_adj_sid_add(adj, AF_INET);
if (adj && adj->ipv6_address_count > 0)
- isis_sr_adj_sid_add(adj, AF_INET6);
+ sr_adj_sid_add(adj, AF_INET6);
break;
default:
break;
/* Uninstall Adj-SIDs. */
for (ALL_LIST_ELEMENTS(area->srdb.adj_sids, node, nnode, sra))
- isis_sr_adj_sid_del(sra);
+ sr_adj_sid_del(sra);
/* Uninstall Prefix-SIDs. */
for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
struct sr_node *srn;
srn = srdb_node_first(&srdb->sr_nodes[level - 1]);
- isis_sr_node_del(area, level, srn);
+ sr_node_del(area, level, srn);
}
}
install_element(VIEW_NODE, &show_sr_prefix_sids_cmd);
/* Register hooks. */
- hook_register(isis_adj_state_change_hook, isis_sr_adj_state_change);
- hook_register(isis_adj_ip_enabled_hook, isis_sr_adj_ip_enabled);
- hook_register(isis_adj_ip_disabled_hook, isis_sr_adj_ip_disabled);
- hook_register(isis_route_update_hook, isis_sr_route_update);
- hook_register(isis_if_new_hook, isis_sr_if_new_hook);
+ hook_register(isis_adj_state_change_hook, sr_adj_state_change);
+ hook_register(isis_adj_ip_enabled_hook, sr_adj_ip_enabled);
+ hook_register(isis_adj_ip_disabled_hook, sr_adj_ip_disabled);
+ hook_register(isis_route_update_hook, sr_route_update);
+ hook_register(isis_if_new_hook, sr_if_new_hook);
}
void isis_sr_term(void)
{
/* Unregister hooks. */
- hook_unregister(isis_adj_state_change_hook, isis_sr_adj_state_change);
- hook_unregister(isis_adj_ip_enabled_hook, isis_sr_adj_ip_enabled);
- hook_unregister(isis_adj_ip_disabled_hook, isis_sr_adj_ip_disabled);
- hook_unregister(isis_route_update_hook, isis_sr_route_update);
- hook_unregister(isis_if_new_hook, isis_sr_if_new_hook);
+ hook_unregister(isis_adj_state_change_hook, sr_adj_state_change);
+ hook_unregister(isis_adj_ip_enabled_hook, sr_adj_ip_enabled);
+ hook_unregister(isis_adj_ip_disabled_hook, sr_adj_ip_disabled);
+ hook_unregister(isis_route_update_hook, sr_route_update);
+ hook_unregister(isis_if_new_hook, sr_if_new_hook);
}