diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2013-01-14 14:39:39 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2013-01-14 14:39:39 +0000 |
commit | a50eb8c2b9cf596ceaaa792a6effd224668e44e7 (patch) | |
tree | 51df0419d37431b813bcd8706c5f627c59f92a84 /usr.sbin/ospf6d | |
parent | ed0949ddfb82beef23f3af12f8a0d7f69c6eff8e (diff) |
kroute.c rev 1.69 of ospfd for ospf6d
------------------------------------------------------------------------
date: 2009/06/02 20:16:59; author: claudio; state: Exp; lines: +13 -3
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@
------------------------------------------------------------------------
ok claudio@
Diffstat (limited to 'usr.sbin/ospf6d')
-rw-r--r-- | usr.sbin/ospf6d/kroute.c | 16 | ||||
-rw-r--r-- | usr.sbin/ospf6d/ospf6d.h | 6 |
2 files changed, 17 insertions, 5 deletions
diff --git a/usr.sbin/ospf6d/kroute.c b/usr.sbin/ospf6d/kroute.c index b8d812ecf59..248a50f028f 100644 --- a/usr.sbin/ospf6d/kroute.c +++ b/usr.sbin/ospf6d/kroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kroute.c,v 1.40 2012/10/21 21:30:44 bluhm Exp $ */ +/* $OpenBSD: kroute.c,v 1.41 2013/01/14 14:39:38 florian Exp $ */ /* * Copyright (c) 2004 Esben Norby <norby@openbsd.org> @@ -393,9 +393,11 @@ kr_redist_eval(struct kroute *kr, struct rroute *rr) IN6_IS_ADDR_V4COMPAT(&kr->prefix)) 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 (IN6_IS_ADDR_LOOPBACK(&kr->nexthop)) + if (IN6_IS_ADDR_LOOPBACK(&kr->nexthop) && + !(kr->flags & (F_BLACKHOLE|F_REJECT))) goto dont_redistribute; /* Should we redistrubute this route? */ @@ -1106,6 +1108,10 @@ fetchtable(void) sa_in6 = (struct sockaddr_in6 *)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) @@ -1308,6 +1314,10 @@ dispatch_rtmsg(void) fatalx("classful IPv6 address?!!"); 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/ospf6d/ospf6d.h b/usr.sbin/ospf6d/ospf6d.h index 275c54e586a..77e9ebf5373 100644 --- a/usr.sbin/ospf6d/ospf6d.h +++ b/usr.sbin/ospf6d/ospf6d.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ospf6d.h,v 1.25 2012/10/22 07:28:49 bluhm Exp $ */ +/* $OpenBSD: ospf6d.h,v 1.26 2013/01/14 14:39:38 florian Exp $ */ /* * Copyright (c) 2004, 2007 Esben Norby <norby@openbsd.org> @@ -56,7 +56,9 @@ #define F_DOWN 0x0010 #define F_STATIC 0x0020 #define F_DYNAMIC 0x0040 -#define F_REDISTRIBUTED 0x0100 +#define F_REJECT 0x0080 +#define F_BLACKHOLE 0x0100 +#define F_REDISTRIBUTED 0x0200 struct imsgev { struct imsgbuf ibuf; |