summaryrefslogtreecommitdiff
path: root/usr.sbin/ripd/kroute.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-06-02 21:43:37 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-06-02 21:43:37 +0000
commit1906e55f24c21258f2be91468f091c51c45b3f85 (patch)
tree354424eb7027c14854722020641296291dec3cb2 /usr.sbin/ripd/kroute.c
parentc49d5366f34eed33138ccc6fe5fa2c2953877573 (diff)
Same reject and blackhole route handling as in ospfd. Allow those routes
to be redistributed even though they point to 127.0.0.1. OK michele@
Diffstat (limited to 'usr.sbin/ripd/kroute.c')
-rw-r--r--usr.sbin/ripd/kroute.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/ripd/kroute.c b/usr.sbin/ripd/kroute.c
index 3bd2a0d68bd..203b38ea97d 100644
--- a/usr.sbin/ripd/kroute.c
+++ b/usr.sbin/ripd/kroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kroute.c,v 1.14 2009/03/31 09:11:45 michele Exp $ */
+/* $OpenBSD: kroute.c,v 1.15 2009/06/02 21:43:36 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -390,9 +390,11 @@ dont_redistribute:
(a >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET)
return;
/*
- * Consider networks with nexthop loopback as not redistributable.
+ * Consider networks with nexthop loopback as not redistributable
+ * unless it is a reject or blackhole route.
*/
- if (kr->nexthop.s_addr == htonl(INADDR_LOOPBACK))
+ if (kr->nexthop.s_addr == htonl(INADDR_LOOPBACK) &&
+ !(kr->flags & (F_BLACKHOLE|F_REJECT)))
return;
/* Should we redistribute this route? */
@@ -888,6 +890,10 @@ fetchtable(void)
sa_in = (struct sockaddr_in *)rti_info[RTAX_NETMASK];
if (rtm->rtm_flags & RTF_STATIC)
kr->r.flags |= F_STATIC;
+ if (rtm->rtm_flags & RTF_BLACKHOLE)
+ kr->r.flags |= F_BLACKHOLE;
+ if (rtm->rtm_flags & RTF_REJECT)
+ kr->r.flags |= F_REJECT;
if (rtm->rtm_flags & RTF_DYNAMIC)
kr->r.flags |= F_DYNAMIC;
if (rtm->rtm_flags & RTF_PROTO1)
@@ -1097,6 +1103,10 @@ dispatch_rtmsg(void)
prefix.s_addr));
if (rtm->rtm_flags & RTF_STATIC)
flags |= F_STATIC;
+ if (rtm->rtm_flags & RTF_BLACKHOLE)
+ flags |= F_BLACKHOLE;
+ if (rtm->rtm_flags & RTF_REJECT)
+ flags |= F_REJECT;
if (rtm->rtm_flags & RTF_DYNAMIC)
flags |= F_DYNAMIC;
if (rtm->rtm_flags & RTF_PROTO1)