0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-22 09:41:54 +00:00

Many %u changed into %I and dump cleanup.

This commit is contained in:
Ondrej Filip 2000-04-18 18:21:10 +00:00
parent 1508ee8b53
commit 89929e9daa
2 changed files with 11 additions and 19 deletions

View File

@ -50,49 +50,41 @@ void
ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p, ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
struct ospf_iface *ifa, int size, ip_addr faddr) struct ospf_iface *ifa, int size, ip_addr faddr)
{ {
char sip[100]; /* FIXME: Should be smaller */
u32 nrid, *pnrid; u32 nrid, *pnrid;
struct ospf_neighbor *neigh,*n; struct ospf_neighbor *neigh,*n;
u8 i,twoway; u8 i,twoway;
char *beg=": Bad OSPF hello packet from ", *rec=" received: ";
nrid=ntohl(((struct ospf_packet *)ps)->routerid); nrid=ntohl(((struct ospf_packet *)ps)->routerid);
if((unsigned)ipa_mklen(ipa_ntoh(ps->netmask))!=ifa->iface->addr->pxlen) if((unsigned)ipa_mklen(ipa_ntoh(ps->netmask))!=ifa->iface->addr->pxlen)
{ {
ip_ntop(ps->netmask,sip); log("%s%s%I%s%Ibad netmask %I.\n", p->name, beg, nrid, rec,
log("%s: Bad OSPF packet from %u received: bad netmask %s.", ipa_ntoh(ps->netmask));
p->name, nrid, sip);
log("%s: Discarding",p->name);
return; return;
} }
if(ntohs(ps->helloint)!=ifa->helloint) if(ntohs(ps->helloint)!=ifa->helloint)
{ {
log("%s: Bad OSPF packet from %u received: hello interval mismatch.", log("%s%s%I%shello interval mismatch.\n", p->name, beg, nrid, rec);
p->name, nrid);
log("%s: Discarding",p->name);
return; return;
} }
if(ntohl(ps->deadint)!=ifa->helloint*ifa->deadc) if(ntohl(ps->deadint)!=ifa->helloint*ifa->deadc)
{ {
log("%s: Bad OSPF packet from %u received: dead interval mismatch.", log("%s%s%I%sdead interval mismatch.\n", p->name, beg, nrid, rec);
p->name, nrid);
log("%s: Discarding",p->name);
return; return;
} }
if(ps->options!=ifa->options) if(ps->options!=ifa->options)
{ {
log("%s: Bad OSPF packet from %u received: options mismatch.", log("%s%s%I%soptions mismatch.\n", p->name, beg, nrid, rec);
p->name, nrid); /* FIXME: This not good */
log("%s: Discarding",p->name);
return; return;
} }
if((n=find_neigh(ifa, nrid))==NULL) if((n=find_neigh(ifa, nrid))==NULL)
{ {
log("%s: New neighbor found: %u.", p->name,nrid); log("%s: New neighbor found: %I.", p->name,nrid);
n=mb_alloc(p->pool, sizeof(struct ospf_neighbor)); n=mb_alloc(p->pool, sizeof(struct ospf_neighbor));
add_tail(&ifa->neigh_list, NODE n); add_tail(&ifa->neigh_list, NODE n);
n->rid=nrid; n->rid=nrid;
@ -135,7 +127,7 @@ ospf_hello_rx(struct ospf_hello_packet *ps, struct proto *p,
{ {
if(ntohl(*(pnrid+i))==p->cf->global->router_id) if(ntohl(*(pnrid+i))==p->cf->global->router_id)
{ {
DBG("%s: Twoway received. %u\n", p->name, nrid); DBG("%s: Twoway received from %I\n", p->name, nrid);
ospf_neigh_sm(n, INM_2WAYREC); ospf_neigh_sm(n, INM_2WAYREC);
twoway=1; twoway=1;
break; break;
@ -262,7 +254,7 @@ neighbor_timer_hook(timer *timer)
n=(struct ospf_neighbor *)timer->data; n=(struct ospf_neighbor *)timer->data;
ifa=n->ifa; ifa=n->ifa;
p=(struct proto *)(ifa->proto); p=(struct proto *)(ifa->proto);
debug("%s: Inactivity timer fired on interface %s for neighbor %u.\n", debug("%s: Inactivity timer fired on interface %s for neighbor %I.\n",
p->name, ifa->iface->name, n->rid); p->name, ifa->iface->name, n->rid);
tm_stop(n->inactim); tm_stop(n->inactim);
rfree(n->inactim); rfree(n->inactim);

View File

@ -22,7 +22,7 @@ neigh_chstate(struct ospf_neighbor *n, u8 state)
ifa=n->ifa; ifa=n->ifa;
p=(struct proto *)(ifa->proto); p=(struct proto *)(ifa->proto);
debug("%s: Neigbor '%u' changes state from \"%u\" to \"%u\".\n", debug("%s: Neigbor %I changes state from \"%u\" to \"%u\".\n",
p->name, n->rid, ospf_ns[n->state], ospf_ns[state]); p->name, n->rid, ospf_ns[n->state], ospf_ns[state]);
n->state=state; n->state=state;
} }
@ -329,7 +329,7 @@ bdr_election(struct ospf_iface *ifa, struct proto *p)
ifa->drid=ndrid; ifa->drid=ndrid;
ifa->bdrid=nbdrid; ifa->bdrid=nbdrid;
DBG("%s: DR=%u, BDR=%u\n",p->name, ifa->drid, ifa->bdrid); DBG("%s: DR=%I, BDR=%I\n",p->name, ifa->drid, ifa->bdrid);
if(myid==ifa->drid) iface_chstate(ifa, OSPF_IS_DR); if(myid==ifa->drid) iface_chstate(ifa, OSPF_IS_DR);
else else