Netdev List
 help / color / mirror / Atom feed
From: Paolo Galtieri <pgaltieri@mvista.com>
To: netdev@oss.sgi.com
Subject: Infinite loop in autoconfig with no dhcp server
Date: Tue, 28 Jun 2005 08:14:09 -0700	[thread overview]
Message-ID: <1119971649.21672.12.camel@playin.mvista.com> (raw)

Folks,
  it appears that the attempt to do auto configuration will go on
forever if there is no DHCP server available.  The question I have is is
this the intended behavior when IPCONFIG_DYNAMIC is set, but
CONFIG_ROOT_NFS is not?

The function in question is ip_auto_config() in net/ipv4/ipconfig.c

Here is the situation:

At the top of ip_auto_config() we have:

#ifdef IPCONFIG_DYNAMIC
 try_try_again:
#endif

A bit further down we have:

    if (ic_myaddr == INADDR_NONE ||
#ifdef CONFIG_ROOT_NFS
        (MAJOR(ROOT_DEV) == UNNAMED_MAJOR
         && root_server_addr == INADDR_NONE
         && ic_servaddr == INADDR_NONE) ||
#endif
        ic_first_dev->next) {
#ifdef IPCONFIG_DYNAMIC

We are doing dynamic configuration so we drop into the if and initialize
the retry count:

        int retries = CONF_OPEN_RETRIES;

We call ic_dynamic() to attempt the connection:

        if (ic_dynamic() < 0) {
            ic_close_devs();

There is no DHCP server running so ic_dynamic() returns -1 indicating a
timeout occured.  We decrement retries to 1 and go to try_try_again.

            if (--retries) {
                printk(KERN_ERR
                       "IP-Config: Reopening network devices...\n");
                goto try_try_again;
            }

We drop back into the if set retries to 2 again, since it is a local
variable, call ic_dynamic() which returns -1 due to a timeout.
We decrement retries to 1 and go to try_try_again.  We drop into the if
again, set retries to 2, call ic_dynamic() ad infinitum.

We have the Energizer Bunny auto configuration :-), it goes on and on
and on.

We never reach the "Auto-configuration of network failed" printk.

One way to fix the problem is attached below.

Does this seem reasonable or should I go find a rock and crawl under it?


Please reply directly to me as I am not on this mailing list.

Paolo Galtieri

--- linux-2.6.12.1/net/ipv4/ipconfig.c  2005-06-23 06:49:56.000000000
-0700
+++ linux-2.6.12.1-new/net/ipv4/ipconfig.c      2005-06-28
08:09:11.143292280 -0700
@@ -1248,6 +1248,10 @@
 {
        u32 addr;

+#ifdef IPCONFIG_DYNAMIC
+       int retries = CONF_OPEN_RETRIES;
+#endif
+
 #ifdef CONFIG_PROC_FS
        proc_net_fops_create("pnp", S_IRUGO, &pnp_seq_fops);
 #endif /* CONFIG_PROC_FS */
@@ -1284,8 +1288,6 @@
            ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC

-               int retries = CONF_OPEN_RETRIES;
-
                if (ic_dynamic() < 0) {
                        ic_close_devs();

                 reply	other threads:[~2005-06-28 15:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1119971649.21672.12.camel@playin.mvista.com \
    --to=pgaltieri@mvista.com \
    --cc=netdev@oss.sgi.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