Skip to content

Commit

Permalink
net: Re-check prerequisites when autoloading
Browse files Browse the repository at this point in the history
With net autoload, we check the prerequisites for the initial command,
but the greater prerequisites when autoloading are not checked.

If we would attempt to autoload, check those prerequisites too.

If we are not expecting a serverip from the server, then don't worry
about it not being set, but don't attempt to load if it isn't.

Signed-off-by: Joe Hershberger <[email protected]>
  • Loading branch information
jhershbe committed Jul 26, 2018
1 parent 3a66fcb commit 3855cad
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions net/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,16 @@ void net_auto_load(void)
const char *s = env_get("autoload");

if (s != NULL && strcmp(s, "NFS") == 0) {
if (net_check_prereq(NFS)) {
/* We aren't expecting to get a serverip, so just accept the assigned IP */
#ifdef CONFIG_BOOTP_SERVERIP
net_set_state(NETLOOP_SUCCESS);
#else
printf("Cannot autoload with NFS\n");
net_set_state(NETLOOP_FAIL);
#endif
return;
}
/*
* Use NFS to load the bootfile.
*/
Expand All @@ -347,6 +357,16 @@ void net_auto_load(void)
net_set_state(NETLOOP_SUCCESS);
return;
}
if (net_check_prereq(TFTPGET)) {
/* We aren't expecting to get a serverip, so just accept the assigned IP */
#ifdef CONFIG_BOOTP_SERVERIP
net_set_state(NETLOOP_SUCCESS);
#else
printf("Cannot autoload with TFTPGET\n");
net_set_state(NETLOOP_FAIL);
#endif
return;
}
tftp_start(TFTPGET);
}

Expand Down

0 comments on commit 3855cad

Please sign in to comment.