Prefer use of a 'nfsserverip' env var before falling back to 'serverip'
when using the nfs command. Similar to how the 'tftpserverip' env var
is preferred over 'serverip' by the tftp command.

This also updates the error message to closer match the error message
used by the lwIP tftp command when a server ip is not set.

Signed-off-by: Jonas Karlman <[email protected]>
---
 net/lwip/nfs.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/net/lwip/nfs.c b/net/lwip/nfs.c
index 1812bbda68e5..c3b819a091ec 100644
--- a/net/lwip/nfs.c
+++ b/net/lwip/nfs.c
@@ -247,10 +247,12 @@ int do_nfs(struct cmd_tbl *cmdtp, int flag, int argc, 
char *const argv[])
                }
        }
 
+       if (!server_ip)
+               server_ip = env_get("nfsserverip");
        if (!server_ip)
                server_ip = env_get("serverip");
        if (!server_ip) {
-               log_err("*** ERROR: 'serverip' not set\n");
+               log_err("error: nfsserverip/serverip not set\n");
                ret = CMD_RET_FAILURE;
                goto out;
        }
-- 
2.52.0

Reply via email to