summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ospfd/ospf_interface.c25
-rw-r--r--ospfd/ospf_interface.h2
-rw-r--r--ospfd/ospf_nsm.c9
3 files changed, 18 insertions, 18 deletions
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index a4f4cd216a..2a758d5583 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -494,6 +494,20 @@ struct ospf_interface *ospf_if_lookup_recv_if(struct ospf *ospf,
return match;
}
+void ospf_interface_fifo_flush(struct ospf_interface *oi)
+{
+ struct ospf *ospf = oi->ospf;
+
+ ospf_fifo_flush(oi->obuf);
+
+ if (oi->on_write_q) {
+ listnode_delete(ospf->oi_write_q, oi);
+ if (list_isempty(ospf->oi_write_q))
+ THREAD_OFF(ospf->t_write);
+ oi->on_write_q = 0;
+ }
+}
+
static void ospf_if_reset_stats(struct ospf_interface *oi)
{
oi->hello_in = oi->hello_out = 0;
@@ -505,19 +519,10 @@ static void ospf_if_reset_stats(struct ospf_interface *oi)
void ospf_if_stream_unset(struct ospf_interface *oi)
{
- struct ospf *ospf = oi->ospf;
-
/* flush the interface packet queue */
- ospf_fifo_flush(oi->obuf);
+ ospf_interface_fifo_flush(oi);
/*reset protocol stats */
ospf_if_reset_stats(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);
- oi->on_write_q = 0;
- }
}
diff --git a/ospfd/ospf_interface.h b/ospfd/ospf_interface.h
index e441016406..51fc1bf3c3 100644
--- a/ospfd/ospf_interface.h
+++ b/ospfd/ospf_interface.h
@@ -351,6 +351,8 @@ extern void ospf_if_interface(struct interface *ifp);
extern uint32_t ospf_if_count_area_params(struct interface *ifp);
extern void ospf_reset_hello_timer(struct interface *ifp, struct in_addr addr,
bool is_addr);
+
+extern void ospf_interface_fifo_flush(struct ospf_interface *oi);
DECLARE_HOOK(ospf_vl_add, (struct ospf_vl_data * vd), (vd));
DECLARE_HOOK(ospf_vl_delete, (struct ospf_vl_data * vd), (vd));
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 1373e5e1bb..a27550853b 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -439,14 +439,7 @@ static int nsm_kill_nbr(struct ospf_neighbor *nbr)
* be sending packets. Let's flush anything
* we got.
*/
- ospf_fifo_flush(oi->obuf);
- if (oi->on_write_q) {
- listnode_delete(oi->ospf->oi_write_q, oi);
- if (list_isempty(oi->ospf->oi_write_q))
- THREAD_OFF(oi->ospf->t_write);
- oi->on_write_q = 0;
- }
-
+ ospf_interface_fifo_flush(oi);
return 0;
}