summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/ospfd/ospfd.c17
-rw-r--r--usr.sbin/ripd/ripd.c17
2 files changed, 22 insertions, 12 deletions
diff --git a/usr.sbin/ospfd/ospfd.c b/usr.sbin/ospfd/ospfd.c
index 18aae6370f3..6cbd094358a 100644
--- a/usr.sbin/ospfd/ospfd.c
+++ b/usr.sbin/ospfd/ospfd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ospfd.c,v 1.62 2009/03/24 19:26:13 michele Exp $ */
+/* $OpenBSD: ospfd.c,v 1.63 2009/03/27 14:37:26 michele Exp $ */
/*
* Copyright (c) 2005 Claudio Jeker <claudio@openbsd.org>
@@ -527,8 +527,6 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
SIMPLEQ_FOREACH(r, &ospfd_conf->redist_list, entry) {
switch (r->type & ~REDIST_NO) {
case REDIST_LABEL:
- if (is_default)
- continue;
if (kr->rtlabel == r->label) {
*metric = r->metric;
return (r->type & REDIST_NO ? 0 : 1);
@@ -560,10 +558,17 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
}
break;
case REDIST_ADDR:
- if (is_default)
- continue;
if (kr->flags & F_DYNAMIC)
continue;
+
+ if (r->addr.s_addr == INADDR_ANY &&
+ r->mask.s_addr == INADDR_ANY) {
+ if (is_default)
+ return (r->type & REDIST_NO? 0 : 1);
+ else
+ return (0);
+ }
+
if ((kr->prefix.s_addr & r->mask.s_addr) ==
(r->addr.s_addr & r->mask.s_addr) &&
kr->prefixlen >= mask2prefixlen(r->mask.s_addr)) {
@@ -573,7 +578,7 @@ ospf_redistribute(struct kroute *kr, u_int32_t *metric)
break;
case REDIST_DEFAULT:
if (is_default)
- return (1);
+ return (r->type & REDIST_NO ? 0 : 1);
break;
}
}
diff --git a/usr.sbin/ripd/ripd.c b/usr.sbin/ripd/ripd.c
index 462d43a64a6..c6ba4964b43 100644
--- a/usr.sbin/ripd/ripd.c
+++ b/usr.sbin/ripd/ripd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripd.c,v 1.12 2009/03/24 19:26:13 michele Exp $ */
+/* $OpenBSD: ripd.c,v 1.13 2009/03/27 14:37:25 michele Exp $ */
/*
* Copyright (c) 2006 Michele Marchetto <mydecay@openbeer.it>
@@ -494,8 +494,6 @@ rip_redistribute(struct kroute *kr)
SIMPLEQ_FOREACH(r, &conf->redist_list, entry) {
switch (r->type & ~REDIST_NO) {
case REDIST_LABEL:
- if (is_default)
- continue;
if (kr->rtlabel == r->label)
return (r->type & REDIST_NO ? 0 : 1);
break;
@@ -521,10 +519,17 @@ rip_redistribute(struct kroute *kr)
return (r->type & REDIST_NO ? 0 : 1);
break;
case REDIST_ADDR:
- if (is_default)
- continue;
if (kr->flags & F_DYNAMIC)
continue;
+
+ if (r->addr.s_addr == INADDR_ANY &&
+ r->mask.s_addr == INADDR_ANY) {
+ if (is_default)
+ return (r->type & REDIST_NO? 0 : 1);
+ else
+ return (0);
+ }
+
if ((kr->prefix.s_addr & r->mask.s_addr) ==
(r->addr.s_addr & r->mask.s_addr) &&
(kr->netmask.s_addr & r->mask.s_addr) ==
@@ -533,7 +538,7 @@ rip_redistribute(struct kroute *kr)
break;
case REDIST_DEFAULT:
if (is_default)
- return (1);
+ return (r->type & REDIST_NO? 0 : 1);
break;
}
}