summaryrefslogtreecommitdiffstats
path: root/isisd
diff options
context:
space:
mode:
Diffstat (limited to 'isisd')
-rw-r--r--isisd/isis_adjacency.h2
-rw-r--r--isisd/isis_affinitymap.c30
-rw-r--r--isisd/isis_bpf.c3
-rw-r--r--isisd/isis_circuit.c13
-rw-r--r--isisd/isis_cli.c280
-rw-r--r--isisd/isis_lsp.c2
-rw-r--r--isisd/isis_main.c58
-rw-r--r--isisd/isis_nb_config.c144
-rw-r--r--isisd/isis_pdu.c177
-rw-r--r--isisd/isis_route.c18
-rw-r--r--isisd/isis_spf.c8
-rw-r--r--isisd/isis_sr.c3
-rw-r--r--isisd/isis_tlvs.c5
-rw-r--r--isisd/isis_zebra.c4
-rw-r--r--isisd/isisd.c31
15 files changed, 397 insertions, 381 deletions
diff --git a/isisd/isis_adjacency.h b/isisd/isis_adjacency.h
index dc18105..b5c7dd8 100644
--- a/isisd/isis_adjacency.h
+++ b/isisd/isis_adjacency.h
@@ -74,12 +74,10 @@ struct isis_adjacency {
struct nlpids nlpids; /* protocols spoken ... */
struct in_addr *ipv4_addresses;
unsigned int ipv4_address_count;
- struct in_addr router_address;
struct in6_addr *ll_ipv6_addrs; /* Link local IPv6 neighbor address */
unsigned int ll_ipv6_count;
struct in6_addr *global_ipv6_addrs; /* Global IPv6 neighbor address */
unsigned int global_ipv6_count;
- struct in6_addr router_address6;
uint8_t prio[ISIS_LEVELS]; /* priorityOfNeighbour for DIS */
int circuit_t; /* from hello PDU hdr */
int level; /* level (1 or 2) */
diff --git a/isisd/isis_affinitymap.c b/isisd/isis_affinitymap.c
index 41bad0a..595091d 100644
--- a/isisd/isis_affinitymap.c
+++ b/isisd/isis_affinitymap.c
@@ -11,35 +11,6 @@
#ifndef FABRICD
-static bool isis_affinity_map_check_use(const char *affmap_name)
-{
- struct isis *isis = isis_lookup_by_vrfid(VRF_DEFAULT);
- struct isis_area *area;
- struct listnode *area_node, *fa_node;
- struct flex_algo *fa;
- struct affinity_map *map;
- uint16_t pos;
-
- if (!isis)
- return false;
-
- map = affinity_map_get(affmap_name);
- pos = map->bit_position;
-
- for (ALL_LIST_ELEMENTS_RO(isis->area_list, area_node, area)) {
- for (ALL_LIST_ELEMENTS_RO(area->flex_algos->flex_algos, fa_node,
- fa)) {
- if (admin_group_get(&fa->admin_group_exclude_any,
- pos) ||
- admin_group_get(&fa->admin_group_include_any,
- pos) ||
- admin_group_get(&fa->admin_group_include_all, pos))
- return true;
- }
- }
- return false;
-}
-
static void isis_affinity_map_update(const char *affmap_name, uint16_t old_pos,
uint16_t new_pos)
{
@@ -90,7 +61,6 @@ void isis_affinity_map_init(void)
{
affinity_map_init();
- affinity_map_set_check_use_hook(isis_affinity_map_check_use);
affinity_map_set_update_hook(isis_affinity_map_update);
}
diff --git a/isisd/isis_bpf.c b/isisd/isis_bpf.c
index 96d6291..47f51a7 100644
--- a/isisd/isis_bpf.c
+++ b/isisd/isis_bpf.c
@@ -8,6 +8,9 @@
*/
#include <zebra.h>
+
+#include <fcntl.h>
+
#if ISIS_METHOD == ISIS_METHOD_BPF
#include <net/if.h>
#include <netinet/if_ether.h>
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index ffa6ad3..7819b20 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -489,7 +489,6 @@ static uint8_t isis_circuit_id_gen(struct isis *isis, struct interface *ifp)
void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
{
- struct listnode *node, *nnode;
struct connected *conn;
if (if_is_broadcast(ifp)) {
@@ -509,20 +508,18 @@ void isis_circuit_if_add(struct isis_circuit *circuit, struct interface *ifp)
circuit->circ_type = CIRCUIT_T_UNKNOWN;
}
- for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn))
+ frr_each (if_connected, ifp->connected, conn)
isis_circuit_add_addr(circuit, conn);
-
}
void isis_circuit_if_del(struct isis_circuit *circuit, struct interface *ifp)
{
- struct listnode *node, *nnode;
struct connected *conn;
assert(circuit->interface == ifp);
/* destroy addresses */
- for (ALL_LIST_ELEMENTS(ifp->connected, node, nnode, conn))
+ frr_each_safe (if_connected, ifp->connected, conn)
isis_circuit_del_addr(circuit, conn);
circuit->circ_type = CIRCUIT_T_UNKNOWN;
@@ -1680,6 +1677,8 @@ void isis_circuit_init(void)
#else
if_cmd_init_default();
#endif
- if_zapi_callbacks(isis_ifp_create, isis_ifp_up,
- isis_ifp_down, isis_ifp_destroy);
+ hook_register_prio(if_real, 0, isis_ifp_create);
+ hook_register_prio(if_up, 0, isis_ifp_up);
+ hook_register_prio(if_down, 0, isis_ifp_down);
+ hook_register_prio(if_unreal, 0, isis_ifp_destroy);
}
diff --git a/isisd/isis_cli.c b/isisd/isis_cli.c
index 9718a45..2b19cbb 100644
--- a/isisd/isis_cli.c
+++ b/isisd/isis_cli.c
@@ -85,13 +85,13 @@ void cli_show_router_isis(struct vty *vty, const struct lyd_node *dnode,
{
const char *vrf = NULL;
- vrf = yang_dnode_get_string(dnode, "./vrf");
+ vrf = yang_dnode_get_string(dnode, "vrf");
vty_out(vty, "!\n");
vty_out(vty, "router isis %s",
- yang_dnode_get_string(dnode, "./area-tag"));
+ yang_dnode_get_string(dnode, "area-tag"));
if (!strmatch(vrf, VRF_DEFAULT_NAME))
- vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "./vrf"));
+ vty_out(vty, " vrf %s", yang_dnode_get_string(dnode, "vrf"));
vty_out(vty, "\n");
}
@@ -172,7 +172,7 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,
* If both ipv4 and ipv6 are off delete the interface isis container.
*/
if (strmatch(ip, "ipv6")) {
- if (!yang_dnode_get_bool(dnode, "./ipv4-routing"))
+ if (!yang_dnode_get_bool(dnode, "ipv4-routing"))
nb_cli_enqueue_change(vty, "./frr-isisd:isis",
NB_OP_DESTROY, NULL);
else
@@ -180,7 +180,7 @@ DEFPY_YANG(no_ip_router_isis, no_ip_router_isis_cmd,
"./frr-isisd:isis/ipv6-routing",
NB_OP_MODIFY, "false");
} else {
- if (!yang_dnode_get_bool(dnode, "./ipv6-routing"))
+ if (!yang_dnode_get_bool(dnode, "ipv6-routing"))
nb_cli_enqueue_change(vty, "./frr-isisd:isis",
NB_OP_DESTROY, NULL);
else
@@ -280,16 +280,16 @@ void cli_show_ip_isis_bfd_monitoring(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- if (!yang_dnode_get_bool(dnode, "./enabled")) {
+ if (!yang_dnode_get_bool(dnode, "enabled")) {
if (show_defaults)
vty_out(vty, " no isis bfd\n");
} else {
vty_out(vty, " isis bfd\n");
}
- if (yang_dnode_exists(dnode, "./profile"))
+ if (yang_dnode_exists(dnode, "profile"))
vty_out(vty, " isis bfd profile %s\n",
- yang_dnode_get_string(dnode, "./profile"));
+ yang_dnode_get_string(dnode, "profile"));
}
/*
@@ -300,8 +300,12 @@ DEFPY_YANG(net, net_cmd, "[no] net WORD",
"A Network Entity Title for this process (OSI only)\n"
"XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
{
- nb_cli_enqueue_change(vty, "./area-address",
- no ? NB_OP_DESTROY : NB_OP_CREATE, net);
+ char xpath[XPATH_MAXLEN];
+
+ snprintf(xpath, XPATH_MAXLEN, "./area-address[.='%s']", net);
+
+ nb_cli_enqueue_change(vty, xpath, no ? NB_OP_DESTROY : NB_OP_CREATE,
+ NULL);
return nb_cli_apply_changes(vty, NULL);
}
@@ -588,9 +592,9 @@ void cli_show_isis_area_pwd(struct vty *vty, const struct lyd_node *dnode,
const char *snp;
vty_out(vty, " area-password %s %s",
- yang_dnode_get_string(dnode, "./password-type"),
- yang_dnode_get_string(dnode, "./password"));
- snp = yang_dnode_get_string(dnode, "./authenticate-snp");
+ yang_dnode_get_string(dnode, "password-type"),
+ yang_dnode_get_string(dnode, "password"));
+ snp = yang_dnode_get_string(dnode, "authenticate-snp");
if (!strmatch("none", snp))
vty_out(vty, " authenticate snp %s", snp);
vty_out(vty, "\n");
@@ -638,9 +642,9 @@ void cli_show_isis_domain_pwd(struct vty *vty, const struct lyd_node *dnode,
const char *snp;
vty_out(vty, " domain-password %s %s",
- yang_dnode_get_string(dnode, "./password-type"),
- yang_dnode_get_string(dnode, "./password"));
- snp = yang_dnode_get_string(dnode, "./authenticate-snp");
+ yang_dnode_get_string(dnode, "password-type"),
+ yang_dnode_get_string(dnode, "password"));
+ snp = yang_dnode_get_string(dnode, "authenticate-snp");
if (!strmatch("none", snp))
vty_out(vty, " authenticate snp %s", snp);
vty_out(vty, "\n");
@@ -861,17 +865,17 @@ void cli_show_isis_lsp_timers(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
const char *l1_refresh =
- yang_dnode_get_string(dnode, "./level-1/refresh-interval");
+ yang_dnode_get_string(dnode, "level-1/refresh-interval");
const char *l2_refresh =
- yang_dnode_get_string(dnode, "./level-2/refresh-interval");
+ yang_dnode_get_string(dnode, "level-2/refresh-interval");
const char *l1_lifetime =
- yang_dnode_get_string(dnode, "./level-1/maximum-lifetime");
+ yang_dnode_get_string(dnode, "level-1/maximum-lifetime");
const char *l2_lifetime =
- yang_dnode_get_string(dnode, "./level-2/maximum-lifetime");
+ yang_dnode_get_string(dnode, "level-2/maximum-lifetime");
const char *l1_gen =
- yang_dnode_get_string(dnode, "./level-1/generation-interval");
+ yang_dnode_get_string(dnode, "level-1/generation-interval");
const char *l2_gen =
- yang_dnode_get_string(dnode, "./level-2/generation-interval");
+ yang_dnode_get_string(dnode, "level-2/generation-interval");
if (strmatch(l1_refresh, l2_refresh)
&& strmatch(l1_lifetime, l2_lifetime) && strmatch(l1_gen, l2_gen))
vty_out(vty,
@@ -980,8 +984,8 @@ void cli_show_isis_spf_min_interval(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " spf-interval %s\n", l1);
@@ -1051,11 +1055,11 @@ void cli_show_isis_spf_ietf_backoff(struct vty *vty,
{
vty_out(vty,
" spf-delay-ietf init-delay %s short-delay %s long-delay %s holddown %s time-to-learn %s\n",
- yang_dnode_get_string(dnode, "./init-delay"),
- yang_dnode_get_string(dnode, "./short-delay"),
- yang_dnode_get_string(dnode, "./long-delay"),
- yang_dnode_get_string(dnode, "./hold-down"),
- yang_dnode_get_string(dnode, "./time-to-learn"));
+ yang_dnode_get_string(dnode, "init-delay"),
+ yang_dnode_get_string(dnode, "short-delay"),
+ yang_dnode_get_string(dnode, "long-delay"),
+ yang_dnode_get_string(dnode, "hold-down"),
+ yang_dnode_get_string(dnode, "time-to-learn"));
}
/*
@@ -1364,15 +1368,15 @@ static void vty_print_def_origin(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " default-information originate %s %s", family, level);
- if (yang_dnode_get_bool(dnode, "./always"))
+ if (yang_dnode_get_bool(dnode, "always"))
vty_out(vty, " always");
- if (yang_dnode_exists(dnode, "./route-map"))
+ if (yang_dnode_exists(dnode, "route-map"))
vty_out(vty, " route-map %s",
- yang_dnode_get_string(dnode, "./route-map"));
- if (show_defaults || !yang_dnode_is_default(dnode, "./metric"))
+ yang_dnode_get_string(dnode, "route-map"));
+ if (show_defaults || !yang_dnode_is_default(dnode, "metric"))
vty_out(vty, " metric %s",
- yang_dnode_get_string(dnode, "./metric"));
+ yang_dnode_get_string(dnode, "metric"));
vty_out(vty, "\n");
}
@@ -1381,7 +1385,7 @@ void cli_show_isis_def_origin_ipv4(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *level = yang_dnode_get_string(dnode, "./level");
+ const char *level = yang_dnode_get_string(dnode, "level");
vty_print_def_origin(vty, dnode, "ipv4", level, show_defaults);
}
@@ -1390,7 +1394,7 @@ void cli_show_isis_def_origin_ipv6(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *level = yang_dnode_get_string(dnode, "./level");
+ const char *level = yang_dnode_get_string(dnode, "level");
vty_print_def_origin(vty, dnode, "ipv6", level, show_defaults);
}
@@ -1505,22 +1509,22 @@ static void vty_print_redistribute(struct vty *vty, const struct lyd_node *dnode
if (table) {
level = yang_dnode_get_string(dnode, "../level");
- tableid = yang_dnode_get_uint16(dnode, "./table");
+ tableid = yang_dnode_get_uint16(dnode, "table");
vty_out(vty, " redistribute %s table %d ", family, tableid);
} else {
- protocol = yang_dnode_get_string(dnode, "./protocol");
+ protocol = yang_dnode_get_string(dnode, "protocol");
if (!table && strmatch(protocol, "table"))
return;
- level = yang_dnode_get_string(dnode, "./level");
+ level = yang_dnode_get_string(dnode, "level");
vty_out(vty, " redistribute %s %s ", family, protocol);
}
vty_out(vty, "%s", level);
- if (show_defaults || !yang_dnode_is_default(dnode, "./metric"))
+ if (show_defaults || !yang_dnode_is_default(dnode, "metric"))
vty_out(vty, " metric %s",
- yang_dnode_get_string(dnode, "%s", "./metric"));
+ yang_dnode_get_string(dnode, "%s", "metric"));
- if (yang_dnode_exists(dnode, "./route-map"))
- routemap = yang_dnode_get_string(dnode, "./route-map");
+ if (yang_dnode_exists(dnode, "route-map"))
+ routemap = yang_dnode_get_string(dnode, "route-map");
if (routemap)
vty_out(vty, " route-map %s", routemap);
vty_out(vty, "\n");
@@ -1557,8 +1561,8 @@ void cli_show_isis_redistribute_ipv6_table(struct vty *vty,
int cli_cmp_isis_redistribute_table(const struct lyd_node *dnode1,
const struct lyd_node *dnode2)
{
- uint16_t table1 = yang_dnode_get_uint16(dnode1, "./table");
- uint16_t table2 = yang_dnode_get_uint16(dnode2, "./table");
+ uint16_t table1 = yang_dnode_get_uint16(dnode1, "table");
+ uint16_t table2 = yang_dnode_get_uint16(dnode2, "table");
return table1 - table2;
}
@@ -1619,7 +1623,7 @@ void cli_show_isis_mt_ipv4_multicast(struct vty *vty,
bool show_defaults)
{
vty_out(vty, " topology ipv4-multicast");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1628,7 +1632,7 @@ void cli_show_isis_mt_ipv4_mgmt(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv4-mgmt");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1638,7 +1642,7 @@ void cli_show_isis_mt_ipv6_unicast(struct vty *vty,
bool show_defaults)
{
vty_out(vty, " topology ipv6-unicast");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1648,7 +1652,7 @@ void cli_show_isis_mt_ipv6_multicast(struct vty *vty,
bool show_defaults)
{
vty_out(vty, " topology ipv6-multicast");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1657,7 +1661,7 @@ void cli_show_isis_mt_ipv6_mgmt(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-mgmt");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1666,7 +1670,7 @@ void cli_show_isis_mt_ipv6_dstsrc(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " topology ipv6-dstsrc");
- if (yang_dnode_get_bool(dnode, "./overload"))
+ if (yang_dnode_get_bool(dnode, "overload"))
vty_out(vty, " overload");
vty_out(vty, "\n");
}
@@ -1771,13 +1775,13 @@ void cli_show_isis_label_blocks(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " segment-routing global-block %s %s",
- yang_dnode_get_string(dnode, "./srgb/lower-bound"),
- yang_dnode_get_string(dnode, "./srgb/upper-bound"));
- if (!yang_dnode_is_default(dnode, "./srlb/lower-bound")
- || !yang_dnode_is_default(dnode, "./srlb/upper-bound"))
+ yang_dnode_get_string(dnode, "srgb/lower-bound"),
+ yang_dnode_get_string(dnode, "srgb/upper-bound"));
+ if (!yang_dnode_is_default(dnode, "srlb/lower-bound")
+ || !yang_dnode_is_default(dnode, "srlb/upper-bound"))
vty_out(vty, " local-block %s %s",
- yang_dnode_get_string(dnode, "./srlb/lower-bound"),
- yang_dnode_get_string(dnode, "./srlb/upper-bound"));
+ yang_dnode_get_string(dnode, "srlb/lower-bound"),
+ yang_dnode_get_string(dnode, "srlb/upper-bound"));
vty_out(vty, "\n");
}
@@ -1899,11 +1903,11 @@ void cli_show_isis_prefix_sid(struct vty *vty, const struct lyd_node *dnode,
const char *sid_value;
bool n_flag_clear;
- prefix = yang_dnode_get_string(dnode, "./prefix");
- lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior");
- sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type");
- sid_value = yang_dnode_get_string(dnode, "./sid-value");
- n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear");
+ prefix = yang_dnode_get_string(dnode, "prefix");
+ lh_behavior = yang_dnode_get_string(dnode, "last-hop-behavior");
+ sid_value_type = yang_dnode_get_string(dnode, "sid-value-type");
+ sid_value = yang_dnode_get_string(dnode, "sid-value");
+ n_flag_clear = yang_dnode_get_bool(dnode, "n-flag-clear");
vty_out(vty, " segment-routing prefix %s", prefix);
if (strmatch(sid_value_type, "absolute"))
@@ -2013,12 +2017,12 @@ void cli_show_isis_prefix_sid_algorithm(struct vty *vty,
bool n_flag_clear;
uint32_t algorithm;
- prefix = yang_dnode_get_string(dnode, "./prefix");
- sid_value_type = yang_dnode_get_string(dnode, "./sid-value-type");
- sid_value = yang_dnode_get_string(dnode, "./sid-value");
- algorithm = yang_dnode_get_uint32(dnode, "./algo");
- lh_behavior = yang_dnode_get_string(dnode, "./last-hop-behavior");
- n_flag_clear = yang_dnode_get_bool(dnode, "./n-flag-clear");
+ prefix = yang_dnode_get_string(dnode, "prefix");
+ sid_value_type = yang_dnode_get_string(dnode, "sid-value-type");
+ sid_value = yang_dnode_get_string(dnode, "sid-value");
+ algorithm = yang_dnode_get_uint32(dnode, "algo");
+ lh_behavior = yang_dnode_get_string(dnode, "last-hop-behavior");
+ n_flag_clear = yang_dnode_get_bool(dnode, "n-flag-clear");
vty_out(vty, " segment-routing prefix %s", prefix);
vty_out(vty, " algorithm %u", algorithm);
@@ -2220,22 +2224,22 @@ void cli_show_isis_srv6_node_msd(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " node-msd\n");
- if (yang_dnode_get_uint8(dnode, "./max-segs-left") !=
+ if (yang_dnode_get_uint8(dnode, "max-segs-left") !=
yang_get_default_uint8("%s/msd/node-msd/max-segs-left", ISIS_SRV6))
vty_out(vty, " max-segs-left %u\n",
- yang_dnode_get_uint8(dnode, "./max-segs-left"));
- if (yang_dnode_get_uint8(dnode, "./max-end-pop") !=
+ yang_dnode_get_uint8(dnode, "max-segs-left"));
+ if (yang_dnode_get_uint8(dnode, "max-end-pop") !=
yang_get_default_uint8("%s/msd/node-msd/max-end-pop", ISIS_SRV6))
vty_out(vty, " max-end-pop %u\n",
- yang_dnode_get_uint8(dnode, "./max-end-pop"));
- if (yang_dnode_get_uint8(dnode, "./max-h-encaps") !=
+ yang_dnode_get_uint8(dnode, "max-end-pop"));
+ if (yang_dnode_get_uint8(dnode, "max-h-encaps") !=
yang_get_default_uint8("%s/msd/node-msd/max-h-encaps", ISIS_SRV6))
vty_out(vty, " max-h-encaps %u\n",
- yang_dnode_get_uint8(dnode, "./max-h-encaps"));
- if (yang_dnode_get_uint8(dnode, "./max-end-d") !=
+ yang_dnode_get_uint8(dnode, "max-h-encaps"));
+ if (yang_dnode_get_uint8(dnode, "max-end-d") !=
yang_get_default_uint8("%s/msd/node-msd/max-end-d", ISIS_SRV6))
vty_out(vty, " max-end-d %u\n",
- yang_dnode_get_uint8(dnode, "./max-end-d"));
+ yang_dnode_get_uint8(dnode, "max-end-d"));
}
/*
@@ -2381,8 +2385,8 @@ void cli_show_isis_frr_lfa_tiebreaker(struct vty *vty,
bool show_defaults)
{
vty_out(vty, " fast-reroute lfa tiebreaker %s index %s %s\n",
- yang_dnode_get_string(dnode, "./type"),
- yang_dnode_get_string(dnode, "./index"),
+ yang_dnode_get_string(dnode, "type"),
+ yang_dnode_get_string(dnode, "index"),
dnode->parent->parent->schema->name);
}
@@ -2554,8 +2558,8 @@ void cli_show_ip_isis_password(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
vty_out(vty, " isis password %s %s\n",
- yang_dnode_get_string(dnode, "./password-type"),
- yang_dnode_get_string(dnode, "./password"));
+ yang_dnode_get_string(dnode, "password-type"),
+ yang_dnode_get_string(dnode, "password"));
}
/*
@@ -2601,8 +2605,8 @@ DEFPY_YANG(no_isis_metric, no_isis_metric_cmd,
void cli_show_ip_isis_metric(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis metric %s\n", l1);
@@ -2660,8 +2664,8 @@ void cli_show_ip_isis_hello_interval(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis hello-interval %s\n", l1);
@@ -2718,8 +2722,8 @@ DEFPY_YANG(no_isis_hello_multiplier, no_isis_hello_multiplier_cmd,
void cli_show_ip_isis_hello_multi(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis hello-multiplier %s\n", l1);
@@ -2837,8 +2841,8 @@ void cli_show_ip_isis_csnp_interval(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis csnp-interval %s\n", l1);
@@ -2896,8 +2900,8 @@ void cli_show_ip_isis_psnp_interval(struct vty *vty,
const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis psnp-interval %s\n", l1);
@@ -3054,12 +3058,16 @@ void cli_show_ip_isis_circ_type(struct vty *vty, const struct lyd_node *dnode,
}
static int ag_change(struct vty *vty, int argc, struct cmd_token **argv,
- const char *xpath, bool no, int start_idx)
+ const char *xpath_base, bool no, int start_idx)
{
- for (int i = start_idx; i < argc; i++)
+ char xpath[XPATH_MAXLEN];
+
+ for (int i = start_idx; i < argc; i++) {
+ snprintf(xpath, XPATH_MAXLEN, "%s[.='%s']", xpath_base,
+ argv[i]->arg);
nb_cli_enqueue_change(vty, xpath,
- no ? NB_OP_DESTROY : NB_OP_CREATE,
- argv[i]->arg);
+ no ? NB_OP_DESTROY : NB_OP_CREATE, NULL);
+ }
return nb_cli_apply_changes(vty, NULL);
}
@@ -3140,8 +3148,8 @@ DEFPY_YANG(no_isis_priority, no_isis_priority_cmd,
void cli_show_ip_isis_priority(struct vty *vty, const struct lyd_node *dnode,
bool show_defaults)
{
- const char *l1 = yang_dnode_get_string(dnode, "./level-1");
- const char *l2 = yang_dnode_get_string(dnode, "./level-2");
+ const char *l1 = yang_dnode_get_string(dnode, "level-1");
+ const char *l2 = yang_dnode_get_string(dnode, "level-2");
if (strmatch(l1, l2))
vty_out(vty, " isis priority %s\n", l1);
@@ -3162,8 +3170,8 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
bool l1_link_fallback, l2_link_fallback;
/* Classic LFA */
- l1_enabled = yang_dnode_get_bool(dnode, "./level-1/lfa/enable");
- l2_enabled = yang_dnode_get_bool(dnode, "./level-2/lfa/enable");
+ l1_enabled = yang_dnode_get_bool(dnode, "level-1/lfa/enable");
+ l2_enabled = yang_dnode_get_bool(dnode, "level-2/lfa/enable");
if (l1_enabled || l2_enabled) {
if (l1_enabled == l2_enabled) {
@@ -3180,8 +3188,8 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
}
/* Remote LFA */
- l1_enabled = yang_dnode_get_bool(dnode, "./level-1/remote-lfa/enable");
- l2_enabled = yang_dnode_get_bool(dnode, "./level-2/remote-lfa/enable");
+ l1_enabled = yang_dnode_get_bool(dnode, "level-1/remote-lfa/enable");
+ l2_enabled = yang_dnode_get_bool(dnode, "level-2/remote-lfa/enable");
if (l1_enabled || l2_enabled) {
if (l1_enabled == l2_enabled) {
@@ -3199,16 +3207,16 @@ void cli_show_ip_isis_frr(struct vty *vty, const struct lyd_node *dnode,
}
/* TI-LFA */
- l1_enabled = yang_dnode_get_bool(dnode, "./level-1/ti-lfa/enable");
- l2_enabled = yang_dnode_get_bool(dnode, "./level-2/ti-lfa/enable");
+ l1_enabled = yang_dnode_get_bool(dnode, "level-1/ti-lfa/enable");
+ l2_enabled = yang_dnode_get_bool(dnode, "level-2/ti-lfa/enable");
l1_node_protection =
- yang_dnode_get_bool(dnode, "./level-1/ti-lfa/node-protection");
+ yang_dnode_get_bool(dnode, "level-1/ti-lfa/node-protection");
l2_node_protection =
- yang_dnode_get_bool(dnode, "./level-2/ti-lfa/node-protection");
+ yang_dnode_get_bool(dnode, "level-2/ti-lfa/node-protection");
l1_link_fallback =
- yang_dnode_get_bool(dnode, "./level-1/ti-lfa/link-fallback");
+ yang_dnode_get_bool(dnode, "level-1/ti-lfa/link-fallback");
l2_link_fallback =
- yang_dnode_get_bool(dnode, "./level-2/ti-lfa/link-fallback");
+ yang_dnode_get_bool(dnode, "level-2/ti-lfa/link-fallback");
if (l1_enabled || l2_enabled) {
@@ -3302,31 +3310,27 @@ DEFPY(isis_lfa_exclude_interface, isis_lfa_exclude_interface_cmd,
"Exclude an interface from computation\n"
"Interface name\n")
{
+ char xpath[XPATH_MAXLEN];
+
if (!level || strmatch(level, "level-1")) {
- if (no) {
- nb_cli_enqueue_change(
- vty,
- "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface",
- NB_OP_DESTROY, ifname);
- } else {
- nb_cli_enqueue_change(
- vty,
- "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface",
- NB_OP_CREATE, ifname);
- }
+ snprintf(xpath, sizeof(xpath),
+ "./frr-isisd:isis/fast-reroute/level-1/lfa/exclude-interface[.='%s']",
+ ifname);
+
+ if (no)
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
+ else
+ nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
}
if (!level || strmatch(level, "level-2")) {
- if (no) {
- nb_cli_enqueue_change(
- vty,
- "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface",
- NB_OP_DESTROY, ifname);
- } else {
- nb_cli_enqueue_change(
- vty,
- "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface",
- NB_OP_CREATE, ifname);
- }
+ snprintf(xpath, sizeof(xpath),
+ "./frr-isisd:isis/fast-reroute/level-2/lfa/exclude-interface[.='%s']",
+ ifname);
+
+ if (no)
+ nb_cli_enqueue_change(vty, xpath, NB_OP_DESTROY, NULL);
+ else
+ nb_cli_enqueue_change(vty, xpath, NB_OP_CREATE, NULL);
}
return nb_cli_apply_changes(vty, NULL);
@@ -3874,24 +3878,24 @@ void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode,
uint32_t priority;
char type_str[10];
- algorithm = yang_dnode_get_uint32(dnode, "./flex-algo");
+ algorithm = yang_dnode_get_uint32(dnode, "flex-algo");
vty_out(vty, " flex-algo %u\n", algorithm);
- if (yang_dnode_exists(dnode, "./advertise-definition"))
+ if (yang_dnode_exists(dnode, "advertise-definition"))
vty_out(vty, " advertise-definition\n");
- if (yang_dnode_exists(dnode, "./dplane-sr-mpls"))
+ if (yang_dnode_exists(dnode, "dplane-sr-mpls"))
vty_out(vty, " dataplane sr-mpls\n");
- if (yang_dnode_exists(dnode, "./dplane-srv6"))
+ if (yang_dnode_exists(dnode, "dplane-srv6"))
vty_out(vty, " dataplane srv6\n");
- if (yang_dnode_exists(dnode, "./dplane-ip"))
+ if (yang_dnode_exists(dnode, "dplane-ip"))
vty_out(vty, " dataplane ip\n");
- if (yang_dnode_exists(dnode, "./prefix-metric"))
+ if (yang_dnode_exists(dnode, "prefix-metric"))
vty_out(vty, " prefix-metric\n");
- if (yang_dnode_exists(dnode, "./metric-type")) {
- metric_type = yang_dnode_get_enum(dnode, "./metric-type");
+ if (yang_dnode_exists(dnode, "metric-type")) {
+ metric_type = yang_dnode_get_enum(dnode, "metric-type");
if (metric_type != MT_IGP) {
flex_algo_metric_type_print(type_str, sizeof(type_str),
metric_type);
@@ -3899,8 +3903,8 @@ void cli_show_isis_flex_algo(struct vty *vty, const struct lyd_node *dnode,
}
}
- if (yang_dnode_exists(dnode, "./priority")) {
- priority = yang_dnode_get_uint32(dnode, "./priority");
+ if (yang_dnode_exists(dnode, "priority")) {
+ priority = yang_dnode_get_uint32(dnode, "priority");
if (priority != FLEX_ALGO_PRIO_DEFAULT)
vty_out(vty, " priority %u\n", priority);
}
diff --git a/isisd/isis_lsp.c b/isisd/isis_lsp.c
index 1b3491f..77573cd 100644
--- a/isisd/isis_lsp.c
+++ b/isisd/isis_lsp.c
@@ -703,7 +703,7 @@ void lspid_print(uint8_t *lsp_id, char *dest, size_t dest_len, char dynhost,
else if (!memcmp(isis->sysid, lsp_id, ISIS_SYS_ID_LEN) && dynhost)
snprintf(id, sizeof(id), "%.14s", cmd_hostname_get());
else
- snprintf(id, sizeof(id), "%pSY", lsp_id);
+ snprintfrr(id, sizeof(id), "%pSY", lsp_id);
if (frag)
snprintf(dest, dest_len, "%s.%02x-%02x", id,
diff --git a/isisd/isis_main.c b/isisd/isis_main.c
index da4c7bc..60ec8cd 100644
--- a/isisd/isis_main.c
+++ b/isisd/isis_main.c
@@ -51,9 +51,16 @@
/* Default configuration file name */
#define ISISD_DEFAULT_CONFIG "isisd.conf"
-/* Default vty port */
-#define ISISD_VTY_PORT 2608
-#define FABRICD_VTY_PORT 2618
+
+#define FABRICD_STATE_NAME "%s/fabricd.json", frr_libstatedir
+#define ISISD_STATE_NAME "%s/isisd.json", frr_libstatedir
+
+/* The typo was there before. Do not fix it! The point is to load mis-saved
+ * state files from older versions.
+ *
+ * Also fabricd was using the same file. Sigh.
+ */
+#define ISISD_COMPAT_STATE_NAME "%s/isid-restart.json", frr_runstatedir
/* isisd privileges */
zebra_capabilities_t _caps_p[] = {ZCAP_NET_RAW, ZCAP_BIND, ZCAP_SYS_ADMIN};
@@ -212,24 +219,41 @@ static void isis_config_end(void)
isis_config_finish(t_isis_cfg);
}
+/* actual paths filled in main() */
+static char state_path[512];
+static char state_compat_path[512];
+static char *state_paths[] = {
+ state_path,
+ state_compat_path,
+ NULL,
+};
+
+/* clang-format off */
+FRR_DAEMON_INFO(
#ifdef FABRICD
-FRR_DAEMON_INFO(fabricd, OPEN_FABRIC, .vty_port = FABRICD_VTY_PORT,
+ fabricd, OPEN_FABRIC,
- .proghelp = "Implementation of the OpenFabric routing protocol.",
+ .vty_port = FABRICD_VTY_PORT,
+ .proghelp = "Implementation of the OpenFabric routing protocol.",
#else
-FRR_DAEMON_INFO(isisd, ISIS, .vty_port = ISISD_VTY_PORT,
+ isisd, ISIS,
- .proghelp = "Implementation of the IS-IS routing protocol.",
+ .vty_port = ISISD_VTY_PORT,
+ .proghelp = "Implementation of the IS-IS routing protocol.",
#endif
- .copyright =
- "Copyright (c) 2001-2002 Sampo Saaristo, Ofer Wald and Hannes Gredler",
+ .copyright = "Copyright (c) 2001-2002 Sampo Saaristo, Ofer Wald and Hannes Gredler",
- .signals = isisd_signals,
- .n_signals = array_size(isisd_signals),
+ .signals = isisd_signals,
+ .n_signals = array_size(isisd_signals),
- .privs = &isisd_privs, .yang_modules = isisd_yang_modules,
- .n_yang_modules = array_size(isisd_yang_modules),
+ .privs = &isisd_privs,
+
+ .yang_modules = isisd_yang_modules,
+ .n_yang_modules = array_size(isisd_yang_modules),
+
+ .state_paths = state_paths,
);
+/* clang-format on */
/*
* Main routine of isisd. Parse arguments and handle IS-IS state machine.
@@ -269,6 +293,14 @@ int main(int argc, char **argv, char **envp)
}
}
+#ifdef FABRICD
+ snprintf(state_path, sizeof(state_path), FABRICD_STATE_NAME);
+#else
+ snprintf(state_path, sizeof(state_path), ISISD_STATE_NAME);
+#endif
+ snprintf(state_compat_path, sizeof(state_compat_path),
+ ISISD_COMPAT_STATE_NAME);
+
/* thread master */
isis_master_init(frr_init());
master = im->master;
diff --git a/isisd/isis_nb_config.c b/isisd/isis_nb_config.c
index b6ee073..5794e16 100644
--- a/isisd/isis_nb_config.c
+++ b/isisd/isis_nb_config.c
@@ -60,8 +60,8 @@ int isis_instance_create(struct nb_cb_create_args *args)
if (args->event != NB_EV_APPLY)
return NB_OK;
- vrf_name = yang_dnode_get_string(args->dnode, "./vrf");
- area_tag = yang_dnode_get_string(args->dnode, "./area-tag");
+ vrf_name = yang_dnode_get_string(args->dnode, "vrf");
+ area_tag = yang_dnode_get_string(args->dnode, "area-tag");
area = isis_area_lookup_by_vrf(area_tag, vrf_name);
if (area)
@@ -650,12 +650,12 @@ int isis_instance_lsp_generation_interval_level_2_modify(
*/
void ietf_backoff_delay_apply_finish(struct nb_cb_apply_finish_args *args)
{
- long init_delay = yang_dnode_get_uint16(args->dnode, "./init-delay");
- long short_delay = yang_dnode_get_uint16(args->dnode, "./short-delay");
- long long_delay = yang_dnode_get_uint16(args->dnode, "./long-delay");
- long holddown = yang_dnode_get_uint16(args->dnode, "./hold-down");
+ long init_delay = yang_dnode_get_uint16(args->dnode, "init-delay");
+ long short_delay = yang_dnode_get_uint16(args->dnode, "short-delay");
+ long long_delay = yang_dnode_get_uint16(args->dnode, "long-delay");
+ long holddown = yang_dnode_get_uint16(args->dnode, "hold-down");
long timetolearn =
- yang_dnode_get_uint16(args->dnode, "./time-to-learn");
+ yang_dnode_get_uint16(args->dnode, "time-to-learn");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
size_t bufsiz = strlen(area->area_tag) + sizeof("IS-IS Lx");
char *buf = XCALLOC(MTYPE_TMP, bufsiz);
@@ -926,11 +926,11 @@ int isis_instance_spf_prefix_priorities_medium_access_list_name_destroy(
*/
void area_password_apply_finish(struct nb_cb_apply_finish_args *args)
{
- const char *password = yang_dnode_get_string(args->dnode, "./password");
+ const char *password = yang_dnode_get_string(args->dnode, "password");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
- int pass_type = yang_dnode_get_enum(args->dnode, "./password-type");
+ int pass_type = yang_dnode_get_enum(args->dnode, "password-type");
uint8_t snp_auth =
- yang_dnode_get_enum(args->dnode, "./authenticate-snp");
+ yang_dnode_get_enum(args->dnode, "authenticate-snp");
switch (pass_type) {
case ISIS_PASSWD_TYPE_CLEARTXT:
@@ -997,11 +997,11 @@ int isis_instance_area_password_authenticate_snp_modify(
*/
void domain_password_apply_finish(struct nb_cb_apply_finish_args *args)
{
- const char *password = yang_dnode_get_string(args->dnode, "./password");
+ const char *password = yang_dnode_get_string(args->dnode, "password");
struct isis_area *area = nb_running_get_entry(args->dnode, NULL, true);
- int pass_type = yang_dnode_get_enum(args->dnode, "./password-type");
+ int pass_type = yang_dnode_get_enum(args->dnode, "password-type");
uint8_t snp_auth =
- yang_dnode_get_enum(args->dnode, "./authenticate-snp");
+ yang_dnode_get_enum(args->dnode, "authenticate-snp");
switch (pass_type) {
case ISIS_PASSWD_TYPE_CLEARTXT:
@@ -1073,9 +1073,9 @@ void default_info_origin_apply_finish(const struct lyd_node *dnode, int family)
unsigned long metric = 0;
const char *routemap = NULL;
struct isis_area *area = nb_running_get_entry(dnode, NULL, true);
- int level = yang_dnode_get_enum(dnode, "./level");
+ int level = yang_dnode_get_enum(dnode, "level");
- if (yang_dnode_get_bool(dnode, "./always")) {
+ if (yang_dnode_get_bool(dnode, "always")) {
originate_type = DEFAULT_ORIGINATE_ALWAYS;
} else if (family == AF_INET6) {
zlog_warn(
@@ -1083,10 +1083,10 @@ void default_info_origin_apply_finish(const struct lyd_node *dnode, int family)
__func__);
}
- if (yang_dnode_exists(dnode, "./metric"))
- metric = yang_dnode_get_uint32(dnode, "./metric");
- if (yang_dnode_exists(dnode, "./route-map"))
- routemap = yang_dnode_get_string(dnode, "./route-map");
+ if (yang_dnode_exists(dnode, "metric"))
+ metric = yang_dnode_get_uint32(dnode, "metric");
+ if (yang_dnode_exists(dnode, "route-map"))
+ routemap = yang_dnode_get_string(dnode, "route-map");
isis_redist_set(area, level, family, DEFAULT_ROUTE, metric, routemap,
originate_type, 0);
@@ -1119,7 +1119,7 @@ int isis_instance_default_information_originate_ipv4_destroy(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- level = yang_dnode_get_enum(args->dnode, "./level");
+ level = yang_dnode_get_enum(args->dnode, "level");
isis_redist_unset(area, level, AF_INET, DEFAULT_ROUTE, 0);
return NB_OK;
@@ -1182,7 +1182,7 @@ int isis_instance_default_information_originate_ipv6_destroy(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- level = yang_dnode_get_enum(args->dnode, "./level");
+ level = yang_dnode_get_enum(args->dnode, "level");
isis_redist_unset(area, level, AF_INET6, DEFAULT_ROUTE, 0);
return NB_OK;
@@ -1236,14 +1236,14 @@ void redistribute_apply_finish(const struct lyd_node *dnode, int family)
const char *routemap = NULL;
struct isis_area *area;
- type = yang_dnode_get_enum(dnode, "./protocol");
- level = yang_dnode_get_enum(dnode, "./level");
+ type = yang_dnode_get_enum(dnode, "protocol");
+ level = yang_dnode_get_enum(dnode, "level");
area = nb_running_get_entry(dnode, NULL, true);
- if (yang_dnode_exists(dnode, "./metric"))
- metric = yang_dnode_get_uint32(dnode, "./metric");
- if (yang_dnode_exists(dnode, "./route-map"))
- routemap = yang_dnode_get_string(dnode, "./route-map");
+ if (yang_dnode_exists(dnode, "metric"))
+ metric = yang_dnode_get_uint32(dnode, "metric");
+ if (yang_dnode_exists(dnode, "route-map"))
+ routemap = yang_dnode_get_string(dnode, "route-map");
isis_redist_set(area, level, family, type, metric, routemap, 0, 0);
}
@@ -1273,8 +1273,8 @@ int isis_instance_redistribute_ipv4_destroy(struct nb_cb_destroy_args *args)
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- level = yang_dnode_get_enum(args->dnode, "./level");
- type = yang_dnode_get_enum(args->dnode, "./protocol");
+ level = yang_dnode_get_enum(args->dnode, "level");
+ type = yang_dnode_get_enum(args->dnode, "protocol");
isis_redist_unset(area, level, AF_INET, type, 0);
return NB_OK;
@@ -1333,12 +1333,12 @@ int isis_instance_redistribute_ipv4_table_create(struct nb_cb_create_args *args)
level = yang_dnode_get_enum(args->dnode, "../level");
area = nb_running_get_entry(args->dnode, "../.", true);
- if (yang_dnode_exists(args->dnode, "./metric"))
- metric = yang_dnode_get_uint32(args->dnode, "./metric");
- if (yang_dnode_exists(args->dnode, "./route-map"))
- routemap = yang_dnode_get_string(args->dnode, "./route-map");
+ if (yang_dnode_exists(args->dnode, "metric"))
+ metric = yang_dnode_get_uint32(args->dnode, "metric");
+ if (yang_dnode_exists(args->dnode, "route-map"))
+ routemap = yang_dnode_get_string(args->dnode, "route-map");
- table = yang_dnode_get_uint16(args->dnode, "./table");
+ table = yang_dnode_get_uint16(args->dnode, "table");
isis_redist_set(area, level, AF_INET, type, metric, routemap, 0, table);
return NB_OK;
@@ -1355,7 +1355,7 @@ int isis_instance_redistribute_ipv4_table_destroy(struct nb_cb_destroy_args *arg
area = nb_running_get_entry(args->dnode, "../.", true);
level = yang_dnode_get_enum(args->dnode, "../level");
type = yang_dnode_get_enum(args->dnode, "../protocol");
- table = yang_dnode_get_uint16(args->dnode, "./table");
+ table = yang_dnode_get_uint16(args->dnode, "table");
isis_redist_unset(area, level, AF_INET, type, table);
return NB_OK;
@@ -1379,8 +1379,8 @@ int isis_instance_redistribute_ipv6_destroy(struct nb_cb_destroy_args *args)
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- level = yang_dnode_get_enum(args->dnode, "./level");
- type = yang_dnode_get_enum(args->dnode, "./protocol");
+ level = yang_dnode_get_enum(args->dnode, "level");
+ type = yang_dnode_get_enum(args->dnode, "protocol");
isis_redist_unset(area, level, AF_INET6, type, 0);
return NB_OK;
@@ -1732,8 +1732,8 @@ int isis_instance_fast_reroute_level_1_lfa_tiebreaker_create(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- index = yang_dnode_get_uint8(args->dnode, "./index");
- type = yang_dnode_get_enum(args->dnode, "./type");
+ index = yang_dnode_get_uint8(args->dnode, "index");
+ type = yang_dnode_get_enum(args->dnode, "type");
tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL1, index, type);
nb_running_set_entry(args->dnode, tie_b);
@@ -1881,8 +1881,8 @@ int isis_instance_fast_reroute_level_2_lfa_tiebreaker_create(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- index = yang_dnode_get_uint8(args->dnode, "./index");
- type = yang_dnode_get_enum(args->dnode, "./type");
+ index = yang_dnode_get_uint8(args->dnode, "index");
+ type = yang_dnode_get_enum(args->dnode, "type");
tie_b = isis_lfa_tiebreaker_add(area, ISIS_LEVEL2, index, type);
nb_running_set_entry(args->dnode, tie_b);
@@ -2212,10 +2212,10 @@ int isis_instance_segment_routing_label_blocks_pre_validate(
uint32_t srlb_lbound;
uint32_t srlb_ubound;
- srgb_lbound = yang_dnode_get_uint32(args->dnode, "./srgb/lower-bound");
- srgb_ubound = yang_dnode_get_uint32(args->dnode, "./srgb/upper-bound");
- srlb_lbound = yang_dnode_get_uint32(args->dnode, "./srlb/lower-bound");
- srlb_ubound = yang_dnode_get_uint32(args->dnode, "./srlb/upper-bound");
+ srgb_lbound = yang_dnode_get_uint32(args->dnode, "srgb/lower-bound");
+ srgb_ubound = yang_dnode_get_uint32(args->dnode, "srgb/upper-bound");
+ srlb_lbound = yang_dnode_get_uint32(args->dnode, "srlb/lower-bound");
+ srlb_ubound = yang_dnode_get_uint32(args->dnode, "srlb/upper-bound");
/* Check that the block size does not exceed 65535 */
if ((srgb_ubound - srgb_lbound + 1) > 65535) {
@@ -2255,8 +2255,8 @@ void isis_instance_segment_routing_srgb_apply_finish(
uint32_t lower_bound, upper_bound;
area = nb_running_get_entry(args->dnode, NULL, true);
- lower_bound = yang_dnode_get_uint32(args->dnode, "./lower-bound");
- upper_bound = yang_dnode_get_uint32(args->dnode, "./upper-bound");
+ lower_bound = yang_dnode_get_uint32(args->dnode, "lower-bound");
+ upper_bound = yang_dnode_get_uint32(args->dnode, "upper-bound");
isis_sr_cfg_srgb_update(area, lower_bound, upper_bound);
}
@@ -2321,8 +2321,8 @@ void isis_instance_segment_routing_srlb_apply_finish(
uint32_t lower_bound, upper_bound;
area = nb_running_get_entry(args->dnode, NULL, true);
- lower_bound = yang_dnode_get_uint32(args->dnode, "./lower-bound");
- upper_bound = yang_dnode_get_uint32(args->dnode, "./upper-bound");
+ lower_bound = yang_dnode_get_uint32(args->dnode, "lower-bound");
+ upper_bound = yang_dnode_get_uint32(args->dnode, "upper-bound");
isis_sr_cfg_srlb_update(area, lower_bound, upper_bound);
}
@@ -2428,7 +2428,7 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_create(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
pcfg = isis_sr_cfg_prefix_add(area, &prefix, SR_ALGORITHM_SPF);
nb_running_set_entry(args->dnode, pcfg);
@@ -2466,13 +2466,13 @@ int isis_instance_segment_routing_prefix_sid_map_prefix_sid_pre_validate(
enum sr_sid_value_type sid_type;
struct isis_prefix_sid psid = {};
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
srgb_lbound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/lower-bound");
srgb_ubound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/upper-bound");
- sid = yang_dnode_get_uint32(args->dnode, "./sid-value");
- sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type");
+ sid = yang_dnode_get_uint32(args->dnode, "sid-value");
+ sid_type = yang_dnode_get_enum(args->dnode, "sid-value-type");
/* Check for invalid indexes/labels. */
srgb_range = srgb_ubound - srgb_lbound + 1;
@@ -2636,8 +2636,8 @@ int isis_instance_segment_routing_algorithm_prefix_sid_create(
return NB_OK;
area = nb_running_get_entry(args->dnode, NULL, true);
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
- algorithm = yang_dnode_get_uint32(args->dnode, "./algo");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
+ algorithm = yang_dnode_get_uint32(args->dnode, "algo");
pcfg = isis_sr_cfg_prefix_add(area, &prefix, algorithm);
pcfg->algorithm = algorithm;
@@ -2676,13 +2676,13 @@ int isis_instance_segment_routing_algorithm_prefix_sid_pre_validate(
enum sr_sid_value_type sid_type;
struct isis_prefix_sid psid = {};
- yang_dnode_get_prefix(&prefix, args->dnode, "./prefix");
+ yang_dnode_get_prefix(&prefix, args->dnode, "prefix");
srgb_lbound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/lower-bound");
srgb_ubound = yang_dnode_get_uint32(
args->dnode, "../../label-blocks/srgb/upper-bound");
- sid = yang_dnode_get_uint32(args->dnode, "./sid-value");
- sid_type = yang_dnode_get_enum(args->dnode, "./sid-value-type");
+ sid = yang_dnode_get_uint32(args->dnode, "sid-value");
+ sid_type = yang_dnode_get_enum(args->dnode, "sid-value-type");
/* Check for invalid indexes/labels. */
srgb_range = srgb_ubound - srgb_lbound + 1;
@@ -2840,8 +2840,8 @@ int isis_instance_flex_algo_create(struct nb_cb_create_args *args)
uint32_t priority = FLEX_ALGO_PRIO_DEFAULT;
struct isis_flex_algo_alloc_arg arg;
- algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo");
- advertise = yang_dnode_exists(args->dnode, "./advertise-definition");
+ algorithm = yang_dnode_get_uint32(args->dnode, "flex-algo");
+ advertise = yang_dnode_exists(args->dnode, "advertise-definition");
switch (args->event) {
case NB_EV_APPLY:
@@ -2875,7 +2875,7 @@ int isis_instance_flex_algo_destroy(struct nb_cb_destroy_args *args)
struct isis_area *area;
uint32_t algorithm;
- algorithm = yang_dnode_get_uint32(args->dnode, "./flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "flex-algo");
area = nb_running_get_entry(args->dnode, NULL, true);
switch (args->event) {
@@ -2904,8 +2904,8 @@ int isis_instance_flex_algo_advertise_definition_modify(
uint32_t algorithm;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
- advertise = yang_dnode_exists(args->dnode, "./../advertise-definition");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
+ advertise = yang_dnode_exists(args->dnode, "../advertise-definition");
switch (args->event) {
case NB_EV_APPLY:
@@ -2937,7 +2937,7 @@ int isis_instance_flex_algo_advertise_definition_destroy(
area = nb_running_get_entry(args->dnode, NULL, true);
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) {
case NB_EV_APPLY:
@@ -3153,7 +3153,7 @@ int isis_instance_flex_algo_prefix_metric_create(struct nb_cb_create_args *args)
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) {
case NB_EV_APPLY:
@@ -3188,7 +3188,7 @@ int isis_instance_flex_algo_prefix_metric_destroy(
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) {
case NB_EV_APPLY:
@@ -3223,7 +3223,7 @@ static int isis_instance_flex_algo_dplane_set(struct nb_cb_create_args *args,
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) {
case NB_EV_APPLY:
@@ -3265,7 +3265,7 @@ static int isis_instance_flex_algo_dplane_unset(struct nb_cb_destroy_args *args,
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
switch (args->event) {
case NB_EV_APPLY:
@@ -3348,7 +3348,7 @@ int isis_instance_flex_algo_metric_type_modify(struct nb_cb_modify_args *args)
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
metric_type = yang_dnode_get_enum(args->dnode, NULL);
switch (args->event) {
@@ -3388,7 +3388,7 @@ int isis_instance_flex_algo_priority_modify(struct nb_cb_modify_args *args)
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
priority = yang_dnode_get_uint32(args->dnode, NULL);
switch (args->event) {
@@ -3424,7 +3424,7 @@ int isis_instance_flex_algo_priority_destroy(struct nb_cb_destroy_args *args)
if (!area)
return NB_ERR_RESOURCE;
- algorithm = yang_dnode_get_uint32(args->dnode, "./../flex-algo");
+ algorithm = yang_dnode_get_uint32(args->dnode, "../flex-algo");
priority = yang_dnode_get_uint32(args->dnode, NULL);
switch (args->event) {
@@ -3754,7 +3754,7 @@ int lib_interface_isis_create(struct nb_cb_create_args *args)
{
struct interface *ifp;
struct isis_circuit *circuit = NULL;
- const char *area_tag = yang_dnode_get_string(args->dnode, "./area-tag");
+ const char *area_tag = yang_dnode_get_string(args->dnode, "area-tag");
switch (args->event) {
case NB_EV_PREPARE:
diff --git a/isisd/isis_pdu.c b/isisd/isis_pdu.c
index 0cd43a7..6f410d3 100644
--- a/isisd/isis_pdu.c
+++ b/isisd/isis_pdu.c
@@ -111,6 +111,7 @@ struct iih_info {
bool v6_usable;
struct isis_tlvs *tlvs;
+ int calculated_type;
};
static int process_p2p_hello(struct iih_info *iih)
@@ -151,6 +152,76 @@ static int process_p2p_hello(struct iih_info *iih)
struct isis_adjacency *adj = iih->circuit->u.p2p.neighbor;
/* If an adjacency exists, check it is with the source of the hello
* packets */
+ if (((iih->circuit->area->is_type == IS_LEVEL_1) &&
+ ((iih->circuit->is_type_config == IS_LEVEL_1_AND_2) ||
+ (iih->circuit->is_type_config == IS_LEVEL_1))) ||
+ ((iih->circuit->area->is_type == IS_LEVEL_1_AND_2) &&
+ (iih->circuit->is_type_config == IS_LEVEL_1) &&
+ ((iih->circ_type == IS_LEVEL_1) ||
+ (iih->circ_type == IS_LEVEL_1_AND_2))) ||
+ ((iih->circuit->area->is_type == IS_LEVEL_1_AND_2) &&
+ (iih->circuit->is_type_config == IS_LEVEL_1_AND_2) &&
+ (iih->circ_type == IS_LEVEL_1))) {
+ if (!isis_tlvs_area_addresses_match(iih->tlvs,
+ iih->circuit->area
+ ->area_addrs)) {
+ if (IS_DEBUG_ADJ_PACKETS) {
+ zlog_debug("ISIS-Adj (%s): Rcvd P2P IIH from (%s), cir type %s, cir id %u, length %u",
+ iih->circuit->area->area_tag,
+ iih->circuit->interface->name,
+ circuit_t2string(
+ iih->circuit->is_type),
+ iih->circuit->circuit_id,
+ iih->pdu_len);
+ }
+
+ return ISIS_WARNING;
+ }
+
+ iih->calculated_type = IS_LEVEL_1;
+
+ }
+
+ else if (((iih->circuit->area->is_type == IS_LEVEL_2) &&
+ ((iih->circuit->is_type_config == IS_LEVEL_1_AND_2) ||
+ (iih->circuit->is_type_config == IS_LEVEL_2))) ||
+ ((iih->circuit->area->is_type == IS_LEVEL_1_AND_2) &&
+ (iih->circuit->is_type_config == IS_LEVEL_2) &&
+ ((iih->circ_type == IS_LEVEL_2) ||
+ (iih->circ_type == IS_LEVEL_1_AND_2))) ||
+ ((iih->circuit->area->is_type == IS_LEVEL_1_AND_2) &&
+ (iih->circuit->is_type_config == IS_LEVEL_1_AND_2) &&
+ (iih->circ_type == IS_LEVEL_2))) {
+ iih->calculated_type = IS_LEVEL_2;
+ }
+
+ else if ((iih->circuit->area->is_type == IS_LEVEL_1_AND_2) &&
+ (iih->circuit->is_type_config == IS_LEVEL_1_AND_2) &&
+ (iih->circ_type == IS_LEVEL_1_AND_2)) {
+ iih->calculated_type = IS_LEVEL_1_AND_2;
+
+ if (!isis_tlvs_area_addresses_match(iih->tlvs,
+ iih->circuit->area
+ ->area_addrs)) {
+ iih->calculated_type = IS_LEVEL_2;
+ }
+ }
+
+ else {
+ if (IS_DEBUG_ADJ_PACKETS) {
+ if (IS_DEBUG_ADJ_PACKETS) {
+ zlog_debug("ISIS-Adj (%s): Rcvd P2P IIH from (%s), cir type %s, cir id %u, length %u",
+ iih->circuit->area->area_tag,
+ iih->circuit->interface->name,
+ circuit_t2string(
+ iih->circuit->is_type),
+ iih->circuit->circuit_id,
+ iih->pdu_len);
+ }
+ }
+ return ISIS_WARNING;
+ }
+
if (adj) {
if (memcmp(iih->sys_id, adj->sysid, ISIS_SYS_ID_LEN)) {
zlog_debug(
@@ -160,12 +231,13 @@ static int process_p2p_hello(struct iih_info *iih)
return ISIS_OK;
}
}
- if (!adj || adj->level != iih->circ_type) {
+ if (!adj || adj->level != iih->calculated_type) {
if (!adj) {
- adj = isis_new_adj(iih->sys_id, NULL, iih->circ_type,
- iih->circuit);
+ adj = isis_new_adj(iih->sys_id, NULL,
+ iih->calculated_type, iih->circuit);
+
} else {
- adj->level = iih->circ_type;
+ adj->level = iih->calculated_type;
}
iih->circuit->u.p2p.neighbor = adj;
/* Build lsp with the new neighbor entry when a new
@@ -174,7 +246,7 @@ static int process_p2p_hello(struct iih_info *iih)
* when an adjacency is up. This will result in the new
* adjacency entry getting added to the lsp tlv neighbor list.
*/
- adj->circuit_t = iih->circ_type;
+ adj->circuit_t = iih->calculated_type;
isis_adj_state_change(&adj, ISIS_ADJ_INITIALIZING, NULL);
adj->sys_type = ISIS_SYSTYPE_UNKNOWN;
}
@@ -205,45 +277,35 @@ static int process_p2p_hello(struct iih_info *iih)
/* 8.2.5.2 a) a match was detected */
if (isis_tlvs_area_addresses_match(iih->tlvs,
iih->circuit->area->area_addrs)) {
- /* 8.2.5.2 a) 2) If the system is L1 - table 5 */
- if (iih->circuit->area->is_type == IS_LEVEL_1) {
+ /* 8.2.5.2 a) 2) If the calculated type is L1 - table 5 */
+ if (iih->calculated_type == IS_LEVEL_1) {
switch (iih->circ_type) {
case IS_LEVEL_1:
+ isis_adj_process_threeway(adj, tw_adj,
+ iih->calculated_type);
+ break;
case IS_LEVEL_1_AND_2:
- if (adj->adj_state != ISIS_ADJ_UP
- || adj->adj_usage == ISIS_ADJ_LEVEL1) {
+ if ((adj->adj_state != ISIS_ADJ_UP) ||
+ (adj->adj_usage == ISIS_ADJ_LEVEL1) ||
+ (adj->adj_usage == ISIS_ADJ_LEVEL1AND2)) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL1);
- }
- break;
- case IS_LEVEL_2:
- if (adj->adj_state != ISIS_ADJ_UP) {
- /* (7) reject - wrong system type event
- */
- zlog_warn("wrongSystemType");
- return ISIS_WARNING;
- } else if (adj->adj_usage == ISIS_ADJ_LEVEL1) {
- /* (6) down - wrong system */
- isis_adj_state_change(&adj,
- ISIS_ADJ_DOWN,
- "Wrong System");
+ iih->calculated_type);
}
break;
}
}
- /* 8.2.5.2 a) 3) If the system is L1L2 - table 6 */
- if (iih->circuit->area->is_type == IS_LEVEL_1_AND_2) {
+ /* 8.2.5.2 a) 3) If the calculated type is L1L2 - table 6 */
+ if (iih->calculated_type == IS_LEVEL_1_AND_2) {
switch (iih->circ_type) {
case IS_LEVEL_1:
if (adj->adj_state != ISIS_ADJ_UP
|| adj->adj_usage == ISIS_ADJ_LEVEL1) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL1);
- } else if ((adj->adj_usage
- == ISIS_ADJ_LEVEL1AND2)
- || (adj->adj_usage
- == ISIS_ADJ_LEVEL2)) {
+ iih->calculated_type);
+ } else if ((adj->adj_usage == ISIS_ADJ_LEVEL2) ||
+ (adj->adj_usage ==
+ ISIS_ADJ_LEVEL1AND2)) {
/* (8) down - wrong system */
isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
@@ -254,10 +316,10 @@ static int process_p2p_hello(struct iih_info *iih)
if (adj->adj_state != ISIS_ADJ_UP
|| adj->adj_usage == ISIS_ADJ_LEVEL2) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL2);
- } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1)
- || (adj->adj_usage
- == ISIS_ADJ_LEVEL1AND2)) {
+ iih->calculated_type);
+ } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) ||
+ (adj->adj_usage ==
+ ISIS_ADJ_LEVEL1AND2)) {
/* (8) down - wrong system */
isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
@@ -268,10 +330,9 @@ static int process_p2p_hello(struct iih_info *iih)
if (adj->adj_state != ISIS_ADJ_UP
|| adj->adj_usage == ISIS_ADJ_LEVEL1AND2) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL1AND2);
- } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1)
- || (adj->adj_usage
- == ISIS_ADJ_LEVEL2)) {
+ iih->calculated_type);
+ } else if ((adj->adj_usage == ISIS_ADJ_LEVEL1) ||
+ (adj->adj_usage == ISIS_ADJ_LEVEL2)) {
/* (8) down - wrong system */
isis_adj_state_change(&adj,
ISIS_ADJ_DOWN,
@@ -282,44 +343,26 @@ static int process_p2p_hello(struct iih_info *iih)
}
/* 8.2.5.2 a) 4) If the system is L2 - table 7 */
- if (iih->circuit->area->is_type == IS_LEVEL_2) {
+ if (iih->calculated_type == IS_LEVEL_2) {
switch (iih->circ_type) {
- case IS_LEVEL_1:
- if (adj->adj_state != ISIS_ADJ_UP) {
- /* (5) reject - wrong system type event
- */
- zlog_warn("wrongSystemType");
- return ISIS_WARNING;
- } else if ((adj->adj_usage
- == ISIS_ADJ_LEVEL1AND2)
- || (adj->adj_usage
- == ISIS_ADJ_LEVEL2)) {
- /* (6) down - wrong system */
- isis_adj_state_change(&adj,
- ISIS_ADJ_DOWN,
- "Wrong System");
- }
- break;
case IS_LEVEL_1_AND_2:
- case IS_LEVEL_2:
- if (adj->adj_state != ISIS_ADJ_UP
- || adj->adj_usage == ISIS_ADJ_LEVEL2) {
+ if (adj->adj_state != ISIS_ADJ_UP ||
+ adj->adj_usage == ISIS_ADJ_LEVEL2 ||
+ adj->adj_usage == ISIS_ADJ_LEVEL1AND2) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL2);
- } else if (adj->adj_usage
- == ISIS_ADJ_LEVEL1AND2) {
- /* (6) down - wrong system */
- isis_adj_state_change(&adj,
- ISIS_ADJ_DOWN,
- "Wrong System");
+ iih->calculated_type);
}
break;
+ case IS_LEVEL_2:
+ isis_adj_process_threeway(adj, tw_adj,
+ iih->calculated_type);
+ break;
}
}
}
/* 8.2.5.2 b) if no match was detected */
else if (listcount(iih->circuit->area->area_addrs) > 0) {
- if (iih->circuit->area->is_type == IS_LEVEL_1) {
+ if (iih->calculated_type == IS_LEVEL_1) {
/* 8.2.5.2 b) 1) is_type L1 and adj is not up */
if (adj->adj_state != ISIS_ADJ_UP) {
isis_adj_state_change(&adj, ISIS_ADJ_DOWN,
@@ -359,7 +402,7 @@ static int process_p2p_hello(struct iih_info *iih)
if (adj->adj_state != ISIS_ADJ_UP
|| adj->adj_usage == ISIS_ADJ_LEVEL2) {
isis_adj_process_threeway(adj, tw_adj,
- ISIS_ADJ_LEVEL2);
+ iih->calculated_type);
} else if (adj->adj_usage == ISIS_ADJ_LEVEL1) {
/* (7) down - wrong system */
isis_adj_state_change(&adj,
diff --git a/isisd/isis_route.c b/isisd/isis_route.c
index be92dcc..b907c96 100644
--- a/isisd/isis_route.c
+++ b/isisd/isis_route.c
@@ -260,24 +260,6 @@ isis_route_info_new(struct prefix *prefix, struct prefix_ipv6 *src_p,
ISIS_CIRCUIT_FLAPPED_AFTER_SPF))
SET_FLAG(rinfo->flag, ISIS_ROUTE_FLAG_ZEBRA_RESYNC);
- /* update neighbor router address */
- switch (prefix->family) {
- case AF_INET:
- if (depth == 2 && prefix->prefixlen == IPV4_MAX_BITLEN)
- adj->router_address = prefix->u.prefix4;
- break;
- case AF_INET6:
- if (depth == 2 && prefix->prefixlen == IPV6_MAX_BITLEN
- && (!src_p || !src_p->prefixlen)) {
- adj->router_address6 = prefix->u.prefix6;
- }
- break;
- default:
- flog_err(EC_LIB_DEVELOPMENT,
- "%s: unknown address family [%d]", __func__,
- prefix->family);
- exit(1);
- }
adjinfo2nexthop(prefix->family, rinfo->nexthops, adj, sr,
label_stack);
if (!allow_ecmp)
diff --git a/isisd/isis_spf.c b/isisd/isis_spf.c
index a2230cd..7a4b45a 100644
--- a/isisd/isis_spf.c
+++ b/isisd/isis_spf.c
@@ -378,6 +378,8 @@ isis_spftree_new(struct isis_area *area, struct lspdb_head *lspdb,
static void _isis_spftree_del(struct isis_spftree *spftree)
{
+ void *info, *backup_info;
+
hash_clean_and_free(&spftree->prefix_sids, NULL);
isis_zebra_rlfa_unregister_all(spftree);
isis_rlfa_list_clear(spftree);
@@ -391,10 +393,12 @@ static void _isis_spftree_del(struct isis_spftree *spftree)
list_delete(&spftree->sadj_list);
isis_vertex_queue_free(&spftree->tents);
isis_vertex_queue_free(&spftree->paths);
- isis_route_table_info_free(spftree->route_table->info);
- isis_route_table_info_free(spftree->route_table_backup->info);
+ info = spftree->route_table->info;
+ backup_info = spftree->route_table_backup->info;
route_table_finish(spftree->route_table);
route_table_finish(spftree->route_table_backup);
+ isis_route_table_info_free(info);
+ isis_route_table_info_free(backup_info);
}
void isis_spftree_del(struct isis_spftree *spftree)
diff --git a/isisd/isis_sr.c b/isisd/isis_sr.c
index 76cde6d..1d69dbb 100644
--- a/isisd/isis_sr.c
+++ b/isisd/isis_sr.c
@@ -936,7 +936,6 @@ int sr_if_addr_update(struct interface *ifp)
struct isis_circuit *circuit;
struct isis_area *area;
struct connected *connected;
- struct listnode *node;
bool need_lsp_regenerate = false;
/* Get corresponding circuit */
@@ -948,7 +947,7 @@ int sr_if_addr_update(struct interface *ifp)
if (!area)
return 0;
- FOR_ALL_INTERFACES_ADDRESSES (ifp, connected, node) {
+ frr_each (if_connected, ifp->connected, connected) {
for (int i = 0; i < SR_ALGORITHM_COUNT; i++) {
pcfgs[i] = isis_sr_cfg_prefix_find(
area, connected->address, i);
diff --git a/isisd/isis_tlvs.c b/isisd/isis_tlvs.c
index ecf43fa..2b0a58b 100644
--- a/isisd/isis_tlvs.c
+++ b/isisd/isis_tlvs.c
@@ -13,6 +13,11 @@
#include <zebra.h>
#include <json-c/json_object.h>
+#ifdef CRYPTO_OPENSSL
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#endif
+
#ifdef CRYPTO_INTERNAL
#include "md5.h"
#endif
diff --git a/isisd/isis_zebra.c b/isisd/isis_zebra.c
index 8252c1a..18a0c49 100644
--- a/isisd/isis_zebra.c
+++ b/isisd/isis_zebra.c
@@ -1395,9 +1395,7 @@ void isis_zebra_init(struct event_loop *master, int instance)
zclient->zebra_connected = isis_zebra_connected;
/* Initialize special zclient for synchronous message exchanges. */
- struct zclient_options options = zclient_options_default;
- options.synchronous = true;
- zclient_sync = zclient_new(master, &options, NULL, 0);
+ zclient_sync = zclient_new(master, &zclient_options_sync, NULL, 0);
zclient_sync->sock = -1;
zclient_sync->redist_default = ZEBRA_ROUTE_ISIS;
zclient_sync->instance = instance;
diff --git a/isisd/isisd.c b/isisd/isisd.c
index b1064d8..772eb97 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -3346,35 +3346,19 @@ void isis_area_advertise_high_metrics_set(struct isis_area *area,
}
/*
- * Returns the path of the file (non-volatile memory) that contains restart
- * information.
- */
-char *isis_restart_filepath(void)
-{
- static char filepath[MAXPATHLEN];
- snprintf(filepath, sizeof(filepath), ISISD_RESTART, "");
- return filepath;
-}
-
-/*
* Record in non-volatile memory the overload on startup time.
*/
void isis_restart_write_overload_time(struct isis_area *isis_area,
uint32_t overload_time)
{
- char *filepath;
const char *area_name;
json_object *json;
json_object *json_areas;
json_object *json_area;
- filepath = isis_restart_filepath();
+ json = frr_daemon_state_load();
area_name = isis_area->area_tag;
- json = json_object_from_file(filepath);
- if (json == NULL)
- json = json_object_new_object();
-
json_object_object_get_ex(json, "areas", &json_areas);
if (!json_areas) {
json_areas = json_object_new_object();
@@ -3389,8 +3373,8 @@ void isis_restart_write_overload_time(struct isis_area *isis_area,
json_object_int_add(json_area, "overload_time",
isis_area->overload_on_startup_time);
- json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+
+ frr_daemon_state_save(&json);
}
/*
@@ -3398,7 +3382,6 @@ void isis_restart_write_overload_time(struct isis_area *isis_area,
*/
uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
{
- char *filepath;
const char *area_name;
json_object *json;
json_object *json_areas;
@@ -3406,12 +3389,9 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
json_object *json_overload_time;
uint32_t overload_time = 0;
- filepath = isis_restart_filepath();
area_name = isis_area->area_tag;
- json = json_object_from_file(filepath);
- if (json == NULL)
- json = json_object_new_object();
+ json = frr_daemon_state_load();
json_object_object_get_ex(json, "areas", &json_areas);
if (!json_areas) {
@@ -3433,8 +3413,7 @@ uint32_t isis_restart_read_overload_time(struct isis_area *isis_area)
json_object_object_del(json_areas, area_name);
- json_object_to_file_ext(filepath, json, JSON_C_TO_STRING_PRETTY);
- json_object_free(json);
+ frr_daemon_state_save(&json);
return overload_time;
}