int
ospf_rx_hook(sock *sk, int size)
{
- DBG(" OSPF: RX_Hook called on interface ");
+ struct ospf_iface *ifa;
+ struct proto *p;
+
+ ifa=(struct ospf_iface *)(sk->data);
+
+ p=(struct proto *)(ifa->proto);
+ DBG(p->name);
+ DBG(": RX_Hook called on interface ");
DBG(sk->iface->name);
DBG(".\n");
return(1);
void
ospf_tx_hook(sock *sk)
{
- DBG(" OSPF: TX_Hook called on interface ");
+ struct ospf_iface *ifa;
+ struct proto *p;
+
+ ifa=(struct ospf_iface *)(sk->data);
+
+ p=(struct proto *)(ifa->proto);
+ DBG(p->name);
+ DBG(": TX_Hook called on interface ");
DBG(sk->iface->name);
DBG(".\n");
}
void
ospf_err_hook(sock *sk, int err)
{
- DBG(" OSPF: Err_Hook called on interface ");
+ struct ospf_iface *ifa;
+ struct proto *p;
+
+ ifa=(struct ospf_iface *)(sk->data);
+
+ p=(struct proto *)(ifa->proto);
+ DBG(p->name);
+ DBG(": Err_Hook called on interface ");
DBG(sk->iface->name);
DBG(".\n");
}
mcsk->iface=ifa->iface;
mcsk->rbsize=ifa->iface->mtu;
mcsk->tbsize=ifa->iface->mtu;
+ mcsk->data=(void *)ifa;
if(sk_open(mcsk)!=0)
{
- DBG(" OSPF: SK_OPEN: failed\n");
+ DBG(p->name);
+ DBG(": SK_OPEN: failed\n");
return(NULL);
}
- DBG(" OSPF: SK_OPEN: open\n");
+ DBG(p->name);
+ DBG(": SK_OPEN: open\n");
return(mcsk);
}
else return(NULL);
hello_timer_hook(timer *timer)
{
struct ospf_iface *ifa;
+ struct proto *p;
ifa=(struct ospf_iface *)timer->data;
- debug(" OSPF: Hello timer fired on interface %s.\n",
- ifa->iface->name);
+ p=(struct proto *)(ifa->proto);
+ debug("%s: Hello timer fired on interface %s.\n",
+ p->name, ifa->iface->name);
}
void
add_hello_timer(struct ospf_iface *ifa)
{
+ struct proto *p;
+ p=(struct proto *)(ifa->proto);
+
if(ifa->helloint==0) ifa->helloint=HELLOINT_D;
ifa->timer->hook=hello_timer_hook;
ifa->timer->recurrent=ifa->helloint;
ifa->timer->expires=0;
tm_start(ifa->timer,0);
- DBG(" OSPF: Installing hello timer.\n");
+ DBG("%s: Installing hello timer.\n", p->name);
}
void
wait_timer_hook(timer *timer)
{
struct ospf_iface *ifa;
+ struct proto *p;
ifa=(struct ospf_iface *)timer->data;
- debug(" OSPF: Wait timer fired on interface %s.\n",
- ifa->iface->name);
+ p=(struct proto *)(ifa->proto);
+ debug("%s: Wait timer fired on interface %s.\n",
+ p->name, ifa->iface->name);
if(ifa->state=OSPF_IS_WAITING)
{
/*
*/
if(ifa->priority!=0)
{
- debug(" OSPF: Changing state into DR.\n");
+ debug("%s: Changing state into DR.\n", p->name);
+
ifa->state=OSPF_IS_DR;
ifa->drip=ifa->iface->addr->ip;
/* FIXME: Set ifa->drid */
}
else
{
- debug(" OSPF: Changing state into DROTHER.\n");
+ debug("%s: Changing state into DROTHER.\n",p->name);
ifa->state=OSPF_IS_DROTHER;
}
add_hello_timer(ifa);
}
void
-add_wait_timer(struct ospf_iface *ifa,pool *pool, int wait)
+add_wait_timer(struct ospf_iface *ifa, pool *pool, int wait)
{
+ struct proto *p;
+
+ p=(struct proto *)(ifa->proto);
ifa->timer=tm_new(pool);
ifa->timer->data=ifa;
ifa->timer->randomize=1;
ifa->timer->recurrent=0;
ifa->timer->expires=0;
tm_start(ifa->timer,(wait!=0 ? wait : WAIT_D));
- DBG(" OSPF: Installing wait timer.\n");
+ DBG(p->name);
+ DBG(": Installing wait timer.\n");
}
else
{
debug(" OSPF: using interface %s.\n", iface->name);
/* FIXME: Latter I'll use config - this is incorrect */
ifa=mb_alloc(p->pool, sizeof(struct ospf_iface));
+ ifa->proto=(struct proto_ospf *)p;
ifa->iface=iface;
add_tail(&((struct proto_ospf *)p)->iface_list, NODE ifa);
ospf_iface_default(ifa);
static int
ospf_start(struct proto *p)
{
- DBG(" OSPF: Start\n");
+ DBG(p->name);
+ DBG(": Start\n");
p->if_notify=ospf_if_notify;
char areastr[20];
struct ospf_config *c = (void *) p->cf;
- DBG(" OSPF: Dump.\n");
+ DBG(p->name);
+ DBG(": Dump.\n");
debug(" -AreaID: %d\n", c->area );
}