summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/if.c4
-rw-r--r--lib/if.h6
-rw-r--r--zebra/interface.c7
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/if.c b/lib/if.c
index 1e34ff4b84..371c6bef87 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -1423,6 +1423,8 @@ static int lib_interface_create(enum nb_event event,
#else
ifp = if_get_by_name(ifname, vrf->vrf_id);
#endif /* SUNOS_5 */
+
+ ifp->configured = true;
nb_running_set_entry(dnode, ifp);
break;
}
@@ -1450,6 +1452,8 @@ static int lib_interface_destroy(enum nb_event event,
break;
case NB_EV_APPLY:
ifp = nb_running_unset_entry(dnode);
+
+ ifp->configured = false;
if_delete(ifp);
break;
}
diff --git a/lib/if.h b/lib/if.h
index e3ec278f9f..ee99fad2e1 100644
--- a/lib/if.h
+++ b/lib/if.h
@@ -293,6 +293,12 @@ struct interface {
struct route_node *node;
vrf_id_t vrf_id;
+ /*
+ * Has the end users entered `interface XXXX` from the cli in some
+ * fashion?
+ */
+ bool configured;
+
QOBJ_FIELDS
};
diff --git a/zebra/interface.c b/zebra/interface.c
index 6486c01430..d21ab25fed 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -767,6 +767,13 @@ void if_delete_update(struct interface *ifp)
memset(&zif->brslave_info, 0,
sizeof(struct zebra_l2info_brslave));
}
+
+ if (!ifp->configured) {
+ if (IS_ZEBRA_DEBUG_KERNEL)
+ zlog_debug("interface %s is being deleted from the system",
+ ifp->name);
+ if_delete(ifp);
+ }
}
/* VRF change for an interface */