summaryrefslogtreecommitdiff
path: root/usr.sbin/ripd
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
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')
-rw-r--r--usr.sbin/ripd/kroute.c16
-rw-r--r--usr.sbin/ripd/ripd.h4
2 files changed, 16 insertions, 4 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)
diff --git a/usr.sbin/ripd/ripd.h b/usr.sbin/ripd/ripd.h
index 7c400bdc9a0..718e6a5d81e 100644
--- a/usr.sbin/ripd/ripd.h
+++ b/usr.sbin/ripd/ripd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ripd.h,v 1.12 2009/03/24 19:26:13 michele Exp $ */
+/* $OpenBSD: ripd.h,v 1.13 2009/06/02 21:43:36 claudio Exp $ */
/*
* Copyright (c) 2004 Esben Norby <norby@openbsd.org>
@@ -56,6 +56,8 @@
#define F_DYNAMIC 0x0040
#define F_OSPFD_INSERTED 0x0080
#define F_REDISTRIBUTED 0x0100
+#define F_REJECT 0x0200
+#define F_BLACKHOLE 0x0400
#define REDISTRIBUTE_ON 0x01