changeset 255:21264951b120

Fix problems with gateway/mask setup.
author gthomas
date Tue, 30 Jul 2002 12:59:22 +0000
parents 8f06eb89a9e3
children 1eb79d208648
files packages/redboot/current/ChangeLog packages/redboot/current/src/net/ip.c packages/redboot/current/src/net/net_io.c
diffstat 3 files changed, 22 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/packages/redboot/current/ChangeLog
+++ b/packages/redboot/current/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-30  Gary Thomas  <gary@chez-thomas.org>
+
+	* src/net/net_io.c: Handle broadcast/mask setup better (failed if
+	not found in FLASH).  Also print on network info line.
+
 2002-07-18  Gary Thomas  <gary@chez-thomas.org>
 
 	* src/net/tftp_client.c: 
--- a/packages/redboot/current/src/net/ip.c
+++ b/packages/redboot/current/src/net/ip.c
@@ -9,11 +9,11 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
 // Software Foundation; either version 2 or (at your option) any later version.
-// Copyright (C) 2002 Gary Thomas
 //
 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
--- a/packages/redboot/current/src/net/net_io.c
+++ b/packages/redboot/current/src/net/net_io.c
@@ -570,7 +570,13 @@ static void
 show_addrs(void)
 {
     diag_printf("IP: %s", inet_ntoa((in_addr_t *)&__local_ip_addr));
-    diag_printf(", Default server: %s", inet_ntoa(&my_bootp_info.bp_siaddr));
+#ifdef CYGSEM_REDBOOT_NETWORKING_USE_GATEWAY
+    diag_printf("/%s", inet_ntoa((in_addr_t *)&__local_ip_mask));
+    diag_printf(", Gateway: %s\n", inet_ntoa((in_addr_t *)&__local_ip_gate));
+#else
+    diag_printf(", ");
+#endif
+    diag_printf("Default server: %s", inet_ntoa(&my_bootp_info.bp_siaddr));
 #ifdef CYGPKG_REDBOOT_NETWORKING_DNS
     show_dns();
 #endif
@@ -583,14 +589,15 @@ flash_get_IP(char *id, ip_addr_t *val)
 {
     ip_addr_t my_ip;
     int i;
-    
-    flash_get_config(id, &my_ip, CONFIG_IP);
-    if (my_ip[0] != 0 || my_ip[1] != 0 ||
-        my_ip[2] != 0 || my_ip[3] != 0) {
-        // 'id' is set to something so let it override any static IP
-        for (i=0; i<4; i++)
-            (*val)[i] = my_ip[i];
-    }        
+
+    if (flash_get_config(id, &my_ip, CONFIG_IP)) {
+        if (my_ip[0] != 0 || my_ip[1] != 0 ||
+            my_ip[2] != 0 || my_ip[3] != 0) {
+            // 'id' is set to something so let it override any static IP
+            for (i=0; i<4; i++)
+                (*val)[i] = my_ip[i];
+        }        
+    }
 }
 #endif