diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-06-02 20:17:00 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-06-02 20:17:00 +0000 |
commit | e40f25d1cdb2c8adca730b245f8488c3a2c96022 (patch) | |
tree | d7bf98024aa901e0a831a84a4ee05861ae692101 /usr.sbin | |
parent | 6cabe8487d304e040dafe427a8df72b38e527bc4 (diff) |
Track reject and blackhole routes and allow them to be redistributed even
though they point to the loopback. Mainly used for redistribute default since
on default free routers we need to have a fake route now.
After discussion with Tonnerre Lombard, idea OK henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ospfd/kroute.c | 16 | ||||
-rw-r--r-- | usr.sbin/ospfd/ospfd.h | 12 |
2 files changed, 20 insertions, 8 deletions
diff --git a/usr.sbin/ospfd/kroute.c b/usr.sbin/ospfd/kroute.c index 23a1a22639b..18838ea3d1b 100644 --- a/usr.sbin/ospfd/kroute.c +++ b/usr.sbin/ospfd/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.68 2009/04/26 12:48:06 sthen Exp $ */ +/* $OpenBSD: kroute.c,v 1.69 2009/06/02 20:16:59 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -467,9 +467,11 @@ kr_redist_eval(struct kroute *kr, struct rroute *rr) (a >> IN_CLASSA_NSHIFT) == IN_LOOPBACKNET) goto dont_redistribute; /* - * 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))) goto dont_redistribute; /* Should we redistribute this route? */ @@ -1199,6 +1201,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 (sa_in != NULL) { @@ -1393,6 +1399,10 @@ dispatch_rtmsg(void) prefixlen_classful(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; break; diff --git a/usr.sbin/ospfd/ospfd.h b/usr.sbin/ospfd/ospfd.h index f8b98780055..0e1d6c805db 100644 --- a/usr.sbin/ospfd/ospfd.h +++ b/usr.sbin/ospfd/ospfd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospfd.h,v 1.77 2009/04/07 14:57:33 reyk Exp $ */ +/* $OpenBSD: ospfd.h,v 1.78 2009/06/02 20:16:59 claudio Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -51,10 +51,12 @@ #define F_OSPFD_INSERTED 0x0001 #define F_KERNEL 0x0002 -#define F_CONNECTED 0x0008 -#define F_DOWN 0x0010 -#define F_STATIC 0x0020 -#define F_DYNAMIC 0x0040 +#define F_CONNECTED 0x0004 +#define F_STATIC 0x0008 +#define F_DYNAMIC 0x0010 +#define F_DOWN 0x0020 +#define F_REJECT 0x0040 +#define F_BLACKHOLE 0x0080 #define F_REDISTRIBUTED 0x0100 /* buffer */ |