If one interface is disabled, the holdtimer of the attached adjacencies
will eventually timeout after a few seconds. But there's no need to wait
when we know that the interface is disabled. In these cases, remove the
attached adjacencies to speedup the convergence process.
---
 interface.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/interface.c b/interface.c
index e18477b..7c80d1e 100644
--- a/interface.c
+++ b/interface.c
@@ -165,15 +165,13 @@ if_new(struct kif *kif)
 void
 if_del(struct iface *iface)
 {
-       struct adj              *adj;
        struct if_addr          *if_addr;
 
+       if (iface->state == IF_STA_ACTIVE)
+               if_act_reset(iface);
+
        log_debug("if_del: interface %s", iface->name);
 
-       while ((adj = LIST_FIRST(&iface->adj_list)) != NULL) {
-               LIST_REMOVE(adj, iface_entry);
-               adj_del(adj);
-       }
        while ((if_addr = LIST_FIRST(&iface->addr_list)) != NULL)
                LIST_REMOVE(if_addr, iface_entry);
 
@@ -262,6 +260,12 @@ int
 if_act_reset(struct iface *iface)
 {
        struct in_addr           addr;
+       struct adj              *adj;
+
+       while ((adj = LIST_FIRST(&iface->adj_list)) != NULL) {
+               LIST_REMOVE(adj, iface_entry);
+               adj_del(adj);
+       }
 
        if_stop_hello_timer(iface);
 
-- 
1.9.1

Reply via email to