Route (reject|blackhole) support from 6Wind patch.
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index b84cdba..60043c9 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1163,7 +1163,8 @@
req.r.rtm_table = table;
req.r.rtm_dst_len = length;
- if (zebra_flags & ZEBRA_FLAG_BLACKHOLE)
+ if ((zebra_flags & ZEBRA_FLAG_BLACKHOLE)
+ || (zebra_flags & ZEBRA_FLAG_REJECT))
discard = 1;
else
discard = 0;
@@ -1173,9 +1174,13 @@
req.r.rtm_protocol = RTPROT_ZEBRA;
req.r.rtm_scope = RT_SCOPE_UNIVERSE;
- if (discard)
- req.r.rtm_type = RTN_BLACKHOLE;
- else
+ if (discard) {
+ if (zebra_flags & ZEBRA_FLAG_BLACKHOLE)
+ req.r.rtm_type = RTN_BLACKHOLE;
+ else if (zebra_flags & ZEBRA_FLAG_REJECT)
+ req.r.rtm_type = RTN_UNREACHABLE;
+ else assert(RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */
+ } else
req.r.rtm_type = RTN_UNICAST;
}
@@ -1236,7 +1241,8 @@
req.r.rtm_flags |= RTM_F_EQUALIZE;
#endif /* RTM_F_EQUALIZE */
- if (rib->flags & ZEBRA_FLAG_BLACKHOLE)
+ if ((rib->flags & ZEBRA_FLAG_BLACKHOLE)
+ || (rib->flags & ZEBRA_FLAG_REJECT))
discard = 1;
else
discard = 0;
@@ -1246,9 +1252,13 @@
req.r.rtm_protocol = RTPROT_ZEBRA;
req.r.rtm_scope = RT_SCOPE_UNIVERSE;
- if (discard)
- req.r.rtm_type = RTN_BLACKHOLE;
- else
+ if (discard) {
+ if (rib->flags & ZEBRA_FLAG_BLACKHOLE)
+ req.r.rtm_type = RTN_BLACKHOLE;
+ else if (rib->flags & ZEBRA_FLAG_REJECT)
+ req.r.rtm_type = RTN_UNREACHABLE;
+ else assert(RTN_BLACKHOLE != RTN_UNREACHABLE); /* false */
+ } else
req.r.rtm_type = RTN_UNICAST;
}