summaryrefslogtreecommitdiff
path: root/proto/ospf/ospf.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>1999-11-03 12:59:38 +0000
committerOndrej Filip <feela@network.cz>1999-11-03 12:59:38 +0000
commitecc3cf6f50768284b9660b5717190107e742404f (patch)
treebc1aa40ece80a9c048fc6d234447b677f048d2c0 /proto/ospf/ospf.c
parent03b7bd14de501891ea8ae1d914e1da0b1f4147d5 (diff)
Working on db des receiving.
Preparing for building LDA database.
Diffstat (limited to 'proto/ospf/ospf.c')
-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 59b36145..bd8bfc9a 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;
}
}