aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x[-rw-r--r--]sysconfig/network-scripts/ifcfg-lo0
-rwxr-xr-xsysconfig/network-scripts/ifdown4
-rwxr-xr-xsysconfig/network-scripts/ifdown-bnep2
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth42
-rwxr-xr-xsysconfig/network-scripts/ifdown-ippp34
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifdown-ipv60
-rwxr-xr-xsysconfig/network-scripts/ifdown-post6
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifdown-sit0
-rwxr-xr-xsysconfig/network-scripts/ifdown-tunnel2
-rwxr-xr-xsysconfig/network-scripts/ifup-bnep2
-rwxr-xr-xsysconfig/network-scripts/ifup-eth376
-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-post8
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifup-sit3
-rwxr-xr-xsysconfig/network-scripts/ifup-tunnel1
-rw-r--r--[-rwxr-xr-x]sysconfig/network-scripts/ifup-wireless191
-rwxr-xr-x[-rw-r--r--]sysconfig/network-scripts/network-functions45
19 files changed, 549 insertions, 554 deletions
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 18cee69d..39827341 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
@@ -52,6 +52,8 @@ if [ "$_use_nm" = "true" ]; then
fi
exit 0
fi
+ echo $"$0: interface ${CONFIG} 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 9b2d385d..59201fd9 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 932dd882..36e796f4 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
@@ -84,6 +87,10 @@ 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
retcode=0
[ -n "$(pidof -x dhclient)" ] && {
@@ -105,7 +112,31 @@ for VER in "" 6 ; do
fi
fi
done
-}
+}
+
+# Kill running dhcp client if present (supports more clients than the above)
+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
+
+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
@@ -129,6 +160,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
@@ -164,7 +200,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 ed203997..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 /run/ipppd.$DEVICE.pid ] ; then
- pppdpid=$(cat /run/ipppd.$DEVICE.pid)
- kill -9 $pppdpid > /dev/null 2>&1
- rm -f /run/ipppd.$DEVICE.pid > /dev/null 2>&1
-fi
diff --git a/sysconfig/network-scripts/ifdown-ipv6 b/sysconfig/network-scripts/ifdown-ipv6
index 7ba3efdc..7ba3efdc 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 229c9877..ff8f5255 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -65,6 +65,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-sit b/sysconfig/network-scripts/ifdown-sit
index 37d100e6..37d100e6 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 a5384b18..d2ac6922 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-bnep b/sysconfig/network-scripts/ifup-bnep
index 019e741b..5650b092 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 76eedebd..5c3a72a4 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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
net_log $"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
net_log $"Bridge support not available: brctl not found"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
@@ -114,9 +128,67 @@ is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || {
else
net_log $"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=
+if is_wireless_device ${DEVICE}; then
+ # ralink devices need to be up for wireless-tools to work
+ ip link set dev ${DEVICE} up
+ 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
@@ -128,9 +200,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
-
# Team slave device?
if [ -n "${TEAM_MASTER}" ] && [ ! "${DEVICETYPE}" = "TeamPort" ] && [ -x ./ifup-TeamPort ]; then
./ifup-TeamPort ${CONFIG} $2
@@ -193,41 +262,159 @@ if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
[ -r /run/radvd/radvd.pid ] && kill -HUP $(cat /run/radvd/radvd.pid)
exit 0
fi
+
+# 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
-if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
- if is_true "${PERSISTENT_DHCLIENT}"; then
- ONESHOT="";
+
+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
+ 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
+ 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;
+ ONESHOT="-1"
+ fi
generate_config_file_name
generate_lease_file_name
+ DHCP_ARGS="$DHCP_ARGS $ONESHOT -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient-${DEVICE}.pid $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
- # Initialize the dhclient args and obtain the hostname options if needed:
- DHCLIENTARGS="${DHCLIENTARGS} ${ONESHOT} -q ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /run/dhclient-${DEVICE}.pid"
- set_hostname_options DHCLIENTARGS
-
+# 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
echo
echo -n $"Determining IP information for ${DEVICE}..."
- if ! is_true "${PERSISTENT_DHCLIENT}" && check_link_down ${DEVICE}; then
- echo $" failed; no link present. Check cable?"
- exit 1
+ 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
ethtool_set
- if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
- echo $" done."
- dhcpipv4="good"
+ mdv-network-event dhcp_request ${DEVICE}
+ if $DHCP_CLIENT $DHCP_ARGS ; then
+ mdv-network-event dhcp_success ${DEVICE}
+ echo $" done."
+ dhcpipv4="good"
else
- echo $" failed."
- if is_true "${IPV4_FAILURE_FATAL}"; then
- exit 1
- fi
- if is_false "$IPV6INIT" || ! is_true "$DHCPV6C"; then
- exit 1
- fi
- net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
+ 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."
+ if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ if [[ "$IPV6INIT" = [nN0]* || "$DHCPV6C" != [yY1]* ]] ; then
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
fi
# end dynamic device configuration
else
@@ -237,91 +424,94 @@ else
ethtool_set
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
else
+
+ expand_config
+
+ [ -n "${ARP}" ] && \
+ ip link set dev ${REALDEVICE} $(toggle_value arp $ARP)
+
+ if ! ip link set dev ${REALDEVICE} up ; then
+ net_log $"Failed to bring up ${DEVICE}."
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
- expand_config
+ ethtool_set
- [ -n "${ARP}" ] && \
- ip link set dev ${REALDEVICE} $(toggle_value arp $ARP)
+ [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
- if ! ip link set dev ${REALDEVICE} up ; then
- net_log $"Failed to bring up ${DEVICE}."
- exit 1
+ if [ "${DEVICE}" = "lo" ]; then
+ SCOPE="scope host"
+ else
+ SCOPE=${SCOPE:-}
+ fi
+
+ if [ -n "$SRCADDR" ]; then
+ SRC="src $SRCADDR"
+ else
+ SRC=
+ fi
+
+ if [ "${REALDEVICE}" != "lo" ]; then
+ # set IP address(es)
+ for idx in {0..256} ; do
+ if [ -z "${ipaddr[$idx]}" ]; then
+ break
fi
- ethtool_set
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+ if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
+ if [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] ; then
+ ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
+ if [ $? = 1 ]; then
+ ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p')
+ net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
+ fi
- if [ "${DEVICE}" = "lo" ]; then
- SCOPE="scope host"
- else
- SCOPE=${SCOPE:-}
+ if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \
+ brd ${broadcast[$idx]:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
+ net_log $"Error adding address ${ipaddr[$idx]} for ${DEVICE}."
+ fi
fi
if [ -n "$SRCADDR" ]; then
- SRC="src $SRCADDR"
- else
- SRC=
+ sysctl -w "net.ipv4.conf.${SYSCTLDEVICE}.arp_filter=1" >/dev/null 2>&1
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
- if [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] ; then
- ARPING=$(/sbin/arping -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]})
- if [ $? = 1 ]; then
- ARPINGMAC=$(echo $ARPING | sed -ne 's/.*\[\(.*\)\].*/\1/p')
- net_log $"Error, some other host ($ARPINGMAC) already uses address ${ipaddr[$idx]}."
- exit 1
- fi
- fi
-
- if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \
- brd ${broadcast[$idx]:-+} dev ${REALDEVICE} ${SCOPE} label ${DEVICE}; then
- net_log $"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
+ # update ARP cache of neighboring computers
+ if ! is_false "${arpupdate[$idx]}" && [ "${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
- # update ARP cache of neighboring computers
- if ! is_false "${arpupdate[$idx]}" && [ "${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
+ # set lifetime of address to forever
+ ip addr change ${ipaddr[$idx]}/${prefix[$idx]} dev ${REALDEVICE} valid_lft forever preferred_lft forever
+ done
- # set lifetime of address to forever
- ip addr change ${ipaddr[$idx]}/${prefix[$idx]} dev ${REALDEVICE} valid_lft forever preferred_lft forever
- done
-
- # 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
- ip route replace default ${METRIC:+metric $METRIC} \
- ${EXTRA_ROUTE_OPTS} \
- via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \
- ${GATEWAYDEV:+dev $GATEWAYDEV} ||
- net_log $"Error adding default gateway ${GATEWAY} for ${DEVICE}."
- elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then
- ip route replace default ${METRIC:+metric $METRIC} \
- ${EXTRA_ROUTE_OPTS} \
- ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} ||
- net_log $"Error adding default gateway for ${REALDEVICE}."
- 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
+ ip route replace default ${METRIC:+metric $METRIC} \
+ ${EXTRA_ROUTE_OPTS} \
+ via ${GATEWAY} ${WINDOW:+window $WINDOW} ${SRC} \
+ ${GATEWAYDEV:+dev $GATEWAYDEV} ||
+ net_log $"Error adding default gateway ${GATEWAY} for ${DEVICE}."
+ elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then
+ ip route replace default ${METRIC:+metric $METRIC} \
+ ${EXTRA_ROUTE_OPTS} \
+ ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} ||
+ net_log $"Error adding default gateway for ${REALDEVICE}."
fi
fi
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
diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp
deleted file mode 100755
index e1f08a79..00000000
--- a/sysconfig/network-scripts/ifup-ippp
+++ /dev/null
@@ -1,384 +0,0 @@
-#! /bin/bash
-#
-# ifup-ippp
-#
-# This script is normally called from the ifup script when it detects an 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" ] && {
- val=$(ipcalc --prefix $IPADDR $NETMASK)
- pfx=${val##PREFIX=}
- }
- # activate ISDN device
- /usr/bin/logger -p daemon.info -t ifup-ippp "ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE"
- ip addr add $IPADDR peer $GATEWAY${pfx:/$pfx} dev $DEVICE
- ip link set dev $DEVICE up
-
- 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
- if [ "$GATEWAY" = "0.0.0.0" ]; then
- ip route replace default ${METRIC:+metric $METRIC} dev ${DEVICE} >/dev/null 2>&1
- else
- ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE} >/dev/null 2>&1
- fi
- fi
- fi
-
- # Setup IPv6
- if ! is_false "$IPV6INIT" && ! [[ -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 34b0cbee..1751ee65 100755..100644
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -79,6 +79,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
@@ -180,6 +181,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
if [ $? = 0 ]; then
# device is already up
net_log $"Device 'tun6to4' (from '$DEVICE') is already up, shutdown first"
+ mdv-network-event connection_failure ${DEVICE}
exit 1
fi
@@ -308,6 +310,7 @@ if [ "$IPV6TO4INIT" = "yes" ]; then
fi
else
net_log $"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 1b29afeb..1b29afeb 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 bcca632e..7b68ce5b 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -6,7 +6,7 @@
cd /etc/sysconfig/network-scripts
. ./network-functions
-[ -f ../network ] && . ../network
+[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
unset REALDEVICE
if [ "$1" = --realdevice ] ; then
@@ -144,6 +144,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-sit b/sysconfig/network-scripts/ifup-sit
index 3daa3801..d29bb4d1 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
net_log $"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
net_log $"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
net_log $"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 5a1df54c..f4b9bcbc 100755
--- a/sysconfig/network-scripts/ifup-tunnel
+++ b/sysconfig/network-scripts/ifup-tunnel
@@ -61,6 +61,7 @@ esac
# Generic tunnel devices are not supported here
if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 -o "$DEVICE" = ip6tnl0 ]; then
net_log $"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 702b6199..5fdceadf 100755..100644
--- a/sysconfig/network-scripts/ifup-wireless
+++ b/sysconfig/network-scripts/ifup-wireless
@@ -15,48 +15,181 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
#
-# Configure wireless network device options. See iw(8) for more info.
+# Configure wireless network device options. See iwconfig(8) for more info.
+# Mageia prefixes the following variables with WIRELESS_ prefix.
# Valid variables:
# MODE: Ad-Hoc, Managed, etc.
# ESSID: Name of the wireless network
+# NWID: Name of this machine on the network. Hostname is default
# FREQ: Frequency to operate on. See CHANNEL
+# 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.
+# RTS: Explicit RTS handshake. Usually not specified (auto)
+# FRAG: Fragmentation threshold to split packets. Usually not specified.
+# IWCONFIG: Extra parameters to pass directly to IWCONFIG
+# 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.
-cd /etc/sysconfig/network-scripts
-. ./network-functions
+# unify variables common to RH and Mageia-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}
-IW=${IW:-iw}
+# 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
-[ "$KEY" ] && KEYS="key d:0:$KEY"
+# Set link up (some cards require this.)
+/sbin/ip link set dev ${DEVICE} up
-shopt -s nocasematch
+# 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
-case "$MODE" in
-managed)
- if [ "$ESSID" ]; then
- $IW dev "$DEVICE" set type managed
- $IW dev "$DEVICE" connect -w "$ESSID" $FREQ $KEYS
- fi
- ;;
-ad-hoc)
- if [ -n "$ESSID" -a -n "$FREQ" ]; then
- $IW dev "$DEVICE" set type ibss
- $IW dev "$DEVICE" ibss join "$ESSID" "$FREQ" $KEYS
- fi
- ;;
-monitor)
- if [ "$FREQ" ]; then
- $IW dev "$DEVICE" set type monitor
- $IW dev "$DEVICE" set freq "$FREQ"
+# 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
+ [ -n "$KEY3" ] && iwconfig $DEVICE key "[3]" $KEY3
+ [ -n "$KEY4" ] && iwconfig $DEVICE key "[4]" $KEY4
+ [ -n "$DEFAULTKEY" ] && iwconfig $DEVICE key "[${DEFAULTKEY}]"
+ [ -n "$KEY" ] && iwconfig $DEVICE key $KEY
+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
- ;;
-esac
+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
+
+# More specific parameters passed directly to IWCONFIG
+if [ -n "$IWCONFIG" ] ; then
+ iwconfig $DEVICE $IWCONFIG
+fi
+
+# iwspy settings
+if [ -n "$SPYIPS" ] ; then
+ for IP in $SPYIPS; do
+ iwspy $DEVICE + $IP
+ done
+fi
+if [ -n "$IWSPY" ] ; then
+ /sbin/iwspy $DEVICE $IWSPY
+fi
+
+# private options
+if [ -n "$IWPRIV" ] ; then
+ IFS=$'\n' echo "$IWPRIV" | while read priv; do
+ [ -n -n "$priv" ] && eval "/sbin/iwpriv $DEVICE $priv"
+ done
+fi
-if [ -n "$WOWLAN" ] ; then
- PHYDEVICE=$(phy_wireless_device $DEVICE)
- iw phy $PHYDEVICE wowlan enable ${WOWLAN}
+# ESSID need to be last : most device re-perform the scanning/discovery
+# when this is set, and things like encryption keys are better be
+# defined if we want to discover the right set of APs/nodes.
+if [ -n "$ESSID" ] ; then
+ iwconfig $DEVICE essid "$ESSID"
+else
+ # use any essid
+ iwconfig $DEVICE essid any >/dev/null 2>&1
fi
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 9d6f9366..d2a2de85 100644..100755
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -13,6 +13,8 @@ HOSTNAME="$(hostname)"
[ -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
@@ -306,19 +308,28 @@ is_nm_running ()
string:"org.freedesktop.NetworkManager" >/dev/null 2>&1
}
+is_nm_device_unavailable ()
+{
+ [ -x /usr/bin/nmcli ] && \
+ LANG=C LC_ALL=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:unavailable$"
+}
+
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_handling ()
{
- LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
+ [ -x /usr/bin/nmcli ] && \
+ LANG=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^\(${1}:connected\)\|\(${1}:connecting.*\)$"
}
is_nm_device_unmanaged ()
{
- LANG=C nmcli -t --fields GENERAL dev show "${1}" 2>/dev/null | awk -F ':' '/GENERAL.STATE/ { if ($2 == "unmanaged") exit 0 ; else exit 1; }'
+ [ -x /usr/bin/nmcli ] && \
+ LANG=C LC_ALL=C nmcli -t --fields GENERAL dev show "${1}" 2>/dev/null | awk -F ':' '/GENERAL.STATE/ { if ($2 == "unmanaged") exit 0 ; else exit 1; }'
}
# Sets $alias to the device module if $? != 0
@@ -456,6 +467,9 @@ 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 ()
@@ -470,7 +484,10 @@ check_device_down ()
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
@@ -646,14 +663,20 @@ 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"$'\n'$(/bin/grep -vF "$s" $1)
else
s=$(cat $1)
fi
+ else
+ return
+ fi
+ if [ -e "$RESOLVCONF_FLAGFILE" ]; then
+ echo "$s" | /sbin/resolvconf -a ${DEVICE}
+ else
+ (echo "$s" > /etc/resolv.conf) >/dev/null 2>&1;
fi
- (echo "$s" > /etc/resolv.conf) >/dev/null 2>&1;
r=$?
if [ $r -eq 0 ]; then
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 # reset the correct context
@@ -663,6 +686,16 @@ change_resolv_conf ()
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
+}
+
# Logging function
#
# Usage: net_log <message> <err|warning|info> <optional file/function name>