diff options
Diffstat (limited to 'proto/ospf')
-rw-r--r-- | proto/ospf/dbdes.c | 18 | ||||
-rw-r--r-- | proto/ospf/hello.c | 5 | ||||
-rw-r--r-- | proto/ospf/iface.c | 6 | ||||
-rw-r--r-- | proto/ospf/neighbor.c | 6 |
4 files changed, 24 insertions, 11 deletions
diff --git a/proto/ospf/dbdes.c b/proto/ospf/dbdes.c index 03e010e2..1f9dd55e 100644 --- a/proto/ospf/dbdes.c +++ b/proto/ospf/dbdes.c @@ -39,6 +39,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) switch(n->state) { case NEIGHBOR_EXSTART: /* Send empty packets */ + n->myimms.bit.i=1; pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf); op=(struct ospf_packet *)pkt; fill_ospf_pkt_hdr(ifa, pkt, DBDES_P); @@ -55,6 +56,8 @@ ospf_dbdes_tx(struct ospf_neighbor *n) break; case NEIGHBOR_EXCHANGE: + n->myimms.bit.i=0; + if(((n->myimms.bit.ms) && (n->dds==n->ddr+1)) || ((!(n->myimms.bit.ms)) && (n->dds==n->ddr))) { @@ -139,6 +142,7 @@ ospf_dbdes_tx(struct ospf_neighbor *n) { ospf_neigh_sm(n, INM_EXDONE); if(n->myimms.bit.ms) tm_stop(n->rxmt_timer); + else tm_start(n->rxmt_timer,ifa->rxmtint); } } break; @@ -277,7 +281,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, break; } } - + if(ps->imms.bit.i) break; case NEIGHBOR_EXCHANGE: if((ps->imms.byte==n->imms.byte) && (ps->options==n->options) && (ntohl(ps->ddseq)==n->ddr)) @@ -295,14 +299,14 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, if(ps->imms.bit.ms!=n->imms.bit.ms) /* M/S bit differs */ { - DBG("SEQMIS-BIT-MS\n"); + log("SEQMIS-BIT-MS\n"); ospf_neigh_sm(n, INM_SEQMIS); break; } if(ps->imms.bit.i) /* I bit is set */ { - DBG("SEQMIS-BIT-I\n"); + log("SEQMIS-BIT-I\n"); ospf_neigh_sm(n, INM_SEQMIS); break; } @@ -311,7 +315,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, if(ps->options!=n->options) /* Options differs */ { - DBG("SEQMIS-OPT\n"); + log("SEQMIS-OPT\n"); ospf_neigh_sm(n, INM_SEQMIS); break; } @@ -320,7 +324,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, { if(ntohl(ps->ddseq)!=n->dds) /* MASTER */ { - DBG("SEQMIS-MASTER\n"); + log("SEQMIS-MASTER\n"); ospf_neigh_sm(n, INM_SEQMIS); break; } @@ -341,7 +345,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, { if(ntohl(ps->ddseq)!=(n->dds+1)) /* SLAVE */ { - DBG("SEQMIS-SLAVE\n"); + log("SEQMIS-SLAVE\n"); ospf_neigh_sm(n, INM_SEQMIS); break; } @@ -362,7 +366,7 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, } else { - DBG("SEQMIS-FULL\n"); + log("SEQMIS-FULL\n"); ospf_neigh_sm(n, INM_SEQMIS); } break; diff --git a/proto/ospf/hello.c b/proto/ospf/hello.c index a80dfa25..5627d7ee 100644 --- a/proto/ospf/hello.c +++ b/proto/ospf/hello.c @@ -7,6 +7,8 @@ */ #include "ospf.h" +#include <sys/socket.h> +#include "lib/sysio.h" void install_inactim(struct ospf_neighbor *n) @@ -59,8 +61,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, { u32 nrid, *pnrid; struct ospf_neighbor *neigh,*n; - u8 twoway,oldpriority; - u32 i; + u8 i,twoway,oldpriority; ip_addr olddr,oldbdr; ip_addr mask; char *beg=": Bad OSPF hello packet from ", *rec=" received: "; diff --git a/proto/ospf/iface.c b/proto/ospf/iface.c index 2cbff6c9..83f6ac30 100644 --- a/proto/ospf/iface.c +++ b/proto/ospf/iface.c @@ -47,8 +47,9 @@ iface_chstate(struct ospf_iface *ifa, u8 state) DBG("%s: Adding new multicast socket for (B)DR\n", p->name); ifa->dr_sk=sk_new(p->pool); ifa->dr_sk->type=SK_IP_MC; + ifa->dr_sk->sport=0; ifa->dr_sk->dport=OSPF_PROTO; - ifa->dr_sk->saddr=AllDRouters; + ifa->dr_sk->saddr=ipa_from_u32(0); ifa->dr_sk->daddr=AllDRouters; ifa->dr_sk->tos=IP_PREC_INTERNET_CONTROL; ifa->dr_sk->ttl=1; @@ -222,8 +223,9 @@ ospf_open_mc_socket(struct ospf_iface *ifa) mcsk=sk_new(p->pool); mcsk->type=SK_IP_MC; + mcsk->sport=0; mcsk->dport=OSPF_PROTO; - mcsk->saddr=AllSPFRouters; + mcsk->saddr=ipa_from_u32(0); mcsk->daddr=AllSPFRouters; mcsk->tos=IP_PREC_INTERNET_CONTROL; mcsk->ttl=1; diff --git a/proto/ospf/neighbor.c b/proto/ospf/neighbor.c index d9c9b1be..785e3bca 100644 --- a/proto/ospf/neighbor.c +++ b/proto/ospf/neighbor.c @@ -67,6 +67,11 @@ neigh_chstate(struct ospf_neighbor *n, u8 state) schedule_rt_lsa(ifa->oa); schedule_net_lsa(ifa); } + if(oldstate>=NEIGHBOR_EXSTART && state<NEIGHBOR_EXSTART) + { + /* Stop RXMT timer */ + tm_stop(n->rxmt_timer); + } if(state==NEIGHBOR_EXSTART) { if(n->adj==0) /* First time adjacency */ @@ -294,6 +299,7 @@ ospf_neigh_sm(struct ospf_neighbor *n, int event) } break; case INM_SEQMIS: + OSPF_TRACE(D_EVENTS, "Seq mis!"); case INM_BADLSREQ: OSPF_TRACE(D_EVENTS, "Bad LS req!"); if(n->state>=NEIGHBOR_EXCHANGE) |