]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: Allow blackhole route deletion for prefixes
authorDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 16 Apr 2018 22:42:40 +0000 (18:42 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 21 May 2018 15:56:16 +0000 (11:56 -0400)
With the recent change to just pass the prefix in
for the RTM_DELROUTE, for blackhole routes we
had stopped modifying the req.rtm_type to
be the appropriate type for blackhole routes.

Since we are just deleting on the route, and
zebra is never going to really install the same
route multiple times then we do not need
to specify the req.r.rtm_type for the deletion
command.

Ticket: CM-20616
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
zebra/rt_netlink.c

index 2b2c02a64470345d5b956cda04ff5538a3775203..fbe2bbb815336b44d20b58658f86c3e21ffdbcde 100644 (file)
@@ -1336,7 +1336,17 @@ static int netlink_route_multipath(int cmd, struct prefix *p,
        req.r.rtm_src_len = src_p ? src_p->prefixlen : 0;
        req.r.rtm_protocol = zebra2proto(re->type);
        req.r.rtm_scope = RT_SCOPE_UNIVERSE;
-       req.r.rtm_type = RTN_UNICAST;
+
+       /*
+        * blackhole routes are not RTN_UNICAST, they are
+        * RTN_ BLACKHOLE|UNREACHABLE|PROHIBIT
+        * so setting this value as a RTN_UNICAST would
+        * cause the route lookup of just the prefix
+        * to fail.  So no need to specify this for
+        * the RTM_DELROUTE case
+        */
+       if (cmd != RTM_DELROUTE)
+               req.r.rtm_type = RTN_UNICAST;
 
        addattr_l(&req.n, sizeof req, RTA_DST, &p->u.prefix, bytelen);
        if (src_p)