I ran into a couple of problems with the network startup and shutdown scripts dealing with multiple IP addresses on a network device.
With some minor changes to the network scripts I was able to get the problems resolved. Now I am interested in letting the appropriate people know about the problems.
Who is the best contact to report a problem with a Slackware network script, specifically "rc.inet1" and "rc.wireless"?
rc.inet1.conf file exhibiting problem.
Code:
# Config information for eth0:
IPADDR[0]=""
NETMASK[0]=""
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""
# Config information for eth1:
IPADDR[1]="192.168.175.99"
NETMASK[1]="255.255.255.0"
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""
# Config information for eth1:1
IFNAME[2]="eth1:1"
IPADDR[2]="89.89.89.99"
NETMASK[2]="255.255.255.0"
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""
# Config information for eth1:2
IFNAME[3]="eth1:2"
IPADDR[3]="89.89.80.99"
NETMASK[3]="255.255.255.0"
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""
# Default gateway IP address:
GATEWAY=""
# Change this to "yes" for debugging output to stdout. Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"
Commented lines omitted.
The "rc.wireless" script was not removing the ":1" or ":2" from the device names. That caused "cat" to report an error when the script tests some information in "/sys".
Errors reported by "rc.wireless":
Code:
cat: '/sys/class/net/eth1:1/uevent': No such file or directory
cat: '/sys/class/net/eth1:2/uevent': No such file or directory
I copied the "cut" command used in "rc.inet1" to correct the problem. The errors might have been harmless.
Excerpt from modified "rc.wireless":
Code:
is_wireless_device ()
{
# Return 0 for a wireless interface, or 1 for a non-wireless interface.
if LC_ALL=C $IWPATH/iwconfig `echo ${1}: | cut -f 1 -d :` 2>&1 | grep -q "IEEE 802.11" ; then
return 0
elif [ -d /sys/class/net/`echo ${1}: | cut -f 1 -d :`/wireless ]; then
return 0
elif [ "$(cat /sys/class/net/`echo ${1}: | cut -f 1 -d :`/uevent | grep DEVTYPE)" = "DEVTYPE=wlan" ]; then
return 0
else # all tests failed, assume the device is not wireless (or add a better test :)
return 1
fi
}
The "rc.inet1" script takes down the network interfaces in the same order as it brought them up. That causes a problem because it disables the main network interface "eth1" before disabling "eth1:1" and "eth1:2".
Errors reported by "rc.inet1":
Code:
SIOCSIFFLAGS: Cannot assign requested address
SIOCSIFFLAGS: Cannot assign requested address
It is probably harmless and also will occur when attempting to shut down an interface that is already down.
I changed the script to shut down the interfaces in the reverse order, from the last to the first.
Exceprt from modified "rc.inet1":
Code:
# Function to stop the network:
stop() {
gateway_down
i=$MAXNICS
while [ $i -gt 0 ]; do
i=$(($i-1))
if_down ${IFNAME[$i]}
done
lo_down
}
The script already took into account that gateways had to be shut down first and the loop-back driver last.
One other suggestion that I would like to make is for a network parameter "AUTO[n]" that defaults to "yes". Valid settings would be "yes", "start", "stop", or "no". It would be helpful to exclude interfaces from the automatic network startup and/or shutdown done by "rc.inet1" but still allow manual startup with "rc.inet1 wlan0_start" for example. The "AUTO[n]" parameter would be tested by "start()" and "stop()" but not by "if_up()" or "if_down()". The "yes" or "" setting would automatically start and stop the interface. A setting of "start" or "stop" would only do the requested action automatically. The "no" setting would neither start nor stop the interface when starting or stopping all interfaces.
Mostly the reason for excluding an interface is to avoid the 10 second wait for a DHCP attempt. Another reason is to avoid the default route being set to that interface.