1
0
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:
Viacheslav Mitrofanov
2022-12-02 12:18:07 +03:00
committed by Tom Rini
parent ffdbf3bad5
commit 7fbf230d79
3 changed files with 103 additions and 7 deletions

View File

@@ -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;
}