mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-24 21:54:01 +00:00
net: ipv6: Fix IPv6 netmask parsing
It should be possible to specify a netmask when setting a static IPv6 address. For example: setenv ip6addr 2001:cafe:cafe:cafe::100/64 The net_prefix_length and net_ip6 should be updated properly. Signed-off-by: Sean Edmond <seanedmond@microsoft.com> Reviewed-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
This commit is contained in:
parent
878a20aa15
commit
796e549822
1 changed files with 6 additions and 3 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue