Cleanup in preparation for ipv6.
This commit is contained in:
parent
b0c9c21c29
commit
7f704c06d8
3 changed files with 14 additions and 9 deletions
|
@ -58,7 +58,7 @@ protocol static {
|
||||||
bgp_community.empty;
|
bgp_community.empty;
|
||||||
print "community = ", bgp_community;
|
print "community = ", bgp_community;
|
||||||
print "done";
|
print "done";
|
||||||
quitbird;
|
accept;
|
||||||
};
|
};
|
||||||
|
|
||||||
route 0.0.0.0/0 via 195.113.31.113;
|
route 0.0.0.0/0 via 195.113.31.113;
|
||||||
|
|
|
@ -75,8 +75,8 @@ rip_tx_err( sock *s, int err )
|
||||||
log( L_ERR "Unexpected error at rip transmit: %m" );
|
log( L_ERR "Unexpected error at rip transmit: %m" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_entry *e, struct rip_interface *rif )
|
rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_entry *e, struct rip_interface *rif, int pos )
|
||||||
{
|
{
|
||||||
DBG( "." );
|
DBG( "." );
|
||||||
b->family = htons( 2 ); /* AF_INET */
|
b->family = htons( 2 ); /* AF_INET */
|
||||||
|
@ -100,6 +100,8 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
|
||||||
b->metric = htonl( P_CF->infinity );
|
b->metric = htonl( P_CF->infinity );
|
||||||
}
|
}
|
||||||
ipa_hton( b->network );
|
ipa_hton( b->network );
|
||||||
|
|
||||||
|
return pos+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -110,6 +112,7 @@ rip_tx( sock *s )
|
||||||
struct proto *p = c->proto;
|
struct proto *p = c->proto;
|
||||||
struct rip_packet *packet = (void *) s->tbuf;
|
struct rip_packet *packet = (void *) s->tbuf;
|
||||||
int i, packetlen;
|
int i, packetlen;
|
||||||
|
int maxi, nullupdate = 1;
|
||||||
|
|
||||||
DBG( "Sending to %I\n", s->daddr );
|
DBG( "Sending to %I\n", s->daddr );
|
||||||
do {
|
do {
|
||||||
|
@ -124,13 +127,15 @@ rip_tx( sock *s )
|
||||||
packet->heading.unused = 0;
|
packet->heading.unused = 0;
|
||||||
|
|
||||||
i = !!P_CF->authtype;
|
i = !!P_CF->authtype;
|
||||||
|
maxi = ((P_CF->authtype == AT_MD5) ? PACKET_MD5_MAX : PACKET_MAX);
|
||||||
|
|
||||||
FIB_ITERATE_START(&P->rtable, &c->iter, z) {
|
FIB_ITERATE_START(&P->rtable, &c->iter, z) {
|
||||||
struct rip_entry *e = (struct rip_entry *) z;
|
struct rip_entry *e = (struct rip_entry *) z;
|
||||||
|
|
||||||
if (!rif->triggered || (!(e->updated < now-5))) {
|
if (!rif->triggered || (!(e->updated < now-5))) {
|
||||||
|
nullupdate = 0;
|
||||||
rip_tx_prepare( p, s->daddr, packet->block + i, e, rif );
|
i = rip_tx_prepare( p, s->daddr, packet->block + i, e, rif, i );
|
||||||
if (i++ == ((P_CF->authtype == AT_MD5) ? PACKET_MD5_MAX : PACKET_MAX)) {
|
if (i >= maxi) {
|
||||||
FIB_ITERATE_PUT(&c->iter, z);
|
FIB_ITERATE_PUT(&c->iter, z);
|
||||||
goto break_loop;
|
goto break_loop;
|
||||||
}
|
}
|
||||||
|
@ -143,7 +148,7 @@ rip_tx( sock *s )
|
||||||
packetlen = rip_outgoing_authentication(p, (void *) &packet->block[0], packet, i);
|
packetlen = rip_outgoing_authentication(p, (void *) &packet->block[0], packet, i);
|
||||||
|
|
||||||
DBG( ", sending %d blocks, ", i );
|
DBG( ", sending %d blocks, ", i );
|
||||||
if (i == !!P_CF->authtype) {
|
if (nullupdate) {
|
||||||
DBG( "not sending NULL update\n" );
|
DBG( "not sending NULL update\n" );
|
||||||
c->done = 1;
|
c->done = 1;
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -389,7 +394,7 @@ rip_rx(sock *s, int size)
|
||||||
if (size < 0) BAD( "Too small packet" );
|
if (size < 0) BAD( "Too small packet" );
|
||||||
if (size % sizeof( struct rip_block )) BAD( "Odd sized packet" );
|
if (size % sizeof( struct rip_block )) BAD( "Odd sized packet" );
|
||||||
num = size / sizeof( struct rip_block );
|
num = size / sizeof( struct rip_block );
|
||||||
if (num>25) BAD( "Too many blocks" );
|
if (num>PACKET_MAX) BAD( "Too many blocks" );
|
||||||
|
|
||||||
rip_process_packet( p, (struct rip_packet *) s->rbuf, num, s->faddr, s->fport );
|
rip_process_packet( p, (struct rip_packet *) s->rbuf, num, s->faddr, s->fport );
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -92,7 +92,7 @@ struct rip_entry {
|
||||||
|
|
||||||
struct rip_packet {
|
struct rip_packet {
|
||||||
struct rip_packet_heading heading;
|
struct rip_packet_heading heading;
|
||||||
struct rip_block block[25];
|
struct rip_block block[PACKET_MAX];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct rip_interface {
|
struct rip_interface {
|
||||||
|
|
Loading…
Reference in a new issue