Cleanup in packet.c. Deleted unused parameters.
This commit is contained in:
parent
d5d9693ce9
commit
5e3436d20f
11 changed files with 72 additions and 114 deletions
|
@ -182,26 +182,11 @@ ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct ospf_neighbor *n)
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
|
ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size)
|
struct ospf_iface *ifa, struct ospf_neighbor *n)
|
||||||
{
|
{
|
||||||
struct proto *p = (struct proto *) ifa->proto;
|
struct proto *p = (struct proto *) ifa->proto;
|
||||||
u32 nrid, myrid = p->cf->global->router_id;
|
u32 myrid = p->cf->global->router_id;
|
||||||
struct ospf_neighbor *n;
|
unsigned int size = ntohs(ps->ospf_packet.length);
|
||||||
|
|
||||||
nrid = ntohl(((struct ospf_packet *) ps)->routerid);
|
|
||||||
|
|
||||||
|
|
||||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
|
||||||
{
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received dbdes from unknown neigbor! %I.", nrid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ifa->iface->mtu < size)
|
|
||||||
{
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received dbdes larger than MTU from %I!", n->ip);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received dbdes from %I via %s.", n->ip,
|
OSPF_TRACE(D_PACKETS, "Received dbdes from %I via %s.", n->ip,
|
||||||
ifa->iface->name);
|
ifa->iface->name);
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
|
|
||||||
void ospf_dbdes_send(struct ospf_neighbor *n);
|
void ospf_dbdes_send(struct ospf_neighbor *n);
|
||||||
void ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
|
void ospf_dbdes_receive(struct ospf_dbdes_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size);
|
struct ospf_iface *ifa, struct ospf_neighbor *n);
|
||||||
|
|
||||||
#endif /* _BIRD_OSPF_DBDES_H_ */
|
#endif /* _BIRD_OSPF_DBDES_H_ */
|
||||||
|
|
|
@ -10,18 +10,14 @@
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_hello_receive(struct ospf_hello_packet *ps,
|
ospf_hello_receive(struct ospf_hello_packet *ps,
|
||||||
struct ospf_iface *ifa, int size, ip_addr faddr)
|
struct ospf_iface *ifa, struct ospf_neighbor *n, ip_addr faddr)
|
||||||
{
|
{
|
||||||
u32 nrid, *pnrid;
|
u32 *pnrid;
|
||||||
struct ospf_neighbor *n;
|
|
||||||
u8 i, twoway, oldpriority;
|
|
||||||
ip_addr olddr, oldbdr;
|
ip_addr olddr, oldbdr;
|
||||||
ip_addr mask;
|
ip_addr mask;
|
||||||
char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
|
char *beg = "Bad OSPF hello packet from ", *rec = " received: ";
|
||||||
int eligible = 0;
|
|
||||||
struct proto *p = (struct proto *) ifa->proto;
|
struct proto *p = (struct proto *) ifa->proto;
|
||||||
|
unsigned int size = ntohs(ps->ospf_packet.length), i, twoway, oldpriority, eligible = 0;
|
||||||
nrid = ntohl(((struct ospf_packet *) ps)->routerid);
|
|
||||||
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received hello from %I via %s", faddr,
|
OSPF_TRACE(D_PACKETS, "Received hello from %I via %s", faddr,
|
||||||
ifa->iface->name);
|
ifa->iface->name);
|
||||||
|
@ -30,7 +26,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
|
||||||
|
|
||||||
if ((unsigned) ipa_mklen(mask) != ifa->iface->addr->pxlen)
|
if ((unsigned) ipa_mklen(mask) != ifa->iface->addr->pxlen)
|
||||||
{
|
{
|
||||||
log(L_ERR, "%s%I%sbad netmask %I.", beg, nrid, rec, mask);
|
log(L_ERR "%s%I%sbad netmask %I.", beg, faddr, rec, mask);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +50,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
if (!n)
|
||||||
{
|
{
|
||||||
if ((ifa->type == OSPF_IT_NBMA))
|
if ((ifa->type == OSPF_IT_NBMA))
|
||||||
{
|
{
|
||||||
|
@ -92,7 +88,7 @@ ospf_hello_receive(struct ospf_hello_packet *ps,
|
||||||
|
|
||||||
n = ospf_neighbor_new(ifa);
|
n = ospf_neighbor_new(ifa);
|
||||||
|
|
||||||
n->rid = nrid;
|
n->rid = ntohl(((struct ospf_packet *) ps)->routerid);
|
||||||
n->ip = faddr;
|
n->ip = faddr;
|
||||||
n->dr = ps->dr;
|
n->dr = ps->dr;
|
||||||
ipa_ntoh(n->dr);
|
ipa_ntoh(n->dr);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#define _BIRD_OSPF_HELLO_H_
|
#define _BIRD_OSPF_HELLO_H_
|
||||||
|
|
||||||
void ospf_hello_receive(struct ospf_hello_packet *ps,
|
void ospf_hello_receive(struct ospf_hello_packet *ps,
|
||||||
struct ospf_iface *ifa, int size, ip_addr faddr);
|
struct ospf_iface *ifa, struct ospf_neighbor *n, ip_addr faddr);
|
||||||
void ospf_hello_send(timer * timer, int poll, struct ospf_neighbor *dirn);
|
void ospf_hello_send(timer *timer, int poll, struct ospf_neighbor *dirn);
|
||||||
|
|
||||||
#endif /* _BIRD_OSPF_HELLO_H_ */
|
#endif /* _BIRD_OSPF_HELLO_H_ */
|
||||||
|
|
|
@ -119,25 +119,13 @@ ospf_lsack_send(struct ospf_neighbor *n, int queue)
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_lsack_receive(struct ospf_lsack_packet *ps,
|
ospf_lsack_receive(struct ospf_lsack_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size)
|
struct ospf_iface *ifa, struct ospf_neighbor *n)
|
||||||
{
|
{
|
||||||
u32 nrid, myrid;
|
|
||||||
struct ospf_neighbor *n;
|
|
||||||
struct ospf_lsa_header lsa, *plsa;
|
struct ospf_lsa_header lsa, *plsa;
|
||||||
u16 nolsa, i;
|
u16 nolsa;
|
||||||
struct top_hash_entry *en;
|
struct top_hash_entry *en;
|
||||||
u16 lenn = ntohs(ps->ospf_packet.length);
|
|
||||||
struct proto *p = (struct proto *) ifa->proto;
|
struct proto *p = (struct proto *) ifa->proto;
|
||||||
|
unsigned int size = ntohs(ps->ospf_packet.length), i;
|
||||||
nrid = ntohl(ps->ospf_packet.routerid);
|
|
||||||
|
|
||||||
myrid = p->cf->global->router_id;
|
|
||||||
|
|
||||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
|
||||||
{
|
|
||||||
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_TRACE(D_PACKETS, "Received LS ack from %I", n->ip);
|
||||||
ospf_neigh_sm(n, INM_HELLOREC);
|
ospf_neigh_sm(n, INM_HELLOREC);
|
||||||
|
@ -145,10 +133,10 @@ ospf_lsack_receive(struct ospf_lsack_packet *ps,
|
||||||
if (n->state < NEIGHBOR_EXCHANGE)
|
if (n->state < NEIGHBOR_EXCHANGE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nolsa = (lenn - sizeof(struct ospf_lsack_packet)) /
|
nolsa = (size - sizeof(struct ospf_lsack_packet)) /
|
||||||
sizeof(struct ospf_lsa_header);
|
sizeof(struct ospf_lsa_header);
|
||||||
|
|
||||||
if ((nolsa < 1) || ((lenn - sizeof(struct ospf_lsack_packet)) !=
|
if ((nolsa < 1) || ((size - sizeof(struct ospf_lsack_packet)) !=
|
||||||
(nolsa * sizeof(struct ospf_lsa_header))))
|
(nolsa * sizeof(struct ospf_lsa_header))))
|
||||||
{
|
{
|
||||||
log(L_ERR "Received corrupted LS ack from %I", n->ip);
|
log(L_ERR "Received corrupted LS ack from %I", n->ip);
|
||||||
|
|
|
@ -17,7 +17,7 @@ struct lsah_n
|
||||||
};
|
};
|
||||||
|
|
||||||
void ospf_lsack_receive(struct ospf_lsack_packet *ps,
|
void ospf_lsack_receive(struct ospf_lsack_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size);
|
struct ospf_iface *ifa, struct ospf_neighbor *n);
|
||||||
void ospf_lsack_send(struct ospf_neighbor *n, int queue);
|
void ospf_lsack_send(struct ospf_neighbor *n, int queue);
|
||||||
void ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
|
void ospf_lsack_enqueue(struct ospf_neighbor *n, struct ospf_lsa_header *h,
|
||||||
int queue);
|
int queue);
|
||||||
|
|
|
@ -66,36 +66,27 @@ ospf_lsreq_send(struct ospf_neighbor *n)
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
|
ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size)
|
struct ospf_iface *ifa, struct ospf_neighbor *n)
|
||||||
{
|
{
|
||||||
u32 nrid;
|
|
||||||
struct ospf_neighbor *n;
|
|
||||||
struct ospf_lsreq_header *lsh;
|
struct ospf_lsreq_header *lsh;
|
||||||
struct l_lsr_head *llsh;
|
struct l_lsr_head *llsh;
|
||||||
list uplist;
|
list uplist;
|
||||||
slab *upslab;
|
slab *upslab;
|
||||||
int length, i, lsano;
|
unsigned int size = ntohs(ps->ospf_packet.length);
|
||||||
|
int i, lsano;
|
||||||
struct proto *p = (struct proto *) ifa->proto;
|
struct proto *p = (struct proto *) ifa->proto;
|
||||||
|
|
||||||
nrid = ntohl(ps->ospf_packet.routerid);
|
|
||||||
|
|
||||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
|
||||||
{
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received lsreq from unknown neighbor! (%I)", nrid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (n->state < NEIGHBOR_EXCHANGE)
|
if (n->state < NEIGHBOR_EXCHANGE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
OSPF_TRACE(D_EVENTS, "Received LS req from neighbor: %I", n->ip);
|
OSPF_TRACE(D_EVENTS, "Received LS req from neighbor: %I", n->ip);
|
||||||
ospf_neigh_sm(n, INM_HELLOREC);
|
ospf_neigh_sm(n, INM_HELLOREC);
|
||||||
|
|
||||||
length = ntohs(ps->ospf_packet.length);
|
|
||||||
lsh = (void *) (ps + 1);
|
lsh = (void *) (ps + 1);
|
||||||
init_list(&uplist);
|
init_list(&uplist);
|
||||||
upslab = sl_new(n->pool, sizeof(struct l_lsr_head));
|
upslab = sl_new(n->pool, sizeof(struct l_lsr_head));
|
||||||
|
|
||||||
lsano = (length - sizeof(struct ospf_lsreq_packet)) /
|
lsano = (size - sizeof(struct ospf_lsreq_packet)) /
|
||||||
sizeof(struct ospf_lsreq_header);
|
sizeof(struct ospf_lsreq_header);
|
||||||
for (i = 0; i < lsano; lsh++, i++)
|
for (i = 0; i < lsano; lsh++, i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,6 +12,6 @@
|
||||||
|
|
||||||
void ospf_lsreq_send(struct ospf_neighbor *n);
|
void ospf_lsreq_send(struct ospf_neighbor *n);
|
||||||
void ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
|
void ospf_lsreq_receive(struct ospf_lsreq_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size);
|
struct ospf_iface *ifa, struct ospf_neighbor *n);
|
||||||
|
|
||||||
#endif /* _BIRD_OSPF_LSREQ_H_ */
|
#endif /* _BIRD_OSPF_LSREQ_H_ */
|
||||||
|
|
|
@ -283,24 +283,15 @@ ospf_lsupd_send_list(struct ospf_neighbor *n, list * l)
|
||||||
|
|
||||||
void
|
void
|
||||||
ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
|
ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size)
|
struct ospf_iface *ifa, struct ospf_neighbor *n)
|
||||||
{
|
{
|
||||||
u32 area, nrid;
|
u32 area;
|
||||||
struct ospf_neighbor *n, *ntmp;
|
struct ospf_neighbor *ntmp;
|
||||||
struct ospf_lsa_header *lsa;
|
struct ospf_lsa_header *lsa;
|
||||||
struct ospf_area *oa;
|
struct ospf_area *oa;
|
||||||
struct proto_ospf *po = ifa->proto;
|
struct proto_ospf *po = ifa->proto;
|
||||||
struct proto *p = (struct proto *) po;
|
struct proto *p = (struct proto *) po;
|
||||||
u8 i;
|
unsigned int i, sendreq = 1, size = ntohs(ps->ospf_packet.length);
|
||||||
int sendreq = 1;
|
|
||||||
|
|
||||||
nrid = ntohl(ps->ospf_packet.routerid);
|
|
||||||
|
|
||||||
if ((n = find_neigh(ifa, nrid)) == NULL)
|
|
||||||
{
|
|
||||||
OSPF_TRACE(D_PACKETS, "Received lsupd from unknown neighbor! (%I)", nrid);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n->state < NEIGHBOR_EXCHANGE)
|
if (n->state < NEIGHBOR_EXCHANGE)
|
||||||
{
|
{
|
||||||
|
@ -329,8 +320,8 @@ ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
|
||||||
{
|
{
|
||||||
struct ospf_lsa_header lsatmp;
|
struct ospf_lsa_header lsatmp;
|
||||||
struct top_hash_entry *lsadb;
|
struct top_hash_entry *lsadb;
|
||||||
int diff = ((u8 *) lsa) - ((u8 *) ps);
|
unsigned diff = ((u8 *) lsa) - ((u8 *) ps), lenn = ntohs(lsa->length);
|
||||||
u16 chsum, lenn = ntohs(lsa->length);
|
u16 chsum;
|
||||||
|
|
||||||
if (((diff + sizeof(struct ospf_lsa_header)) >= size)
|
if (((diff + sizeof(struct ospf_lsa_header)) >= size)
|
||||||
|| ((lenn + diff) > size))
|
|| ((lenn + diff) > size))
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
void ospf_lsupd_send_list(struct ospf_neighbor *n, list * l);
|
void ospf_lsupd_send_list(struct ospf_neighbor *n, list * l);
|
||||||
void ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
|
void ospf_lsupd_receive(struct ospf_lsupd_packet *ps,
|
||||||
struct ospf_iface *ifa, u16 size);
|
struct ospf_iface *ifa, struct ospf_neighbor *n);
|
||||||
int ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
|
int ospf_lsupd_flood(struct ospf_neighbor *n, struct ospf_lsa_header *hn,
|
||||||
struct ospf_lsa_header *hh, struct ospf_iface *iff,
|
struct ospf_lsa_header *hh, struct ospf_iface *iff,
|
||||||
struct ospf_area *oa, int rtl);
|
struct ospf_area *oa, int rtl);
|
||||||
|
|
|
@ -84,6 +84,8 @@ ospf_rx_hook(sock * sk, int size)
|
||||||
struct ospf_packet *ps;
|
struct ospf_packet *ps;
|
||||||
struct ospf_iface *ifa = (struct ospf_iface *) (sk->data);
|
struct ospf_iface *ifa = (struct ospf_iface *) (sk->data);
|
||||||
struct proto *p = (struct proto *) (ifa->proto);
|
struct proto *p = (struct proto *) (ifa->proto);
|
||||||
|
struct ospf_neighbor *n;
|
||||||
|
char *mesg = "Bad OSPF packet from ";
|
||||||
|
|
||||||
if (ifa->stub)
|
if (ifa->stub)
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -93,65 +95,71 @@ ospf_rx_hook(sock * sk, int size)
|
||||||
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
|
ps = (struct ospf_packet *) ipv4_skip_header(sk->rbuf, &size);
|
||||||
if (ps == NULL)
|
if (ps == NULL)
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: bad IP header", p->name);
|
log(L_ERR "%s%I - bad IP header", mesg, sk->faddr);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((unsigned) size < sizeof(struct ospf_packet))
|
if ((unsigned) size < sizeof(struct ospf_packet))
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: too short (%u bytes)", p->name, size);
|
log(L_ERR "%s%I - too short (%u bytes)", mesg, sk->faddr, size);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ntohs(ps->length) != size) || (size != (4 * (size / 4))))
|
if ((ntohs(ps->length) != size) || (size != (4 * (size / 4))))
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: size field does not match", p->name);
|
log(L_ERR "%s%I - size field does not match", mesg, sk->faddr);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ps->version != OSPF_VERSION)
|
if (ps->version != OSPF_VERSION)
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: version %u", p->name, ps->version);
|
log(L_ERR "%s%I - version %u", mesg, sk->faddr, ps->version);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipsum_verify(ps, 16, (void *) ps + sizeof(struct ospf_packet),
|
if (!ipsum_verify(ps, 16, (void *) ps + sizeof(struct ospf_packet),
|
||||||
ntohs(ps->length) - sizeof(struct ospf_packet), NULL))
|
ntohs(ps->length) - sizeof(struct ospf_packet), NULL))
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: bad checksum", p->name);
|
log(L_ERR "%s%I - bad checksum", mesg, sk->faddr);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ospf_rx_authenticate(ifa, ps))
|
if (!ospf_rx_authenticate(ifa, ps))
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: bad password", p->name);
|
log(L_ERR "%s%I - bad password", mesg, sk->faddr);
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(ps->areaid) != ifa->an)
|
if (ntohl(ps->areaid) != ifa->an)
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: other area %ld", p->name, ps->areaid);
|
log(L_ERR "%s%I - other area %ld", mesg, sk->faddr, ps->areaid);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(ps->routerid) == p->cf->global->router_id)
|
if (ntohl(ps->routerid) == p->cf->global->router_id)
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: received my own router ID!", p->name);
|
log(L_ERR "%s%I - received my own router ID!", mesg, sk->faddr);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ntohl(ps->routerid) == 0)
|
if (ntohl(ps->routerid) == 0)
|
||||||
{
|
{
|
||||||
log("%s: Bad OSPF packet received: Id 0.0.0.0 is not allowed.", p->name);
|
log(L_ERR "%s%I - router id = 0.0.0.0", mesg, sk->faddr);
|
||||||
log("%s: Discarding", p->name);
|
return 1;
|
||||||
return (1);
|
}
|
||||||
|
|
||||||
|
if ((unsigned) size > ifa->iface->mtu)
|
||||||
|
{
|
||||||
|
log(L_ERR "%s%I - received larger packet than MTU", mesg, sk->faddr);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
n = find_neigh(ifa, ntohl(((struct ospf_packet *) ps)->routerid));
|
||||||
|
|
||||||
|
if(!n && (ps->type != HELLO_P))
|
||||||
|
{
|
||||||
|
OSPF_TRACE(D_PACKETS, "Received non-hello packet from uknown neighbor (%I)", sk->faddr);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump packet
|
/* Dump packet
|
||||||
|
@ -166,30 +174,29 @@ ospf_rx_hook(sock * sk, int size)
|
||||||
{
|
{
|
||||||
case HELLO_P:
|
case HELLO_P:
|
||||||
DBG("%s: Hello received.\n", p->name);
|
DBG("%s: Hello received.\n", p->name);
|
||||||
ospf_hello_receive((struct ospf_hello_packet *) ps, ifa, size, sk->faddr);
|
ospf_hello_receive((struct ospf_hello_packet *) ps, ifa, n, sk->faddr);
|
||||||
break;
|
break;
|
||||||
case DBDES_P:
|
case DBDES_P:
|
||||||
DBG("%s: Database description received.\n", p->name);
|
DBG("%s: Database description received.\n", p->name);
|
||||||
ospf_dbdes_receive((struct ospf_dbdes_packet *) ps, ifa, size);
|
ospf_dbdes_receive((struct ospf_dbdes_packet *) ps, ifa, n);
|
||||||
break;
|
break;
|
||||||
case LSREQ_P:
|
case LSREQ_P:
|
||||||
DBG("%s: Link state request received.\n", p->name);
|
DBG("%s: Link state request received.\n", p->name);
|
||||||
ospf_lsreq_receive((struct ospf_lsreq_packet *) ps, ifa, size);
|
ospf_lsreq_receive((struct ospf_lsreq_packet *) ps, ifa, n);
|
||||||
break;
|
break;
|
||||||
case LSUPD_P:
|
case LSUPD_P:
|
||||||
DBG("%s: Link state update received.\n", p->name);
|
DBG("%s: Link state update received.\n", p->name);
|
||||||
ospf_lsupd_receive((struct ospf_lsupd_packet *) ps, ifa, size);
|
ospf_lsupd_receive((struct ospf_lsupd_packet *) ps, ifa, n);
|
||||||
break;
|
break;
|
||||||
case LSACK_P:
|
case LSACK_P:
|
||||||
DBG("%s: Link state ack received.\n", p->name);
|
DBG("%s: Link state ack received.\n", p->name);
|
||||||
ospf_lsack_receive((struct ospf_lsack_packet *) ps, ifa, size);
|
ospf_lsack_receive((struct ospf_lsack_packet *) ps, ifa, n);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log("%s: Bad packet received: wrong type %u", p->name, ps->type);
|
log(L_ERR "%s%I - wrong type %u", mesg, sk->faddr, ps->type);
|
||||||
log("%s: Discarding\n", p->name);
|
return 1;
|
||||||
return (1);
|
|
||||||
};
|
};
|
||||||
return (1);
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue