summaryrefslogtreecommitdiff
path: root/ospfd/ospf_interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'ospfd/ospf_interface.c')
-rw-r--r--ospfd/ospf_interface.c63
1 files changed, 58 insertions, 5 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 029f929c11..60e109ea80 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -477,7 +477,7 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
continue;
- if (if_is_loopback(oi->ifp) || if_is_vrf(oi->ifp))
+ if (if_is_loopback_or_vrf(oi->ifp))
continue;
if (CHECK_FLAG(oi->connected->flags, ZEBRA_IFA_UNNUMBERED))
@@ -719,7 +719,7 @@ static int ospf_if_delete_hook(struct interface *ifp)
int ospf_if_is_enable(struct ospf_interface *oi)
{
- if (!(if_is_loopback(oi->ifp) || if_is_vrf(oi->ifp)))
+ if (!(if_is_loopback_or_vrf(oi->ifp)))
if (if_is_up(oi->ifp))
return 1;
@@ -915,9 +915,9 @@ struct ospf_interface *ospf_vl_new(struct ospf *ospf,
ospf->vrf_id);
snprintf(ifname, sizeof(ifname), "VLINK%u", vlink_count);
- vi = if_create_name(ifname, ospf->vrf_id);
+ vi = if_get_by_name(ifname, ospf->vrf_id, ospf->name);
/*
- * if_create_name sets ZEBRA_INTERFACE_LINKDETECTION
+ * if_get_by_name sets ZEBRA_INTERFACE_LINKDETECTION
* virtual links don't need this.
*/
UNSET_FLAG(vi->status, ZEBRA_INTERFACE_LINKDETECTION);
@@ -1291,7 +1291,7 @@ uint8_t ospf_default_iftype(struct interface *ifp)
{
if (if_is_pointopoint(ifp))
return OSPF_IFTYPE_POINTOPOINT;
- else if (if_is_loopback(ifp) || if_is_vrf(ifp))
+ else if (if_is_loopback_or_vrf(ifp))
return OSPF_IFTYPE_LOOPBACK;
else
return OSPF_IFTYPE_BROADCAST;
@@ -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,