diff options
author | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-03 19:36:40 -0500 |
---|---|---|
committer | Joe Hershberger <joe.hershberger@ni.com> | 2018-07-26 14:08:20 -0500 |
commit | 3855cad62342c3268465bc760e2bd7e6d0ce7f31 (patch) | |
tree | 77c65135c28b0ce46511a4706ae3a8597fd696ea /net | |
parent | 3a66fcb7c3dd3297d7e49185a8da2cbe77ffa431 (diff) |
net: Re-check prerequisites when autoloading
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 <joe.hershberger@ni.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/net.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net/net.c b/net/net.c index bff3e9c5b53..42a50e60f84 100644 --- a/net/net.c +++ b/net/net.c @@ -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. */ @@ -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); } |