]> git.proxmox.com Git - mirror_frr.git/blobdiff - zebra/zebra_fpm_protobuf.c
isisd: implement the 'lsp-too-large' notification
[mirror_frr.git] / zebra / zebra_fpm_protobuf.c
index 450ad5b0bffc7bc70ac4e2c2dd1ab84bd0ee848d..be0f6a23be74224f4a83756306b5b30e784d4323 100644 (file)
@@ -129,6 +129,7 @@ static inline int add_nexthop(qpb_allocator_t *allocator, Fpm__AddRoute *msg,
        }
 
        // TODO: Use src.
+       (void)src;
 
        return 1;
 }
@@ -141,7 +142,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,39 +164,34 @@ 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->has_route_type = 1;
+       msg->route_type = FPM__ROUTE_TYPE__NORMAL;
        msg->metric = re->metric;
 
        /*
         * Figure out the set of nexthops to be added to the message.
         */
        num_nhs = 0;
-       for (ALL_NEXTHOPS(re->nexthop, nexthop)) {
+       for (ALL_NEXTHOPS(re->ng, nexthop)) {
                if (num_nhs >= multipath_num)
                        break;
 
                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;
 
@@ -252,6 +247,7 @@ static Fpm__Message *create_route_message(qpb_allocator_t *allocator,
        fpm__message__init(msg);
 
        if (!re) {
+               msg->has_type = 1;
                msg->type = FPM__MESSAGE__TYPE__DELETE_ROUTE;
                msg->delete_route =
                        create_delete_route_message(allocator, dest, re);
@@ -262,6 +258,7 @@ static Fpm__Message *create_route_message(qpb_allocator_t *allocator,
                return msg;
        }
 
+       msg->has_type = 1;
        msg->type = FPM__MESSAGE__TYPE__ADD_ROUTE;
        msg->add_route = create_add_route_message(allocator, dest, re);
        if (!msg->add_route) {