commit
a4fb94325c
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required (VERSION 3.12.1)
|
||||
cmake_minimum_required (VERSION 2.8)
|
||||
project (clibcni)
|
||||
|
||||
option(VERSION "set clibcni version" ON)
|
||||
|
||||
@ -124,6 +124,9 @@ static int do_parse_ipnet(const char *cidr_str, const char *ip_str, uint8_t **ip
|
||||
ERROR("Parse cidr failed: %s", *err != NULL ? *err : "");
|
||||
return -1;
|
||||
}
|
||||
if (ip_str == NULL) {
|
||||
return 0;
|
||||
}
|
||||
ret = parse_ip_from_str(ip_str, ip, ip_len, err);
|
||||
if (ret != 0) {
|
||||
ERROR("Parse ip failed: %s", *err != NULL ? *err : "");
|
||||
|
||||
@ -645,6 +645,10 @@ static int do_parse_ipv6_from_str(const char *addr, struct in6_addr *ipv6, uint8
|
||||
{
|
||||
int nret = 0;
|
||||
|
||||
if (addr == NULL) {
|
||||
ERROR("Empty address");
|
||||
return -1;
|
||||
}
|
||||
nret = inet_pton(AF_INET6, addr, ipv6);
|
||||
if (nret < 0) {
|
||||
nret = asprintf(err, "ipv6 inet_pton %s", strerror(errno));
|
||||
@ -674,6 +678,10 @@ int parse_ip_from_str(const char *addr, uint8_t **ips, size_t *len, char **err)
|
||||
struct in6_addr ipv6;
|
||||
int ret = -1;
|
||||
|
||||
if (addr == NULL) {
|
||||
ERROR("Empty address");
|
||||
return -1;
|
||||
}
|
||||
nret = inet_pton(AF_INET, addr, &ipv4);
|
||||
if (nret < 0) {
|
||||
nret = asprintf(err, "ipv4 inet_pton %s", strerror(errno));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user