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]

dhcp_prot.c: some fixes


Hi all;

The attachment fixes the following problems.

    1) When dhcp is reinitialized by calling init_all_network_interfaces()
       (from management thread), or retried due to the failute at the 
       previous trial, the lease is left the previous state. It causes 
       unexpected problems. For example, if the previous do_dhcp exits 
       with the lease as DHCP_LEASE_T1, *pstate changes into 
       DHCPSTATE_RENEWING from DHCPSTATE_INIT immediately before 
       the switch sentence in the next do_dhcp().
    2) If the state falls into DHCPSTATE_NOTBOUND, do_dhcp_down_net() is 
       not called from dhcp_halt() because ethX_up is false at the time.

Motoya Kurotsu
Allied Telesis K.K.

diff -Nurp common.orig/current/ChangeLog common/current/ChangeLog
--- common.orig/current/ChangeLog	Fri Jul 25 03:07:45 2003
+++ common/current/ChangeLog	Tue Jul 29 11:04:19 2003
@@ -1,3 +1,9 @@
+2003-07-29  Motoya Kurotsu  <kurotsu@allied-telesis.co.jp>
+
+	* src/dhcp_prot.c (do_dhcp): Initialize the lease when
+	dhcp is (re)initialized or retried.
+	Return true when the state falls into DHCPSTATE_NOTBOUND.
+
 2003-07-24  Nick Garnett  <nickg@balti.calivar.com>
 
 	* src/dhcp_prot.c: Added a declaration for cyg_arc4random() to
diff -Nurp common.orig/current/src/dhcp_prot.c common/current/src/dhcp_prot.c
--- common.orig/current/src/dhcp_prot.c	Fri Jul 25 03:07:46 2003
+++ common/current/src/dhcp_prot.c	Mon Jul 28 18:54:36 2003
@@ -592,6 +592,7 @@ do_dhcp(const char *intf, struct bootp *
             return false;
 
         *pstate = DHCPSTATE_INIT;
+	lease->which = lease->next = 0;
     }
 
     s = socket(AF_INET, SOCK_DGRAM, 0);
@@ -1189,7 +1190,7 @@ do_dhcp(const char *intf, struct bootp *
             // No lease active
             no_lease( lease );
             // Leave interface up so app can tidy.
-            return false;
+            return true;
 
         case DHCPSTATE_FAILED:
             // All done with socket


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