summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rwxr-xr-xsbin/init.d/functions8
-rwxr-xr-xsbin/init.d/network11
3 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 318e690..e264785 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006/02/02 : 0.3.35
+- the network script can now set the hostname via DHCP and waits 1 second for
+ the link to set up when needed before the DHCP request.
+2005/10/02
+- the 'daemon' function no longer closes stdin/stdout, but rather redirects them
+ to /dev/null in order to avoid stupid daemons such as cron to pass closed fds
+ to the services they call !
2004/12/14 : 0.3.34
- firewall now supports anonymous config files
2004/05/31 : 0.3.33
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index 7156528..e2af4e2 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -148,11 +148,11 @@ function svc_pidof {
}
# This function starts the given process in background, in a new session,
-# and with all its I/O closed, to ensure that it will not block a TTY if
-# a lazy coder didn't think appropriate to close the file descriptors
-# before forking.
+# and with all its I/O directed to /dev/null, to ensure that it will not
+# block a TTY if a lazy coder didn't think appropriate to close the file
+# descriptors before forking.
function daemon {
- setsid "$@" <&- 1<&- 2<&- &
+ setsid "$@" </dev/null >&0 2>&0 &
}
######################
diff --git a/sbin/init.d/network b/sbin/init.d/network
index b982877..266e1b0 100755
--- a/sbin/init.d/network
+++ b/sbin/init.d/network
@@ -32,6 +32,8 @@ fi
. `dirname $0`/functions
option ip option_ip
+option usedhcphostname boolean_option 0
+option dhcptimeout standard_option 10
option media standard_option
option duplex standard_option
option speed standard_option
@@ -302,7 +304,14 @@ function do_start {
while [ $arg -lt $addr_idx ]; do
if [ "${addr_list[$arg]}" = "dhcp" ]; then
echo " ==> Waiting for ip address with DHCP request ... "
- dhcpcd -t 10 $instname
+ # on some cards (eg: tg3), we need to wait a bit before
+ # using the link.
+ ethtool $instname 2>/dev/null | grep -qF 'Link detected: yes' || sleep 1
+ if [ "$opt_usedhcphostname" = 0 ]; then
+ dhcpcd -t ${opt_dhcptimeout:-10} $instname
+ else
+ dhcpcd -H -t ${opt_dhcptimeout:-10} $instname
+ fi
set -- $(ip addr show dev $instname | grep ' inet ')
if [ -n "$2" ]; then
echo " Device $instname has IP address $2"