summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2006-07-16 15:10:03 +0200
committerWilly Tarreau <willy@wtap.(none)>2006-07-26 12:03:50 +0200
commitd60ddb026299aab4875c2a667b72e1b10fd7af13 (patch)
tree37ecfdaafe8582d9e902888869cf3ce74c240691
parent[RELEASE] init-scripts-0.3.31 (diff)
downloadinit-scripts-d60ddb026299aab4875c2a667b72e1b10fd7af13.tar.gz
[RELEASE] init-scripts-0.3.32v0.3.32
-rw-r--r--ChangeLog7
-rwxr-xr-xetc/startup.rc1
-rwxr-xr-xsbin/init.d/functions2
-rwxr-xr-xsbin/init.d/network66
4 files changed, 66 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 3b61d82..824d87c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2004/05/30 : 0.3.32
+- added a commented out line with "/sbin/wdd" in 'startup.rc'
+- added full path to /sbin/rmmod in 'functions' (needed by cron)
+- 'network' now starts lo even if it is already up (allows multiple addresses)
+- 'network' can execute a command at load/unload time
+- 'network' now accepts local routes without gateways (use '-' instead of the
+ gateway)
2004/03/11 : 0.3.31
- fixed a load error in the firewall script with forwarding disabled
- fixed an infinite loop bug in recursive_rmmod()
diff --git a/etc/startup.rc b/etc/startup.rc
index 177d2c1..f1293e1 100755
--- a/etc/startup.rc
+++ b/etc/startup.rc
@@ -1,3 +1,4 @@
#!/bin/sh
/sbin/init.d/sysprofiles /etc/config.rc
+#/sbin/wdd
diff --git a/sbin/init.d/functions b/sbin/init.d/functions
index 4d1be02..7156528 100755
--- a/sbin/init.d/functions
+++ b/sbin/init.d/functions
@@ -228,7 +228,7 @@ function recursive_rmmod {
(( mod++ ))
done
elif [ "${args[2]}" = "0" ]; then
- rmmod $1
+ /sbin/rmmod $1
return $?
else
# impossible to remove this module (count>0)
diff --git a/sbin/init.d/network b/sbin/init.d/network
index a136a69..883a9f0 100755
--- a/sbin/init.d/network
+++ b/sbin/init.d/network
@@ -13,7 +13,7 @@
# [no] arp
# [no] multicast
# shutdown
-# ip route <ip/mask> <gw> [ip args...]
+# ip route <ip/mask> <-|gw> [ip args...]
# vrrp ... (ignored by this script)
# we want ALL instances to stop and restart at once
@@ -44,6 +44,8 @@ option arp boolean_option 1
option multicast boolean_option 1
option shutdown boolean_option
option vrrp multiple_option
+option load multiple_option
+option unload multiple_option
SVC_VARS="addr_list route_list arp_list addr_idx route_idx arp_idx"
@@ -52,13 +54,14 @@ function do_help {
echo "Usage: ${0##*/} <status|start|stop|flush|reload|help>"
echo "List of config.rc options (name, type, default value, current value) :"
echo
- echo " - ip addr <address>, arp <ip> <mac>|pub, dhcp, route <dest> <gw> [<args>]"
+ echo " - ip addr <address>, arp <ip> <mac>|pub, dhcp, route <dest> <-|gw> [<args>]"
echo " - media auto|{full|fdx|100full|100fdx}|{half|hdx|100half|100hdx}"
echo " - duplex {half|full}"
echo " - speed {10|100|1000}"
echo " - auto {on|off}"
echo " - slave <interface*>"
echo " - modprobe <module> <arg*>"
+ echo " - load|unload <command> <arg*>"
echo " - lladdr <mac_addr>"
echo " - mtu <mtu> ; arp {on|off} ; multicast {on|off} ; shutdown"
echo " - vrrp <id|prio|addr|auth_type|pass|garp>"
@@ -156,9 +159,6 @@ function do_start {
if [ -z "$instname" ]; then
echo "# Starting $svcname ..."
- #if [ "$opt_modprobe" != "#" ]; then
- # modprobe $opt_modprobe || return 1
- #fi
arg=0
while [ $arg -lt ${#opt_modprobe[*]} ]; do
if [ "${opt_modprobe[$arg]}" != "#" ]; then
@@ -169,11 +169,24 @@ function do_start {
arg=$[$arg+1]
done
arg=0
+ while [ $arg -lt ${#opt_load[*]} ]; do
+ if [ "${opt_load[$arg]}" != "#" ]; then
+ if ! sh -c "${opt_load[$arg]}"; then
+ echo " ==> start $svcname : load ${opt_load[$arg]} failed. Trying anyway."
+ fi
+ fi
+ arg=$[$arg+1]
+ done
+ arg=0
while [ $arg -lt $route_idx ]; do
local dest gw
dest=${route_list[$arg]%%[ ]*}
gw=${route_list[$arg]#*[ ]} # gw and potentially other ip args
- ip route add $dest via $gw
+ if [ -n "${gw##-*}" }; then
+ ip route add $dest via $gw
+ else
+ ip route add $dest ${gw#*[- ]} # gw is "-"
+ fi
arg=$[$arg+1]
done
echo " ==> start $svcname : Done."
@@ -187,7 +200,7 @@ function do_start {
echo "# Starting $svcname${instname:+[$instname]} ..."
# we only check running instances when an interface is defined
do_status $svcname $instname > /dev/null 2>&1
- if [ $? = 0 -a $FORCE_START_STOP -eq 0 ] ; then
+ if [ $? = 0 -a "$instname" != "lo" -a $FORCE_START_STOP -eq 0 ] ; then
echo " ==> Service $svcname${instname:+[$instname]} already running.";
[ $SVC_AUTO_START -eq 0 ] && echo " ==> please use '--force' or 'restart' instead or check with 'status'."
return 0
@@ -212,7 +225,17 @@ function do_start {
fi
arg=$[$arg+1]
done
-
+ arg=0
+ while [ $arg -lt ${#opt_load[*]} ]; do
+ if [ "${opt_load[$arg]}" != "#" ]; then
+ if ! sh -c "${opt_load[$arg]}"; then
+ echo " ==> start $svcname : load ${opt_load[$arg]} failed. Trying anyway."
+ fi
+ fi
+ arg=$[$arg+1]
+ done
+ arg=0
+
# a dot in an interface name means physical_if.vlanid
# We have to create the interface now.
if [ -z "${instname//*.*/}" ]; then
@@ -315,7 +338,11 @@ function do_start {
local dest gw
dest=${route_list[$arg]%%[ ]*}
gw=${route_list[$arg]#*[ ]} # gw and potentially other ip args
- ip route add $dest dev $instname via $gw
+ if [ -n "${gw##-*}" }; then
+ ip route add $dest dev $instname via $gw
+ else
+ ip route add $dest dev $instname ${gw#*[- ]} # gw is "-"
+ fi
arg=$[$arg+1]
done
echo " ==> start $svcname${instname:+[$instname]} : Done."
@@ -352,6 +379,17 @@ function do_stop {
if [ -z "$instname" ]; then
echo "# Stopping $svcname ..."
+
+ arg=0
+ while [ $arg -lt ${#opt_unload[*]} ]; do
+ if [ "${opt_unload[$arg]}" != "#" ]; then
+ if ! sh -c "${opt_unload[$arg]}"; then
+ echo " ==> stop $svcname : unload ${opt_unload[$arg]} failed. Trying anyway."
+ fi
+ fi
+ arg=$[$arg+1]
+ done
+
arg=${#opt_modprobe[*]}
while [ $arg -gt 0 ]; do
arg=$[$arg-1]
@@ -393,6 +431,16 @@ function do_stop {
ip link set $instname down >/dev/null 2>&1
ip addr flush dev $instname >/dev/null 2>&1
+ arg=0
+ while [ $arg -lt ${#opt_unload[*]} ]; do
+ if [ "${opt_unload[$arg]}" != "#" ]; then
+ if ! sh -c "${opt_unload[$arg]}"; then
+ echo " ==> stop $svcname : unload ${opt_unload[$arg]} failed. Trying anyway."
+ fi
+ fi
+ arg=$[$arg+1]
+ done
+
# a dot in an interface name means physical_if.vlanid
# We have to remove the interface now.
[ -z "${instname//*.*/}" ] && vconfig rem $instname >/dev/null