summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorHamster Tian <haotia@gmail.com>2018-11-22 23:36:14 +0800
committerHans Dedecker <dedeckeh@gmail.com>2018-11-23 15:51:43 +0100
commitae6cf8008e50ba9838a056d78cb6aea405c55b7d (patch)
tree885721ebe7923c71e097beb8eaf7ea9661a39967 /src
parent57f639e3b0288c2ec12cdfb8598a182293746a0a (diff)
config: correctly break string for prefix filter
This if statement does the following: 1. Copy the value of "config prefix_filter" 2. Break the string at "/" 3. Save the number after / as prefix length 4. Convert the address before / into in6_addr However the extraneous "=" broke the second step and inet_pton failed with addresses with mask. This commit removes the = thus fixes the feature. Signed-off-by: Tian Hao <haotia@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/config.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c
index b36afb1..9ae8466 100644
--- a/src/config.c
+++ b/src/config.c
@@ -730,14 +730,15 @@ int config_parse_interface(void *data, size_t len, const char *name, bool overwr
char *astr = malloc(strlen(str) + 1);
char *delim;
int l;
+
if (!astr || !strcpy(astr, str) ||
- (delim = strchr(astr, '/')) == NULL || (*(delim++) == 0) ||
+ (delim = strchr(astr, '/')) == NULL || (*(delim++) = 0) ||
sscanf(delim, "%i", &l) == 0 || l > 128 ||
- inet_pton(AF_INET6, astr, &iface->pio_filter_addr) == 0) {
+ inet_pton(AF_INET6, astr, &iface->pio_filter_addr) == 0)
iface->pio_filter_length = 0;
- } else {
+ else
iface->pio_filter_length = l;
- }
+
if (astr)
free(astr);
}