aboutsummaryrefslogtreecommitdiff
path: root/net/net6.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/net6.c')
-rw-r--r--net/net6.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/net6.c b/net/net6.c
index fdea0787885..75577bcea17 100644
--- a/net/net6.c
+++ b/net/net6.c
@@ -47,10 +47,13 @@ static int on_ip6addr(const char *name, const char *value, enum env_op op,
}
mask = strchr(value, '/');
- len = strlen(value);
- if (mask)
- net_prefix_length = simple_strtoul(value + len, NULL, 10);
+ if (mask) {
+ net_prefix_length = simple_strtoul(mask + 1, NULL, 10);
+ len = mask - value;
+ } else {
+ len = strlen(value);
+ }
return string_to_ip6(value, len, &net_ip6);
}