net-snk: Allow stateless autoconfig IPv6 addresses with IP_INIT_IPV6_MANUAL

When manually specifying the TFTP server address and boot file name
in IPv6 mode, we can still get the client IPv6 address via link-local
or stateless IPv6 address autoconfiguration. So the netboot should
not abort if just the client IPv6 address has not been specified yet.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
This commit is contained in:
Thomas Huth 2016-01-14 00:10:39 +01:00 committed by Alexey Kardashevskiy
parent 82660c5da4
commit 056ff5b32d
1 changed files with 11 additions and 4 deletions

View File

@ -486,10 +486,8 @@ netboot(int argc, char *argv[])
}
}
else if (ip_version == 6) {
if (memcmp(&obp_tftp_args.ci6addr, null_ip6, 16) != 0
&& memcmp(&obp_tftp_args.si6addr, null_ip6, 16) != 0
if (memcmp(&obp_tftp_args.si6addr, null_ip6, 16) != 0
&& obp_tftp_args.filename[0] != 0) {
memcpy(&fn_ip.server_ip6.addr[0],
&obp_tftp_args.si6addr.addr, 16);
obp_tftp_args.ip_init = IP_INIT_IPV6_MANUAL;
@ -523,7 +521,16 @@ netboot(int argc, char *argv[])
obp_tftp_args.bootp_retries, F_IPV6);
break;
case IP_INIT_IPV6_MANUAL:
set_ipv6_address(fn_ip.fd, &obp_tftp_args.ci6addr);
if (memcmp(&obp_tftp_args.ci6addr, null_ip6, 16)) {
set_ipv6_address(fn_ip.fd, &obp_tftp_args.ci6addr);
} else {
/*
* If no client address has been specified, then
* use a link-local or stateless autoconfig address
*/
set_ipv6_address(fn_ip.fd, NULL);
memcpy(&fn_ip.own_ip6, get_ipv6_address(), 16);
}
break;
case IP_INIT_DEFAULT:
rc = dhcp(ret_buffer, &fn_ip, obp_tftp_args.bootp_retries, 0);