[ovs-dev] [PATCH ovn] osx: Fix compilation error.

Numan Siddique numans at ovn.org
Tue Dec 15 13:35:55 UTC 2020


On Tue, Dec 15, 2020 at 6:20 PM Dumitru Ceara <dceara at redhat.com> wrote:
>
> On 12/15/20 1:21 PM, numans at ovn.org wrote:
> > From: Numan Siddique <numans at ovn.org>
> >
> > 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.")
> > Signed-off-by: Numan Siddique <numans at ovn.org>
> > ---
>
> Hi Numan,
>
> What about using PRIuSIZE instead?  Something like:
>

Thanks for the review and suggestion. That's even better.

I submitted v2.

Thanks
Numan

> https://github.com/dceara/ovn/commit/95a7fa063fef28d40093283b69f29812b5b85d3d
>
> Thanks,
> Dumitru
>
> >  northd/ovn-northd.c | 10 ++++++----
> >  1 file changed, 6 insertions(+), 4 deletions(-)
> >
> > diff --git a/northd/ovn-northd.c b/northd/ovn-northd.c
> > index dfd7d69d0e..b535491956 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) {
> > @@ -7689,9 +7689,10 @@ build_ecmp_routing_policy_flows(struct hmap *lflows, struct ovn_datapath *od,
> >                        out_port->json_key);
> >
> >          ds_clear(&match);
> > +        uint16_t member_id = (uint16_t) i + 1;
> >          ds_put_format(&match, REG_ECMP_GROUP_ID" == %"PRIu16" && "
> >                        REG_ECMP_MEMBER_ID" == %"PRIu16,
> > -                      ecmp_group_id, i + 1);
> > +                      ecmp_group_id, member_id);
> >          ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_POLICY_ECMP,
> >                                  100, ds_cstr(&match),
> >                                  ds_cstr(&actions), &rule->header_);
> > @@ -7702,12 +7703,13 @@ 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++) {
> > +        uint16_t member_id = (uint16_t) i + 1;
> >          if (i > 0) {
> >              ds_put_cstr(&actions, ", ");
> >          }
> >
> > -        ds_put_format(&actions, "%"PRIu16, i + 1);
> > +        ds_put_format(&actions, "%"PRIu16, member_id);
> >      }
> >      ds_put_cstr(&actions, ");");
> >      ovn_lflow_add_with_hint(lflows, od, S_ROUTER_IN_POLICY,
> >
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>


More information about the dev mailing list