summaryrefslogtreecommitdiff
path: root/zebra/rt_netlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'zebra/rt_netlink.c')
-rw-r--r--zebra/rt_netlink.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/zebra/rt_netlink.c b/zebra/rt_netlink.c
index b84cdbac..60043c9b 100644
--- a/zebra/rt_netlink.c
+++ b/zebra/rt_netlink.c
@@ -1163,7 +1163,8 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
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 @@ netlink_route (int cmd, int family, void *dest, int length, void *gate,
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
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 @@ netlink_route_multipath (int cmd, struct prefix *p, struct rib *rib,
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;
}