]> git.proxmox.com Git - mirror_frr.git/blobdiff - pbrd/pbr_nht.c
Merge pull request #3502 from donaldsharp/socket_to_me_baby
[mirror_frr.git] / pbrd / pbr_nht.c
index a8cefce84f1db0ed0ee37e5f8074d4e17aa62faf..6103bd7db5e2cf71a6e85f90cc018c480b040aac 100644 (file)
@@ -69,7 +69,7 @@ static void *pbr_nhrc_hash_alloc(void *p)
        return nhrc;
 }
 
-static int pbr_nhrc_hash_equal(const void *arg1, const void *arg2)
+static bool pbr_nhrc_hash_equal(const void *arg1, const void *arg2)
 {
        const struct nexthop *nh1, *nh2;
 
@@ -139,7 +139,7 @@ static uint32_t pbr_nh_hash_key(void *arg)
        return key;
 }
 
-static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
+static bool pbr_nh_hash_equal(const void *arg1, const void *arg2)
 {
        const struct pbr_nexthop_cache *pbrnc1 =
                (const struct pbr_nexthop_cache *)arg1;
@@ -147,25 +147,25 @@ static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
                (const struct pbr_nexthop_cache *)arg2;
 
        if (pbrnc1->nexthop->vrf_id != pbrnc2->nexthop->vrf_id)
-               return 0;
+               return false;
 
        if (pbrnc1->nexthop->ifindex != pbrnc2->nexthop->ifindex)
-               return 0;
+               return false;
 
        if (pbrnc1->nexthop->type != pbrnc2->nexthop->type)
-               return 0;
+               return false;
 
        switch (pbrnc1->nexthop->type) {
        case NEXTHOP_TYPE_IFINDEX:
-               return 1;
+               return true;
        case NEXTHOP_TYPE_IPV4_IFINDEX:
        case NEXTHOP_TYPE_IPV4:
                return pbrnc1->nexthop->gate.ipv4.s_addr
                       == pbrnc2->nexthop->gate.ipv4.s_addr;
        case NEXTHOP_TYPE_IPV6_IFINDEX:
        case NEXTHOP_TYPE_IPV6:
-               return !memcmp(&pbrnc1->nexthop->gate.ipv6,
-                              &pbrnc2->nexthop->gate.ipv6, 16);
+               return !!memcmp(&pbrnc1->nexthop->gate.ipv6,
+                               &pbrnc2->nexthop->gate.ipv6, 16);
        case NEXTHOP_TYPE_BLACKHOLE:
                return pbrnc1->nexthop->bh_type == pbrnc2->nexthop->bh_type;
        }
@@ -173,7 +173,7 @@ static int pbr_nh_hash_equal(const void *arg1, const void *arg2)
        /*
         * We should not get here
         */
-       return 0;
+       return false;
 }
 
 static void pbr_nhgc_delete(struct pbr_nexthop_group_cache *p)
@@ -586,13 +586,13 @@ struct pbr_nexthop_group_cache *pbr_nht_add_group(const char *name)
               pnhgc);
 
        for (ALL_NEXTHOPS(nhgc->nhg, nhop)) {
-               struct pbr_nexthop_cache lookup;
+               struct pbr_nexthop_cache lookupc;
                struct pbr_nexthop_cache *pnhc;
 
-               lookup.nexthop = nhop;
-               pnhc = hash_lookup(pnhgc->nhh, &lookup);
+               lookupc.nexthop = nhop;
+               pnhc = hash_lookup(pnhgc->nhh, &lookupc);
                if (!pnhc) {
-                       pnhc = hash_get(pnhgc->nhh, &lookup, pbr_nh_alloc);
+                       pnhc = hash_get(pnhgc->nhh, &lookupc, pbr_nh_alloc);
                        pnhc->parent = pnhgc;
                }
        }
@@ -724,7 +724,7 @@ static uint32_t pbr_nhg_hash_key(void *arg)
        return jhash(&nhgc->name, strlen(nhgc->name), 0x52c34a96);
 }
 
-static int pbr_nhg_hash_equal(const void *arg1, const void *arg2)
+static bool pbr_nhg_hash_equal(const void *arg1, const void *arg2)
 {
        const struct pbr_nexthop_group_cache *nhgc1 =
                (const struct pbr_nexthop_group_cache *)arg1;