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.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 4ea367ecad..5742ece1f7 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -6,7 +6,7 @@
#include <zebra.h>
-#include "thread.h"
+#include "frrevent.h"
#include "linklist.h"
#include "prefix.h"
#include "if.h"
@@ -289,7 +289,7 @@ void ospf_if_cleanup(struct ospf_interface *oi)
/* oi->nbrs and oi->nbr_nbma should be deleted on InterfaceDown event */
/* delete all static neighbors attached to this interface */
for (ALL_LIST_ELEMENTS(oi->nbr_nbma, node, nnode, nbr_nbma)) {
- THREAD_OFF(nbr_nbma->t_poll);
+ EVENT_OFF(nbr_nbma->t_poll);
if (nbr_nbma->nbr) {
nbr_nbma->nbr->nbr_nbma = NULL;
@@ -356,7 +356,7 @@ void ospf_if_free(struct ospf_interface *oi)
listnode_delete(oi->ospf->oiflist, oi);
listnode_delete(oi->area->oiflist, oi);
- thread_cancel_event(master, oi);
+ event_cancel_event(master, oi);
memset(oi, 0, sizeof(*oi));
XFREE(MTYPE_OSPF_IF, oi);
@@ -492,7 +492,7 @@ void ospf_interface_fifo_flush(struct ospf_interface *oi)
if (oi->on_write_q) {
listnode_delete(ospf->oi_write_q, oi);
if (list_isempty(ospf->oi_write_q))
- THREAD_OFF(ospf->t_write);
+ EVENT_OFF(ospf->t_write);
oi->on_write_q = 0;
}
}
@@ -651,6 +651,8 @@ int ospf_if_new_hook(struct interface *ifp)
ifp->info = XCALLOC(MTYPE_OSPF_IF_INFO, sizeof(struct ospf_if_info));
+ IF_OSPF_IF_INFO(ifp)->oii_fd = -1;
+
IF_OIFS(ifp) = route_table_init();
IF_OIFS_PARAMS(ifp) = route_table_init();
@@ -691,6 +693,8 @@ static int ospf_if_delete_hook(struct interface *ifp)
{
int rc = 0;
struct route_node *rn;
+ struct ospf_if_info *oii;
+
rc = ospf_opaque_del_if(ifp);
/*
@@ -707,6 +711,13 @@ static int ospf_if_delete_hook(struct interface *ifp)
route_table_finish(IF_OIFS(ifp));
route_table_finish(IF_OIFS_PARAMS(ifp));
+ /* Close per-interface socket */
+ oii = ifp->info;
+ if (oii && oii->oii_fd > 0) {
+ close(oii->oii_fd);
+ oii->oii_fd = -1;
+ }
+
XFREE(MTYPE_OSPF_IF_INFO, ifp->info);
return rc;
@@ -977,7 +988,6 @@ static void ospf_vl_if_delete(struct ospf_vl_data *vl_data)
if_delete(&ifp);
if (!vrf_is_enabled(vrf))
vrf_delete(vrf);
- vlink_count--;
}
/* for a defined area, count the number of configured vl
@@ -1368,6 +1378,16 @@ static int ospf_ifp_up(struct interface *ifp)
struct ospf_interface *oi;
struct route_node *rn;
struct ospf_if_info *oii = ifp->info;
+ struct ospf *ospf;
+
+ if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
+ zlog_debug("Zebra: Interface[%s] state change to up.",
+ ifp->name);
+
+ /* Open per-intf write socket if configured */
+ ospf = ifp->vrf->info;
+ if (ospf && ospf->intf_socket_enabled)
+ ospf_ifp_sock_init(ifp);
ospf_if_recalculate_output_cost(ifp);
@@ -1385,10 +1405,6 @@ static int ospf_ifp_up(struct interface *ifp)
return 0;
}
- if (IS_DEBUG_OSPF(zebra, ZEBRA_INTERFACE))
- zlog_debug("Zebra: Interface[%s] state change to up.",
- ifp->name);
-
for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next(rn)) {
if ((oi = rn->info) == NULL)
continue;
@@ -1417,6 +1433,9 @@ static int ospf_ifp_down(struct interface *ifp)
ospf_if_down(oi);
}
+ /* Close per-interface write socket if configured */
+ ospf_ifp_sock_close(ifp);
+
return 0;
}
@@ -1471,7 +1490,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
ospf_hello_send(oi);
/* Restart hello timer for this interface */
- THREAD_OFF(oi->t_hello);
+ EVENT_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
@@ -1495,7 +1514,7 @@ void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
ospf_hello_send(oi);
/* Restart the hello timer. */
- THREAD_OFF(oi->t_hello);
+ EVENT_OFF(oi->t_hello);
OSPF_HELLO_TIMER_ON(oi);
}
}