aboutsummaryrefslogtreecommitdiff
path: root/net/tftp.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2018-07-03 19:36:43 -0500
committerJoe Hershberger <joe.hershberger@ni.com>2018-07-26 14:08:20 -0500
commit6ab12830921c1de4eb90a0d471bf5f4677af734c (patch)
treee843a02a84a0797ab7d0dbb7e4e4cc8d3cb0a3a9 /net/tftp.c
parentf43308fa0c7834d9707a2c212591275d1e095e50 (diff)
downloadu-boot-6ab12830921c1de4eb90a0d471bf5f4677af734c.zip
u-boot-6ab12830921c1de4eb90a0d471bf5f4677af734c.tar.gz
u-boot-6ab12830921c1de4eb90a0d471bf5f4677af734c.tar.bz2
net: Consolidate the parsing of bootfile
The same basic parsing was implemented in tftp and nfs, so add a helper function to do the work once. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'net/tftp.c')
-rw-r--r--net/tftp.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/net/tftp.c b/net/tftp.c
index 6671b1f..68ffd81 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -735,7 +735,7 @@ void tftp_start(enum proto_t protocol)
tftp_block_size_option, timeout_ms);
tftp_remote_ip = net_server_ip;
- if (net_boot_file_name[0] == '\0') {
+ if (!net_parse_bootfile(&tftp_remote_ip, tftp_filename, MAX_LEN)) {
sprintf(default_filename, "%02X%02X%02X%02X.img",
net_ip.s_addr & 0xFF,
(net_ip.s_addr >> 8) & 0xFF,
@@ -747,17 +747,6 @@ void tftp_start(enum proto_t protocol)
printf("*** Warning: no boot file name; using '%s'\n",
tftp_filename);
- } else {
- char *p = strchr(net_boot_file_name, ':');
-
- if (p == NULL) {
- strncpy(tftp_filename, net_boot_file_name, MAX_LEN);
- tftp_filename[MAX_LEN - 1] = 0;
- } else {
- tftp_remote_ip = string_to_ip(net_boot_file_name);
- strncpy(tftp_filename, p + 1, MAX_LEN);
- tftp_filename[MAX_LEN - 1] = 0;
- }
}
printf("Using %s device\n", eth_get_name());