diff options
| author | Sean Edmond <[email protected]> | 2023-02-15 20:38:36 -0800 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2023-05-05 13:41:55 -0400 |
| commit | 5e541c48a7d34e6b6e426bf5b50d7111d7e680f6 (patch) | |
| tree | ea12a6cbbe2333fd5754761b1ca66acaba6065d0 /cmd | |
| parent | 8491a7e4ed82a996189a8c97acca90e88f63d345 (diff) | |
net: ipv6: IPv6 environment variable cleanup
Fix "setenv gatewayip6".
Synchronize IPv6 local variables with environment variables
in netboot_update_env()
Signed-off-by: Sean Edmond <[email protected]>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/net.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/cmd/net.c b/cmd/net.c index d5e20843dda..036b7720a7c 100644 --- a/cmd/net.c +++ b/cmd/net.c @@ -186,7 +186,7 @@ U_BOOT_CMD( static void netboot_update_env(void) { - char tmp[22]; + char tmp[44]; if (net_gateway.s_addr) { ip_to_string(net_gateway, tmp); @@ -247,6 +247,27 @@ static void netboot_update_env(void) env_set("ntpserverip", tmp); } #endif + + if (IS_ENABLED(CONFIG_IPV6)) { + if (!ip6_is_unspecified_addr(&net_ip6) || + net_prefix_length != 0) { + sprintf(tmp, "%pI6c", &net_ip6); + if (net_prefix_length != 0) + sprintf(tmp, "%s/%d", tmp, net_prefix_length); + + env_set("ip6addr", tmp); + } + + if (!ip6_is_unspecified_addr(&net_server_ip6)) { + sprintf(tmp, "%pI6c", &net_server_ip6); + env_set("serverip6", tmp); + } + + if (!ip6_is_unspecified_addr(&net_gateway6)) { + sprintf(tmp, "%pI6c", &net_gateway6); + env_set("gatewayip6", tmp); + } + } } /** |
