summaryrefslogtreecommitdiff
path: root/zebra/interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/interface.c')
-rw-r--r--zebra/interface.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 664e493d84..e912b2dcf8 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -64,7 +64,7 @@ static void zebra_if_node_destroy(route_table_delegate_t *delegate,
struct route_node *node)
{
if (node->info)
- list_delete(node->info);
+ list_delete_and_null((struct list **)&node->info);
route_node_destroy(delegate, table, node);
}
@@ -138,7 +138,7 @@ static int if_zebra_delete_hook(struct interface *ifp)
struct rtadvconf *rtadv;
rtadv = &zebra_if->rtadv;
- list_free(rtadv->AdvPrefixList);
+ list_delete_and_null(&rtadv->AdvPrefixList);
#endif /* HAVE_RTADV */
XFREE(MTYPE_TMP, zebra_if);
@@ -322,7 +322,7 @@ int if_subnet_delete(struct interface *ifp, struct connected *ifc)
}
/* Otherwise, free list and route node. */
- list_free(addr_list);
+ list_delete_and_null(&addr_list);
rn->info = NULL;
route_unlock_node(rn);
@@ -627,7 +627,7 @@ static void if_delete_connected(struct interface *ifp)
}
/* Free chain list and respective route node. */
- list_delete(addr_list);
+ list_delete_and_null(&addr_list);
rn->info = NULL;
route_unlock_node(rn);
} else if (cp.family == AF_INET6) {
@@ -685,7 +685,7 @@ void if_delete_update(struct interface *ifp)
while processing the deletion. Each client daemon is responsible
for setting ifindex to IFINDEX_INTERNAL after processing the
interface deletion message. */
- ifp->ifindex = IFINDEX_INTERNAL;
+ if_set_index(ifp, IFINDEX_INTERNAL);
ifp->node = NULL;
/* if the ifp is in a vrf, move it to default so vrf can be deleted if
@@ -1317,7 +1317,7 @@ DEFUN (show_interface,
"Interface status and configuration\n"
VRF_CMD_HELP_STR)
{
- struct listnode *node;
+ struct vrf *vrf;
struct interface *ifp;
vrf_id_t vrf_id = VRF_DEFAULT;
@@ -1327,7 +1327,8 @@ DEFUN (show_interface,
VRF_GET_ID(vrf_id, argv[3]->arg);
/* All interface print. */
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf_id), node, ifp))
+ vrf = vrf_lookup_by_id(vrf_id);
+ FOR_ALL_INTERFACES (vrf, ifp)
if_dump_vty(vty, ifp);
return CMD_SUCCESS;
@@ -1343,14 +1344,13 @@ DEFUN (show_interface_vrf_all,
VRF_ALL_CMD_HELP_STR)
{
struct vrf *vrf;
- struct listnode *node;
struct interface *ifp;
interface_update_stats();
/* All interface print. */
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp))
+ FOR_ALL_INTERFACES (vrf, ifp)
if_dump_vty(vty, ifp);
return CMD_SUCCESS;
@@ -1425,11 +1425,11 @@ DEFUN (show_interface_name_vrf_all,
static void if_show_description(struct vty *vty, vrf_id_t vrf_id)
{
- struct listnode *node;
+ struct vrf *vrf = vrf_lookup_by_id(vrf_id);
struct interface *ifp;
vty_out(vty, "Interface Status Protocol Description\n");
- for (ALL_LIST_ELEMENTS_RO(vrf_iflist(vrf_id), node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
int len;
len = vty_out(vty, "%s", ifp->name);
@@ -1486,7 +1486,7 @@ DEFUN (show_interface_desc_vrf_all,
struct vrf *vrf;
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- if (!list_isempty(vrf->iflist)) {
+ if (!RB_EMPTY (if_name_head, &vrf->ifaces_by_name)) {
vty_out(vty, "\n\tVRF %u\n\n", vrf->vrf_id);
if_show_description(vty, vrf->vrf_id);
}
@@ -2830,13 +2830,12 @@ static int link_params_config_write(struct vty *vty, struct interface *ifp)
static int if_config_write(struct vty *vty)
{
struct vrf *vrf;
- struct listnode *node;
struct interface *ifp;
zebra_ptm_write(vty);
RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name)
- for (ALL_LIST_ELEMENTS_RO(vrf->iflist, node, ifp)) {
+ FOR_ALL_INTERFACES (vrf, ifp) {
struct zebra_if *if_data;
struct listnode *addrnode;
struct connected *ifc;