rip ipv6 bugfix
This commit is contained in:
parent
3ca3e999ec
commit
18b4d6bf27
1 changed files with 15 additions and 6 deletions
|
@ -96,9 +96,15 @@ rip_tx_err( sock *s, int err )
|
||||||
static int
|
static int
|
||||||
rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_entry *e, struct rip_interface *rif, int pos )
|
rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_entry *e, struct rip_interface *rif, int pos )
|
||||||
{
|
{
|
||||||
|
int metric;
|
||||||
DBG( "." );
|
DBG( "." );
|
||||||
b->tag = htons( e->tag );
|
b->tag = htons( e->tag );
|
||||||
b->network = e->n.prefix;
|
b->network = e->n.prefix;
|
||||||
|
metric = e->metric;
|
||||||
|
if (neigh_connected_to(p, &e->whotoldme, rif->iface)) {
|
||||||
|
DBG( "(split horizon)" );
|
||||||
|
metric = P_CF->infinity;
|
||||||
|
}
|
||||||
#ifndef IPV6
|
#ifndef IPV6
|
||||||
b->family = htons( 2 ); /* AF_INET */
|
b->family = htons( 2 ); /* AF_INET */
|
||||||
b->netmask = ipa_mkmask( e->n.pxlen );
|
b->netmask = ipa_mkmask( e->n.pxlen );
|
||||||
|
@ -109,14 +115,12 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
|
||||||
else
|
else
|
||||||
b->nexthop = IPA_NONE;
|
b->nexthop = IPA_NONE;
|
||||||
ipa_hton( b->nexthop );
|
ipa_hton( b->nexthop );
|
||||||
|
b->metric = htonl( metric );
|
||||||
#else
|
#else
|
||||||
b->pxlen = e->n.pxlen;
|
b->pxlen = e->n.pxlen;
|
||||||
|
b->metric = metric; /* it is u8 */
|
||||||
#endif
|
#endif
|
||||||
b->metric = htonl( e->metric );
|
|
||||||
if (neigh_connected_to(p, &e->whotoldme, rif->iface)) {
|
|
||||||
DBG( "(split horizon)" );
|
|
||||||
b->metric = htonl( P_CF->infinity );
|
|
||||||
}
|
|
||||||
ipa_hton( b->network );
|
ipa_hton( b->network );
|
||||||
|
|
||||||
return pos+1;
|
return pos+1;
|
||||||
|
@ -328,7 +332,12 @@ advertise_entry( struct proto *p, struct rip_block *b, ip_addr whotoldme )
|
||||||
}
|
}
|
||||||
n = net_get( p->table, b->network, pxlen );
|
n = net_get( p->table, b->network, pxlen );
|
||||||
r = rte_get_temp(a);
|
r = rte_get_temp(a);
|
||||||
|
#ifndef IPV6
|
||||||
r->u.rip.metric = ntohl(b->metric) + rif->metric;
|
r->u.rip.metric = ntohl(b->metric) + rif->metric;
|
||||||
|
#else
|
||||||
|
r->u.rip.metric = b->metric + rif->metric;
|
||||||
|
#endif
|
||||||
|
|
||||||
r->u.rip.entry = NULL;
|
r->u.rip.entry = NULL;
|
||||||
if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
|
if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
|
||||||
r->u.rip.tag = ntohl(b->tag);
|
r->u.rip.tag = ntohl(b->tag);
|
||||||
|
|
Loading…
Reference in a new issue