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?

Index: kroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/kroute.c,v
retrieving revision 1.40
diff -u -p -r1.40 kroute.c
--- kroute.c    21 Oct 2012 21:30:44 -0000      1.40
+++ kroute.c    13 Dec 2012 16:14:12 -0000
@@ -393,9 +393,11 @@ kr_redist_eval(struct kroute *kr, struct
            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)
Index: ospf6d.h
===================================================================
RCS file: /cvs/src/usr.sbin/ospf6d/ospf6d.h,v
retrieving revision 1.25
diff -u -p -r1.25 ospf6d.h
--- ospf6d.h    22 Oct 2012 07:28:49 -0000      1.25
+++ ospf6d.h    13 Dec 2012 16:14:12 -0000
@@ -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;

-- 
I'm not entirely sure you are real.

Reply via email to