From: Ben Pfaff Date: Thu, 26 Nov 2015 06:30:21 +0000 (-0800) Subject: ofproto-dpif-xlate: Fix byte-order error in comparison. X-Git-Tag: v2.5.0~253 X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fovs.git;a=commitdiff_plain;h=73e8bc2371975fd7ab690c4b9a5757119f30b2ce ofproto-dpif-xlate: Fix byte-order error in comparison. Found by sparse. CC: Jarno Rajahalme Signed-off-by: Ben Pfaff Acked-by: Flavio Leitner --- diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c index ab4d52fb3..f3b56f1bc 100644 --- a/ofproto/ofproto-dpif-xlate.c +++ b/ofproto/ofproto-dpif-xlate.c @@ -4262,12 +4262,13 @@ put_ct_nat(struct xlate_ctx *ctx) nl_msg_put_flag(ctx->odp_actions, OVS_NAT_ATTR_PROTO_RANDOM); } if (ofn->range_af == AF_INET) { - nl_msg_put_u32(ctx->odp_actions, OVS_NAT_ATTR_IP_MIN, + nl_msg_put_be32(ctx->odp_actions, OVS_NAT_ATTR_IP_MIN, ofn->range.addr.ipv4.min); if (ofn->range.addr.ipv4.max && - ofn->range.addr.ipv4.max > ofn->range.addr.ipv4.min) { - nl_msg_put_u32(ctx->odp_actions, OVS_NAT_ATTR_IP_MAX, - ofn->range.addr.ipv4.max); + (ntohl(ofn->range.addr.ipv4.max) + > ntohl(ofn->range.addr.ipv4.min))) { + nl_msg_put_be32(ctx->odp_actions, OVS_NAT_ATTR_IP_MAX, + ofn->range.addr.ipv4.max); } } else if (ofn->range_af == AF_INET6) { nl_msg_put_unspec(ctx->odp_actions, OVS_NAT_ATTR_IP_MIN,