lifecycle: consider an interface eligible for takedown if it has only one dependent (itself)
This commit is contained in:
parent
ca07082ff4
commit
f139bc2416
1 changed files with 7 additions and 2 deletions
|
@ -274,12 +274,17 @@ handle_refcounting(struct lif_dict *state, struct lif_interface *iface, bool up)
|
|||
else
|
||||
lif_state_unref_if(state, iface->ifname, iface);
|
||||
|
||||
#ifdef DEBUG_REFCOUNTING
|
||||
fprintf(stderr, "handle_refcounting(): orig_refcount=%zu, refcount=%zu, direction=%s\n",
|
||||
orig_refcount, iface->refcount, up ? "UP" : "DOWN");
|
||||
#endif
|
||||
|
||||
/* if going up and orig_refcount > 0 -- we're already configured. */
|
||||
if (up && orig_refcount > 0)
|
||||
return true;
|
||||
|
||||
/* if going down and iface->refcount > 0 -- we still have other dependents. */
|
||||
if (!up && iface->refcount > 0)
|
||||
/* if going down and iface->refcount > 1 -- we still have other dependents. */
|
||||
if (!up && iface->refcount > 1)
|
||||
return true;
|
||||
|
||||
/* we can change this interface -- no blocking dependents. */
|
||||
|
|
Loading…
Reference in a new issue