Indented. No other change.
This commit is contained in:
parent
c76ba51a5f
commit
fb9bf6888c
2 changed files with 84 additions and 86 deletions
|
@ -15,6 +15,7 @@ char *s_queue[]={ "direct", "delayed" };
|
|||
* Note, that h is in network endianity!
|
||||
* =====================================
|
||||
*/
|
||||
|
||||
void
|
||||
ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
|
||||
struct proto *p, int queue)
|
||||
|
@ -24,8 +25,8 @@ ospf_lsack_enqueue(struct ospf_neighbor *n,struct ospf_lsa_header *h,
|
|||
no = mb_alloc(n->pool, sizeof(struct lsah_n));
|
||||
memcpy(&no->lsa, h, sizeof(struct ospf_lsa_header));
|
||||
add_tail(&n->ackl[queue], NODE no);
|
||||
DBG("Adding (%s) ack for %I, ID: %I, RT: %I, Type: %u\n", s_queue[queue], n->rid,
|
||||
ntohl(h->id), ntohl(h->rt),h->type);
|
||||
DBG("Adding (%s) ack for %I, ID: %I, RT: %I, Type: %u\n", s_queue[queue],
|
||||
n->rid, ntohl(h->id), ntohl(h->rt), h->type);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -40,18 +41,15 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
|
|||
struct ospf_iface *ifa = n->ifa;
|
||||
struct proto *p = &n->ifa->proto->proto;
|
||||
|
||||
if(EMPTY_LIST(n->ackl[queue])) return;
|
||||
if (EMPTY_LIST(n->ackl[queue]))
|
||||
return;
|
||||
|
||||
OSPF_TRACE(D_PACKETS, "LS ack sent to %I (%s)", n->ip, s_queue[queue]);
|
||||
|
||||
if (ifa->type == OSPF_IT_BCAST)
|
||||
{
|
||||
sk = ifa->hello_sk;
|
||||
}
|
||||
else
|
||||
{
|
||||
sk = ifa->ip_sk;
|
||||
}
|
||||
|
||||
pk = (struct ospf_lsack_packet *) sk->tbuf;
|
||||
op = (struct ospf_packet *) sk->tbuf;
|
||||
|
@ -68,37 +66,31 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
|
|||
ntohl((h + i)->rt), (h + i)->type);
|
||||
rem_node(NODE no);
|
||||
mb_free(no);
|
||||
if((i*sizeof(struct ospf_lsa_header)+sizeof(struct ospf_lsack_packet)+SIPH)>
|
||||
n->ifa->iface->mtu)
|
||||
if ((i * sizeof(struct ospf_lsa_header) +
|
||||
sizeof(struct ospf_lsack_packet) + SIPH) > n->ifa->iface->mtu)
|
||||
{
|
||||
if (!EMPTY_LIST(n->ackl[queue]))
|
||||
{
|
||||
len=sizeof(struct ospf_lsack_packet)+i*sizeof(struct ospf_lsa_header);
|
||||
len =
|
||||
sizeof(struct ospf_lsack_packet) +
|
||||
i * sizeof(struct ospf_lsa_header);
|
||||
op->length = htons(len);
|
||||
ospf_pkt_finalize(n->ifa, op);
|
||||
DBG("Sending and continuing! Len=%u\n", len);
|
||||
if (ifa->type == OSPF_IT_BCAST)
|
||||
{
|
||||
if ((ifa->state == OSPF_IS_DR) || (ifa->state == OSPF_IS_BACKUP))
|
||||
{
|
||||
sk_send_to(sk, len, AllSPFRouters, OSPF_PROTO);
|
||||
}
|
||||
else
|
||||
{
|
||||
sk_send_to(sk, len, AllDRouters, OSPF_PROTO);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((ifa->state == OSPF_IS_DR) || (ifa->state == OSPF_IS_BACKUP))
|
||||
{
|
||||
sk_send_to_agt(sk, len, ifa, NEIGHBOR_EXCHANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
sk_send_to_bdr(sk, len, ifa);
|
||||
}
|
||||
}
|
||||
|
||||
fill_ospf_pkt_hdr(n->ifa, pk, LSACK_P);
|
||||
i = 0;
|
||||
|
@ -145,15 +137,15 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps, struct proto *p,
|
|||
|
||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
||||
{
|
||||
OSPF_TRACE(D_PACKETS, "Received LS ack from unknown neigbor! (%I)",
|
||||
nrid);
|
||||
OSPF_TRACE(D_PACKETS, "Received LS ack from unknown neigbor! (%I)", nrid);
|
||||
return;
|
||||
}
|
||||
|
||||
OSPF_TRACE(D_PACKETS, "Received LS ack from %I", n->ip);
|
||||
ospf_neigh_sm(n, INM_HELLOREC);
|
||||
|
||||
if(n->state<NEIGHBOR_EXCHANGE) return;
|
||||
if (n->state < NEIGHBOR_EXCHANGE)
|
||||
return;
|
||||
|
||||
nolsa = (lenn - sizeof(struct ospf_lsack_packet)) /
|
||||
sizeof(struct ospf_lsa_header);
|
||||
|
@ -170,11 +162,13 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps, struct proto *p,
|
|||
for (i = 0; i < nolsa; i++)
|
||||
{
|
||||
ntohlsah(plsa + i, &lsa);
|
||||
if((en=ospf_hash_find_header(n->lsrth,&lsa))==NULL) continue;
|
||||
if ((en = ospf_hash_find_header(n->lsrth, &lsa)) == NULL)
|
||||
continue;
|
||||
|
||||
if (lsa_comp(&lsa, &en->lsa) != CMP_SAME)
|
||||
{
|
||||
if((lsa.sn==LSA_MAXSEQNO)&&(lsa.age==LSA_MAXAGE)) continue;
|
||||
if ((lsa.sn == LSA_MAXSEQNO) && (lsa.age == LSA_MAXAGE))
|
||||
continue;
|
||||
|
||||
OSPF_TRACE(D_PACKETS, "Strange LS acknoledgement from %I", n->ip);
|
||||
OSPF_TRACE(D_PACKETS, "Id: %I, Rt: %I, Type: %u",
|
||||
|
@ -189,7 +183,8 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps, struct proto *p,
|
|||
DBG("Deleting LS Id: %I RT: %I Type: %u from LS Retl for neighbor %I\n",
|
||||
lsa.id, lsa.rt, lsa.type, n->rid);
|
||||
s_rem_node(SNODE en);
|
||||
if(en->lsa_body!=NULL) mb_free(en->lsa_body);
|
||||
if (en->lsa_body != NULL)
|
||||
mb_free(en->lsa_body);
|
||||
en->lsa_body = NULL;
|
||||
ospf_hash_delete(n->lsrth, en);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
|
||||
#ifndef _BIRD_OSPF_LSACK_H_
|
||||
#define _BIRD_OSPF_LSACK_H_
|
||||
struct lsah_n {
|
||||
|
||||
struct lsah_n
|
||||
{
|
||||
node n;
|
||||
struct ospf_lsa_header lsa;
|
||||
};
|
||||
|
@ -19,4 +21,5 @@ void ospf_lsack_receive(struct ospf_lsack_packet *ps, struct proto *p,
|
|||
void ospf_lsack_send(struct ospf_neighbor *n, int queue);
|
||||
void ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
|
||||
struct proto *p, int queue);
|
||||
|
||||
#endif /* _BIRD_OSPF_LSACK_H_ */
|
||||
|
|
Loading…
Reference in a new issue