summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--proto/ospf/ospf.c59
1 files changed, 58 insertions, 1 deletions
diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c
index 59b3614..bd8bfc9 100644
--- a/proto/ospf/ospf.c
+++ b/proto/ospf/ospf.c
@@ -23,6 +23,9 @@
#include "ospf.h"
+#define IAMMASTER(x) ((x) & DBDES_MS)
+#define INISET(x) ((x) & DBDES_I)
+
void
rxmt_timer_hook(timer *timer)
{
@@ -581,12 +584,66 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
{
/* Duplicate packet */
debug("%s: Received duplicate dbdes from (%u)!\n", p->name, nrid);
- return;
+ if(IAMMASTER(n->imms))
+ {
+ return;
+ }
+ else
+ {
+ /* FIXME: Send response! */
+ }
+ }
+
+ if(IAMMASTER(ps->imms)!=IAMMASTER(n->myimms)) /* M/S bit differs */
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ break;
+ }
+
+ if(INISET(ps->imms)) /* I bit is set */
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ break;
+ }
+
+ if(ps->options!=n->options) /* Options differs */
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ break;
+ }
+
+ if(IAMMASTER(n->myimms))
+ {
+ if(ps->ddseq!=n->dds)
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ break;
+ }
}
+ else
+ {
+ if(ps->ddseq!=(n->dds+1))
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ break;
+ }
+ }
+
+ /* FIXME: Packet accepted, go on */
break;
case NEIGHBOR_LOADING:
case NEIGHBOR_FULL:
+ if((ps->imms==n->imms) && (ps->options=n->options) &&
+ (ps->ddseq==n->dds)) /* Only duplicate are accepted */
+ {
+ debug("%s: Received duplicate dbdes from (%u)!\n", p->name, nrid);
+ return;
+ }
+ else
+ {
+ ospf_neigh_sm(n, INM_SEQMIS);
+ }
break;
}
}