summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2016-09-26 18:36:13 +0200
committerDonald Sharp <sharpd@cumulusnetworks.com>2016-10-07 09:09:52 -0400
commit8ff5a39992b1b8ef53f40b0c49970af4cee07974 (patch)
tree545232cef958f25b3a5e6e181e2aeebec05179c5
parent6a098b3aa757252c803a1c8017c9eefc578321e7 (diff)
isisd: use qobj for vty->index context position
This converts all uses of vty->index over to qobj. With this, isisd now supports concurrent configuration editing as there are no more unsafe references held anywhere while in config-edit mode. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--isisd/isis_redist.c9
-rw-r--r--isisd/isis_routemap.c42
-rw-r--r--isisd/isis_vty.c136
-rw-r--r--isisd/isisd.c42
4 files changed, 67 insertions, 162 deletions
diff --git a/isisd/isis_redist.c b/isisd/isis_redist.c
index 1ce6a925e7..21daaa7794 100644
--- a/isisd/isis_redist.c
+++ b/isisd/isis_redist.c
@@ -553,7 +553,7 @@ DEFUN (isis_redistribute,
"Route map reference\n"
"Pointer to route-map entries\n")
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int family;
int afi;
int type;
@@ -619,7 +619,7 @@ DEFUN (no_isis_redistribute,
"Redistribute into level-1\n"
"Redistribute into level-2\n")
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int type;
int level;
int family;
@@ -667,7 +667,7 @@ DEFUN (isis_default_originate,
"Route map reference\n"
"Pointer to route-map entries\n")
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int family;
int originate_type;
int level;
@@ -734,8 +734,7 @@ DEFUN (no_isis_default_originate,
"Distribute default route into level-1\n"
"Distribute default route into level-2\n")
{
- struct isis_area *area = vty->index;
-
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int family;
int level;
diff --git a/isisd/isis_routemap.c b/isisd/isis_routemap.c
index fdc0100e77..2bed5d65d2 100644
--- a/isisd/isis_routemap.c
+++ b/isisd/isis_routemap.c
@@ -253,9 +253,10 @@ static struct route_map_rule_cmd route_set_metric_cmd =
/* ------------------------------------------------------------*/
static int
-isis_route_match_add(struct vty *vty, struct route_map_index *index,
+isis_route_match_add(struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_add_match (index, command, arg);
@@ -275,9 +276,10 @@ isis_route_match_add(struct vty *vty, struct route_map_index *index,
}
static int
-isis_route_match_delete(struct vty *vty, struct route_map_index *index,
+isis_route_match_delete(struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_delete_match (index, command, arg);
@@ -297,9 +299,10 @@ isis_route_match_delete(struct vty *vty, struct route_map_index *index,
}
static int
-isis_route_set_add(struct vty *vty, struct route_map_index *index,
+isis_route_set_add(struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_add_set(index, command, arg);
@@ -320,9 +323,10 @@ isis_route_set_add(struct vty *vty, struct route_map_index *index,
}
static int
-isis_route_set_delete (struct vty *vty, struct route_map_index *index,
+isis_route_set_delete (struct vty *vty,
const char *command, const char *arg)
{
+ VTY_DECLVAR_CONTEXT (route_map_index, index);
int ret;
ret = route_map_delete_set (index, command, arg);
@@ -354,7 +358,7 @@ DEFUN (match_ip_address,
"IP access-list number (expanded range)\n"
"IP Access-list name\n")
{
- return isis_route_match_add(vty, vty->index, "ip address", argv[0]);
+ return isis_route_match_add(vty, "ip address", argv[0]);
}
DEFUN (no_match_ip_address,
@@ -369,8 +373,8 @@ DEFUN (no_match_ip_address,
"IP Access-list name\n")
{
if (argc == 0)
- return isis_route_match_delete(vty, vty->index, "ip address", NULL);
- return isis_route_match_delete(vty, vty->index, "ip address", argv[0]);
+ return isis_route_match_delete(vty, "ip address", NULL);
+ return isis_route_match_delete(vty, "ip address", argv[0]);
}
ALIAS (no_match_ip_address,
@@ -392,7 +396,7 @@ DEFUN (match_ip_address_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
- return isis_route_match_add(vty, vty->index, "ip address prefix-list", argv[0]);
+ return isis_route_match_add(vty, "ip address prefix-list", argv[0]);
}
DEFUN (no_match_ip_address_prefix_list,
@@ -405,8 +409,8 @@ DEFUN (no_match_ip_address_prefix_list,
"Match entries of prefix-lists\n")
{
if (argc == 0)
- return isis_route_match_delete (vty, vty->index, "ip address prefix-list", NULL);
- return isis_route_match_delete (vty, vty->index, "ip address prefix-list", argv[0]);
+ return isis_route_match_delete (vty, "ip address prefix-list", NULL);
+ return isis_route_match_delete (vty, "ip address prefix-list", argv[0]);
}
ALIAS (no_match_ip_address_prefix_list,
@@ -429,7 +433,7 @@ DEFUN (match_ipv6_address,
"Match IPv6 address of route\n"
"IPv6 access-list name\n")
{
- return isis_route_match_add(vty, vty->index, "ipv6 address", argv[0]);
+ return isis_route_match_add(vty, "ipv6 address", argv[0]);
}
DEFUN (no_match_ipv6_address,
@@ -442,8 +446,8 @@ DEFUN (no_match_ipv6_address,
"IPv6 access-list name\n")
{
if (argc == 0)
- return isis_route_match_delete(vty, vty->index, "ipv6 address", NULL);
- return isis_route_match_delete(vty, vty->index, "ipv6 address", argv[0]);
+ return isis_route_match_delete(vty, "ipv6 address", NULL);
+ return isis_route_match_delete(vty, "ipv6 address", argv[0]);
}
ALIAS (no_match_ipv6_address,
@@ -465,7 +469,7 @@ DEFUN (match_ipv6_address_prefix_list,
"Match entries of prefix-lists\n"
"IP prefix-list name\n")
{
- return isis_route_match_add(vty, vty->index, "ipv6 address prefix-list", argv[0]);
+ return isis_route_match_add(vty, "ipv6 address prefix-list", argv[0]);
}
DEFUN (no_match_ipv6_address_prefix_list,
@@ -478,8 +482,8 @@ DEFUN (no_match_ipv6_address_prefix_list,
"Match entries of prefix-lists\n")
{
if (argc == 0)
- return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", NULL);
- return isis_route_match_delete (vty, vty->index, "ipv6 address prefix-list", argv[0]);
+ return isis_route_match_delete (vty, "ipv6 address prefix-list", NULL);
+ return isis_route_match_delete (vty, "ipv6 address prefix-list", argv[0]);
}
ALIAS (no_match_ipv6_address_prefix_list,
@@ -504,7 +508,7 @@ DEFUN (set_metric,
"Metric vale for destination routing protocol\n"
"Metric value\n")
{
- return isis_route_set_add(vty, vty->index, "metric", argv[0]);
+ return isis_route_set_add(vty, "metric", argv[0]);
}
DEFUN (no_set_metric,
@@ -516,8 +520,8 @@ DEFUN (no_set_metric,
"Metric value\n")
{
if (argc == 0)
- return isis_route_set_delete(vty, vty->index, "metric", NULL);
- return isis_route_set_delete(vty, vty->index, "metric", argv[0]);
+ return isis_route_set_delete(vty, "metric", NULL);
+ return isis_route_set_delete(vty, "metric", argv[0]);
}
ALIAS (no_set_metric,
diff --git a/isisd/isis_vty.c b/isisd/isis_vty.c
index 53c635ea61..12ef682c17 100644
--- a/isisd/isis_vty.c
+++ b/isisd/isis_vty.c
@@ -32,10 +32,9 @@
static struct isis_circuit *
isis_circuit_lookup (struct vty *vty)
{
- struct interface *ifp;
+ struct interface *ifp = VTY_GET_CONTEXT(interface);
struct isis_circuit *circuit;
- ifp = (struct interface *) vty->index;
if (!ifp)
{
vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
@@ -61,15 +60,12 @@ DEFUN (ip_router_isis,
"IS-IS Routing for IP\n"
"Routing process tag\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct isis_circuit *circuit;
struct isis_area *area;
const char *af = argv[0];
const char *area_tag = argv[1];
- ifp = (struct interface *) vty->index;
- assert (ifp);
-
/* Prevent more than one area per circuit */
circuit = circuit_scan_by_ifp (ifp);
if (circuit && circuit->area)
@@ -115,19 +111,12 @@ DEFUN (no_ip_router_isis,
"IS-IS Routing for IP\n"
"Routing process tag\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
struct isis_area *area;
struct isis_circuit *circuit;
const char *af = argv[0];
const char *area_tag = argv[1];
- ifp = (struct interface *) vty->index;
- if (!ifp)
- {
- vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
-
area = isis_area_lookup (area_tag);
if (!area)
{
@@ -1404,11 +1393,9 @@ DEFUN (metric_style,
"Send and accept both styles of TLVs during transition\n"
"Use new style of TLVs to carry wider metric\n")
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int ret;
- assert(area);
-
if (strncmp (argv[0], "w", 1) == 0)
{
isis_area_metricstyle_set(area, false, true);
@@ -1434,10 +1421,9 @@ DEFUN (no_metric_style,
NO_STR
"Use old-style (ISO 10589) or new-style packet formats\n")
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int ret;
- assert (area);
ret = validate_metric_style_narrow (vty, area);
if (ret != CMD_SUCCESS)
return ret;
@@ -1452,8 +1438,7 @@ DEFUN (set_overload_bit,
"Set overload bit to avoid any transit traffic\n"
"Set overload bit\n")
{
- struct isis_area *area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_overload_bit_set(area, true);
return CMD_SUCCESS;
@@ -1465,8 +1450,7 @@ DEFUN (no_set_overload_bit,
"Reset overload bit to accept transit traffic\n"
"Reset overload bit\n")
{
- struct isis_area *area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_overload_bit_set(area, false);
return CMD_SUCCESS;
@@ -1478,8 +1462,7 @@ DEFUN (set_attached_bit,
"Set attached bit to identify as L1/L2 router for inter-area traffic\n"
"Set attached bit\n")
{
- struct isis_area *area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_attached_bit_set(area, true);
return CMD_SUCCESS;
@@ -1490,8 +1473,7 @@ DEFUN (no_set_attached_bit,
"no set-attached-bit",
"Reset attached bit\n")
{
- struct isis_area *area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_attached_bit_set(area, false);
return CMD_SUCCESS;
@@ -1503,8 +1485,7 @@ DEFUN (dynamic_hostname,
"Dynamic hostname for IS-IS\n"
"Dynamic hostname\n")
{
- struct isis_area *area = vty->index;
- assert(area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_dynhostname_set(area, true);
return CMD_SUCCESS;
@@ -1517,8 +1498,7 @@ DEFUN (no_dynamic_hostname,
"Dynamic hostname for IS-IS\n"
"Dynamic hostname\n")
{
- struct isis_area *area = vty->index;
- assert(area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
isis_area_dynhostname_set(area, false);
return CMD_SUCCESS;
@@ -1526,16 +1506,10 @@ DEFUN (no_dynamic_hostname,
static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
struct listnode *node;
struct isis_circuit *circuit;
- if (!area)
- {
- vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
-
for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
{
if(circuit->state != C_STATE_INIT && circuit->state != C_STATE_UP)
@@ -1590,17 +1564,9 @@ DEFUN (is_type,
"Act as both a station router and an area router\n"
"Act as an area router only\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int type;
- area = vty->index;
-
- if (!area)
- {
- vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
-
type = string2circuit_t (argv[0]);
if (!type)
{
@@ -1622,12 +1588,9 @@ DEFUN (no_is_type,
"Act as both a station router and an area router\n"
"Act as an area router only\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int type;
- area = vty->index;
- assert (area);
-
/*
* Put the is-type back to defaults:
* - level-1-2 on first area
@@ -1679,11 +1642,10 @@ DEFUN (lsp_gen_interval,
"Minimum interval between regenerating same LSP\n"
"Minimum interval in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = atoi (argv[0]);
level = IS_LEVEL_1 | IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1695,11 +1657,10 @@ DEFUN (no_lsp_gen_interval,
NO_STR
"Minimum interval between regenerating same LSP\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
level = IS_LEVEL_1 | IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1719,11 +1680,10 @@ DEFUN (lsp_gen_interval_l1,
"Set interval for level 1 only\n"
"Minimum interval in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = atoi (argv[0]);
level = IS_LEVEL_1;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1736,11 +1696,10 @@ DEFUN (no_lsp_gen_interval_l1,
"Minimum interval between regenerating same LSP\n"
"Set interval for level 1 only\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
level = IS_LEVEL_1;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1761,11 +1720,10 @@ DEFUN (lsp_gen_interval_l2,
"Set interval for level 2 only\n"
"Minimum interval in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = atoi (argv[0]);
level = IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1778,11 +1736,10 @@ DEFUN (no_lsp_gen_interval_l2,
"Minimum interval between regenerating same LSP\n"
"Set interval for level 2 only\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
uint16_t interval;
int level;
- area = vty->index;
interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
level = IS_LEVEL_2;
return set_lsp_gen_interval (vty, area, interval, level);
@@ -1802,10 +1759,9 @@ DEFUN (spf_interval,
"Minimum interval between SPF calculations\n"
"Minimum interval between consecutive SPFs in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
u_int16_t interval;
- area = vty->index;
interval = atoi (argv[0]);
area->min_spf_interval[0] = interval;
area->min_spf_interval[1] = interval;
@@ -1819,9 +1775,7 @@ DEFUN (no_spf_interval,
NO_STR
"Minimum interval between SPF calculations\n")
{
- struct isis_area *area;
-
- area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
@@ -1843,10 +1797,9 @@ DEFUN (spf_interval_l1,
"Set interval for level 1 only\n"
"Minimum interval between consecutive SPFs in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
u_int16_t interval;
- area = vty->index;
interval = atoi (argv[0]);
area->min_spf_interval[0] = interval;
@@ -1860,9 +1813,7 @@ DEFUN (no_spf_interval_l1,
"Minimum interval between SPF calculations\n"
"Set interval for level 1 only\n")
{
- struct isis_area *area;
-
- area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
@@ -1884,10 +1835,9 @@ DEFUN (spf_interval_l2,
"Set interval for level 2 only\n"
"Minimum interval between consecutive SPFs in seconds\n")
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
u_int16_t interval;
- area = vty->index;
interval = atoi (argv[0]);
area->min_spf_interval[1] = interval;
@@ -1901,9 +1851,7 @@ DEFUN (no_spf_interval_l2,
"Minimum interval between SPF calculations\n"
"Set interval for level 2 only\n")
{
- struct isis_area *area;
-
- area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
@@ -1922,17 +1870,11 @@ static int
area_max_lsp_lifetime_set(struct vty *vty, int level,
uint16_t interval)
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int lvl;
uint16_t refresh_interval = interval - 300;
int set_refresh_interval[ISIS_LEVELS] = {0, 0};
- if (!area)
- {
- vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
-
for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
{
if (!(lvl & level))
@@ -2049,15 +1991,9 @@ ALIAS (no_max_lsp_lifetime_l2,
static int
area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval)
{
- struct isis_area *area = vty->index;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int lvl;
- if (!area)
- {
- vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
-
for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
{
if (!(lvl & level))
@@ -2174,13 +2110,7 @@ area_passwd_set(struct vty *vty, int level,
const char *passwd, u_char snp_auth),
const char *passwd, u_char snp_auth)
{
- struct isis_area *area = vty->index;
-
- if (!area)
- {
- vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
+ VTY_DECLVAR_CONTEXT (isis_area, area);
if (passwd && strlen(passwd) > 254)
{
@@ -2267,14 +2197,8 @@ DEFUN (no_area_passwd,
"Configure the authentication password for an area\n"
"Set the authentication password for a routing domain\n")
{
+ VTY_DECLVAR_CONTEXT (isis_area, area);
int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
- struct isis_area *area = vty->index;
-
- if (!area)
- {
- vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
- return CMD_ERR_NO_MATCH;
- }
return isis_area_passwd_unset (area, level);
}
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 2e66752ec1..e84ae7cf00 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -203,8 +203,7 @@ isis_area_get (struct vty *vty, const char *area_tag)
if (area)
{
- vty->node = ISIS_NODE;
- vty->index = area;
+ VTY_PUSH_CONTEXT (ISIS_NODE, area);
return CMD_SUCCESS;
}
@@ -213,8 +212,7 @@ isis_area_get (struct vty *vty, const char *area_tag)
if (isis->debugs & DEBUG_EVENTS)
zlog_debug ("New IS-IS area instance %s", area->area_tag);
- vty->node = ISIS_NODE;
- vty->index = area;
+ VTY_PUSH_CONTEXT (ISIS_NODE, area);
return CMD_SUCCESS;
}
@@ -324,13 +322,12 @@ isis_area_destroy (struct vty *vty, const char *area_tag)
int
area_net_title (struct vty *vty, const char *net_title)
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
struct area_addr *addr;
struct area_addr *addrp;
struct listnode *node;
u_char buff[255];
- area = vty->index;
if (!area)
{
@@ -427,12 +424,11 @@ area_net_title (struct vty *vty, const char *net_title)
int
area_clear_net_title (struct vty *vty, const char *net_title)
{
- struct isis_area *area;
+ VTY_DECLVAR_CONTEXT (isis_area, area);
struct area_addr addr, *addrp = NULL;
struct listnode *node;
u_char buff[255];
- area = vty->index;
if (!area)
{
vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
@@ -1876,10 +1872,7 @@ DEFUN (log_adj_changes,
"log-adjacency-changes",
"Log changes in adjacency state\n")
{
- struct isis_area *area;
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
area->log_adj_changes = 1;
@@ -1891,10 +1884,7 @@ DEFUN (no_log_adj_changes,
"no log-adjacency-changes",
"Stop logging changes in adjacency state\n")
{
- struct isis_area *area;
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
area->log_adj_changes = 0;
@@ -1918,10 +1908,7 @@ DEFUN (topology_generate_grid,
"Optional param 3\n"
"Topology\n")
{
- struct isis_area *area;
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
if (!spgrid_check_params (vty, argc, argv))
{
@@ -1976,11 +1963,8 @@ DEFUN (topology_baseis,
"A Network IS Base for this topology\n"
"XXXX.XXXX.XXXX Network entity title (NET)\n")
{
- struct isis_area *area;
u_char buff[ISIS_SYS_ID_LEN];
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
if (sysid2buff (buff, argv[0]))
sysid2buff (area->topology_baseis, argv[0]);
@@ -1996,10 +1980,7 @@ DEFUN (no_topology_baseis,
"A Network IS Base for this topology\n"
"XXXX.XXXX.XXXX Network entity title (NET)\n")
{
- struct isis_area *area;
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
return CMD_SUCCESS;
@@ -2019,10 +2000,7 @@ DEFUN (topology_basedynh,
"Dynamic hostname base for this topology\n"
"Dynamic hostname base\n")
{
- struct isis_area *area;
-
- area = vty->index;
- assert (area);
+ VTY_DECLVAR_CONTEXT (isis_area, area);
/* I hope that it's enough. */
area->topology_basedynh = strndup (argv[0], 16);