X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fofp-util.c;h=3484394c5774b139e083ea4ceabaad4a6f89c41f;hb=c5cf10598f8c9f4428291e9df3ecd72a05fb1ccf;hp=af2d853eb448844b901a8472d2d9271c415e8edf;hpb=dcbe78ad12926487b77c72b71d66ef4fcd53af6e;p=sliver-openvswitch.git diff --git a/lib/ofp-util.c b/lib/ofp-util.c index af2d853eb..3484394c5 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -85,7 +85,7 @@ ofputil_netmask_to_wcbits(ovs_be32 netmask) void ofputil_wildcard_from_ofpfw10(uint32_t ofpfw, struct flow_wildcards *wc) { - BUILD_ASSERT_DECL(FLOW_WC_SEQ == 25); + BUILD_ASSERT_DECL(FLOW_WC_SEQ == 26); /* Initialize most of wc. */ flow_wildcards_init_catchall(wc); @@ -5394,8 +5394,12 @@ ofputil_port_to_ofp11(ofp_port_t ofp10_port) bool ofputil_port_from_string(const char *s, ofp_port_t *portp) { - uint32_t port32; + unsigned int port32; /* int is at least 32 bits wide. */ + if (*s == '-') { + VLOG_WARN("Negative value %s is not a valid port number.", s); + return false; + } *portp = 0; if (str_to_uint(s, 10, &port32)) { if (port32 < ofp_to_u16(OFPP_MAX)) {