bird/proto/ospf/lsack.c

70 lines
1.4 KiB
C
Raw Normal View History

2000-03-31 04:00:42 +08:00
/*
* BIRD -- OSPF
*
* (c) 2000 Ondrej Filip <feela@network.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include "ospf.h"
void
ospf_lsack_tx(struct ospf_neighbor *n)
{
/* FIXME Go on! */
}
void
ospf_lsack_rx(struct ospf_lsack_packet *ps, struct proto *p,
struct ospf_iface *ifa, u16 size)
{
u32 nrid, myrid;
struct ospf_neighbor *n;
2000-04-12 23:20:13 +08:00
struct ospf_lsa_header lsa,*plsa;
2000-03-31 04:00:42 +08:00
int length;
2000-04-12 23:20:13 +08:00
u16 nolsa,i;
struct top_hash_entry *en;
2000-03-31 04:00:42 +08:00
nrid=ntohl(ps->ospf_packet.routerid);
myrid=p->cf->global->router_id;
if((n=find_neigh(ifa, nrid))==NULL)
{
2000-04-12 23:37:52 +08:00
debug("%s: Received lsack from unknown neigbor! (%I)\n", p->name,
2000-03-31 04:00:42 +08:00
nrid);
return ;
}
2000-04-12 23:37:52 +08:00
if(n->state<NEIGHBOR_EXCHANGE) return;
2000-04-12 23:20:13 +08:00
nolsa=(ntohs(ps->ospf_packet.length)-sizeof(struct ospf_lsack_packet))/
sizeof(struct ospf_lsa_header);
2000-04-12 23:37:52 +08:00
DBG("Received %d lsa ack(s)\n",nolsa);
2000-04-12 23:20:13 +08:00
plsa=( struct ospf_lsa_header *)(ps+1);
for(i=0;i<nolsa;i++)
{
ntohlsah(plsa+i,&lsa);
if((en=ospf_hash_find_header(n->lsrth,&lsa))==NULL) continue;
if(lsa_comp(&lsa,&en->lsa)!=CMP_SAME)
{
log("Strange LS acknoledgement from %d\n",n->rid);
continue;
}
2000-04-12 23:37:52 +08:00
DBG("Deleting LS Id: %I RT: %I Type: %u from LS Retl for neighbor %I\n",
2000-04-12 23:20:13 +08:00
lsa.id,lsa.rt,lsa.type,n->rid);
s_rem_node(SNODE en);
ospf_hash_delete(n->lsrth,en);
}
2000-03-31 04:00:42 +08:00
}
2000-04-04 08:32:17 +08:00
void
add_ack_list(struct ospf_neighbor *n,struct ospf_lsa_header *lsa)
{
/* FIXME Go on */
}