summaryrefslogtreecommitdiff
path: root/net/net.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2018-07-03 19:36:39 -0500
committerJoe Hershberger <joe.hershberger@ni.com>2018-07-26 14:08:19 -0500
commit3a66fcb7c3dd3297d7e49185a8da2cbe77ffa431 (patch)
tree1e8bfdffb0f1af9dab1a0a4324f516057e3fd507 /net/net.c
parentfaecf84ab14d38e9316275775097caeea73b1f32 (diff)
net: When checking prerequisites, consider boot_file_name
For net_boot_common, we allow the serverip to be specified as part of the boot file name. For net commands that require serverip, include that source as a valid specification of serverip. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Reviewed-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'net/net.c')
-rw-r--r--net/net.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/net.c b/net/net.c
index f35695b4fc..bff3e9c5b5 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1341,7 +1341,7 @@ static int net_check_prereq(enum proto_t protocol)
/* Fall through */
case TFTPGET:
case TFTPPUT:
- if (net_server_ip.s_addr == 0) {
+ if (net_server_ip.s_addr == 0 && !is_serverip_in_cmd()) {
puts("*** ERROR: `serverip' not set\n");
return 1;
}
@@ -1512,6 +1512,11 @@ void copy_filename(char *dst, const char *src, int size)
*dst = '\0';
}
+int is_serverip_in_cmd(void)
+{
+ return !!strchr(net_boot_file_name, ':');
+}
+
#if defined(CONFIG_CMD_NFS) || \
defined(CONFIG_CMD_SNTP) || \
defined(CONFIG_CMD_DNS)