net: Don't write the "serverip" env var if configured not to
authorJoe Hershberger <joe.hershberger@ni.com>
Wed, 23 May 2012 07:59:17 +0000 (07:59 +0000)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 23 May 2012 22:53:04 +0000 (17:53 -0500)
Before this patch, bootp would not overwrite the value, but the
value was still clobbered in the env

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
common/cmd_net.c

index 65f32bceef41de6e7b953752f2e92bf727e2d315..2f660566f72f07f3fd8defc53ec85e45339796a1 100644 (file)
@@ -153,12 +153,16 @@ static void netboot_update_env (void)
                ip_to_string (NetOurIP, tmp);
                setenv ("ipaddr", tmp);
        }
-
+#if !defined(CONFIG_BOOTP_SERVERIP)
+       /*
+        * Only attempt to change serverip if net/bootp.c:BootpCopyNetParams()
+        * could have set it
+        */
        if (NetServerIP) {
                ip_to_string (NetServerIP, tmp);
                setenv ("serverip", tmp);
        }
-
+#endif
        if (NetOurDNSIP) {
                ip_to_string (NetOurDNSIP, tmp);
                setenv ("dnsip", tmp);