summaryrefslogtreecommitdiff
path: root/ospf6d/ospf6_top.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2016-12-07 17:15:32 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2016-12-09 17:36:25 +0100
commitcdc2d7650764bda9b84c3a1c43f26b83fdcb767c (patch)
tree4a6391d630d7d140b31a4bc4dc5bc89c749614eb /ospf6d/ospf6_top.c
parent3c5070bec0a64918ae87b0992221b8e6c98ff136 (diff)
*: coccinelle-replace vty->index
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'ospf6d/ospf6_top.c')
-rw-r--r--ospf6d/ospf6_top.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 238053231a..32d7a33912 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -298,8 +298,7 @@ DEFUN (router_ospf6,
ospf6 = ospf6_create ();
/* set current ospf point. */
- vty->node = OSPF6_NODE;
- vty->index = ospf6;
+ VTY_PUSH_CONTEXT(OSPF6_NODE, ospf6);
return CMD_SUCCESS;
}
@@ -313,8 +312,7 @@ DEFUN (no_router_ospf6,
OSPF6_STR)
{
/* return to config node . */
- vty->node = CONFIG_NODE;
- vty->index = NULL;
+ VTY_PUSH_CONTEXT_NULL(CONFIG_NODE);
return CMD_SUCCESS;
}
@@ -326,12 +324,10 @@ DEFUN (ospf6_router_id,
"Configure OSPF Router-ID\n"
V4NOTATION_STR)
{
+ VTY_DECLVAR_CONTEXT(ospf6, o);
int idx_ipv4 = 1;
int ret;
u_int32_t router_id;
- struct ospf6 *o;
-
- o = (struct ospf6 *) vty->index;
ret = inet_pton (AF_INET, argv[idx_ipv4]->arg, &router_id);
if (ret == 0)
@@ -352,7 +348,7 @@ DEFUN (ospf6_log_adjacency_changes,
"log-adjacency-changes",
"Log changes in adjacency state\n")
{
- struct ospf6 *ospf6 = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
@@ -365,7 +361,7 @@ DEFUN (ospf6_log_adjacency_changes_detail,
"Log changes in adjacency state\n"
"Log all state changes\n")
{
- struct ospf6 *ospf6 = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
SET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
@@ -378,7 +374,7 @@ DEFUN (no_ospf6_log_adjacency_changes,
NO_STR
"Log changes in adjacency state\n")
{
- struct ospf6 *ospf6 = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
@@ -392,7 +388,7 @@ DEFUN (no_ospf6_log_adjacency_changes_detail,
"Log changes in adjacency state\n"
"Log all state changes\n")
{
- struct ospf6 *ospf6 = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, ospf6);
UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_DETAIL);
UNSET_FLAG(ospf6->config_flags, OSPF6_LOG_ADJACENCY_CHANGES);
@@ -407,9 +403,9 @@ DEFUN (ospf6_timers_lsa,
"Minimum delay in receiving new version of a LSA\n"
"Delay in milliseconds\n")
{
+ VTY_DECLVAR_CONTEXT(ospf6, ospf);
int idx_number = 3;
unsigned int minarrival;
- struct ospf6 *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
@@ -429,9 +425,9 @@ DEFUN (no_ospf6_timers_lsa,
"Minimum delay in receiving new version of a LSA\n"
"Delay in milliseconds\n")
{
+ VTY_DECLVAR_CONTEXT(ospf6, ospf);
int idx_number = 4;
unsigned int minarrival;
- struct ospf6 *ospf = vty->index;
if (!ospf)
return CMD_SUCCESS;
@@ -457,7 +453,7 @@ DEFUN (ospf6_distance,
"Administrative distance\n"
"OSPF6 Administrative distance\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
o->distance_all = atoi (argv[1]->arg);
@@ -471,7 +467,7 @@ DEFUN (no_ospf6_distance,
"Administrative distance\n"
"OSPF6 Administrative distance\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
o->distance_all = 0;
@@ -502,7 +498,7 @@ DEFUN (ospf6_distance_ospf6,
"External routes\n"
"Distance for external routes\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
char *intra, *inter, *external;
intra = inter = external = NULL;
@@ -572,7 +568,7 @@ DEFUN (no_ospf6_distance_ospf6,
"External routes\n"
"Distance for external routes\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
char *intra, *inter, *external;
intra = inter = external = NULL;
@@ -636,7 +632,7 @@ DEFUN (ospf6_distance_source,
"IP source prefix\n"
"Access list name\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
char *alname = (argc == 4) ? argv[3]->arg : NULL;
ospf6_distance_set (vty, o, argv[1]->arg, argv[2]->arg, alname);
@@ -652,7 +648,7 @@ DEFUN (no_ospf6_distance_source,
"IP source prefix\n"
"Access list name\n")
{
- struct ospf6 *o = vty->index;
+ VTY_DECLVAR_CONTEXT(ospf6, o);
char *alname = (argc == 5) ? argv[4]->arg : NULL;
ospf6_distance_unset (vty, o, argv[2]->arg, argv[3]->arg, alname);
@@ -669,16 +665,14 @@ DEFUN (ospf6_interface_area,
"OSPF6 area ID in IPv4 address notation\n"
)
{
+ VTY_DECLVAR_CONTEXT(ospf6, o);
int idx_ifname = 1;
int idx_ipv4 = 3;
- struct ospf6 *o;
struct ospf6_area *oa;
struct ospf6_interface *oi;
struct interface *ifp;
u_int32_t area_id;
- o = (struct ospf6 *) vty->index;
-
/* find/create ospf6 interface */
ifp = if_get_by_name (argv[idx_ifname]->arg);
oi = (struct ospf6_interface *) ifp->info;