mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 00:32:04 +02:00
net: tftp: Add IPv6 support for tftpboot
The command tftpboot uses IPv4 by default. Add the possibility to use IPv6 instead. If an address in the command is an IPv6 address it will use IPv6 to boot or if there is a suffix -ipv6 in the end of the command it also force using IPv6. All other tftpboot features and parameters are left the same. Signed-off-by: Viacheslav Mitrofanov <v.v.mitrofanov@yadro.com> Reviewed-by: Ramon Fried <rfried.dev@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Tom Rini
parent
ffdbf3bad5
commit
7fbf230d79
17
net/net.c
17
net/net.c
@@ -1455,7 +1455,14 @@ static int net_check_prereq(enum proto_t protocol)
|
||||
/* Fall through */
|
||||
case TFTPGET:
|
||||
case TFTPPUT:
|
||||
if (net_server_ip.s_addr == 0 && !is_serverip_in_cmd()) {
|
||||
if (IS_ENABLED(CONFIG_IPV6) && use_ip6) {
|
||||
if (!memcmp(&net_server_ip6, &net_null_addr_ip6,
|
||||
sizeof(struct in6_addr)) &&
|
||||
!strchr(net_boot_file_name, '[')) {
|
||||
puts("*** ERROR: `serverip6' not set\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (net_server_ip.s_addr == 0 && !is_serverip_in_cmd()) {
|
||||
puts("*** ERROR: `serverip' not set\n");
|
||||
return 1;
|
||||
}
|
||||
@@ -1468,7 +1475,13 @@ common:
|
||||
case NETCONS:
|
||||
case FASTBOOT:
|
||||
case TFTPSRV:
|
||||
if (net_ip.s_addr == 0) {
|
||||
if (IS_ENABLED(CONFIG_IPV6) && use_ip6) {
|
||||
if (!memcmp(&net_link_local_ip6, &net_null_addr_ip6,
|
||||
sizeof(struct in6_addr))) {
|
||||
puts("*** ERROR: `ip6addr` not set\n");
|
||||
return 1;
|
||||
}
|
||||
} else if (net_ip.s_addr == 0) {
|
||||
puts("*** ERROR: `ipaddr' not set\n");
|
||||
return 1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user