aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2011-10-21 01:28:48 +0100
committerColin Guthrie <colin@mageia.org>2011-10-21 10:10:39 +0100
commitbe75c98a06d569fbaa2d86f92676af961795d094 (patch)
treee2ce8ce7ffb97af34164634a3fbd8630dc7463e8 /sysconfig
parent4688ea25c9a5a87e48f89fc91a3c93a7c8c95b4a (diff)
downloadinitscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.gz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.bz2
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.tar.xz
initscripts-be75c98a06d569fbaa2d86f92676af961795d094.zip
Add the mdkconf patch
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/init12
-rw-r--r--sysconfig/init.s3902
-rwxr-xr-x[-rw-r--r--]sysconfig/network-scripts/ifcfg-lo0
-rwxr-xr-xsysconfig/network-scripts/ifdown11
-rwxr-xr-xsysconfig/network-scripts/ifdown-bnep2
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth56
-rwxr-xr-xsysconfig/network-scripts/ifdown-ippp34
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifdown-ipv60
-rwxr-xr-xsysconfig/network-scripts/ifdown-post13
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp9
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifdown-sit0
-rwxr-xr-xsysconfig/network-scripts/ifdown-tunnel2
-rwxr-xr-xsysconfig/network-scripts/ifup16
-rwxr-xr-xsysconfig/network-scripts/ifup-bnep2
-rwxr-xr-xsysconfig/network-scripts/ifup-eth308
-rwxr-xr-xsysconfig/network-scripts/ifup-ippp384
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifup-ipv63
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifup-plusb0
-rwxr-xr-xsysconfig/network-scripts/ifup-post14
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp41
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifup-sit3
-rwxr-xr-xsysconfig/network-scripts/ifup-tunnel1
-rwxr-xr-xsysconfig/network-scripts/ifup-wireless110
-rw-r--r--sysconfig/network-scripts/network-functions99
-rwxr-xr-xsysconfig/networking/ifcfg-lo9
25 files changed, 545 insertions, 586 deletions
diff --git a/sysconfig/init b/sysconfig/init
index 6c3f1238..cf2eb896 100644
--- a/sysconfig/init
+++ b/sysconfig/init
@@ -3,18 +3,22 @@
# anything else => new style bootup without ANSI colors or positioning
BOOTUP=color
# column to start "[ OK ]" label in
-RES_COL=60
+RES_COL=$((COLUMNS - 15))
# terminal sequence to move to that column. You could change this
# to something like "tput hpa ${RES_COL}" if your terminal supports it
MOVE_TO_COL="echo -en \\033[${RES_COL}G"
# terminal sequence to set color to a 'success' color (currently: green)
-SETCOLOR_SUCCESS="echo -en \\033[0;32m"
+SETCOLOR_SUCCESS="echo -en \\033[1;32m"
# terminal sequence to set color to a 'failure' color (currently: red)
-SETCOLOR_FAILURE="echo -en \\033[0;31m"
+SETCOLOR_FAILURE="echo -en \\033[1;31m"
# terminal sequence to set color to a 'warning' color (currently: yellow)
-SETCOLOR_WARNING="echo -en \\033[0;33m"
+SETCOLOR_WARNING="echo -en \\033[1;33m"
# terminal sequence to reset to the default color.
SETCOLOR_NORMAL="echo -en \\033[0;39m"
+# default kernel loglevel on boot (syslog will reset this)
+LOGLEVEL=3
+# Set to anything other than 'no' to allow hotkey interactive startup...
+PROMPT=yes
# Set to 'yes' to allow probing for devices with swap signatures
AUTOSWAP=no
# What ttys should gettys be started on?
diff --git a/sysconfig/init.s390 b/sysconfig/init.s390
index fdacee05..802732da 100644
--- a/sysconfig/init.s390
+++ b/sysconfig/init.s390
@@ -3,7 +3,7 @@
# anything else => new style bootup without ANSI colors or positioning
BOOTUP=serial
# column to start "[ OK ]" label in
-RES_COL=60
+RES_COL=65
# terminal sequence to move to that column. You could change this
# to something like "tput hpa ${RES_COL}" if your terminal supports it
MOVE_TO_COL=
diff --git a/sysconfig/network-scripts/ifcfg-lo b/sysconfig/network-scripts/ifcfg-lo
index cb4f3f94..cb4f3f94 100644..100755
--- a/sysconfig/network-scripts/ifcfg-lo
+++ b/sysconfig/network-scripts/ifcfg-lo
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index db045da4..57e56e3f 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -7,7 +7,7 @@ unset WINDOW # defined by screen, conflicts with our usage
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=$1
@@ -42,13 +42,8 @@ then
fi
if [ "$USE_NM" = "true" ]; then
- if [ -n "$UUID" -a -z "$DEVICE" ]; then
- DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
- fi
- if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then
- nmcli dev disconnect iface "$DEVICE"
- exit $?
- fi
+ echo $"$0: interface ${1} is controlled by NetworkManager; skipping." >&2
+ exit 0
fi
if [ -x /sbin/ifdown-pre-local ]; then
diff --git a/sysconfig/network-scripts/ifdown-bnep b/sysconfig/network-scripts/ifdown-bnep
index b8064fd8..b7749adf 100755
--- a/sysconfig/network-scripts/ifdown-bnep
+++ b/sysconfig/network-scripts/ifdown-bnep
@@ -5,7 +5,7 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=${1}
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth
index 530975c3..711d3284 100755
--- a/sysconfig/network-scripts/ifdown-eth
+++ b/sysconfig/network-scripts/ifdown-eth
@@ -20,9 +20,12 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=${1}
+boot=$2
+daemon=
+[ "foo${boot}" = "fooboot" -o "foo${boot}" = "foodaemon" ] && daemon=1
source_config
@@ -63,27 +66,35 @@ if is_bonding_device ${DEVICE} ; then
fi
/etc/sysconfig/network-scripts/ifdown-ipv6 ${CONFIG}
+if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -f /var/run/dhcp6c_${DEVICE}.pid ]; then
+ kill $(cat /var/run/dhcp6c_${DEVICE}.pid);
+ rm -f /var/run/dhcp6c_${DEVICE}.pid;
+fi
+
+# Kill running dhcp client if present
+dhcp_client_pids() {
+ CLIENTS='dhcpcd|pump|dhcpxd|dhclient|zcip'
+ [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ] && CLIENTS="${CLIENTS}|wpa_supplicant"
+ ps xw | egrep "${CLIENTS}" | grep ${DEVICE} | awk '{print $1;}'
+}
+
+if [ -n "${daemon}" -a "$MII_NOT_SUPPORTED" != "yes" ]; then
+ # use ifplugd -k -W to wait for it to be killed
+ /sbin/ifplugd -k -W -i ${DEVICE}
+fi
retcode=0
-[ -n "$(pidof -x dhclient)" ] && {
- for VER in "" 6 ; do
- if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
- dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid)
- if [[ "$DHCPRELEASE" = [yY1]* ]]; then
- /sbin/dhclient -r -lf /var/lib/dhclient/dhclient$VER-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid ${DEVICE} >/dev/null 2>&1
- retcode=$?
- else
- kill $dhcpid >/dev/null 2>&1
- retcode=$?
- reason=STOP$VER interface=${DEVICE} /sbin/dhclient-script
- fi
- if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
- rm -f /var/run/dhclient$VER-${DEVICE}.pid
- kill $dhcpid >/dev/null 2>&1
- fi
- fi
+pids=`dhcp_client_pids`
+if [ -n "$pids" ]; then
+ kill $pids
+ retcode=$?
+ waited=0
+ while ! dhcp_client_pids > /dev/null && [ "$waited" -lt 50 ] ; do
+ usleep 10000
+ waited=$(($waited+1))
done
-}
+fi
+
# we can't just delete the configured address because that address
# may have been changed in the config file since the device was
# brought up. Flush all addresses associated with this
@@ -99,6 +110,11 @@ if [ -d "/sys/class/net/${REALDEVICE}" ]; then
echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
fi
+ # Remove ip addresses from kernel
+ for ip in `ip addr show | egrep ${DEVICE}\$ | grep inet | awk '{print $2;}'`; do
+ ip addr del $ip dev ${DEVICE}
+ done
+
if [ "${REALDEVICE}" = "${DEVICE}" ]; then
ip link set dev ${DEVICE} down 2>/dev/null
fi
@@ -128,7 +144,7 @@ while ! check_device_down ${DEVICE} && [ "$waited" -lt 50 ] ; do
done
# don't leave an outdated key sitting around
-if [ -n "${WIRELESS_ENC_KEY}" ] && [ -x /sbin/iwconfig ]; then
+if [ -z "$IN_HOTPLUG" -a -n "${WIRELESS_ENC_KEY}" -a -x /sbin/iwconfig ]; then
/sbin/iwconfig ${DEVICE} enc 0 >/dev/null 2>&1
fi
diff --git a/sysconfig/network-scripts/ifdown-ippp b/sysconfig/network-scripts/ifdown-ippp
deleted file mode 100755
index f6fe5f12..00000000
--- a/sysconfig/network-scripts/ifdown-ippp
+++ /dev/null
@@ -1,34 +0,0 @@
-#! /bin/sh
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-# Get global network configuration
-[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
-
-CONFIG=$1
-
-. ./$CONFIG
-
-# stopping ibod daemon for channel bundling
-if [ -f /var/lock/subsys/ibod ] ; then
- kill -9 $(pidof ibod) >/dev/null 2>&1
- rm -f /var/lock/subsys/ibod
-fi
-
-# Shut down IPv6
-/etc/sysconfig/network-scripts/ifdown-ipv6 $CONFIG
-
-# shutdown isdn device
-isdnctrl hangup $DEVICE >/dev/null 2>&1
-sleep 1
-ip link set dev $DEVICE down >/dev/null 2>&1
-
-# delete isdn device
-isdnctrl delif $DEVICE >/dev/null 2>&1
-
-# kill ipppd daemon
-if [ -f /var/run/ipppd.$DEVICE.pid ] ; then
- pppdpid=$(cat /var/run/ipppd.$DEVICE.pid)
- kill -9 $pppdpid > /dev/null 2>&1
- rm -f /var/run/ipppd.$DEVICE.pid > /dev/null 2>&1
-fi
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index 9f04531a..9f04531a 100755..100644
--- a/sysconfig/network-scripts/ifdown-ipv6
+++ b/sysconfig/network-scripts/ifdown-ipv6
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index 0a1b938a..98fe64cc 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -19,12 +19,9 @@ source_config
/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME}
if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
- if [ -f /etc/resolv.conf.save ]; then
- change_resolv_conf /etc/resolv.conf.save
- rm -f /etc/resolv.conf.save
- fi
+ clear_resolv_conf
if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
- if [ -f /etc/ppp/peers/$DEVICE ] ; then
+ if [ -f /etc/ppp/peers/$DEVICE -a "$TYPE" != "ADSL" ] ; then
rm -f /etc/ppp/peers/$DEVICE
fi
fi
@@ -49,6 +46,12 @@ fi
# Notify programs that have requested notification
do_netreport
+mdv-network-event interface_down ${DEVICE}
+
+if [ -d /etc/sysconfig/network-scripts/ifdown.d -a -x /usr/bin/run-parts ]; then
+ /usr/bin/run-parts --arg ${DEVICE} /etc/sysconfig/network-scripts/ifdown.d
+fi
+
if [ -x /sbin/ifdown-local ]; then
/sbin/ifdown-local ${DEVICE}
fi
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
index fca64638..99b1b09e 100755
--- a/sysconfig/network-scripts/ifdown-ppp
+++ b/sysconfig/network-scripts/ifdown-ppp
@@ -4,10 +4,11 @@ cd /etc/sysconfig/network-scripts
. ./network-functions
CONFIG=$1
+[ -f "$CONFIG" ] || CONFIG=ifcfg-$1
source_config
if [ "$TYPE" = "xDSL" ] && [ -x /usr/sbin/adsl-stop ] ; then
- adsl-stop /etc/sysconfig/network-scripts/$CONFIG
+ adsl-stop
exit $?
fi
@@ -25,7 +26,11 @@ if [ "${DEMAND}" = "yes" ] && [ -f /var/run/ppp-${CONFIG}.pid ] ; then
exit 1
fi
-file=/var/run/pppwatch-${DEVICE}.pid
+if [ "$TYPE" = "ADSL" ]; then
+ file=/var/run/${DEVICE}.pid
+else
+ file=/var/run/pppwatch-${DEVICE}.pid
+fi
if [ ! -f $file ]; then
# ppp isn't running, or we didn't start it
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit
index 041dc3cd..041dc3cd 100755..100644
--- a/sysconfig/network-scripts/ifdown-sit
+++ b/sysconfig/network-scripts/ifdown-sit
diff --git a/sysconfig/network-scripts/ifdown-tunnel b/sysconfig/network-scripts/ifdown-tunnel
index a1f643c7..a96aff4b 100755
--- a/sysconfig/network-scripts/ifdown-tunnel
+++ b/sysconfig/network-scripts/ifdown-tunnel
@@ -25,7 +25,7 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=$1
need_config "$CONFIG"
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 1eaabab8..fb203f5a 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -15,6 +15,9 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+TEXTDOMAIN=initscripts
+
unset WINDOW # defined by screen, conflicts with our usage
. /etc/init.d/functions
@@ -22,7 +25,7 @@ unset WINDOW # defined by screen, conflicts with our usage
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=${1}
@@ -65,9 +68,9 @@ then
exit 0
fi
-if [ "$USE_NM" = "true" -a -n "$UUID" ]; then
- nmcli con up uuid "$UUID"
- exit $?
+if [ "$USE_NM" = "true" ]; then
+ echo $"$0: interface ${1} is controlled by NetworkManager; skipping." >&2
+ exit 0
fi
# Ethernet 802.1Q VLAN support
@@ -124,9 +127,8 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then
fi
fi
-if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
- DYNCONFIG=true
-fi
+# signalling the start of connection
+mdv-network-event connection_start ${DEVICE}
if [ -x /sbin/ifup-pre-local ]; then
/sbin/ifup-pre-local ${CONFIG} $2
diff --git a/sysconfig/network-scripts/ifup-bnep b/sysconfig/network-scripts/ifup-bnep
index 5aff2777..e80ccb6b 100755
--- a/sysconfig/network-scripts/ifup-bnep
+++ b/sysconfig/network-scripts/ifup-bnep
@@ -5,7 +5,7 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=${1}
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 9377494c..b1039176 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -15,21 +15,33 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+PATH=/sbin:/usr/sbin:/bin:/usr/bin
+TEXTDOMAIN=initscripts
+
. /etc/init.d/functions
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
CONFIG=${1}
+boot=${2}
+daemon=
+[ "foo${boot}" = "fooboot" -o "foo${boot}" = "foodaemon" ] && daemon=1
need_config "${CONFIG}"
source_config
+# Old BOOTP variable
+if [ "${BOOTP}" = "yes" ]; then
+ BOOTPROTO=bootp
+fi
+
if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
DYNCONFIG=true
+ [ "${BOOTPROTO}" = bootp ] && DHCP_CLIENT=/sbin/pump
fi
# load the module associated with that device
@@ -41,6 +53,7 @@ if [ -n "${HWADDR}" ]; then
FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
if [ "${FOUNDMACADDR}" != "${HWADDR}" -a "${FOUNDMACADDR}" != "${MACADDR}" ]; then
echo $"Device ${DEVICE} has different MAC address than expected, ignoring."
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
fi
@@ -49,6 +62,7 @@ fi
if [ "${TYPE}" = "Bridge" ]; then
if [ ! -x /usr/sbin/brctl ]; then
echo $"Bridge support not available: brctl not found"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then
@@ -60,12 +74,22 @@ fi
# If the device is a tap device, create it with tunctl, if available.
if [ "${TYPE}" = "Tap" ]; then
- if [ ! -x /usr/sbin/tunctl ]; then
+ if [ ! -x /usr/sbin/tunctl -a ! -x /usr/bin/tunctl ]; then
echo $"Tap support not available: tunctl not found"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
+ # load the correct module if necessary (#54748)
+ if [ ! -c /dev/net/tun ]; then
+ if ! modprobe tun > /dev/null 2>&1; then
+ echo $"No TUN/TAP support available in kernel for device ${DEVICE}"
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ fi
+
[ -n "${OWNER}" ] && OWNER="-u ${OWNER}"
- /usr/sbin/tunctl ${OWNER} -t ${DEVICE} > /dev/null
+ tunctl ${OWNER} -t ${DEVICE} > /dev/null
fi
# now check the real state
@@ -75,9 +99,67 @@ is_available ${REALDEVICE} || {
else
echo $"Device ${DEVICE} does not seem to be present, delaying initialization."
fi
+ mdv-network-event connection_failure ${DEVICE}
exit 1
}
+# is the device wireless? If so, configure wireless device specifics
+IS_WIRELESS=
+# ralink devices need to be up for wireless-tools to work
+[ -d "/sys/class/net/${DEVICE}/wireless" ] && ip link set dev ${DEVICE} up
+if is_wireless_device ${DEVICE}; then
+ if [ -n "${daemon}" -o "$MII_NOT_SUPPORTED" = "yes" ]; then
+ # try to trigger association (and always load wireless settings)
+ WIRELESS_CONFIG="wireless.d/$WIRELESS_ESSID"
+ [ -f "$WIRELESS_CONFIG" ] && source "$WIRELESS_CONFIG"
+ . ./ifup-wireless
+ if [ -n "$WIRELESS_WPA_DRIVER" -a -x /usr/sbin/wpa_supplicant -a -f /etc/wpa_supplicant.conf ]; then
+ if wpa_cli -i${DEVICE} status &>/dev/null; then
+ echo "Another wpa_supplicant instance is already running for device $DEVICE"
+ else
+ /usr/sbin/wpa_supplicant -B -i ${DEVICE} \
+ -c /etc/wpa_supplicant.conf \
+ -D ${WIRELESS_WPA_DRIVER}
+ fi
+ if [ "$WIRELESS_WPA_REASSOCIATE" = "yes" ]; then
+ sleep 2
+ wpa_cli reassociate
+ fi
+ fi
+ elif [ -n "$WIRELESS_WPA_DRIVER" ]; then
+ # roaming enabled, on association
+ # source interface parameters related to current ESSID or AP if any
+ WIRELESS_CURRENT_ESSID=`iwgetid -r ${DEVICE}`
+ if [ -n "$WIRELESS_CURRENT_ESSID" ]; then
+ WIRELESS_CONFIG="wireless.d/$WIRELESS_CURRENT_ESSID"
+ if [ ! -f "$WIRELESS_CONFIG" ]; then
+ WIRELESS_CURRENT_AP=`iwgetid -r -a ${DEVICE}`
+ WIRELESS_CONFIG="wireless.d/$WIRELESS_CURRENT_AP"
+ fi
+ if [ -f "$WIRELESS_CONFIG" ]; then
+ source "$WIRELESS_CONFIG"
+ else
+ echo "Wireless device $DEVICE is associated with $WIRELESS_CURRENT_ESSID but configuration is missing"
+ fi
+ else
+ echo "Wireless device $DEVICE is configured with a roaming daemon but isn't associated"
+ fi
+ fi
+ IS_WIRELESS=1
+fi
+
+# DVB Card
+if [ -n "${DVB_ADAPTER_ID}" -a -n "${DVB_NETWORK_DEMUX}" -a -n "${DVB_NETWORK_PID}" ]; then
+ dvbnet -a ${DVB_ADAPTER_ID} -n ${DVB_NETWORK_DEMUX} -p ${DVB_NETWORK_PID}
+fi
+
+# ATMARP protocol support, enabled if ATM_ADDR is defined (VCI.VPI)
+# useful for modems using the atm kernel module (e.g. Speedtouch)
+# and ISP using "RFC 1483 Routed VC MUX" (e.g. Free Degroupe)
+if [ -n "${ATM_ADDR}" -a -x /usr/sbin/atmarpd -a -x /usr/sbin/atmarp ]; then
+ pidof atmarpd >/dev/null 2>&1 || /usr/sbin/atmarpd -b -l syslog >/dev/null 2>&1
+ atmarp -c ${DEVICE} 2>/dev/null
+fi
# this isn't the same as the MAC in the configuration filename. It is
# available as a configuration option in the config file, forcing the kernel
@@ -89,9 +171,6 @@ if [ -n "${MTU}" ]; then
ip link set dev ${DEVICE} mtu ${MTU}
fi
-# is the device wireless? If so, configure wireless device specifics
-is_wireless_device ${DEVICE} && . ./ifup-wireless
-
# slave device?
if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves || {
@@ -99,7 +178,7 @@ if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
}
if [ -n "$ETHTOOL_OPTS" ] ; then
- /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
+ ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
exit 0
@@ -162,21 +241,115 @@ if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
exit 0
fi
-if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
- if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then
- ONESHOT="";
+# exec ifplugd daemon at boot if supported
+if [ -n "${daemon}" -a "$MII_NOT_SUPPORTED" != "yes" ]; then
+ IFPLUGD_ARGS="${IFPLUGD_ARGS=-I -b}"
+ exec /sbin/ifplugd $IFPLUGD_ARGS -i $DEVICE
+fi
+
+
+BLURB="# temporary ifup addition"
+
+if [ -n "$DYNCONFIG" -a "XXX$DHCP_CLIENT" = "XXX" ];then
+ if [ -x /sbin/dhclient ];then
+ DHCP_CLIENT=/sbin/dhclient
+ # Remove any temporary references which were previously added to dhclient config
+ if [ -w /etc/dhclient-${DEVICE}.conf -a -x /sbin/dhclient ] ; then
+ grep -v "$BLURB" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
+ cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
+ rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
+ fi
+ elif [ -x /sbin/dhcpcd ];then
+ DHCP_CLIENT=/sbin/dhcpcd
+ elif [ -x /sbin/pump ];then
+ DHCP_CLIENT=/sbin/pump
+ elif [ -x /sbin/dhcpxd ];then
+ DHCP_CLIENT=/sbin/dhcpxd
+ else
+ echo $"Can't find a dhcp client"
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1;
+ fi
+fi
+
+if [ "$DHCP_HOSTNAME" ] && [ "$DOMAINNAME" ]
+then
+ DHCP_HOSTNAME=`echo $DHCP_HOSTNAME | sed -e "s/\.$DOMAINNAME//g"`
+fi
+
+DHCP_ARGS=
+if [ "XXX$DHCP_CLIENT" != "XXX" ];then
+case $(basename $DHCP_CLIENT) in
+ dhcpcd)
+ DHCP_ARGS="--waitip"
+ [ -n "${DHCP_HOSTNAME}" ] && DHCP_ARGS="${DHCP_ARGS} -h ${DHCP_HOSTNAME}"
+ [ "${PEERDNS}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -C resolv.conf"
+ [ "${PEERGATEWAY}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -G"
+ [ -n "${DHCP_TIMEOUT}" ] && DHCP_ARGS="${DHCP_ARGS} -t ${DHCP_TIMEOUT}"
+ [ "${NEEDHOSTNAME}" = "no" ] && DHCP_ARGS="${DHCP_ARGS} -C lookup-hostname"
+ if [ "${PEERNTPD}" = "yes" ]; then
+ DHCP_ARGS="${DHCP_ARGS} -o ntp_servers"
else
- ONESHOT="-1";
- fi;
- # allow users to use generic '/etc/dhcp/dhclient.conf' (as documented in manpage!)
- # if per-device file doesn't exist or is empty
- if [ -s /etc/dhcp/dhclient-${DEVICE}.conf ]; then
- DHCLIENTCONF="-cf /etc/dhcp/dhclient-${DEVICE}.conf";
- elif [ -s /etc/dhclient-${DEVICE}.conf ]; then
- DHCLIENTCONF="-cf /etc/dhclient-${DEVICE}.conf";
+ DHCP_ARGS="${DHCP_ARGS} -C ntp.conf -O ntp_servers"
+ fi
+ if [ "${PEERYP}" = "yes" ]; then
+ DHCP_ARGS="${DHCP_ARGS} -o nis_domain -o nis_servers"
else
- DHCLIENTCONF='';
- fi;
+ DHCP_ARGS="${DHCP_ARGS} -C yp.conf -C ypbind -O nis_domain -O nis_servers"
+ fi
+
+ DHCP_ARGS="${DHCP_ARGS} ${DEVICE}"
+ PIDF=/var/run/dhcpcd-${DEVICE}.pid
+ if [[ -f ${PIDF} ]]; then
+ PID=$(cat ${PIDF})
+ if [[ -n ${PID} ]]; then
+ echo "dhcpcd is running, ifdown the interface first"
+ exit;
+ fi
+ /bin/rm -f ${PIDF}; #clear it
+ fi
+ ;;
+ pump)
+ [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-h $DHCP_HOSTNAME"
+ [ "${NEEDHOSTNAME}" = "yes" ] && DHCP_ARGS="$DHCP_ARGS --lookup-hostname"
+ [ "${PEERDNS}" = "no" ] && DHCP_ARGS="$DHCP_ARGS -d"
+ [ "${PEERGATEWAY}" = "no" ] && DHCP_ARGS="$DHCP_ARGS --no-gateway"
+ DHCP_ARGS="$DHCP_ARGS -i $DEVICE"
+ ;;
+ dhcpxd)
+ # dhcpxd don't support NEEDHOSTNAME, PEERGATEWAY
+ [ -n "$DHCP_HOSTNAME" ] && DHCP_ARGS="-H $HOSTNAME"
+ DHCP_ARGS="$DHCP_ARGS --wait $DEVICE"
+ ;;
+ dhclient)
+ if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then
+ ONESHOT=
+ else
+ ONESHOT="-1"
+ fi
+ DHCP_ARGS="$DHCP_ARGS $ONESHOT -q -lf /var/lib/dhcp/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid -cf /etc/dhclient-${DEVICE}.conf $DEVICE"
+ if [ -n "$DHCP_HOSTNAME" ]; then
+ if [ ! -e /etc/dhclient-${DEVICE}.conf ] || ! grep -q "[^# ]*send *host-name" /etc/dhclient-${DEVICE}.conf; then
+ echo "send host-name \"${DHCP_HOSTNAME}\"; $BLURB" >> /etc/dhclient-${DEVICE}.conf
+ fi
+ fi
+ if [ -n "$DHCP_TIMEOUT" ]; then
+ if [ ! -e /etc/dhclient-${DEVICE}.conf ] || ! grep -q "[^# ]*timeout" /etc/dhclient-${DEVICE}.conf; then
+ echo "timeout $DHCP_TIMEOUT; $BLURB" >> /etc/dhclient-${DEVICE}.conf
+ fi
+ fi
+ ;;
+esac
+fi
+
+# Remove any temporary references which were previously added to dhclient config
+if [ -w /etc/dhclient-${DEVICE}.conf ] && [ -x /sbin/dhclient ] ; then
+ LC_ALL=C grep -v "# temporary MDK ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
+ cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
+ rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
+fi
+
+if [ -n "${DYNCONFIG}" ]; then
# copy any lease obtained by the initrd
for file in /dev/.dhclient-${DEVICE}.leases /dev/.initramfs/net.${DEVICE}.lease ; do
if [ -f "${file}" ]; then
@@ -184,22 +357,40 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
[ -x /sbin/restorecon ] && restorecon /var/lib/dhclient/dhclient-${DEVICE}.leases > /dev/null 2>&1
fi
done
- DHCLIENTARGS="${DHCLIENTARGS} ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${ONESHOT} -q ${DHCLIENTCONF} -lf /var/lib/dhclient/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid"
echo
echo -n $"Determining IP information for ${DEVICE}..."
if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then
echo $" failed; no link present. Check cable?"
+ ip link set dev ${DEVICE} down >/dev/null 2>&1
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
if [ -n "$ETHTOOL_OPTS" ] ; then
- /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
+ ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
- if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
+ mdv-network-event dhcp_request ${DEVICE}
+ if $DHCP_CLIENT $DHCP_ARGS ; then
+ mdv-network-event dhcp_success ${DEVICE}
echo $" done."
else
+ mdv-network-event dhcp_failure ${DEVICE}
+ # Associate a zeroconf IP address to an alias of the interface
+ if [ -x /sbin/zcip ]; then
+ mdv-network-event zcip_request ${DEVICE}
+ if /sbin/zcip -s -i $DEVICE:${ZEROCONF_ALIAS_NUMER=9}; then
+ mdv-network-event zcip_success ${DEVICE}
+ echo $" done."
+ if [ -x /etc/init.d/tmdns ]; then
+ /etc/init.d/tmdns reload > /dev/null 2>&1
+ fi
+ exit 0
+ fi
+ fi
+ mdv-network-event zcip_failure ${DEVICE}
echo $" failed."
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
# end dynamic device configuration
@@ -208,7 +399,7 @@ else
# enable device without IP, useful for e.g. PPPoE
ip link set dev ${REALDEVICE} up
if [ -n "$ETHTOOL_OPTS" ] ; then
- /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
+ ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
else
@@ -220,11 +411,12 @@ else
if ! ip link set dev ${REALDEVICE} up ; then
echo $"Failed to bring up ${DEVICE}."
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
if [ -n "$ETHTOOL_OPTS" ] ; then
- /sbin/ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
+ ethtool -s ${REALDEVICE} $ETHTOOL_OPTS
fi
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
@@ -241,41 +433,39 @@ else
SRC=
fi
- # set IP address(es)
- for idx in {0..256} ; do
- if [ -z "${ipaddr[$idx]}" ]; then
- break
- fi
-
- if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
- [ "${REALDEVICE}" != "lo" ] && \
- if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then
- echo $"Error, some other host already uses address ${ipaddr[$idx]}."
- exit 1
- fi
-
- if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \
- brd ${broadcast[$idx]:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
- echo $"Error adding address ${ipaddr[$idx]} for ${DEVICE}."
- fi
- fi
-
- if [ -n "$SRCADDR" ]; then
- sysctl -w "net.ipv4.conf.${SYSCTLDEVICE}.arp_filter=1" >/dev/null 2>&1
- fi
+ if [ "${REALDEVICE}" != "lo" ]; then
+ if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${IPADDR}/${PREFIX}" ; then
+ if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${IPADDR} ; then
+ echo $"Error, some other host already uses address ${IPADDR}."
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ if ! ip addr add ${IPADDR}/${PREFIX} \
+ brd ${BROADCAST:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
+ echo $"Error adding address ${IPADDR} for ${DEVICE}."
+ fi
+ fi
+
+ if [ -n "$SRCADDR" ]; then
+ sysctl -w "net.ipv4.conf.${REALDEVICE}.arp_filter=1" >/dev/null 2>&1
+ fi
- # update ARP cache of neighboring computers
- if [ "${REALDEVICE}" != "lo" ]; then
- /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${ipaddr[$idx]}
- ( sleep 2;
- /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${ipaddr[$idx]} ) > /dev/null 2>&1 < /dev/null &
- fi
- done
+ # update ARP cache of neighboring computers
+ /sbin/arping -q -A -c 1 -I ${REALDEVICE} ${IPADDR}
+ ( sleep 2;
+ /sbin/arping -q -U -c 1 -I ${REALDEVICE} ${IPADDR} ) > /dev/null 2>&1 < /dev/null &
+ fi
# Set a default route.
if [ "${DEFROUTE}" != "no" ] && [ -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${REALDEVICE}" ]; then
# set up default gateway. replace if one already exists
- if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${netmask[0]} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then
+ if [ -n "${GATEWAY}" ] && [ "$(ipcalc --network ${GATEWAY} ${NETMASK} 2>/dev/null)" = "NETWORK=${NETWORK}" ]; then
+ if [ -n "${ATM_ADDR}" -a -x /usr/sbin/atmarpd -a -x /usr/sbin/atmarp ]; then
+ ip link set dev ${REALDEVICE} down
+ ip link set dev ${REALDEVICE} up
+ sleep 2
+ atmarp -s ${GATEWAY} ${ATM_ADDR} null 2>/dev/null
+ fi
ip route replace default ${METRIC:+metric $METRIC} \
via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \
${GATEWAYDEV:+dev $GATEWAYDEV}
@@ -288,14 +478,16 @@ else
fi
# Add Zeroconf route.
-if [ -z "${NOZEROCONF}" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo" ]; then
+if [ "${NOZEROCONF}" != "yes" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo" ]; then
ip route add 169.254.0.0/16 dev ${REALDEVICE} metric $((1000 + $(cat /sys/class/net/${REALDEVICE}/ifindex))) scope link
fi
# IPv6 initialisation?
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
-if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
- /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} -lf /var/lib/dhclient/dhclient6-${DEVICE}.leases -pf /var/run/dhclient6-${DEVICE}.pid ${DHCP_HOSTNAME:+-H $DHCP_HOSTNAME} ${DEVICE}
+if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhcp6c ]; then
+ /sbin/dhcp6c ${DHCPV6C_OPTIONS} ${DEVICE}
+ dhcp6_pid=($(/bin/ps -eo 'pid,args' | /bin/grep "dhcp6c ${DHCPV6C_OPTIONS} ${DEVICE}" | egrep -v grep))
+ [ -n "$dhcp6_pid" ] && echo ${dhcp6_pid[0]} > /var/run/dhcp6c_${DEVICE}.pid
fi
if [ "${IPX}" = yes ]; then
diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp
deleted file mode 100755
index 7cfe6f39..00000000
--- a/sysconfig/network-scripts/ifup-ippp
+++ /dev/null
@@ -1,384 +0,0 @@
-#! /bin/sh
-#
-# ifup-ippp
-#
-# This script is normally called from the ifup script when it detects a ippp device.
-
-. /etc/init.d/functions
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-# Get global network configuration
-[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
-
-GATEWAY=""
-
-# set device
-CONFIG=$1
-[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
-source_config
-
-if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
- exit
-fi
-
-if [ ! -f /var/lock/subsys/isdn ] && [ -x /etc/init.d/isdn ] ; then
- /etc/init.d/isdn start
-fi
-
-# check that ipppd is available for syncppp
-if [ "$ENCAP" = "syncppp" ]; then
- if [ ! -x /sbin/ipppd ] && [ ! -x /usr/sbin/ipppd ] ; then
- /usr/bin/logger -p daemon.info -t ifup-ippp "ipppd does not exist or is not executable"
- exit 1
- fi
-fi
-
-# check that isdnctrl is available
-if [ ! -x /sbin/isdnctrl ] && [ ! -x /usr/sbin/isdnctrl ] ; then
- /usr/bin/logger -p daemon.info -t ifup-ippp "isdnctrl does not exist or is not executable"
- exit 1
-fi
-
-# check all ISDN devices
-if ! isdnctrl list all >/dev/null 2>&1 ; then
- /usr/bin/logger -p daemon.info -t ifup-ippp "cannot list ISDN devices"
- exit 1
-fi
-
-# check if device already is configured
-isdnctrl list $DEVICE >/dev/null 2>&1 && exit 0
-
-function log_echo()
-{
- /usr/bin/logger -p daemon.info -t ifup-ippp $"$*"
-}
-
-function log_isdnctrl()
-{
- /usr/bin/logger -p daemon.info -t ifup-ippp isdnctrl $*
- isdnctrl $* >/dev/null 2>&1 || exit 1
-}
-
-function create_option_file()
-{
- umask 066
- echo "$1" > /etc/ppp/ioption-secret-$DEVICE
- umask 022
-}
-
-function start_ibod()
-{
- # don't start ibod, if it's running
- [ -f /var/lock/subsys/ibod ] && return
-
- device=$1
- if [ -f /etc/isdn/ibod.cf ] && [ -x /usr/sbin/ibod ] ; then
- ibod $device &
- pid=$(pidof ibod)
- [ -n "$pid" ] && touch /var/lock/subsys/ibod
- fi
-}
-
-function addprovider()
-{
- options=
- if [ -z "$PHONE_OUT" ]; then
- log_echo "Error: $1: no outgoing phone number set"
- return 1
- fi
-
- # set the encapsulation mode
- [ -z "$ENCAP" ] && ENCAP="syncppp"
-
- # set the dial mode
- [ -z "$DIALMODE" ] && DIALMODE="off"
-
- [ "$AUTH" = "none" -o "$AUTH" = "noauth" -o -z "$AUTH" ] && AUTH="-pap -chap"
-
- # set layer-2/3 protocol
- [ -z "$L2_PROT" ] && L2_PROT="hdlc"
- [ -z "$L3_PROT" ] && L3_PROT="trans"
-
- # check local/remote IP
- [ -z "$IPADDR" ] && IPADDR="0.0.0.0"
- [ -z "$GATEWAY" ] && GATEWAY="0.0.0.0"
-
- # set default route
- [ "$DEFROUTE" = "yes" ] && options="$options defaultroute deldefaultroute"
-
- # set authentication
- _auth=$(echo "$AUTH" | sed 's/[a-z -]*//g')
- if [ -n "$_auth" ]; then
- if [ -z "$USER" -a "$DIALIN" != "on" ]; then
- log_echo " Error: $1 (syncppp) user is not set"
- return 1
- fi
- if [ "$DIALIN" != "on" ]; then
- # we should hide the user name, so i add user name to option file.
- if [ "$AUTH" = "-pap +chap" ]; then
- create_option_file "name \"$USER\""
- else
- create_option_file "user \"$USER\""
- fi
- options="$options file /etc/ppp/ioption-secret-$DEVICE"
- fi
-
- # authentication options:
- # +pap and/or +chap does not work correct by dialout - remove
- # them if it's configured as dialout
- [ "$DIALIN" = "on" ] || AUTH=$(echo "$AUTH" | sed 's/+[a-z]*//g')
- fi
-
- # add ISDN device
- log_isdnctrl addif $DEVICE
-
- # set local MSN
- [ -z "$MSN" ] || log_isdnctrl eaz $DEVICE $MSN
-
- # set dialout numbers
- if echo $COUNTRYCODE | grep ":" >/dev/null 2>&1 ; then
- COUNTRYCODE="$(echo $COUNTRYCODE | cut -f 2 -d ':')"
- [ "$COUNTRYCODE" = "0" ] && COUNTRYCODE=
- else
- COUNTRYCODE=
- fi
- for i in $PHONE_OUT; do
- log_isdnctrl addphone $DEVICE out $COUNTRYCODE$PREFIX$AREACODE$i
- done
- for i in $PHONE_IN; do
- log_isdnctrl addphone $DEVICE in $i
- done
-
- # set layer-2/3 protocol
- log_isdnctrl l2_prot $DEVICE $L2_PROT
- log_isdnctrl l3_prot $DEVICE $L3_PROT
-
- # set encapsulation
- log_isdnctrl encap $DEVICE $ENCAP
-
- # set dialmode
- log_isdnctrl dialmode $DEVICE $DIALMODE
-
- [ -n "$SECURE" ] && log_isdnctrl secure $DEVICE $SECURE
- [ -n "$HUPTIMEOUT" ] && log_isdnctrl huptimeout $DEVICE $HUPTIMEOUT
- [ -n "$CHARGEHUP" ] && log_isdnctrl chargehup $DEVICE $CHARGEHUP
- [ -n "$CHARGEINT" ] && log_isdnctrl chargeint $DEVICE $CHARGEINT
-
- [ -n "$IHUP" ] && log_isdnctrl ihup $DEVICE $IHUP
-
- # set the number of dial atempts for each number
- [ -n "$DIALMAX" ] && log_isdnctrl dialmax $DEVICE $DIALMAX
-
- # set callback
- if [ "$CALLBACK" = "out" -o "$CALLBACK" = "in" ] ; then
- log_isdnctrl callback $DEVICE $CALLBACK
- else
- log_isdnctrl callback $DEVICE off
- fi
- [ -n "$CBDELAY" ] && log_isdnctrl cbdelay $DEVICE $CBDELAY
- [ -n "$CBHUP" ] && log_isdnctrl cbhup $DEVICE $CBHUP
-
- options="$options ipparam $DEVNAME"
-
- [ "$ENCAP" = "syncppp" ] && log_isdnctrl pppbind $DEVICE
-
- if [ "$IPADDR" = "0.0.0.0" ]; then
- options="$options ipcp-accept-local"
- else
- if [ "$DIALIN" != "on" ]; then
- options="$options noipdefault"
- fi
- fi
- # Add device
- options="$options /dev/$DEVICE"
-
- # set channel bundling
- if [ "$BUNDLING" = "yes" -o "$BUNDLING" = "on" ] && [ -n "$SLAVE_DEVICE" ]; then
- [ -z "$SLAVE_MSN" ] && SLAVE_MSN="$MSN"
- [ -z "$SLAVE_PHONE_OUT" ] && SLAVE_PHONE_OUT="$PHONE_OUT"
- [ -z "$SLAVE_PHONE_IN" ] && SLAVE_PHONE_IN="$PHONE_IN"
- [ -z "$SLAVE_HUPTIMEOUT" ] && SLAVE_HUPTIMEOUT="$HUPTIMEOUT"
- [ -z "$SLAVE_CHARGEHUP" ] && SLAVE_CHARGEHUP="$CHARGEHUP"
- [ -z "$SLAVE_CHARGEINT" ] && SLAVE_CHARGEINT="$CHARGEINT"
- [ -z "$SLAVE_CBHUP" ] && SLAVE_CBHUP="$CBHUP"
- [ -z "$SLAVE_IHUP" ] && SLAVE_IHUP="$IHUP"
- [ -z "$SLAVE_DIALMAX" ] && SLAVE_DIALMAX="$DIALMAX"
- [ -z "$SLAVE_CALLBACK" ] && SLAVE_CALLBACK="$CALLBACK"
- [ -z "$SLAVE_CBDELAY" ] && SLAVE_CBDELAY="$CBDELAY"
- if [ "$DIALIN" != "on" ] ; then
- [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="auto"
- else
- # Master should not dial by default on incoming MPPP
- [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="$DIALMODE"
- fi
-
- slave=$SLAVE_DEVICE
- options="$options /dev/$slave +mp"
-
- # Create slave and set options
- log_isdnctrl addslave $DEVICE $slave
- [ -z $SLAVE_MSN ] || log_isdnctrl eaz $slave $SLAVE_MSN
-
- # set phone number
- for i in $SLAVE_PHONE_OUT; do
- log_isdnctrl addphone $slave out $COUNTRYCODE$PREFIX$AREACODE$i
- done
- for i in $SLAVE_PHONE_IN; do
- log_isdnctrl addphone $slave in $i
- done
-
- # set layer-2/3 protocol
- log_isdnctrl l2_prot $slave $L2_PROT
- log_isdnctrl l3_prot $slave $L3_PROT
-
- # set encapsulation
- log_isdnctrl encap $slave $ENCAP
-
- # set dial mode
- log_isdnctrl dialmode $slave $SLAVE_DIALMODE
-
- [ -n "$SECURE" ] && log_isdnctrl secure $slave $SECURE
- [ -n "$SLAVE_HUPTIMEOUT" ] && log_isdnctrl huptimeout $slave $SLAVE_HUPTIMEOUT
- [ -n "$SLAVE_CHARGEHUP" ] && log_isdnctrl chargehup $slave $SLAVE_CHARGEHUP
- [ -n "$SLAVE_CHARGEINT" ] && log_isdnctrl chargeint $slave $SLAVE_CHARGEINT
- [ -n "$SLAVE_IHUP" ] && log_isdnctrl ihup $slave $SLAVE_IHUP
- [ -n "$SLAVE_DIALMAX" ] && log_isdnctrl dialmax $slave $SLAVE_DIALMAX
-
- # set callback
- [ -n "$SLAVE_CBHUP" ] && log_isdnctrl cbhup $slave $SLAVE_CBHUP
- [ -n "$SLAVE_CALLBACK" ] || SLAVE_CALLBACK="off"
- log_isdnctrl callback $slave $SLAVE_CALLBACK
- [ -n "$SLAVE_CBDELAY" ] && log_isdnctrl cbdelay $DEVICE $SLAVE_CBDELAY
-
- # options for master device
- [ -n "$SLAVE_DELAY" ] && log_isdnctrl sdelay $DEVICE $SLAVE_DELAY
- [ -n "$SLAVE_TRIGGER" ] && log_isdnctrl trigger $DEVICE $SLAVE_TRIGGER
- fi
-
- if [ "$GATEWAY" = "0.0.0.0" ]; then
- if [ "$DIALIN" != "on" ]; then
- options="$options ipcp-accept-remote"
- fi
- options="$IPADDR:$GATEWAY $options"
- else
- options="$options $IPADDR:$GATEWAY"
- fi
-
- # Van Jacobson style TCP/IP header compression and
- # VJ connection-ID compression
- [ "$VJ" = "off" ] && options="$options -vj"
- [ "$VJCCOMP" = "off" ] && options="$options -vjccomp"
-
- # Address/Control compression, protocol field compression,
- [ "$AC" = "off" ] && options="$options -ac"
- [ "$PC" = "off" ] && options="$options -pc"
-
- # BSD-Compression scheme
- if [ "$BSDCOMP" = "on" ] ; then
- options="$options bsdcomp 9,9"
- else
- options="$options -bsdcomp"
- fi
- # Stac compression
- if [ "$LZS" = "on" ] ; then
- # supports LZS check mode 3 and 4
- [ -n "$LZS_MODE" ] || LZS_MODE="4"
- [ "$LZS_MODE" = "3" ] && options="$options lzs 1"
- [ "$LZS_MODE" = "4" ] && options="$options lzs 1:4"
- fi
-
- # Set max receive and max transmit units
- [ -n "$MRU" ] && options="$options mru $MRU"
- [ -n "$MTU" ] && options="$options mtu $MTU"
-
- # set CBCP protocoll
- if [ "$CBCP" = "on" ] ; then
- if [ -n "$CBCP_MSN" ] ; then
- # User managed callback
- options="$options callback $CBCP_MSN"
- else
- # admin managed callback, it's enabled by default
- options="$options callback 6"
- fi
- else
- # Disable CBCP
- options="$options -callback-cbcp"
- fi
-
- # set CCP protocoll
- [ "$CCP" = "off" ] && options="$options noccp"
-
- # set host name
- [ -n "$ISDN_HOSTNAME" ] && options="$options remotename $ISDN_HOSTNAME"
-
- # Set authentication
- for i in $AUTH ; do
- options="$options $i"
- done
-
- # add ppp options
- for i in $PPPOPTIONS ; do
- options="$options $i"
- done
-
- # check dns entry
- if [ -z "$DNS1" -a -z "$DNS2" ]; then
- options="$options ms-get-dns"
- else
- [ -n "$DNS1" ] && options="$options ms-dns $DNS1"
- [ -n "$DNS2" ] && options="$options ms-dns $DNS2"
- fi
-
- # set debug
- [ "$DEBUG" = "yes" ] && options="-d $options"
-
- # set netmask, if available
- [ -n "$NETMASK" ] && netmask="netmask $NETMASK"
-
- # activate ISDN device
- /usr/bin/logger -p daemon.info -t ifup-ippp "ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up"
- ifconfig $DEVICE $IPADDR pointopoint $GATEWAY $netmask up >/dev/null 2>&1
-
- if [ "$ENCAP" = "syncppp" ]; then
- # start ipppd daemon
- /usr/bin/logger -p daemon.info -t ifup-ippp "ipppd $options $netmask"
- ipppd $options $netmask >/dev/null 2>&1
-
- # start ibod daemon
- if [ "$DIALIN" != "on" ]; then
- [ "$BUNDLING" = "yes" -o "$BUNDLING" = "on" ] && [ -n "$SLAVE_DEVICE" ] && start_ibod $DEVICE
- fi
- fi
-
- # set default gateway for dial on demand
- if [ "$DIALMODE" = "auto" ] ; then
- echo 1 > /proc/sys/net/ipv4/ip_dynaddr
- if [ "$DEFROUTE" = "yes" ] ; then
- route del default >/dev/null 2>&1
- if [ "$GATEWAY" = "0.0.0.0" ]; then
- route add default ${METRIC:+metric $METRIC} $DEVICE \
- >/dev/null 2>&1
- else
- route add default gw $GATEWAY ${METRIC:+metric $METRIC} \
- >/dev/null 2>&1
- fi
- fi
- fi
-
- # Setup IPv6
- if [ "$IPV6INIT" = "yes" -a ! -z "$IPV6ADDR" ]; then
- # Native IPv6 use of device configured, check of encapsulation required
- if [ "$ENCAP" = "syncppp" ]; then
- echo $"Warning: ipppd (kernel 2.4.x and below) doesn't support IPv6 using encapsulation 'syncppp'"
- elif [ "$ENCAP" = "rawip" ]; then
- echo $"Warning: link doesn't support IPv6 using encapsulation 'rawip'"
- fi
- fi
- /etc/sysconfig/network-scripts/ifup-ipv6 $CONFIG
-}
-
-addprovider || exit 1
-
-exit 0
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
index da1062ec..4facc403 100755..100644
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -80,6 +80,7 @@ ipv6_test || exit 1
ipv6_test_device_status $DEVICE
if [ $? != 0 -a $? != 11 ]; then
# device doesn't exist or other problem occurs
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
@@ -176,6 +177,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
if [ $? = 0 ]; then
# device is already up
echo $"Device 'tun6to4' (from '$DEVICE') is already up, shutdown first"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
@@ -304,6 +306,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
fi
else
echo $"6to4 configuration is not valid"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
fi
diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb
index e185e647..e185e647 100755..100644
--- a/sysconfig/network-scripts/ifup-plusb
+++ b/sysconfig/network-scripts/ifup-plusb
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 29af56b7..a751bf38 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -3,7 +3,7 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
unset REALDEVICE
if [ "$1" = --realdevice ] ; then
@@ -22,8 +22,12 @@ fi
/etc/sysconfig/network-scripts/ifup-routes ${REALDEVICE} ${DEVNAME}
+# metric setting (skip for alias interfaces)
+if [ "${REALDEVICE}" = "${DEVICE}" ] && [ -n "$METRIC" ] && type -p ifmetric > /dev/null 2>&1; then
+ ifmetric ${DEVICE} $METRIC
+fi
-if [ "$PEERDNS" != "no" ] ||[ -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
+if [ "$PEERDNS" != "no" -a "$BOOTPROTO" != "dhcp" ] ||[ -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
[ -n "$MS_DNS1" ] && DNS1=$MS_DNS1
[ -n "$MS_DNS2" ] && DNS2=$MS_DNS2
if [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf &&
@@ -96,6 +100,12 @@ fi
# Notify programs that have requested notification
do_netreport
+mdv-network-event interface_up ${DEVICE}
+
+if [ -d /etc/sysconfig/network-scripts/ifup.d -a -x /usr/bin/run-parts ]; then
+ /usr/bin/run-parts --arg ${DEVICE} /etc/sysconfig/network-scripts/ifup.d
+fi
+
if [ -x /sbin/ifup-local ]; then
/sbin/ifup-local ${DEVICE}
fi
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
index fb30639d..d53f3d70 100755
--- a/sysconfig/network-scripts/ifup-ppp
+++ b/sysconfig/network-scripts/ifup-ppp
@@ -9,16 +9,20 @@ cd /etc/sysconfig/network-scripts
if [ "${1}" = daemon ] ; then
# we've been called from ppp-watch, so don't invoke it for persistence
shift
+ # do not detach connection so that ppp-watch can monitor it
+ DETACH=nodetach
else
# just in case a full path to the configuration file is passed in
CONFIG=${1##*/} # CONFIG=$(basename $1)
[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
source_config
- # don't start ppp-watch by xDSL
- if [ "${DEMAND}" != yes -a "$TYPE" != "xDSL" ] ; then
+ # don't start ppp-watch by xDSL and ADSL
+ if [ "${DEMAND}" != yes -a "$TYPE" != "xDSL" -a "$TYPE" != "ADSL" ] ; then
# let ppp-watch do the right thing
exec /sbin/ppp-watch "${CONFIG##ifcfg-}" "$2"
fi
+ # detach connection not to hang boot
+ DETACH=updetach
fi
CONFIG=$1
@@ -46,17 +50,19 @@ fi
echo $"ifup-ppp for ${DEVICE} exiting"
/usr/bin/logger -p daemon.info -t ifup-ppp \
$"pppd does not exist or is not executable for ${DEVICE}"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
}
# check that xDSL connection
if [ "$TYPE" = "xDSL" ] ; then
if [ -x /usr/sbin/adsl-start ] ; then
- adsl-start /etc/sysconfig/network-scripts/$CONFIG
+ adsl-start
exit $?
else
/usr/bin/logger -p daemon.info -t ifup-ppp \
$"adsl-start does not exist or is not executable for ${DEVICE}"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
fi
@@ -75,6 +81,7 @@ if [ ! -f ${PEERCONF} ]; then
echo $"ifup-ppp for ${DEVNAME} exiting"
/usr/bin/logger -p daemon.info -t ifup-ppp \
$"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
}
fi
@@ -102,12 +109,12 @@ fi
if [ "${DEFROUTE}" != no ] ; then
# pppd will no longer delete an existing default route
# so we have to help it out a little here.
- DEFRT=$(ip route list match 0.0.0.0/0)
+ DEFRT=$(ip route list match 0.0.0.0/0 dev ${DEVICE})
[ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes
- echo "$DEFRT" | while read spec; do
+ [ -n "${DEFRT}" ] && echo "$DEFRT" | while read spec; do
ip route del $spec;
done
- opts="$opts defaultroute"
+ opts="$opts defaultroute multipledefaultroutes"
fi
if [ "${PEERDNS}" != no ] ; then
cp -f /etc/resolv.conf /etc/resolv.conf.save
@@ -130,16 +137,30 @@ if [ "${DEBUG}" = yes ] ; then
opts="$opts debug"
fi
-if [ ${DEMAND} = yes ] ; then
+if [ "${DEMAND}" = yes ] ; then
opts="$opts demand ktune idle ${IDLETIMEOUT} holdoff ${RETRYTIMEOUT}"
exec=
else
- opts="$opts nodetach"
+ opts="$opts $DETACH"
exec=exec
fi
-/usr/bin/logger -p daemon.info -t ifup-ppp \
- $"pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}"
+if [ "$TYPE" != "xDSL" -a "$TYPE" != "ADSL" ] ; then
+ CELLULAR_PIN=$(cat pin-${DEVICE} 2>/dev/null)
+ if [ -n "$CELLULAR_PIN" -a -x /usr/sbin/comgt ]; then
+ COMGTPIN=$CELLULAR_PIN comgt PIN -d $MODEMPORT
+ fi
+fi
+
+# ATM bridging support, enabled if ATM_ADDR is defined (VCI.VPI)
+# useful for pppoe over USB modems
+if [ -n "${ATM_ADDR}" -a -n "${ATM_DEVICE}" -a -x /usr/sbin/br2684ctl ]; then
+ br2684ctl -b -c 0 -a ${ATM_ADDR}
+ ifconfig ${ATM_DEVICE} up
+fi
+
+(logger -p daemon.info -t ifup-ppp \
+ $"pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}" &)&
$exec pppd $opts ${MODEMPORT} ${LINESPEED} \
ipparam ${DEVNAME} linkname ${DEVNAME} call ${DEVNAME}\
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index f593a677..b41dbf81 100755..100644
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -56,11 +56,13 @@ ipv6_test || exit 1
# Generic tunnel device sit0 is not supported here
if [ "$DEVICE" = "sit0" ]; then
echo $"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and restart (IPv6) networking"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
if [ -z "$IPV6TUNNELIPV4" ]; then
echo $"Missing remote IPv4 address of tunnel, configuration is not valid"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
@@ -69,6 +71,7 @@ ipv6_test_device_status $DEVICE
if [ $? = 0 ]; then
# device is already up
echo $"Device '$DEVICE' is already up, please shutdown first"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
diff --git a/sysconfig/network-scripts/ifup-tunnel b/sysconfig/network-scripts/ifup-tunnel
index 8fd631e5..fe43cdd9 100755
--- a/sysconfig/network-scripts/ifup-tunnel
+++ b/sysconfig/network-scripts/ifup-tunnel
@@ -54,6 +54,7 @@ esac
# Generic tunnel devices are not supported here
if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 ]; then
echo $"Device '$DEVICE' isn't supported as a valid GRE device name."
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
diff --git a/sysconfig/network-scripts/ifup-wireless b/sysconfig/network-scripts/ifup-wireless
index 3f2759c4..a75699ec 100755
--- a/sysconfig/network-scripts/ifup-wireless
+++ b/sysconfig/network-scripts/ifup-wireless
@@ -18,6 +18,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
# Configure wireless network device options. See iwconfig(8) for more info.
+# Mandriva prefixes the following variables with WIRELESS_ prefix.
# Valid variables:
# MODE: Ad-Hoc, Managed, etc.
# ESSID: Name of the wireless network
@@ -26,44 +27,94 @@
# CHANNEL: Numbered frequency to operate on. See FREQ
# SENS: Sensitivity threshold for packet rejection.
# RATE: Transfer rate. Usually one of Auto, 11, 5, 2, or 1.
-# KEY: Encryption key for WEP.
# RTS: Explicit RTS handshake. Usually not specified (auto)
# FRAG: Fragmentation threshold to split packets. Usually not specified.
-# SPYIPS: List of IP addresses to "spy" on for link performance stats.
# IWCONFIG: Extra parameters to pass directly to IWCONFIG
-# SECURITYMODE: Security mode, e.g: 'open' or 'restricted'
# IWPRIV: Extra parameters to pass directly to IWPRIV
+#
+# redhat-only variables:
+# KEY: Encryption key for WEP.
+# KEY[1-4]: Encryption key for WEP in position [1-4]
+# SECURITYMODE: Security mode, e.g: 'open' or 'restricted'
+# SPYIPS: List of IP addresses to "spy" on for link performance stats.
+#
+# mandriva-only variables:
+# WIRELESS_NICK: nickname for wireless connection
+# WIRELESS_ENC_KEY: Encryption key for WEP.
+# WIRELESS_ENC_MODE: Security mode, e.g: 'open' or 'restricted'
+# WIRELESS_XSUPPLICANT: Enabling xsupplicant support
+# WIRELESS_XSUPPLICANT_FILE: Custom location for xsupplicant.conf file
# Only meant to be called from ifup.
+# unify variables common to RH and Mandriva-style ifcfg
+MODE=${MODE:-$WIRELESS_MODE}
+ESSID=${ESSID:-$WIRELESS_ESSID}
+NWID=${NWID:-$WIRELESS_NWID}
+FREQ=${FREQ:-$WIRELESS_FREQ}
+CHANNEL=${CHANNEL:-$WIRELESS_CHANNEL}
+SENS=${SENS:-$WIRELESS_SENS}
+RATE=${RATE:-$WIRELESS_RATE}
+POWER=${POWER:-$WIRELESS_POWER}
+RTS=${RTS:-$WIRELESS_RTS}
+FRAG=${FRAG:-$WIRELESS_FRAG}
+IWCONFIG=${IWCONFIG:-$WIRELESS_IWCONFIG}
+IWSPY=${IWSPY:-$WIRELESS_IWSPY}
+IWPRIV=${IWPRIV:-$WIRELESS_IWPRIV}
+
# Mode need to be first : some settings apply only in a specific mode !
if [ -n "$MODE" ] ; then
+ # for some cards, the mode can only be set with the card is down
+ # so we bring the card down (and suspending ifplugd if it is running)
+ # in order to do so (mdv bug #43166)
+ ifplugd -S -i $DEVICE 2>/dev/null
+ /sbin/ip link set dev $DEVICE down
iwconfig $DEVICE mode $MODE
+ ifplugd -R -i $DEVICE 2>/dev/null
fi
# Set link up (some cards require this.)
/sbin/ip link set dev ${DEVICE} up
+# Setup the card nickname
# This is a bit hackish, but should do the job right...
if [ -n "$ESSID" -o -n "$MODE" ] ; then
NICKNAME=$(/bin/hostname)
iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
fi
+if [ -n "$WIRELESS_NICK" ] ; then
+ iwconfig $DEVICE nick $WIRELESS_NICK >/dev/null 2>&1
+elif [ -n "$ESSID" ] || [ -n "$MODE" ] ; then
+ # This is a bit hackish, but should do the job right...
+ NICKNAME=`/bin/hostname`
+ iwconfig $DEVICE nick $NICKNAME >/dev/null 2>&1
+fi
+
# Regular stuff...
+# network id
if [ -n "$NWID" ] ; then
iwconfig $DEVICE nwid $NWID
fi
+
+# frequency and channel
if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
iwconfig $DEVICE freq $FREQ
elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
iwconfig $DEVICE channel $CHANNEL
fi
+
+# sensitivity
if [ -n "$SENS" ] ; then
iwconfig $DEVICE sens $SENS
fi
+
+# rate
if [ -n "$RATE" ] ; then
iwconfig $DEVICE rate "$RATE"
fi
+
+# encryption
+# for redhat-style ifcfg
if [ -n "$KEY" -o -n "$KEY1" -o -n "$KEY2" -o -n "$KEY3" -o -n "$KEY4" ] ; then
[ -n "$KEY1" ] && iwconfig $DEVICE key "[1]" $KEY1
[ -n "$KEY2" ] && iwconfig $DEVICE key "[2]" $KEY2
@@ -74,12 +125,39 @@ if [ -n "$KEY" -o -n "$KEY1" -o -n "$KEY2" -o -n "$KEY3" -o -n "$KEY4" ] ; then
else
iwconfig $DEVICE key off
fi
+
+# for mandriva-style ifcfg
+if [ -n "$WIRELESS_ENC_KEY" -o "$WIRELESS_ENC_MODE" ] ; then
+ if [ -n "$WIRELESS_ENC_MODE" ]; then
+ iwconfig $DEVICE key $WIRELESS_ENC_MODE "$WIRELESS_ENC_KEY"
+ else
+ # compatibility for older config files
+ # that used to contain enc mode in key
+ echo "$WIRELESS_ENC_KEY" | egrep -q '^(open|restricted) '
+ if [ $? == 0 ]; then
+ iwconfig $DEVICE key $WIRELESS_ENC_KEY
+ else
+ iwconfig $DEVICE key "$WIRELESS_ENC_KEY"
+ fi
+ fi
+fi
+
+# security mode
if [ -n "$SECURITYMODE" ]; then
iwconfig $DEVICE enc $SECURITYMODE
fi
+
+# power
+if [ -n "$POWER" ] ; then
+ iwconfig $DEVICE power $POWER
+fi
+
+# rts
if [ -n "$RTS" ] ; then
iwconfig $DEVICE rts $RTS
fi
+
+# fragmentation
if [ -n "$FRAG" ] ; then
iwconfig $DEVICE frag $FRAG
fi
@@ -89,13 +167,21 @@ if [ -n "$IWCONFIG" ] ; then
iwconfig $DEVICE $IWCONFIG
fi
+# iwspy settings
if [ -n "$SPYIPS" ] ; then
for IP in $SPYIPS; do
- iwspy $DEVICE + $IP
+ iwspy $DEVICE + $IP
done
fi
+if [ -n "$IWSPY" ] ; then
+ /sbin/iwspy $DEVICE $IWSPY
+fi
+
+# private options
if [ -n "$IWPRIV" ] ; then
- iwpriv $DEVICE $IWPRIV
+ IFS=$'\n' echo "$IWPRIV" | while read priv; do
+ [ -n -n "$priv" ] && eval "/sbin/iwpriv $DEVICE $priv"
+ done
fi
# ESSID need to be last : most device re-perform the scanning/discovery
@@ -107,3 +193,17 @@ else
# use any essid
iwconfig $DEVICE essid any >/dev/null 2>&1
fi
+
+# settings for xsupplicant
+if [ -n "$WIRELESS_XSUPPLICANT" -a -x /usr/sbin/xsupplicant ]; then
+ if [ -f /var/run/console.lock ] ; then
+ WIRELESS_XSUPPLICANT_FILE=/home/$(cat /var/run/console.lock)/.xsupplicant.conf
+ elif [ -f /etc/xsupplicant.conf ] ; then
+ WIRELESS_XSUPPLICANT_FILE=/etc/xsupplicant.conf
+ fi
+ if [ -n "$WIRELESS_XSUPPLICANT_FILE" ]; then
+ iwconfig $DEVICE key on
+ ifconfig $DEVICE allmulti
+ /usr/sbin/xsupplicant -i ${DEVICE} -c ${WIRELESS_XSUPPLICANT_FILE} &
+ fi
+fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 562fe7cb..37e088a0 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -9,6 +9,8 @@ export PATH
[ -z "$__sed_discard_ignored_files" ] && . /etc/init.d/functions
+RESOLVCONF_FLAGFILE=/var/run/resolvconf/enable-updates
+
get_hwaddr ()
{
if [ -f /sys/class/net/${1}/address ]; then
@@ -54,11 +56,6 @@ get_device_by_hwaddr ()
LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }"
}
-get_uuid_by_config ()
-{
- dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/$1" 2>/dev/null | awk -F '"' '/string / { print $2 }'
-}
-
need_config ()
{
local nconfig
@@ -121,6 +118,9 @@ source_config ()
CTC)
DEVICETYPE="ctc"
;;
+ IUCV)
+ DEVICETYPE="iucv"
+ ;;
GRE | IPIP)
DEVICETYPE="tunnel"
;;
@@ -147,46 +147,27 @@ source_config ()
else
ISALIAS=no
fi
- ! is_false $NM_CONTROLLED && is_nm_running && USE_NM=true
- if [ -z "$UUID" -a "$USE_NM" = "true" ]; then
- UUID=$(get_uuid_by_config $CONFIG)
- fi
+ is_true $NM_CONTROLLED && USE_NM=true
}
expand_config ()
{
- local i=0 val
- for idx in '' {0..255} ; do
- ipaddr[$i]=$(eval echo '$'IPADDR$idx)
- if [ -z "${ipaddr[$i]}" ]; then
- [ "$idx" ] && [ $idx -gt 2 ] && break
- continue
- fi
- prefix[$i]=$(eval echo '$'PREFIX$idx)
- netmask[$i]=$(eval echo '$'NETMASK$idx)
- broadcast[$i]=$(eval echo '$'BROADCAST$idx)
-
- if [ "${netmask[$i]}x" = "x" ]; then
- val=$(/bin/ipcalc --netmask "${ipaddr[$i]}")
- netmask[$i]=${val##NETMASK=}
- fi
+ if [ -z "${NETMASK}" ]; then
+ eval $(/bin/ipcalc --netmask ${IPADDR})
+ fi
- if [ "${prefix[$i]}x" = "x" ]; then
- val=$(/bin/ipcalc --prefix ${ipaddr[$i]} ${netmask[$i]})
- prefix[$i]=${val##PREFIX=}
- fi
+ if [ -z "${PREFIX}" ]; then
+ eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
+ fi
- if [ "${broadcast[$i]}x" = "x" ]; then
- val=$(/bin/ipcalc --broadcast ${ipaddr[$i]} ${netmask[$i]})
- broadcast[$i]=${val##BROADCAST=}
- fi
- i=$((i+1))
- done
+ if [ -z "${BROADCAST}" ]; then
+ eval $(/bin/ipcalc --broadcast ${IPADDR} ${NETMASK})
+ fi
if [ -z "${NETWORK}" ]; then
- eval $(/bin/ipcalc --network ${ipaddr[0]} ${netmask[0]})
+ eval $(/bin/ipcalc --network ${IPADDR} ${NETMASK})
fi
}
@@ -221,17 +202,19 @@ do_netreport ()
is_nm_running ()
{
- [ "$(LANG=C nmcli -t --fields running nm status 2>/dev/null)" = "running" ]
+ [ -x /usr/bin/nmcli ] && \
+ [ "$(LANG=C LC_ALL=C nmcli -t --fields running nm status 2>/dev/null)" = "running" ]
}
is_nm_active ()
{
- LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:connected$"
+ [ -x /usr/bin/nmcli ] && \
+ LANG=C LC_ALL=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:connected$"
}
is_nm_device_unmanaged ()
{
- LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:unmanaged$"
+ LANG=C LC_ALL=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:unmanaged$"
}
# Sets $alias to the device module if $? != 0
@@ -297,20 +280,34 @@ set_hostname ()
/bin/rm -f $rsctmp
fi
fi
+ if [ -d /etc/sysconfig/network-scripts/hostname.d -a -x /usr/bin/run-parts ]; then
+ /usr/bin/run-parts --arg $1 /etc/sysconfig/network-scripts/hostname.d
+ fi
}
check_device_down ()
{
- if LC_ALL=C ip -o link show dev $1 2>/dev/null | grep -q ",UP" ; then
+ if echo $1 | grep -q ':' ; then
+ if LC_ALL=C ifconfig -a 2>/dev/null | grep -q $1 ; then
+ return 1
+ else
+ return 0
+ fi
+ else
+ if LC_ALL=C ip -o link 2>/dev/null | grep -q "$1[:@].*,UP" ; then
return 1
else
return 0
fi
+ fi
}
check_link_down ()
{
- if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q ",UP" ; then
+ if [ "${MII_NOT_SUPPORTED}" = yes ]; then
+ return 1
+ fi
+ if ! LC_ALL=C ip link show dev $1 2>/dev/null| grep -q UP ; then
ip link set dev $1 up >/dev/null 2>&1
fi
timeout=0
@@ -409,19 +406,35 @@ change_resolv_conf ()
fi;
n_args=$(($n_args-1));
done;
- elif [ $# -eq 1 ]; then
+ elif [ $# -eq 1 -a -r "$1" ]; then
if [ "x$s" != "x" ]; then
s="$s"$(/bin/grep -vF "$s" $1);
else
s=$(cat $1);
fi;
+ else
+ return
fi;
- (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
+ if [ -e "$RESOLVCONF_FLAGFILE" ]; then
+ echo "$s" | /sbin/resolvconf -a ${DEVICE}
+ else
+ (echo "$s" > /etc/resolv.conf;) >/dev/null 2>&1;
+ fi
r=$?
if [ $r -eq 0 ]; then
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 # reset the correct context
/usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf";
- [ -e /var/lock/subsys/nscd ] && /usr/sbin/nscd -i hosts; # invalidate cache
+ [ -e /var/lock/subsys/nscd ] && [ ! -e "$RESOLVCONF_FLAGFILE" ] && /usr/sbin/nscd -i hosts; # invalidate cache
fi;
return $r;
}
+
+clear_resolv_conf ()
+{
+ if [ -e "$RESOLVCONF_FLAGFILE" ]; then
+ /sbin/resolvconf -d ${DEVICE}
+ elif [ -f /etc/resolv.conf.save ]; then
+ change_resolv_conf /etc/resolv.conf.save
+ rm -f /etc/resolv.conf.save
+ fi
+}
diff --git a/sysconfig/networking/ifcfg-lo b/sysconfig/networking/ifcfg-lo
new file mode 100755
index 00000000..cb4f3f94
--- /dev/null
+++ b/sysconfig/networking/ifcfg-lo
@@ -0,0 +1,9 @@
+DEVICE=lo
+IPADDR=127.0.0.1
+NETMASK=255.0.0.0
+NETWORK=127.0.0.0
+# If you're having problems with gated making 127.0.0.0/8 a martian,
+# you can change this to something else (255.255.255.255, for example)
+BROADCAST=127.255.255.255
+ONBOOT=yes
+NAME=loopback