summaryrefslogtreecommitdiff
path: root/proto/ospf/lsupd.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-03-31 00:21:41 +0000
committerOndrej Filip <feela@network.cz>2000-03-31 00:21:41 +0000
commitf45fd3164bf2f9342e12e867f8d68c7fc77d3177 (patch)
tree647d271be15eb20a1228db8507e8b73df84e7c25 /proto/ospf/lsupd.c
parent14a7921c83f0ecfc8793b3a38e4ac16ae9bd75d3 (diff)
Sending of lspd as responce to lsreq done.
Diffstat (limited to 'proto/ospf/lsupd.c')
-rw-r--r--proto/ospf/lsupd.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/proto/ospf/lsupd.c b/proto/ospf/lsupd.c
index 5f533113..515626bd 100644
--- a/proto/ospf/lsupd.c
+++ b/proto/ospf/lsupd.c
@@ -14,6 +14,54 @@ ospf_lsupd_tx(struct ospf_neighbor *n)
/* FIXME Go on! */
}
+void /* I send all I received in LSREQ */
+ospf_lsupd_tx_list(struct ospf_neighbor *n, list *l)
+{
+ struct l_lsr_head *llsh;
+ u16 len;
+ u32 lsano;
+ struct top_hash_entry *en;
+ struct ospf_lsupd_packet *pk;
+ struct ospf_packet *op;
+ void *pktpos;
+
+ if(HEAD(*l)==NULL) return;
+
+ pk=(struct ospf_lsupd_packet *)n->ifa->ip_sk->tbuf;
+ op=(struct ospf_packet *)n->ifa->ip_sk->tbuf;
+
+ fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
+ len=SIPH+sizeof(struct ospf_lsupd_packet);
+ lsano=0;
+ pktpos=(pk+1);
+
+ 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)
+ {
+ pk->lsano=htonl(lsano);
+ op->length=htons(len);
+ ospf_pkt_finalize(n->ifa, op);
+ sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
+
+ fill_ospf_pkt_hdr(n->ifa, pk, LSUPD);
+ len=SIPH+sizeof(struct ospf_lsupd_packet);
+ lsano=0;
+ pktpos=(pk+1);
+ }
+ 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);
+ }
+ pk->lsano=htonl(lsano);
+ op->length=htons(len);
+ ospf_pkt_finalize(n->ifa, op);
+ sk_send_to(n->ifa->ip_sk,len, n->ip, OSPF_PROTO);
+}
+
void
ospf_lsupd_rx(struct ospf_lsupd_packet *ps, struct proto *p,
struct ospf_iface *ifa, u16 size)