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 <[email protected]>
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);
}