Blob Blame History Raw
From befea4cc873c25574a62ead84cc4413fcbf23619 Mon Sep 17 00:00:00 2001
From: Numan Siddique <numans@ovn.org>
Date: Tue, 15 Dec 2020 17:30:17 +0530
Subject: [PATCH 6/7] osx: Fix compilation error.

The commit "northd: Add ECMP support to router policies." introduced
compilaton error on osx platform.  This patch fixes the issue.

The errors are:

----
northd/ovn-northd.c:7697:38: error: format specifies type 'unsigned short'
but the argument has type 'int' [-Werror,-Wformat]
                      ecmp_group_id, i + 1);
                                     ^~~~~
northd/ovn-northd.c:7713:44: error: format specifies type 'unsigned short'
but the argument has type 'int' [-Werror,-Wformat]
        ds_put_format(&actions, "%"PRIu16, i + 1);
                                 ~~~~~~~~  ^~~~~
----

Fixes: 35b00c7e7990("northd: Add ECMP support to router policies.")
Suggested-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
---
 northd/ovn-northd.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
index dfd7d69d0..b377dffa1 100644
--- a/northd/ovn-northd.c
+++ b/northd/ovn-northd.c
@@ -7650,7 +7650,7 @@ build_ecmp_routing_policy_flows(struct hmap *lflows, struct ovn_datapath *od,
     struct ds match = DS_EMPTY_INITIALIZER;
     struct ds actions = DS_EMPTY_INITIALIZER;
 
-    for (uint16_t i = 0; i < rule->n_nexthops; i++) {
+    for (size_t i = 0; i < rule->n_nexthops; i++) {
         struct ovn_port *out_port = get_outport_for_routing_policy_nexthop(
              od, ports, rule->priority, rule->nexthops[i]);
         if (!out_port) {
@@ -7690,7 +7690,7 @@ build_ecmp_routing_policy_flows(struct hmap *lflows, struct ovn_datapath *od,
 
         ds_clear(&match);
         ds_put_format(&match, REG_ECMP_GROUP_ID" == %"PRIu16" && "
-                      REG_ECMP_MEMBER_ID" == %"PRIu16,
+                      REG_ECMP_MEMBER_ID" == %"PRIuSIZE,
                       ecmp_group_id, i + 1);
         ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_POLICY_ECMP,
                                 100, ds_cstr(&match),
@@ -7702,12 +7702,12 @@ build_ecmp_routing_policy_flows(struct hmap *lflows, struct ovn_datapath *od,
                   "; %s = select(", REG_ECMP_GROUP_ID, ecmp_group_id,
                   REG_ECMP_MEMBER_ID);
 
-    for (uint16_t i = 0; i < rule->n_nexthops; i++) {
+    for (size_t i = 0; i < rule->n_nexthops; i++) {
         if (i > 0) {
             ds_put_cstr(&actions, ", ");
         }
 
-        ds_put_format(&actions, "%"PRIu16, i + 1);
+        ds_put_format(&actions, "%"PRIuSIZE, i + 1);
     }
     ds_put_cstr(&actions, ");");
     ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_POLICY,
-- 
2.28.0