From 2af2636a691da37c73ba032ece29dee1dd20fff7 Mon Sep 17 00:00:00 2001 From: Ondrej Filip Date: Wed, 17 Nov 1999 13:28:51 +0000 Subject: Another bugfix. (In EXCHANGE state.) --- proto/ospf/ospf.c | 63 +++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/proto/ospf/ospf.c b/proto/ospf/ospf.c index 04b6757..3df3901 100644 --- a/proto/ospf/ospf.c +++ b/proto/ospf/ospf.c @@ -58,39 +58,38 @@ ospf_pkt_finalize(struct ospf_iface *ifa, struct ospf_packet *pkt) } void -ospf_dbdes_tx(struct ospf_iface *ifa) +ospf_dbdes_tx(struct ospf_neighbor *n) { struct ospf_dbdes_packet *pkt; struct ospf_packet *op; - struct ospf_neighbor *n; + struct ospf_iface *ifa; u16 length; struct proto *p; + ifa=n->ifa; + p=(struct proto *)(ifa->proto); - WALK_LIST (n, ifa->neigh_list) /* Try to send db_des */ + switch(n->state) { - switch(n->state) - { - case NEIGHBOR_EXSTART: /* Send empty packets */ - pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf); - op=(struct ospf_packet *)pkt; - - fill_ospf_pkt_hdr(ifa, pkt, DBDES); - pkt->iface_mtu= ((struct iface *)ifa)->mtu; - pkt->options= ifa->options; - pkt->imms=n->myimms; - pkt->ddseq=n->dds; - length=sizeof(struct ospf_dbdes_packet); - op->length=htons(length); - ospf_pkt_finalize(ifa, op); - sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); - debug("%s: DB_DES sent for %u.\n", p->name, n->rid); - - /*case NEIGHBOR_EXCHANGE: */ - default: /* Ignore it */ - break; - } + case NEIGHBOR_EXSTART: /* Send empty packets */ + pkt=(struct ospf_dbdes_packet *)(ifa->ip_sk->tbuf); + op=(struct ospf_packet *)pkt; + + fill_ospf_pkt_hdr(ifa, pkt, DBDES); + pkt->iface_mtu= ((struct iface *)ifa)->mtu; + pkt->options= ifa->options; + pkt->imms=n->myimms; + pkt->ddseq=n->dds; + length=sizeof(struct ospf_dbdes_packet); + op->length=htons(length); + ospf_pkt_finalize(ifa, op); + sk_send_to(ifa->ip_sk,length, n->ip, OSPF_PROTO); + debug("%s: DB_DES sent for %u.\n", p->name, n->rid); + + /*case NEIGHBOR_EXCHANGE: */ + default: /* Ignore it */ + break; } } @@ -99,12 +98,16 @@ rxmt_timer_hook(timer *timer) { struct ospf_iface *ifa; struct proto *p; + struct ospf_neighbor *n; ifa=(struct ospf_iface *)timer->data; p=(struct proto *)(ifa->proto); debug("%s: RXMT timer fired on interface %s.\n", p->name, ifa->iface->name); - ospf_dbdes_tx(ifa); + WALK_LIST (n, ifa->neigh_list) /* Try to send db_des */ + { + ospf_dbdes_tx(n); + } } struct ospf_neighbor * @@ -659,15 +662,11 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p, { /* Duplicate packet */ debug("%s: Received duplicate dbdes from (%u)!\n", p->name, nrid); - if(IAMMASTER(n->imms)) + if(!IAMMASTER(n->imms)) { - return; - } - else - { - /* FIXME: Send response! */ - return; + ospf_dbdes_tx(n); } + return; } if(IAMMASTER(ps->imms)!=IAMMASTER(n->myimms)) /* M/S bit differs */ -- cgit v1.2.3