diff options
Diffstat (limited to 'proto/ospf/lsupd.c')
-rw-r--r-- | proto/ospf/lsupd.c | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c index 515626b..8f9d6aa 100644 --- a/proto/ospf/lsupd.c +++ b/proto/ospf/lsupd.c @@ -24,11 +24,15 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l) struct ospf_lsupd_packet *pk; struct ospf_packet *op; void *pktpos; + u8 ii; + u8 *jj=n->ifa->ip_sk->tbuf; if(HEAD(*l)==NULL) return; pk=(struct ospf_lsupd_packet *)n->ifa->ip_sk->tbuf; op=(struct ospf_packet *)n->ifa->ip_sk->tbuf; + + DBG("LSupd: 1st packet\n"); fill_ospf_pkt_hdr(n->ifa, pk, LSUPD); len=SIPH+sizeof(struct ospf_lsupd_packet); @@ -38,13 +42,20 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l) WALK_LIST(llsh, *l) { en=ospf_hash_find(n->ifa->oa->gr,llsh->lsh.id,llsh->lsh.rt,llsh->lsh.type); - if((len+sizeof(struct ospf_lsa_header)+en->body_len)>n->ifa->iface->mtu) + DBG("Sending ID=%u, Type=%u, RT=%u\n", llsh->lsh.id, llsh->lsh.type, + llsh->lsh.rt); + if((len+sizeof(struct ospf_lsa_header)+en->lsa.length)>n->ifa->iface->mtu) { pk->lsano=htonl(lsano); op->length=htons(len); ospf_pkt_finalize(n->ifa, op); + + for(ii=0;ii<(len-SIPH);ii+=4) + DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3)); + sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO); + DBG("LSupd: next packet\n"); fill_ospf_pkt_hdr(n->ifa, pk, LSUPD); len=SIPH+sizeof(struct ospf_lsupd_packet); lsano=0; @@ -53,13 +64,19 @@ ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l) htonlsah(&(en->lsa), pktpos); pktpos=pktpos+sizeof(struct ospf_lsa_header); htonlsab(en->lsa_body, pktpos, en->lsa.type, en->lsa.length); - pktpos=pktpos+en->body_len; - len=len+en->body_len+sizeof(struct ospf_lsa_header); + pktpos=pktpos+en->lsa.length-sizeof(struct ospf_lsa_header); + len=len+en->lsa.length; + lsano++; } pk->lsano=htonl(lsano); - op->length=htons(len); + op->length=htons(len-SIPH); ospf_pkt_finalize(n->ifa, op); + + for(ii=0;ii<(len-SIPH);ii+=4) + DBG("Out dump: %d,%d,%d,%d\n", *(jj+ii), *(jj+ii+1), *(jj+ii+2), *(jj+ii+3)); + sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO); + DBG("LSupd: sent\n"); } void |