public inbox for ecos-maintainers@sourceware.org
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew.lunn@ascom.ch>
To: eCos Maintainers <ecos-maintainers@sources.redhat.com>
Subject: FWD: dhcp_prot.c: some fixes
Date: Tue, 29 Jul 2003 16:06:00 -0000	[thread overview]
Message-ID: <20030729160614.GR1334@biferten.ma.tech.ascom.ch> (raw)

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 -----

             reply	other threads:[~2003-07-29 16:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 16:06 Andrew Lunn [this message]
2003-07-29 16:20 ` Gary Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030729160614.GR1334@biferten.ma.tech.ascom.ch \
    --to=andrew.lunn@ascom.ch \
    --cc=ecos-maintainers@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).