diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-02-03 17:31:27 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2019-02-03 17:31:27 +0100 |
commit | 16605f2fdad730b8bb570e17192dc5f45cf15d3f (patch) | |
tree | d463373e209fd4cacdd621e56527ada6d3664a14 /proto/ospf/dbdes.c | |
parent | 9c94583a3ded3b2792bd08d88beb10100a82d7b4 (diff) |
OSPF: Reject duplicate DBDES packets after dead interval
Master may free last DBDES packet immediately. Slave must wait dead
interval before freeing last DBDES packet and then reject duplicate
DBDES packets with SeqNumberMismatch.
Diffstat (limited to 'proto/ospf/dbdes.c')
-rw-r--r-- | proto/ospf/dbdes.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 4d3bbe8c..a1559782 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -238,6 +238,14 @@ ospf_rxmt_dbdes(struct ospf_proto *p, struct ospf_neighbor *n) ospf_do_send_dbdes(p, n); } +void +ospf_reset_ldd(struct ospf_proto *p UNUSED, struct ospf_neighbor *n) +{ + mb_free(n->ldd_buffer); + n->ldd_buffer = NULL; + n->ldd_bsize = 0; +} + static int ospf_process_dbdes(struct ospf_proto *p, struct ospf_packet *pkt, struct ospf_neighbor *n) { @@ -434,6 +442,7 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa, if (!(n->myimms & DBDES_M) && !(n->imms & DBDES_M)) { tm_stop(n->dbdes_timer); + ospf_reset_ldd(p, n); ospf_neigh_sm(n, INM_EXDONE); break; } @@ -457,7 +466,11 @@ ospf_receive_dbdes(struct ospf_packet *pkt, struct ospf_iface *ifa, ospf_send_dbdes(p, n); if (!(n->myimms & DBDES_M) && !(n->imms & DBDES_M)) + { + /* Use dbdes timer to postpone freeing of Last DBDES packet buffer */ + tm_start(n->dbdes_timer, n->ifa->deadint S); ospf_neigh_sm(n, INM_EXDONE); + } } break; |