summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/if.c')
-rw-r--r--lib/if.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/if.c b/lib/if.c
index dd8922ee91..6235884e5d 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -43,6 +43,8 @@ DEFINE_MTYPE_STATIC(LIB, NBR_CONNECTED, "Neighbor Connected")
DEFINE_MTYPE( LIB, CONNECTED_LABEL, "Connected interface label")
DEFINE_MTYPE_STATIC(LIB, IF_LINK_PARAMS, "Informational Link Parameters")
+DEFINE_QOBJ_TYPE(interface)
+
/* List of interfaces in only the default VRF */
int ptm_enable = 0;
@@ -149,6 +151,8 @@ if_create_vrf (const char *name, int namelen, vrf_id_t vrf_id)
/* Enable Link-detection by default */
SET_FLAG(ifp->status, ZEBRA_INTERFACE_LINKDETECTION);
+ QOBJ_REG (ifp, interface);
+
if (if_master.if_new_hook)
(*if_master.if_new_hook) (ifp);
@@ -193,6 +197,8 @@ if_delete_retain (struct interface *ifp)
if (if_master.if_delete_hook)
(*if_master.if_delete_hook) (ifp);
+ QOBJ_UNREG (ifp);
+
/* Free connected address list */
list_delete_all_node (ifp->connected);
@@ -678,9 +684,8 @@ DEFUN (interface_desc,
"Characters describing this interface\n")
{
int idx_line = 1;
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
- ifp = vty->index;
if (ifp->desc)
XFREE (MTYPE_TMP, ifp->desc);
ifp->desc = argv_concat(argv, argc, idx_line);
@@ -694,9 +699,8 @@ DEFUN (no_interface_desc,
NO_STR
"Interface specific description\n")
{
- struct interface *ifp;
+ VTY_DECLVAR_CONTEXT (interface, ifp);
- ifp = vty->index;
if (ifp->desc)
XFREE (MTYPE_TMP, ifp->desc);
ifp->desc = NULL;
@@ -786,8 +790,7 @@ DEFUN (interface,
vty_out (vty, "%% interface %s not in %s%s", ifname, vrfname, VTY_NEWLINE);
return CMD_WARNING;
}
- vty->index = ifp;
- vty->node = INTERFACE_NODE;
+ VTY_PUSH_CONTEXT_COMPAT (INTERFACE_NODE, ifp);
return CMD_SUCCESS;
}
@@ -852,8 +855,7 @@ DEFUN (vrf,
vrfp = vrf_get (VRF_UNKNOWN, vrfname);
- vty->index = vrfp;
- vty->node = VRF_NODE;
+ VTY_PUSH_CONTEXT_COMPAT (VRF_NODE, vrfp);
return CMD_SUCCESS;
}