Cleanup, mostly debugging messages.
This commit is contained in:
parent
abf2be7d0c
commit
856b87d1e4
1 changed files with 14 additions and 28 deletions
|
@ -5,6 +5,8 @@
|
||||||
*
|
*
|
||||||
* Can be freely distributed and used under the terms of the GNU GPL.
|
* Can be freely distributed and used under the terms of the GNU GPL.
|
||||||
*
|
*
|
||||||
|
FIXME: lock interface so we are not started twice on same interface.
|
||||||
|
|
||||||
FIXME: IpV6 support: packet size
|
FIXME: IpV6 support: packet size
|
||||||
FIXME: IpV6 support: use right address for broadcasts
|
FIXME: IpV6 support: use right address for broadcasts
|
||||||
FIXME: IpV6 support: receive "route using" blocks
|
FIXME: IpV6 support: receive "route using" blocks
|
||||||
|
@ -12,7 +14,7 @@
|
||||||
FIXME (nonurgent): fold rip_connection into rip_interface?
|
FIXME (nonurgent): fold rip_connection into rip_interface?
|
||||||
|
|
||||||
We are not going to honour requests for sending part of
|
We are not going to honour requests for sending part of
|
||||||
routing table. That would need to turn split horizont off,
|
routing table. That would need to turn split horizon off,
|
||||||
etc.
|
etc.
|
||||||
|
|
||||||
Triggered updates. When triggered update was sent, don't send
|
Triggered updates. When triggered update was sent, don't send
|
||||||
|
@ -50,15 +52,6 @@
|
||||||
|
|
||||||
static struct rip_interface *new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_patt *patt);
|
static struct rip_interface *new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_patt *patt);
|
||||||
|
|
||||||
static void
|
|
||||||
rip_reply(struct proto *p)
|
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
P->listen->tbuf = "ACK!";
|
|
||||||
sk_send_to( P->listen, 5, P->listen->faddr, P->listen->fport );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#define P_NAME p->name
|
#define P_NAME p->name
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -106,8 +99,8 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
|
||||||
b->pxlen = e->n.pxlen;
|
b->pxlen = e->n.pxlen;
|
||||||
#endif
|
#endif
|
||||||
b->metric = htonl( e->metric );
|
b->metric = htonl( e->metric );
|
||||||
if (ipa_equal(e->whotoldme, daddr)) { /* FIXME: ouch, daddr is some kind of broadcast address. How am I expected to do split horizont?!?!? */
|
if (ipa_equal(e->whotoldme, daddr)) { /* FIXME: ouch, daddr is some kind of broadcast address. How am I expected to do split horizon?!?!? */
|
||||||
DBG( "(split horizont)" );
|
DBG( "(split horizon)" );
|
||||||
b->metric = htonl( P_CF->infinity );
|
b->metric = htonl( P_CF->infinity );
|
||||||
}
|
}
|
||||||
ipa_hton( b->network );
|
ipa_hton( b->network );
|
||||||
|
@ -313,7 +306,7 @@ process_block( struct proto *p, struct rip_block *block, ip_addr whotoldme )
|
||||||
advertise_entry( p, block, whotoldme );
|
advertise_entry( p, block, whotoldme );
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BAD( x ) { log( L_WARN "RIP/%s: " x, P_NAME ); return 1; }
|
#define BAD( x ) { log( L_REMOTE "%s: " x, P_NAME ); return 1; }
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr whotoldme, int port )
|
rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr whotoldme, int port )
|
||||||
|
@ -330,11 +323,11 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
|
||||||
switch( packet->heading.command ) {
|
switch( packet->heading.command ) {
|
||||||
case RIPCMD_REQUEST: DBG( "Asked to send my routing table\n" );
|
case RIPCMD_REQUEST: DBG( "Asked to send my routing table\n" );
|
||||||
if (P_CF->honour == HO_NEVER) {
|
if (P_CF->honour == HO_NEVER) {
|
||||||
log( L_WARN "They asked me to send routing table, but I was told not to do it\n" );
|
log( L_REMOTE "They asked me to send routing table, but I was told not to do it" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if ((P_CF->honour == HO_NEIGHBOUR) && (!neigh_find( p, &whotoldme, 0 ))) {
|
if ((P_CF->honour == HO_NEIGHBOUR) && (!neigh_find( p, &whotoldme, 0 ))) {
|
||||||
log( L_WARN "They asked me to send routing table, but he is not my neighbour\n" );
|
log( L_REMOTE "They asked me to send routing table, but he is not my neighbour" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
rip_sendto( p, whotoldme, port, HEAD(P->interfaces) ); /* no broadcast */
|
rip_sendto( p, whotoldme, port, HEAD(P->interfaces) ); /* no broadcast */
|
||||||
|
@ -386,7 +379,6 @@ rip_process_packet( struct proto *p, struct rip_packet *packet, int num, ip_addr
|
||||||
default: BAD( "Unknown command" );
|
default: BAD( "Unknown command" );
|
||||||
}
|
}
|
||||||
|
|
||||||
rip_reply(p);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,12 +429,12 @@ rip_timer(timer *t)
|
||||||
DBG( "Garbage: " ); rte_dump( rte );
|
DBG( "Garbage: " ); rte_dump( rte );
|
||||||
|
|
||||||
if (now - rte->u.rip.lastmodX > P_CF->timeout_time) {
|
if (now - rte->u.rip.lastmodX > P_CF->timeout_time) {
|
||||||
TRACE(D_EVENTS, "RIP: entry is too old: " ); rte_dump( rte );
|
TRACE(D_EVENTS, "RIP: entry is too old: %I", rte->net->n.prefix );
|
||||||
e->metric = P_CF->infinity;
|
e->metric = P_CF->infinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (now - rte->u.rip.lastmodX > P_CF->garbage_time) {
|
if (now - rte->u.rip.lastmodX > P_CF->garbage_time) {
|
||||||
TRACE(D_EVENTS, "RIP: entry is much too old: " ); rte_dump( rte );
|
TRACE(D_EVENTS, "RIP: entry is much too old: %I", rte->net->n.prefix );
|
||||||
rte_discard(p->table, rte);
|
rte_discard(p->table, rte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,22 +581,22 @@ new_iface(struct proto *p, struct iface *new, unsigned long flags, struct iface_
|
||||||
|
|
||||||
rif->sock->daddr = new->addr->brd;
|
rif->sock->daddr = new->addr->brd;
|
||||||
if (new->addr->flags & IA_UNNUMBERED)
|
if (new->addr->flags & IA_UNNUMBERED)
|
||||||
log( L_WARN "RIP/%s: rip is not defined over unnumbered links\n", P_NAME );
|
log( L_WARN "%s: rip is not defined over unnumbered links", P_NAME );
|
||||||
if (want_multicast) {
|
if (want_multicast) {
|
||||||
rif->sock->daddr = ipa_from_u32(0xe0000009);
|
rif->sock->daddr = ipa_from_u32(0xe0000009);
|
||||||
rif->sock->saddr = ipa_from_u32(0xe0000009);
|
rif->sock->saddr = ipa_from_u32(0xe0000009);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipa_nonzero(rif->sock->daddr)) {
|
if (!ipa_nonzero(rif->sock->daddr)) {
|
||||||
log( L_WARN "RIP/%s: interface %s is too strange for me", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
|
log( L_WARN "%s: interface %s is too strange for me", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
|
||||||
} else
|
} else
|
||||||
if (!(rif->patt->mode & IM_NOLISTEN))
|
if (!(rif->patt->mode & IM_NOLISTEN))
|
||||||
if (sk_open(rif->sock)<0) {
|
if (sk_open(rif->sock)<0) {
|
||||||
log( L_ERR "RIP/%s: could not listen on %s", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
|
log( L_ERR "%s: could not listen on %s", P_NAME, rif->iface ? rif->iface->name : "(dummy)" );
|
||||||
/* Don't try to transmit into this one? Well, why not? This should not happen, anyway :-) */
|
/* Don't try to transmit into this one? Well, why not? This should not happen, anyway :-) */
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(D_EVENTS, "RIP/%s: listening on %s, port %d, mode %s (%I)", P_NAME, rif->iface ? rif->iface->name : "(dummy)", P_CF->port, want_multicast ? "multicast" : "broadcast", rif->sock->daddr );
|
TRACE(D_EVENTS, "%s: listening on %s, port %d, mode %s (%I)", P_NAME, rif->iface ? rif->iface->name : "(dummy)", P_CF->port, want_multicast ? "multicast" : "broadcast", rif->sock->daddr );
|
||||||
|
|
||||||
return rif;
|
return rif;
|
||||||
}
|
}
|
||||||
|
@ -786,16 +778,10 @@ rip_preconfig(struct protocol *x, struct config *c)
|
||||||
DBG( "RIP: preconfig\n" );
|
DBG( "RIP: preconfig\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
rip_postconfig(struct proto_config *c)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
struct protocol proto_rip = {
|
struct protocol proto_rip = {
|
||||||
name: "RIP",
|
name: "RIP",
|
||||||
template: "rip%d",
|
template: "rip%d",
|
||||||
preconfig: rip_preconfig,
|
preconfig: rip_preconfig,
|
||||||
postconfig: rip_postconfig,
|
|
||||||
get_route_info: rip_get_route_info,
|
get_route_info: rip_get_route_info,
|
||||||
|
|
||||||
init: rip_init,
|
init: rip_init,
|
||||||
|
|
Loading…
Reference in a new issue