summaryrefslogtreecommitdiff
path: root/lib/if.c
diff options
context:
space:
mode:
authorQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
committerQuentin Young <qlyoung@cumulusnetworks.com>2016-10-17 23:36:21 +0000
commite52702f29d003585dcfbb4914b2a52d77a177739 (patch)
tree3e130ded38c48316796bfb602dc6fe6d119129d2 /lib/if.c
parent6fbde29dafeaf7c6aab9789d3eaf0234e99eefb6 (diff)
parent3d3c3cbd115a3c38b490d656002af777d002743c (diff)
Merge branch 'cmaster-next' into vtysh-grammar
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com> Conflicts: bgpd/bgp_route.c bgpd/bgp_routemap.c bgpd/bgp_vty.c isisd/isis_redist.c isisd/isis_routemap.c isisd/isis_vty.c isisd/isisd.c lib/command.c lib/distribute.c lib/if.c lib/keychain.c lib/routemap.c lib/routemap.h ospf6d/ospf6_asbr.c ospf6d/ospf6_interface.c ospf6d/ospf6_neighbor.c ospf6d/ospf6_top.c ospf6d/ospf6_zebra.c ospf6d/ospf6d.c ospfd/ospf_routemap.c ospfd/ospf_vty.c ripd/rip_routemap.c ripngd/ripng_routemap.c vtysh/extract.pl.in vtysh/vtysh.c zebra/interface.c zebra/irdp_interface.c zebra/rt_netlink.c zebra/rtadv.c zebra/test_main.c zebra/zebra_routemap.c zebra/zebra_vty.c
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;
}