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/utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'accel-pppd/utils.h') diff --git a/accel-pppd/utils.h b/accel-pppd/utils.h index d3e0608..a7c3897 100644 --- a/accel-pppd/utils.h +++ b/accel-pppd/utils.h @@ -16,9 +16,9 @@ size_t u_parse_u8(const char *str, uint8_t *val); size_t u_parse_u16(const char *str, uint16_t *val); size_t u_parse_u32(const char *str, uint32_t *val); -int u_parse_ip4addr(const char *src, struct in_addr *addr, - const char **err_msg); size_t u_parse_ip6addr(const char *str, struct in6_addr *addr); +size_t u_parse_ip4addr(const char *str, struct in_addr *addr); + size_t u_parse_ip6cidr(const char *str, struct in6_addr *netp, uint8_t *plen); int u_randbuf(void *buf, size_t buf_len, int *err); -- cgit v1.2.3