changeset 173:547dc35af910

Fix bootp local ip addr bug from last commit
author jlarmour
date Fri, 20 Jul 2001 13:11:29 +0000
parents cd45958b28ff
children 38892b97b685
files packages/redboot/current/src/net/net_io.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -543,11 +543,18 @@ net_init(void)
     flash_get_config("net_debug", &net_debug, CONFIG_BOOL);
     flash_get_config("gdb_port", &gdb_port, CONFIG_INT);
     flash_get_config("bootp", &use_bootp, CONFIG_BOOL);
-    if (use_bootp) {
-        flash_get_config("bootp_my_ip", &__local_ip_addr, CONFIG_IP);
-        flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP)
-;
+    {
+        ip_addr_t bootp_my_ip;
+        char i;
+        flash_get_config("bootp_my_ip", &bootp_my_ip, CONFIG_IP);
+        if (bootp_my_ip[0] != 0 || bootp_my_ip[1] != 0 ||
+            bootp_my_ip[2] != 0 || bootp_my_ip[3] != 0) {
+            // bootp_my_ip is set to something so let it override any static IP
+            for (i=0; i<4; i++)
+                __local_ip_addr[i] = bootp_my_ip[i];
+        }        
     }
+    flash_get_config("bootp_server_ip", &my_bootp_info.bp_siaddr, CONFIG_IP);
 #endif
     have_net = false;
     // Make sure the recv buffers are set up