This is the mail archive of the ecos-patches@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RedBoot: don't initialize network if we don't have an IP address


Hi,

This patch prevents the networking portion of RedBoot from being
initialized if we don't have a valid IP address (i.e., the IP address is
all zeros) and we're not using BOOTP.

David Vrabel
-- 
David Vrabel, Design Engineer

Arcom, Clifton Road           Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK         Web: http://www.arcom.com/
%status
pending
%patch
Index: packages/redboot/current/ChangeLog
===================================================================
--- packages/redboot/current/ChangeLog.orig	2005-04-21 14:20:26.000000000 +0100
+++ packages/redboot/current/ChangeLog	2005-04-21 14:23:15.000000000 +0100
@@ -8,6 +8,9 @@
 
 2005-04-21  David Vrabel  <dvrabel@arcom.com>
 
+	* src/net/net_io.c (net_init): Don't initialize the network if we
+	don't have an IP address.
+
 	* src/main.c (cyg_start): Use the workspace memory section
 	(CYGMEM_SECTION_workspace) as the workspace if it is defined.
 	This prevents the user from trampling over the heap1 section.
Index: packages/redboot/current/src/net/net_io.c
===================================================================
--- packages/redboot/current/src/net/net_io.c.orig	2005-04-21 13:48:46.000000000 +0100
+++ packages/redboot/current/src/net/net_io.c	2005-04-21 14:21:47.000000000 +0100
@@ -770,11 +770,17 @@
             }
         }
     } else {
-        enet_addr_t enet_addr;
-        have_net = true;  // Assume values in FLASH were OK
-        // Tell the world that we are using this fixed IP address
-        if (__arp_request((ip_addr_t *)__local_ip_addr, &enet_addr, 1) >= 0) {
-            diag_printf("Warning: IP address %s in use\n", inet_ntoa((in_addr_t *)&__local_ip_addr));
+        if (__local_ip_addr[0] == 0 && __local_ip_addr[1] == 0 &&
+            __local_ip_addr[2] == 0 && __local_ip_addr[3] == 0) {
+            show_eth_info();
+            diag_printf("No IP info for device!\n");
+        } else {
+            enet_addr_t enet_addr;
+            have_net = true;  // Assume values in FLASH were OK
+            // Tell the world that we are using this fixed IP address
+            if (__arp_request((ip_addr_t *)__local_ip_addr, &enet_addr, 1) >= 0) {
+                diag_printf("Warning: IP address %s in use\n", inet_ntoa((in_addr_t *)&__local_ip_addr));
+            }
         }
     }
     if (have_net) {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]