summaryrefslogtreecommitdiff
path: root/accel-pppd/iprange.c
diff options
context:
space:
mode:
authorGuillaume Nault <g.nault@alphalink.fr>2018-12-07 17:37:42 +0100
committerDmitry Kozlov <xeb@mail.ru>2018-12-08 07:51:34 +0300
commit0f2f775d644c4cd9007b5816c2cfa9e8d933ef6d (patch)
treec487c625a8ce15b18c04c7936bfabd16efaa3f06 /accel-pppd/iprange.c
parent7bbe2a6d695dfffd52cae09b03af246329f96458 (diff)
downloadaccel-ppp-xebd-0f2f775d644c4cd9007b5816c2cfa9e8d933ef6d.tar.gz
accel-ppp-xebd-0f2f775d644c4cd9007b5816c2cfa9e8d933ef6d.zip
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 <g.nault@alphalink.fr>
Diffstat (limited to 'accel-pppd/iprange.c')
-rw-r--r--accel-pppd/iprange.c3
1 files changed, 1 insertions, 2 deletions
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);