From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27278 invoked by alias); 29 Jul 2003 16:06:32 -0000 Mailing-List: contact ecos-maintainers-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Post: List-Help: , Sender: ecos-maintainers-owner@sources.redhat.com Received: (qmail 27270 invoked from network); 29 Jul 2003 16:06:30 -0000 Date: Tue, 29 Jul 2003 16:06:00 -0000 From: Andrew Lunn To: eCos Maintainers Subject: FWD: dhcp_prot.c: some fixes Message-ID: <20030729160614.GR1334@biferten.ma.tech.ascom.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-Filter-Version: 1.11a (rubicon) X-SW-Source: 2003-07/txt/msg00006.txt.bz2 I don't claim to understand the subtleties of DHCP, but this looks OK to me. Could some else take a look as well, particularly the second hunk. Thanks Andrew ----- Forwarded message from Motoya Kurotsu ----- Date: Tue, 29 Jul 2003 11:38:18 +0900 From: Motoya Kurotsu To: ecos-patches@sources.redhat.com Subject: 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 + + * 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 * 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 ----- End forwarded message -----