On Thu, Jun 9, 2016 at 12:12 AM, Justin Pettit <jpet...@ovn.org> wrote:
> A zero prefix length is used to match any IP address, which is useful > for defining default routes. > > Signed-off-by: Justin Pettit <jpet...@ovn.org> > --- > lib/packets.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/lib/packets.c b/lib/packets.c > index 6a55d6f..ecb5339 100644 > --- a/lib/packets.c > +++ b/lib/packets.c > @@ -442,9 +442,9 @@ ip_parse_masked_len(const char *s, int *n, ovs_be32 > *ip, > /* OK. */ > } else if (ovs_scan_len(s, n, IP_SCAN_FMT"/%d", > IP_SCAN_ARGS(ip), &prefix)) { > - if (prefix <= 0 || prefix > 32) { > - return xasprintf("%s: network prefix bits not between 0 and " > - "32", s); > + if (prefix < 0 || prefix > 32) { > + return xasprintf("%s: IPv4 network prefix bits not between 0 > and " > + "31, inclusive", s); > Are we are talking number of bits, not bit indices ? + return xasprintf("%s: IPv4 network prefix bits not between 0 and " + "32, inclusive", s); > } > *mask = be32_prefix_mask(prefix); > } else if (ovs_scan_len(s, n, IP_SCAN_FMT, IP_SCAN_ARGS(ip))) { > @@ -533,9 +533,9 @@ ipv6_parse_masked_len(const char *s, int *n, struct > in6_addr *ip, > if (ovs_scan_len(s, n, " "IPV6_SCAN_FMT, ipv6_s) > && ipv6_parse(ipv6_s, ip)) { > if (ovs_scan_len(s, n, "/%d", &prefix)) { > - if (prefix <= 0 || prefix > 128) { > + if (prefix < 0 || prefix > 128) { > return xasprintf("%s: IPv6 network prefix bits not > between 0 " > - "and 128", s); > + "and 127, inclusive", s); > Are we are talking number of bits, not bit indices ? + "and 128, inclusive", s); > } > *mask = ipv6_create_mask(prefix); > } else if (ovs_scan_len(s, n, "/"IPV6_SCAN_FMT, ipv6_s)) { > -- > 1.9.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev > _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev