From 0f2f775d644c4cd9007b5816c2cfa9e8d933ef6d Mon Sep 17 00:00:00 2001 From: Guillaume Nault Date: Fri, 7 Dec 2018 17:37:42 +0100 Subject: utils: rework u_parse_ip4addr() Redefine u_parse_ip4addr() to match the behaviour of other u_parse_*() functions: * Drop the err_msg parameter. * Return the number of bytes parsed instead of an error number. * Remove support for fancy IPv4 address notations. There is currently only one user of u_parse_ip4addr() (in iprange.c). Dropping the fancy IPv4 address representations is probably not going to harm anyone (quite the opposite as many users don't realise that leading 0 means octal and that plain integers can be considered IPv4 addresses). Signed-off-by: Guillaume Nault --- accel-pppd/iprange.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'accel-pppd/iprange.c') diff --git a/accel-pppd/iprange.c b/accel-pppd/iprange.c index f7b77a2..40c938e 100644 --- a/accel-pppd/iprange.c +++ b/accel-pppd/iprange.c @@ -51,7 +51,6 @@ static int parse_iprange(const char *str, struct iprange_t **range) char ipstr[CIDR_MAXLEN + 1] = { 0 }; struct iprange_t *_range; struct in_addr addr; - const char *errmsg; char *suffix_str; uint32_t ipmin; uint32_t ipmax; @@ -88,7 +87,7 @@ static int parse_iprange(const char *str, struct iprange_t **range) *suffix_str = '\0'; ++suffix_str; - if (u_parse_ip4addr(ipstr, &addr, &errmsg)) { + if (!u_parse_ip4addr(ipstr, &addr)) { log_error("iprange: impossible to parse range \"%s\":" " invalid IPv4 address \"%s\"\n", str, ipstr); -- cgit v1.2.3