summaryrefslogtreecommitdiff
path: root/proto
diff options
context:
space:
mode:
Diffstat (limited to 'proto')
-rw-r--r--proto/ospf/dbdes.c45
-rw-r--r--proto/ospf/neighbor.c18
2 files changed, 41 insertions, 22 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c
index 54dd71fe..bff8beff 100644
--- a/proto/ospf/dbdes.c
+++ b/proto/ospf/dbdes.c
@@ -117,6 +117,7 @@ ospf_dbdes_send(struct ospf_neighbor *n)
case NEIGHBOR_LOADING:
case NEIGHBOR_FULL:
+ pkt = n->ldbdes;
length = ntohs(((struct ospf_packet *) n->ldbdes)->length);
if (!length)
@@ -130,8 +131,14 @@ ospf_dbdes_send(struct ospf_neighbor *n)
/* Copy last sent packet again */
sk_send_to(ifa->ip_sk, length, n->ip, OSPF_PROTO);
+
+ if(n->myimms.bit.ms) tm_start(n->rxmt_timer, n->ifa->rxmtint); /* Restart timer */
+
OSPF_TRACE(D_PACKETS, "DB_DES (M) sent to %I via %s.", n->ip,
ifa->iface->name);
+
+ DBG("DB_DES PS=%u, M=%u.", ntohl(pkt->ddseq), pkt->imms.bit.m);
+
if (!n->myimms.bit.ms)
{
if ((n->myimms.bit.m == 0) && (n->imms.bit.m == 0) &&
@@ -190,6 +197,9 @@ ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
OSPF_TRACE(D_PACKETS, "Received dbdes from %I via %s.", n->ip,
ifa->iface->name);
+
+ DBG("DB_DES PS=%u, M=%u SIZE=%u.", ntohl(ps->ddseq), ps->imms.bit.m, size);
+
ospf_neigh_sm(n, INM_HELLOREC);
switch (n->state)
@@ -218,27 +228,25 @@ ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
ospf_dbdes_send(n);
break;
}
- else
+
+ if (((ps->imms.bit.i == 0) && (ps->imms.bit.ms == 0)) &&
+ (n->rid < myrid) && (n->dds == ntohl(ps->ddseq)))
{
- if (((ps->imms.bit.i == 0) && (ps->imms.bit.ms == 0)) &&
- (n->rid < myrid) && (n->dds == ntohl(ps->ddseq)))
- {
- /* I'm master! */
- n->options = ps->options;
- n->ddr = ntohl(ps->ddseq) - 1;
- n->imms.byte = ps->imms.byte;
- OSPF_TRACE(D_PACKETS, "I'm master to %I.", n->ip);
- ospf_neigh_sm(n, INM_NEGDONE);
- }
- else
- {
- DBG("%s: Nothing happend to %I (imms=%u)\n", p->name, n->ip,
- ps->imms.byte);
- break;
- }
+ /* I'm master! */
+ n->options = ps->options;
+ n->ddr = ntohl(ps->ddseq) - 1; /* It will be set corectly a few lines down */
+ n->imms.byte = ps->imms.byte;
+ OSPF_TRACE(D_PACKETS, "I'm master to %I.", n->ip);
+ ospf_neigh_sm(n, INM_NEGDONE);
}
- if (ps->imms.bit.i)
+ else
+ {
+ DBG("%s: Nothing happend to %I (imms=%u)\n", p->name, n->ip,
+ ps->imms.byte);
break;
+ }
+ if(ps->imms.bit.i) log("FUCK");
+
case NEIGHBOR_EXCHANGE:
if ((ps->imms.byte == n->imms.byte) && (ps->options == n->options) &&
(ntohl(ps->ddseq) == n->ddr))
@@ -331,6 +339,7 @@ ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
{
OSPF_TRACE(D_PACKETS, "dbdes - sequence mismatch neighbor %I (full)",
n->ip);
+ DBG("PS=%u, DDR=%u, DDS=%u", ntohl(ps->ddseq), n->ddr, n->dds);
ospf_neigh_sm(n, INM_SEQMIS);
}
break;
diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c
index 4f69638d..5abaf482 100644
--- a/proto/ospf/neighbor.c
+++ b/proto/ospf/neighbor.c
@@ -605,14 +605,24 @@ rxmt_timer_hook(timer * timer)
DBG("%s: RXMT timer fired on interface %s for neigh: %I.\n",
p->name, ifa->iface->name, n->ip);
- if (n->state < NEIGHBOR_LOADING)
+
+ if(n->state < NEIGHBOR_EXSTART) return;
+
+ if (n->state == NEIGHBOR_EXSTART)
+ {
ospf_dbdes_send(n);
+ return;
+ }
+
+ if ((n->state == NEIGHBOR_EXCHANGE) && n->myimms.bit.ms) /* I'm master */
+ ospf_dbdes_send(n);
+
- if (n->state < NEIGHBOR_FULL)
- ospf_lsreq_send(n);
+ if (n->state < NEIGHBOR_FULL)
+ ospf_lsreq_send(n); /* EXCHANGE or LOADING */
else
{
- if (!EMPTY_SLIST(n->lsrtl))
+ if (!EMPTY_SLIST(n->lsrtl)) /* FULL */
{
list uplist;
slab *upslab;