| 75 | } |
| 76 | |
| 77 | int |
| 78 | parse_ipv6_addr(const char *token, struct in6_addr *ipv6, uint32_t *mask) |
| 79 | { |
| 80 | char ip_str[256] = {0}; |
| 81 | char *pch; |
| 82 | |
| 83 | pch = strchr(token, '/'); |
| 84 | if (pch != NULL) { |
| 85 | strlcpy(ip_str, token, |
| 86 | RTE_MIN((unsigned int long)(pch - token + 1), |
| 87 | sizeof(ip_str))); |
| 88 | pch += 1; |
| 89 | if (is_str_num(pch) != 0) |
| 90 | return -EINVAL; |
| 91 | if (mask) |
| 92 | *mask = atoi(pch); |
| 93 | } else { |
| 94 | strlcpy(ip_str, token, sizeof(ip_str)); |
| 95 | if (mask) |
| 96 | *mask = 0; |
| 97 | } |
| 98 | |
| 99 | if (strlen(ip_str) >= INET6_ADDRSTRLEN) |
| 100 | return -EINVAL; |
| 101 | |
| 102 | if (inet_pton(AF_INET6, ip_str, ipv6) != 1) |
| 103 | return -EINVAL; |
| 104 | |
| 105 | return 0; |
| 106 | } |
| 107 | |
| 108 | int |
| 109 | parse_range(const char *token, uint16_t *low, uint16_t *high) |
no test coverage detected