summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2007-03-27 09:04:34 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2007-03-27 09:04:34 +0000
commit325a5f79df48df0b7532f3514d05103b5b1ebd89 (patch)
treeab8e07043f8d7a93923f0b337fb150a72232c5c8
parent213f5cc81575cb384adf196545ad9a12ffe23e6e (diff)
Correctly handle connected routes in srt_check_route()
OK norby@
-rw-r--r--usr.sbin/dvmrpd/rde_srt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/dvmrpd/rde_srt.c b/usr.sbin/dvmrpd/rde_srt.c
index 8a830ebd32a..9df1bdac2fb 100644
--- a/usr.sbin/dvmrpd/rde_srt.c
+++ b/usr.sbin/dvmrpd/rde_srt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rde_srt.c,v 1.5 2007/03/26 10:11:10 michele Exp $ */
+/* $OpenBSD: rde_srt.c,v 1.6 2007/03/27 09:04:33 michele Exp $ */
/*
* Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org>
@@ -299,7 +299,10 @@ srt_check_route(struct route_report *rr, int connected)
if (rr->net.s_addr == 0)
rr->mask.s_addr = 0;
- adj_metric = rr->metric + iface->metric;
+ if (connected)
+ adj_metric = rr->metric;
+ else
+ adj_metric = rr->metric + iface->metric;
if (adj_metric > INFINITY_METRIC)
adj_metric = INFINITY_METRIC;
@@ -316,6 +319,10 @@ srt_check_route(struct route_report *rr, int connected)
return (0);
}
+ /* If the route is connected accept only downstream neighbors reports */
+ if (rn->connected && rr->metric <= INFINITY_METRIC)
+ return (0);
+
nbr_ip = rn->nexthop.s_addr;
nbr_report = rr->nexthop.s_addr;