public inbox for ecos-maintainers@sourceware.org
 help / color / mirror / Atom feed
* FWD: dhcp_prot.c: some fixes
@ 2003-07-29 16:06 Andrew Lunn
  2003-07-29 16:20 ` Gary Thomas
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lunn @ 2003-07-29 16:06 UTC (permalink / raw)
  To: eCos Maintainers

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 <kurotsu@allied-telesis.co.jp> -----

Date: Tue, 29 Jul 2003 11:38:18 +0900
From: Motoya Kurotsu <kurotsu@allied-telesis.co.jp>
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  <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

----- End forwarded message -----

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: FWD: dhcp_prot.c: some fixes
  2003-07-29 16:06 FWD: dhcp_prot.c: some fixes Andrew Lunn
@ 2003-07-29 16:20 ` Gary Thomas
  0 siblings, 0 replies; 2+ messages in thread
From: Gary Thomas @ 2003-07-29 16:20 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: eCos Maintainers

On Tue, 2003-07-29 at 10:06, Andrew Lunn wrote:
> 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.

I think it's OK.  Of course, I agree that the magic which takes place
when leases expire, etc, makes this a tough call.

I trust that this guy has tested the change - he seems to be pretty good
about things.

-- 
Gary Thomas <gary@mlbassoc.com>
MLB Associates

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-07-29 16:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-29 16:06 FWD: dhcp_prot.c: some fixes Andrew Lunn
2003-07-29 16:20 ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).