summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAnna Jonna Armannsdottir <annajonna@gmail.com>2010-03-22 14:51:55 +0000
committermaximilian attems <maks@debian.org>2010-03-25 02:14:33 +0100
commit40b99bb35a81066aadbd13e663ffdf9d1a3ba2ad (patch)
tree76822fbde6a54148adecd4486dfece9f45c10d9d /scripts
parent06a104875366502651939c8449382fb2ac95a9c5 (diff)
downloadinitramfs-tools-40b99bb35a81066aadbd13e663ffdf9d1a3ba2ad.tar.gz
initramfs-tools-40b99bb35a81066aadbd13e663ffdf9d1a3ba2ad.zip
configure_networking: Try repeatedly ipconfig with increasing timeout
Here is a bug description and a patch. Please consider it. The patch solves a an LTSP client problem that arises when the clients are connected to Cisco switches that have spanning-tree calculations enabled. Also related to: http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=9c3ec61b1a5e2feaa8d9c6de737eaa00eb446a9c And http://git.debian.org/?p=kernel/initramfs-tools.git;a=commitdiff;h=115134f07a0dd042355a2a6fb5a5ca987b000f5d Here in an extensive explaination: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/181258 Also in the following: I can report the same problem. A number of diskless clients go flawlessly through a PXE boot, then the net interface is brought down when the Linux kernel boots and suddenly, dhcp does not work anymore. Background research on the network: The clients are connected to Cisco switches. The configuration of the switches makes them run spanning-tree calculations. This usually takes some seconds but for large networks it can take up to 30 40 seconds. The network port on the switch is turned on, when this calculation has been finished. This is primarily a security measure. See also: http://networkers-online.com/blog/2008/08/what-is-bpdu-filter/ If this security measure is turned off, the client boots without problems. :) To debug the problem, the following boot line was used: kernel amd64/vmlinuz append ro initrd=amd64/initrd.img nbdport=2000 debug=100 break=1 ip=dhcp In my case, this causes a timeout as can be seen on the attached screenshots. The kernel loads the NIC module e1000e and reports the type of NIC et.c. The kernel time reported is 5.927 . The debug shows the following: configure_networking [ -n eth0 ] [-e /tmp/net-eth0.conf ] ipconfig -t 60 eth0 At about 6.4 in kernel time, the NIC module reports further about it's IRQ configuration. Two seconds (2 sec) later at about 8.56 the NIC module reports that the Link is up at 100 Mbps full duplex. Some milliseconds later it signals ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready . At this point in time, ipconfig is just waiting for an answer to the DHCP-discover that really was choked by the switch. Now this is an obvious flaw in the script. It would be much more reasonable to try repeatedly with increasing timouts. This would also be much more efficent. may I suggest the following timeouts: 4 8 16 30 60 The sum of this timeout is about 120 seconds. I did some testing with exponential timeout with 1 2 4 8 16 30 ... and it solved the problem, but it seems that ipconfig runs once additionally after it has actually done the job. I am running tests now with an exponent of n/1.5 instead of n. That would give a sequence of (ca) 2 3 4 6 9 16 25 36 64 100 Attached are a jpeg screenshot of the boot sequence and of course the patch. The patch is relative to the present git snapshot. -- Kindest Regards, Anna Jonna Ármannsdóttir, %& A: Because people read from top to bottom. Unix System Aministration, Computing Services, %& Q: Why is top posting bad? University of Iceland. Signed-off-by: maximilian attems <maks@debian.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/functions64
1 files changed, 38 insertions, 26 deletions
diff --git a/scripts/functions b/scripts/functions
index 60cfc11..f99cba4 100644
--- a/scripts/functions
+++ b/scripts/functions
@@ -299,33 +299,45 @@ configure_networking()
# support ip options see linux sources
# Documentation/filesystems/nfsroot.txt
- case ${IP} in
- none|off)
- # Do nothing
- ;;
- ""|on|any)
- # Bring up device
- ipconfig -t 180 ${DEVICE}
- ;;
- dhcp|bootp|rarp|both)
- ipconfig -t 180 -c ${IP} -d ${DEVICE}
- ;;
- *)
- ipconfig -t 180 -d $IP
-
- # grab device entry from ip option
- NEW_DEVICE=${IP#*:*:*:*:*:*}
- if [ "${NEW_DEVICE}" != "${IP}" ]; then
- NEW_DEVICE=${NEW_DEVICE%:*}
- else
- # wrong parse, possibly only a partial string
- NEW_DEVICE=
- fi
- if [ -n "${NEW_DEVICE}" ]; then
- DEVICE="${NEW_DEVICE}"
+ # Documentation/frv/booting.txt
+
+ for ROUNDTTT in 2 3 4 6 9 16 25 36 64 100; do
+
+ # The NIC is to be configured if this file does not exist.
+ # Ip-Config tries to create this file and when it succeds
+ # creating the file, ipconfig is not run again.
+ if [ -e /tmp/net-"${DEVICE}".conf ]; then
+ break;
fi
- ;;
- esac
+
+ case ${IP} in
+ none|off)
+ # Do nothing
+ ;;
+ ""|on|any)
+ # Bring up device
+ ipconfig -t ${ROUNDTTT} ${DEVICE}
+ ;;
+ dhcp|bootp|rarp|both)
+ ipconfig -t ${ROUNDTTT} -c ${IP} -d ${DEVICE}
+ ;;
+ *)
+ ipconfig -t ${ROUNDTTT} -d $IP
+
+ # grab device entry from ip option
+ NEW_DEVICE=${IP#*:*:*:*:*:*}
+ if [ "${NEW_DEVICE}" != "${IP}" ]; then
+ NEW_DEVICE=${NEW_DEVICE%:*}
+ else
+ # wrong parse, possibly only a partial string
+ NEW_DEVICE=
+ fi
+ if [ -n "${NEW_DEVICE}" ]; then
+ DEVICE="${NEW_DEVICE}"
+ fi
+ ;;
+ esac
+ done
# source ipconfig output
if [ -n "${DEVICE}" ]; then