From 81dfcaa2e27d53f4eb61c549e03065dcb1b8eec3 Mon Sep 17 00:00:00 2001 From: hasso Date: Sun, 25 May 2003 19:21:25 +0000 Subject: Route (reject|blackhole) support from 6Wind patch. --- zebra/rt_netlink.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'zebra/rt_netlink.c') 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; } -- cgit v1.2.1