summaryrefslogtreecommitdiff
path: root/zebra/zebra_fpm_protobuf.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2010-02-05 04:31:56 +0100
committerDavid Lamparter <equinox@opensourcerouting.org>2017-08-28 05:07:51 +0200
commita830942228110cbec0e857d0877d624206627f81 (patch)
tree6823772eab9415dadaeb0722cd8c1114197fa8a1 /zebra/zebra_fpm_protobuf.c
parentfd36be7e15ee49d12500a5ec4d9597d1597715a7 (diff)
zebra: cleanup blackhole support
blackhole support was horribly broken. cleanup by removing blackhole stuff from ZEBRA_FLAG_* introduces support for "prohibit" routes (Linux/netlink only) also clean up blackhole options on "ip route" vty commands. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'zebra/zebra_fpm_protobuf.c')
-rw-r--r--zebra/zebra_fpm_protobuf.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/zebra/zebra_fpm_protobuf.c b/zebra/zebra_fpm_protobuf.c
index 450ad5b0bf..b850f1fb1e 100644
--- a/zebra/zebra_fpm_protobuf.c
+++ b/zebra/zebra_fpm_protobuf.c
@@ -141,7 +141,6 @@ static Fpm__AddRoute *create_add_route_message(qpb_allocator_t *allocator,
struct route_entry *re)
{
Fpm__AddRoute *msg;
- int discard;
struct nexthop *nexthop;
uint num_nhs, u;
struct nexthop *nexthops[MULTIPATH_NUM];
@@ -164,26 +163,7 @@ static Fpm__AddRoute *create_add_route_message(qpb_allocator_t *allocator,
msg->sub_address_family = QPB__SUB_ADDRESS_FAMILY__UNICAST;
msg->key = fpm_route_key_create(allocator, rib_dest_prefix(dest));
qpb_protocol_set(&msg->protocol, re->type);
-
- if ((re->flags & ZEBRA_FLAG_BLACKHOLE)
- || (re->flags & ZEBRA_FLAG_REJECT))
- discard = 1;
- else
- discard = 0;
-
- if (discard) {
- if (re->flags & ZEBRA_FLAG_BLACKHOLE) {
- msg->route_type = FPM__ROUTE_TYPE__BLACKHOLE;
- } else if (re->flags & ZEBRA_FLAG_REJECT) {
- msg->route_type = FPM__ROUTE_TYPE__UNREACHABLE;
- } else {
- assert(0);
- }
- return msg;
- } else {
- msg->route_type = FPM__ROUTE_TYPE__NORMAL;
- }
-
+ msg->route_type = FPM__ROUTE_TYPE__NORMAL;
msg->metric = re->metric;
/*
@@ -197,6 +177,19 @@ static Fpm__AddRoute *create_add_route_message(qpb_allocator_t *allocator,
if (num_nhs >= ZEBRA_NUM_OF(nexthops))
break;
+ if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE) {
+ switch (nexthop->bh_type) {
+ case BLACKHOLE_REJECT:
+ msg->route_type = FPM__ROUTE_TYPE__UNREACHABLE;
+ break;
+ case BLACKHOLE_NULL:
+ default:
+ msg->route_type = FPM__ROUTE_TYPE__BLACKHOLE;
+ break;
+ }
+ return msg;
+ }
+
if (CHECK_FLAG(nexthop->flags, NEXTHOP_FLAG_RECURSIVE))
continue;