correctly. */
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api.nexthop_num = 1;
- api.nexthop = &nexthop_pointer;
api.ifindex_num = 0;
-
- SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
- api.metric = metric;
+ if(metric >= KERNEL_INFINITY) {
+ api.flags = ZEBRA_FLAG_BLACKHOLE;
+ api.nexthop_num = 0;
+ } else {
+ api.nexthop_num = 1;
+ api.nexthop = &nexthop_pointer;
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
+ api.metric = metric;
+ }
debugf(BABEL_DEBUG_ROUTE, "adding route (ipv4) to zebra");
return zapi_ipv4_route (ZEBRA_IPV4_ROUTE_ADD, zclient,
api.message = 0;
api.safi = SAFI_UNICAST;
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api.nexthop_num = 1;
- api.nexthop = &nexthop_pointer;
- SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
- api.ifindex_num = 1;
- api.ifindex = &tmp_ifindex;
- SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
- api.metric = metric;
+ if(metric >= KERNEL_INFINITY) {
+ api.nexthop_num = 0;
+ api.ifindex_num = 0;
+ } else {
+ api.nexthop_num = 1;
+ api.nexthop = &nexthop_pointer;
+ SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
+ api.ifindex_num = 1;
+ api.ifindex = &tmp_ifindex;
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
+ api.metric = metric;
+ }
debugf(BABEL_DEBUG_ROUTE, "adding route (ipv6) to zebra");
return zapi_ipv6_route (ZEBRA_IPV6_ROUTE_ADD, zclient,
api.message = 0;
api.safi = SAFI_UNICAST;
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api.nexthop_num = 1;
- api.nexthop = &nexthop_pointer;
api.ifindex_num = 0;
- SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
- api.metric = metric;
+ if(metric >= KERNEL_INFINITY) {
+ api.flags = ZEBRA_FLAG_BLACKHOLE;
+ api.nexthop_num = 0;
+ } else {
+ api.nexthop_num = 1;
+ api.nexthop = &nexthop_pointer;
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
+ api.metric = metric;
+ }
debugf(BABEL_DEBUG_ROUTE, "removing route (ipv4) to zebra");
return zapi_ipv4_route (ZEBRA_IPV4_ROUTE_DELETE, zclient,
api.message = 0;
api.safi = SAFI_UNICAST;
SET_FLAG(api.message, ZAPI_MESSAGE_NEXTHOP);
- api.nexthop_num = 1;
- api.nexthop = &nexthop_pointer;
- SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
- api.ifindex_num = 1;
- api.ifindex = &tmp_ifindex;
+ if(metric >= KERNEL_INFINITY) {
+ api.flags = ZEBRA_FLAG_BLACKHOLE;
+ api.nexthop_num = 0;
+ api.ifindex_num = 0;
+ } else {
+ api.nexthop_num = 1;
+ api.nexthop = &nexthop_pointer;
+ SET_FLAG(api.message, ZAPI_MESSAGE_IFINDEX);
+ api.ifindex_num = 1;
+ api.ifindex = &tmp_ifindex;
+ SET_FLAG(api.message, ZAPI_MESSAGE_METRIC);
+ api.metric = metric;
+ }
debugf(BABEL_DEBUG_ROUTE, "removing route (ipv6) to zebra");
return zapi_ipv6_route (ZEBRA_IPV6_ROUTE_DELETE, zclient,