summaryrefslogtreecommitdiffstats
path: root/proto/rip
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-06-07 15:58:49 +0200
committerPavel Machek <pavel@ucw.cz>2000-06-07 15:58:49 +0200
commit18b4d6bf278485f86ae5b636f3155fb36735ff1e (patch)
tree7519a908fe1bb090095dcf956b296ecf4004d9d6 /proto/rip
parent3ca3e999ecf00cc6ab8a52a73a7ead26e83a75b7 (diff)
downloadbird-18b4d6bf278485f86ae5b636f3155fb36735ff1e.tar
bird-18b4d6bf278485f86ae5b636f3155fb36735ff1e.zip
rip ipv6 bugfix
Diffstat (limited to 'proto/rip')
-rw-r--r--proto/rip/rip.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/proto/rip/rip.c b/proto/rip/rip.c
index 242960c..7268383 100644
--- a/proto/rip/rip.c
+++ b/proto/rip/rip.c
@@ -96,9 +96,15 @@ rip_tx_err( sock *s, int err )
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 )
{
+ int metric;
DBG( "." );
b->tag = htons( e->tag );
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
b->family = htons( 2 ); /* AF_INET */
b->netmask = ipa_mkmask( e->n.pxlen );
@@ -108,15 +114,13 @@ rip_tx_prepare(struct proto *p, ip_addr daddr, struct rip_block *b, struct rip_e
b->nexthop = e->nexthop;
else
b->nexthop = IPA_NONE;
- ipa_hton( b->nexthop );
+ ipa_hton( b->nexthop );
+ b->metric = htonl( metric );
#else
b->pxlen = e->n.pxlen;
+ b->metric = metric; /* it is u8 */
#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 );
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 );
r = rte_get_temp(a);
+#ifndef IPV6
r->u.rip.metric = ntohl(b->metric) + rif->metric;
+#else
+ r->u.rip.metric = b->metric + rif->metric;
+#endif
+
r->u.rip.entry = NULL;
if (r->u.rip.metric > P_CF->infinity) r->u.rip.metric = P_CF->infinity;
r->u.rip.tag = ntohl(b->tag);