diff options
Diffstat (limited to 'ospfd/ospf_interface.c')
| -rw-r--r-- | ospfd/ospf_interface.c | 65 |
1 files changed, 59 insertions, 6 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c index b3aba247df..eb7a8348e8 100644 --- a/ospfd/ospf_interface.c +++ b/ospfd/ospf_interface.c @@ -188,7 +188,7 @@ struct ospf_interface *ospf_if_table_lookup(struct interface *ifp, struct ospf_interface *rninfo = NULL; p = *prefix; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; /* route_node_get implicitely locks */ if ((rn = route_node_lookup(IF_OIFS(ifp), &p))) { @@ -205,7 +205,7 @@ static void ospf_add_to_if(struct interface *ifp, struct ospf_interface *oi) struct prefix p; p = *oi->address; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; apply_mask(&p); rn = route_node_get(IF_OIFS(ifp), &p); @@ -223,7 +223,7 @@ static void ospf_delete_from_if(struct interface *ifp, struct prefix p; p = *oi->address; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; rn = route_node_lookup(IF_OIFS(oi->ifp), &p); assert(rn); @@ -566,7 +566,7 @@ void ospf_free_if_params(struct interface *ifp, struct in_addr addr) struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p); if (!rn || !rn->info) @@ -601,7 +601,7 @@ struct ospf_if_params *ospf_lookup_if_params(struct interface *ifp, struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; rn = route_node_lookup(IF_OIFS_PARAMS(ifp), (struct prefix *)&p); @@ -621,7 +621,7 @@ struct ospf_if_params *ospf_get_if_params(struct interface *ifp, struct route_node *rn; p.family = AF_INET; - p.prefixlen = IPV4_MAX_PREFIXLEN; + p.prefixlen = IPV4_MAX_BITLEN; p.prefix = addr; apply_mask_ipv4(&p); @@ -1447,6 +1447,59 @@ static int ospf_ifp_destroy(struct interface *ifp) return 0; } +/* Resetting ospf hello timer */ +void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr, + bool is_addr) +{ + struct route_node *rn; + + if (is_addr) { + struct prefix p; + struct ospf_interface *oi = NULL; + + p.u.prefix4 = addr; + p.family = AF_INET; + p.prefixlen = IPV4_MAX_BITLEN; + + oi = ospf_if_table_lookup(ifp, &p); + + if (oi) { + /* Send hello before restart the hello timer + * to avoid session flaps in case of bigger + * hello interval configurations. + */ + ospf_hello_send(oi); + + /* Restart hello timer for this interface */ + OSPF_ISM_TIMER_OFF(oi->t_hello); + OSPF_HELLO_TIMER_ON(oi); + } + + return; + } + + for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) { + struct ospf_interface *oi = rn->info; + + if (!oi) + continue; + + /* If hello interval configured on this oi, don't restart. */ + if (OSPF_IF_PARAM_CONFIGURED(oi->params, v_hello)) + continue; + + /* Send hello before restart the hello timer + * to avoid session flaps in case of bigger + * hello interval configurations. + */ + ospf_hello_send(oi); + + /* Restart the hello timer. */ + OSPF_ISM_TIMER_OFF(oi->t_hello); + OSPF_HELLO_TIMER_ON(oi); + } +} + void ospf_if_init(void) { if_zapi_callbacks(ospf_ifp_create, ospf_ifp_up, |
