aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorPhil Dibowitz <phil@ipom.com>2016-10-05 17:14:08 +0200
committerLukáš Nykrýn <lnykryn@redhat.com>2016-10-12 14:30:08 +0200
commit5c603b1da767ad0075493ca02286312039dbe0dc (patch)
tree0fbc5df0c3a8b6a37731e0c03473c26c455130fd /sysconfig
parentc282b9ebefae10e5b39c404a16a4d2af39d956bf (diff)
downloadinitscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar
initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.gz
initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.bz2
initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.tar.xz
initscripts-5c603b1da767ad0075493ca02286312039dbe0dc.zip
[3/3] Remove tabs and fix spacing: ifup/ifdown scripts
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown10
-rwxr-xr-xsysconfig/network-scripts/ifdown-bnep34
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth158
-rwxr-xr-xsysconfig/network-scripts/ifdown-post38
-rwxr-xr-xsysconfig/network-scripts/ifdown-routes23
-rwxr-xr-xsysconfig/network-scripts/ifdown-sit8
-rwxr-xr-xsysconfig/network-scripts/ifup94
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases488
-rwxr-xr-xsysconfig/network-scripts/ifup-bnep46
-rwxr-xr-xsysconfig/network-scripts/ifup-ctc25
-rwxr-xr-xsysconfig/network-scripts/ifup-eth295
-rwxr-xr-xsysconfig/network-scripts/ifup-ippp64
-rwxr-xr-xsysconfig/network-scripts/ifup-plip13
-rwxr-xr-xsysconfig/network-scripts/ifup-plusb10
-rwxr-xr-xsysconfig/network-scripts/ifup-post132
-rwxr-xr-xsysconfig/network-scripts/ifup-routes41
-rwxr-xr-xsysconfig/network-scripts/ifup-sit32
-rwxr-xr-xsysconfig/network-scripts/ifup-tunnel38
-rwxr-xr-xsysconfig/network-scripts/ifup-wireless12
19 files changed, 782 insertions, 779 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 8cb82880..90b1c834 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -25,10 +25,10 @@ need_config "${CONFIG}"
if [ $UID != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- source_config
- if /usr/sbin/usernetctl ${CONFIG} report ; then
- exec /usr/sbin/usernetctl ${CONFIG} down
- fi
+ source_config
+ if /usr/sbin/usernetctl ${CONFIG} report ; then
+ exec /usr/sbin/usernetctl ${CONFIG} down
+ fi
fi
echo $"Users cannot control this device." >&2
exit 1
@@ -43,7 +43,7 @@ fi
if [ "$_use_nm" = "true" ]; then
if [ -n "$UUID" -a -z "$DEVICE" ]; then
- DEVICE=$(nmcli -t --fields uuid,device con show --active | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
+ DEVICE=$(nmcli -t --fields uuid,device con show --active | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
fi
if [ -n "$DEVICE" ] && ! is_nm_device_unmanaged "$DEVICE" ; then
if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | egrep -q "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
diff --git a/sysconfig/network-scripts/ifdown-bnep b/sysconfig/network-scripts/ifdown-bnep
index b8064fd8..f29b34b6 100755
--- a/sysconfig/network-scripts/ifdown-bnep
+++ b/sysconfig/network-scripts/ifdown-bnep
@@ -13,37 +13,37 @@ source_config
# On hotplug events, just bring the virtual device up as if it's normal Ethernet
if [ -n "$IN_HOTPLUG" ]; then
- exec /etc/sysconfig/network-scripts/ifdown-eth ${CONFIG} $2
+ exec /etc/sysconfig/network-scripts/ifdown-eth ${CONFIG} $2
fi
stop_panu()
{
- kill -TERM $(cat /var/run/pand-${DEVICE}.pid)
+ kill -TERM $(cat /var/run/pand-${DEVICE}.pid)
}
stop_nap()
{
- kill -TERM $(cat /var/run/pand-${DEVICE}.pid)
- /usr/bin/pand -K
+ kill -TERM $(cat /var/run/pand-${DEVICE}.pid)
+ /usr/bin/pand -K
}
stop_gn()
{
- :
+ :
}
case "$ROLE" in
- PANU)
- stop_panu
- ;;
- NAP)
- stop_nap
- ;;
- GN)
- stop_gn
- ;;
- *)
- echo Unknown BNEP mode :$ROLE
- ;;
+PANU)
+ stop_panu
+ ;;
+NAP)
+ stop_nap
+ ;;
+GN)
+ stop_gn
+ ;;
+*)
+ echo Unknown BNEP mode :$ROLE
+ ;;
esac
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth
index 9808ed67..ab3507c0 100755
--- a/sysconfig/network-scripts/ifdown-eth
+++ b/sysconfig/network-scripts/ifdown-eth
@@ -36,50 +36,50 @@ if [ -n "${TEAM_MASTER}" ] && [ ! "${DEVICETYPE}" = "TeamPort" ] && [ -x ./ifdow
fi
if [ "${SLAVE}" != "yes" -o -z "${MASTER}" ]; then
-if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then
- FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
- if [ -n "${FOUNDMACADDR}" -a "${FOUNDMACADDR}" != "${HWADDR}" ]; then
- NEWCONFIG=$(get_config_by_hwaddr ${FOUNDMACADDR})
- if [ -n "${NEWCONFIG}" ]; then
- eval $(LANG=C grep -F "DEVICE=" $NEWCONFIG)
- else
- net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
- exit 1
- fi
- if [ -n "${NEWCONFIG}" -a "${NEWCONFIG##*/}" != "${CONFIG##*/}" -a "${DEVICE}" = "${REALDEVICE}" ]; then
- exec /sbin/ifdown ${NEWCONFIG}
- else
- net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
- exit 1
- fi
+ if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then
+ FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
+ if [ -n "${FOUNDMACADDR}" -a "${FOUNDMACADDR}" != "${HWADDR}" ]; then
+ NEWCONFIG=$(get_config_by_hwaddr ${FOUNDMACADDR})
+ if [ -n "${NEWCONFIG}" ]; then
+ eval $(LANG=C grep -F "DEVICE=" $NEWCONFIG)
+ else
+ net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
+ exit 1
+ fi
+ if [ -n "${NEWCONFIG}" -a "${NEWCONFIG##*/}" != "${CONFIG##*/}" -a "${DEVICE}" = "${REALDEVICE}" ]; then
+ exec /sbin/ifdown ${NEWCONFIG}
+ else
+ net_log $"Device ${DEVICE} has MAC address ${FOUNDMACADDR}, instead of configured address ${HWADDR}. Ignoring."
+ exit 1
+ fi
+ fi
fi
fi
-fi
if is_bonding_device ${DEVICE} ; then
for device in $(LANG=C grep -l "^[[:space:]]*MASTER=['\"]\?${DEVICE}['\"]\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do
- is_ignored_file "$device" && continue
- /sbin/ifdown ${device##*/}
+ is_ignored_file "$device" && continue
+ /sbin/ifdown ${device##*/}
done
for arg in $BONDING_OPTS ; do
- key=${arg%%=*};
- [[ "${key}" != "arp_ip_target" ]] && continue
- value=${arg##*=};
- if [ "${value:0:1}" != "" ]; then
+ key=${arg%%=*};
+ [[ "${key}" != "arp_ip_target" ]] && continue
+ value=${arg##*=};
+ if [ "${value:0:1}" != "" ]; then
OLDIFS=$IFS;
IFS=',';
for arp_ip in $value; do
- if grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
+ if grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
echo "-$arp_ip" > /sys/class/net/${DEVICE}/bonding/arp_ip_target
- fi
+ fi
done
IFS=$OLDIFS;
- else
- value=${value#+};
- if grep -q $value /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
+ else
+ value=${value#+};
+ if grep -q $value /sys/class/net/${DEVICE}/bonding/arp_ip_target; then
echo "-$value" > /sys/class/net/${DEVICE}/bonding/arp_ip_target
- fi
- fi
+ fi
+ fi
done
fi
@@ -87,66 +87,66 @@ 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)
- generate_lease_file_name $VER
- if [[ "$DHCPRELEASE" = [yY1]* ]]; then
- /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${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
- done
-}
+for VER in "" 6 ; do
+ if [ -f "/var/run/dhclient$VER-${DEVICE}.pid" ]; then
+ dhcpid=$(cat /var/run/dhclient$VER-${DEVICE}.pid)
+ generate_lease_file_name $VER
+ if [[ "$DHCPRELEASE" = [yY1]* ]]; then
+ /sbin/dhclient -r -lf ${LEASEFILE} -pf /var/run/dhclient$VER-${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
+done
+}
# 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
# instance instead.
if [ -d "/sys/class/net/${REALDEVICE}" ]; then
- LABEL=
- if [ "${REALDEVICE}" != "${DEVICE}" ]; then
- LABEL="label ${DEVICE}"
- fi
- if [ "${REALDEVICE}" = "lo" ]; then
- ip addr flush dev ${REALDEVICE} ${LABEL} scope host 2>/dev/null
- else
- ip addr flush dev ${REALDEVICE} ${LABEL} scope global 2>/dev/null
- ip -4 addr flush dev ${REALDEVICE} ${LABEL} scope host 2>/dev/null
- fi
-
- if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then
- echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
- fi
-
- if [ "${REALDEVICE}" = "${DEVICE}" ]; then
- ip link set dev ${DEVICE} down 2>/dev/null
- fi
+ LABEL=
+ if [ "${REALDEVICE}" != "${DEVICE}" ]; then
+ LABEL="label ${DEVICE}"
+ fi
+ if [ "${REALDEVICE}" = "lo" ]; then
+ ip addr flush dev ${REALDEVICE} ${LABEL} scope host 2>/dev/null
+ else
+ ip addr flush dev ${REALDEVICE} ${LABEL} scope global 2>/dev/null
+ ip -4 addr flush dev ${REALDEVICE} ${LABEL} scope host 2>/dev/null
+ fi
+
+ if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then
+ echo "-${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
+ fi
+
+ if [ "${REALDEVICE}" = "${DEVICE}" ]; then
+ ip link set dev ${DEVICE} down 2>/dev/null
+ fi
fi
[ "$retcode" = "0" ] && retcode=$?
if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
- /sbin/ip link set dev ${DEVICE} down
- /usr/sbin/brctl delif -- ${BRIDGE} ${DEVICE}
- # Upon removing a device from a bridge,
- # it's necessary to make radvd reload its config
- [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
- if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then
- /usr/sbin/brctl delbr -- ${BRIDGE}
- fi
+ /sbin/ip link set dev ${DEVICE} down
+ /usr/sbin/brctl delif -- ${BRIDGE} ${DEVICE}
+ # Upon removing a device from a bridge,
+ # it's necessary to make radvd reload its config
+ [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
+ if [ -d /sys/class/net/${BRIDGE}/brif ] && [ $(ls -1 /sys/class/net/${BRIDGE}/brif | wc -l) -eq 0 ]; then
+ /usr/sbin/brctl delbr -- ${BRIDGE}
+ fi
fi
if [ "${TYPE}" = "Tap" ]; then
- TUNMODE="mode tap"
- [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
- ip tuntap del ${TUNMODE} dev ${DEVICE} >/dev/null
+ TUNMODE="mode tap"
+ [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
+ ip tuntap del ${TUNMODE} dev ${DEVICE} >/dev/null
fi
if [ -n "${TEAM_CONFIG}" ] && [ ! "${DEVICETYPE}" = "Team" ] && [ -x ./ifdown-Team ]; then
@@ -174,7 +174,7 @@ fi
if [ -n "$VLAN" ]; then
# 802.1q VLAN
if [ -f /proc/net/vlan/${DEVICE} ]; then
- ip link delete ${DEVICE} type vlan
+ ip link delete ${DEVICE} type vlan
fi
fi
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index 0f2285fc..8b56e14f 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -19,32 +19,34 @@ source_config
/etc/sysconfig/network-scripts/ifdown-routes ${REALDEVICE} ${DEVNAME}
if [ "$PEERDNS" != "no" -o -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ] && \
- [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" -o -n "${DNS1}" -o "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ] ; then
- if [ -f /etc/resolv.conf.save ]; then
- change_resolv_conf /etc/resolv.conf.save
- rm -f /etc/resolv.conf.save
- fi
- if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
- if [ -f /etc/ppp/peers/$DEVICE ] ; then
- rm -f /etc/ppp/peers/$DEVICE
- fi
+ [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" -o -n "${DNS1}" \
+ -o "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ] ; then
+if [ -f /etc/resolv.conf.save ]; then
+ change_resolv_conf /etc/resolv.conf.save
+ rm -f /etc/resolv.conf.save
+fi
+if [ "${DEVICETYPE}" = "ppp" -o "${DEVICETYPE}" = "ippp" ]; then
+ if [ -f /etc/ppp/peers/$DEVICE ] ; then
+ rm -f /etc/ppp/peers/$DEVICE
fi
fi
+fi
# Reset the default route if this interface had a special one
if ! check_default_route ; then
# ISDN device needs special handling dial on demand
- if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && [ "$DIALMODE" = "auto" ] ; then
- if [ -z "$GATEWAY" ] ; then
- /sbin/ip route add default ${METRIC:+metric} \
- ${WINDOW:+window $WINDOW} dev ${DEVICE}
- else
- /sbin/ip route add default ${METRIC:+metric} \
- ${WINDOW:+window $WINDOW} via ${GATEWAY}
- fi
+ if [ "${DEVICETYPE}" = "ippp" -o "${DEVICETYPE}" = "isdn" ] && \
+ [ "$DIALMODE" = "auto" ] ; then
+ if [ -z "$GATEWAY" ] ; then
+ /sbin/ip route add default ${METRIC:+metric} \
+ ${WINDOW:+window $WINDOW} dev ${DEVICE}
else
- add_default_route ${DEVICE}
+ /sbin/ip route add default ${METRIC:+metric} \
+ ${WINDOW:+window $WINDOW} via ${GATEWAY}
fi
+else
+ add_default_route ${DEVICE}
+fi
fi
# Inform firewall
diff --git a/sysconfig/network-scripts/ifdown-routes b/sysconfig/network-scripts/ifdown-routes
index 0109404f..1d1549dc 100755
--- a/sysconfig/network-scripts/ifdown-routes
+++ b/sysconfig/network-scripts/ifdown-routes
@@ -1,6 +1,7 @@
#! /bin/bash
#
# Drops static routes which go through device $1
+
if [ -z "$1" ]; then
echo $"usage: ifdown-routes <net-device> [<nickname>]"
exit 1
@@ -18,15 +19,15 @@ if [ -n "$2" -a "$2" != "$1" ]; then
fi
for file in $FILES; do
- if [ -f "$file" ]; then
- proto=
- if [ "$file" != "${file##*/rule6-}" ]; then
- proto="-6"
- fi
- { cat "$file" ; echo ; } | while read line; do
- if [[ ! "$line" =~ $MATCH ]]; then
- /sbin/ip $proto rule del $line
- fi
- done
- fi
+ if [ -f "$file" ]; then
+ proto=
+ if [ "$file" != "${file##*/rule6-}" ]; then
+ proto="-6"
+ fi
+ { cat "$file" ; echo ; } | while read line; do
+ if [[ ! "$line" =~ $MATCH ]]; then
+ /sbin/ip $proto rule del $line
+ fi
+ done
+ fi
done
diff --git a/sysconfig/network-scripts/ifdown-sit b/sysconfig/network-scripts/ifdown-sit
index e4d07345..37d100e6 100755
--- a/sysconfig/network-scripts/ifdown-sit
+++ b/sysconfig/network-scripts/ifdown-sit
@@ -37,8 +37,8 @@ REALDEVICE=${DEVICE%%:*}
# 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"
- exit 1
+ net_log $"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and restart (IPv6) networking"
+ exit 1
fi
# IPv6 test, no module loaded, exit if system is not IPv6-ready
@@ -47,8 +47,8 @@ ipv6_test testonly || exit 0
# Test device status
ipv6_test_device_status $DEVICE
if [ $? != 0 -a $? != 11 ]; then
- # device doesn't exist or other problem occurs
- exit 0
+ # device doesn't exist or other problem occurs
+ exit 0
fi
# Cleanup additional static routes
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index f1678eb3..e06fafb9 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -41,10 +41,10 @@ need_config "${CONFIG}"
if [ ${UID} != 0 ]; then
if [ -x /usr/sbin/usernetctl ]; then
- source_config
- if /usr/sbin/usernetctl ${CONFIG} report ; then
- exec /usr/sbin/usernetctl ${CONFIG} up
- fi
+ source_config
+ if /usr/sbin/usernetctl ${CONFIG} report ; then
+ exec /usr/sbin/usernetctl ${CONFIG} up
+ fi
fi
echo $"Users cannot control this device." >&2
exit 1
@@ -89,56 +89,56 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n "$DEVICE" ]; then
PHYSDEV=${DEVICE%.*}
fi
MATCH='^vlan[0-9]{1,4}?'
- if [[ "${DEVICE}" =~ $MATCH ]]; then
- VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
- # PHYSDEV should be set in ifcfg-vlan* file
- if test -z "$PHYSDEV"; then
+ if [[ "${DEVICE}" =~ $MATCH ]]; then
+ VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//')
+ # PHYSDEV should be set in ifcfg-vlan* file
+ if test -z "$PHYSDEV"; then
net_log $"PHYSDEV should be set for device ${DEVICE}"
exit 1
- fi
+ fi
fi
fi
if [ -n "$VID" ]; then
- if [ ! -d /proc/net/vlan ]; then
+ if [ ! -d /proc/net/vlan ]; then
if ! modprobe 8021q >/dev/null 2>&1 ; then
- net_log $"No 802.1Q VLAN support available in kernel for device ${DEVICE}"
- exit 1
- fi
- fi
-
- is_available_wait ${PHYSDEV} ${DEVTIMEOUT} || {
- if [ "$?" = "1" ] ; then
- net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
- exit 1
- else
- exit 0
- fi
- }
-
- # Link on Physical device needs to be up but no ip required
- check_device_down ${PHYSDEV} && {
- ip -o link set dev ${PHYSDEV} up
- }
-
- if [ ! -f /proc/net/vlan/${DEVICE} ]; then
- if [ "${REORDER_HDR}" = "no" -o "${REORDER_HDR}" = "0" ]; then
- FLAG_REORDER_HDR="reorder_hdr off"
- fi
-
- if [ "${GVRP}" = "yes" -o "${GVRP}" = "1" ]; then
- FLAG_GVRP="gvrp on"
- fi
-
- ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID} ${FLAG_REORDER_HDR} ${FLAG_GVRP} || {
- (/usr/bin/logger -p daemon.info -t ifup \
- $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &)&
- net_log $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}"
- exit 1
- }
- fi
+ net_log $"No 802.1Q VLAN support available in kernel for device ${DEVICE}"
+ exit 1
+ fi
+ fi
+
+ is_available_wait ${PHYSDEV} ${DEVTIMEOUT} || {
+ if [ "$?" = "1" ] ; then
+ net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
+ exit 1
+ else
+ exit 0
+ fi
+ }
+
+ # Link on Physical device needs to be up but no ip required
+ check_device_down ${PHYSDEV} && { ip -o link set dev ${PHYSDEV} up; }
+
+ if [ ! -f /proc/net/vlan/${DEVICE} ]; then
+ if [ "${REORDER_HDR}" = "no" -o "${REORDER_HDR}" = "0" ]; then
+ FLAG_REORDER_HDR="reorder_hdr off"
+ fi
+
+ if [ "${GVRP}" = "yes" -o "${GVRP}" = "1" ]; then
+ FLAG_GVRP="gvrp on"
+ fi
+
+ ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID} ${FLAG_REORDER_HDR} ${FLAG_GVRP} || {
+ (/usr/bin/logger -p daemon.info -t ifup \
+ $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &) &
+ net_log $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}"
+ exit 1
+ }
+ fi
fi
- /usr/lib/systemd/systemd-sysctl --prefix "/proc/sys/net/ipv4/conf/${DEVICE}" --prefix "/proc/sys/net/ipv6/conf/${DEVICE}"
+ /usr/lib/systemd/systemd-sysctl \
+ --prefix "/proc/sys/net/ipv4/conf/${DEVICE}" \
+ --prefix "/proc/sys/net/ipv6/conf/${DEVICE}"
fi
if [ "${BOOTPROTO}" = "bootp" -o "${BOOTPROTO}" = "dhcp" ]; then
@@ -160,5 +160,3 @@ if [ ! -x ${OTHERSCRIPT} ]; then
fi
exec ${OTHERSCRIPT} ${CONFIG} $2
-
-
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index 2989b8d9..50362143 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -64,8 +64,8 @@ TEXTDOMAINDIR=/etc/locale
device=$1
if [ "$device" = "" ]; then
- echo $"usage: ifup-aliases <net-device> [<parent-config>]\n"
- exit 1
+ echo $"usage: ifup-aliases <net-device> [<parent-config>]\n"
+ exit 1
fi
PARENTCONFIG=${2:-ifcfg-$device}
@@ -87,282 +87,286 @@ cd /etc/sysconfig/network-scripts
# A list of all the devices is created in rdev_LIST.
eval $( ip addr show $device label $device:* | \
- awk 'BEGIN { COUNT=0;LAST_DEV="" } /inet / {
-# Split IP address into address/prefix
- split($2,IPADDR,"/");
-# Create A_B_C_D IP address form
- IP_ADDR=IPADDR[1];
- gsub(/\./,"_",IP_ADDR);
-# Split device into device:index
- split($NF,DEV,":");
-# Update last device
- LAST_DEV=LAST_DEV " " DEV[2];
- printf("rdev_%s_addr=%s\nrdevip_%s=%s\nrdev_%s_pb=%s_%s\nrdev_LIST=\"%s\"\n",
- DEV[2],IPADDR[1],IP_ADDR,DEV[2],DEV[2],IPADDR[2],$4,LAST_DEV);
- } END {
- if(LAST_DEV == "") print "no_devices_are_up=yes"
- }' );
-
- #
- # Store configuration of the parent device and network
- #
+ awk 'BEGIN { COUNT=0;LAST_DEV="" } /inet / {
+ # Split IP address into address/prefix
+ split($2,IPADDR,"/");
+ # Create A_B_C_D IP address form
+ IP_ADDR=IPADDR[1];
+ gsub(/\./,"_",IP_ADDR);
+ # Split device into device:index
+ split($NF,DEV,":");
+ # Update last device
+ LAST_DEV=LAST_DEV " " DEV[2];
+ printf("rdev_%s_addr=%s\nrdevip_%s=%s\nrdev_%s_pb=%s_%s\nrdev_LIST=\"%s\"\n",
+ DEV[2],IPADDR[1],IP_ADDR,DEV[2],DEV[2],IPADDR[2],$4,LAST_DEV);
+ } END {
+ if(LAST_DEV == "") print "no_devices_are_up=yes"
+ }' );
+
+#
+# Store configuration of the parent device and network
+#
# read from the /etc/sysconfig/network
eval ` (
- . /etc/sysconfig/network;
- echo network_GATEWAY=$GATEWAY\;;
- echo network_GATEWAYDEV=$GATEWAYDEV\;;
+ . /etc/sysconfig/network;
+ echo network_GATEWAY=$GATEWAY\;;
+ echo network_GATEWAYDEV=$GATEWAYDEV\;;
) `
# read defaults from the parent config file
[ -f $PARENTCONFIG ] || {
- net_log $"Missing config file $PARENTCONFIG."
- exit 1
+ net_log $"Missing config file $PARENTCONFIG."
+ exit 1
}
eval ` (
- . ./$PARENTCONFIG;
- echo default_PREFIX=$PREFIX\;;
- echo default_NETMASK=$NETMASK\;;
- echo default_BROADCAST=$BROADCAST\;;
- echo default_GATEWAY=$GATEWAY\;;
- echo default_NO_ALIASROUTING=$NO_ALIASROUTING\;;
- echo default_ARPCHECK=$ARPCHECK\;;
+ . ./$PARENTCONFIG;
+ echo default_PREFIX=$PREFIX\;;
+ echo default_NETMASK=$NETMASK\;;
+ echo default_BROADCAST=$BROADCAST\;;
+ echo default_GATEWAY=$GATEWAY\;;
+ echo default_NO_ALIASROUTING=$NO_ALIASROUTING\;;
+ echo default_ARPCHECK=$ARPCHECK\;;
) `
[ -z "$default_GATEWAY" ] && default_GATEWAY=$network_GATEWAY
function ini_env ()
{
- DEVICE=""
- IPADDR=""
- IPV6ADDR=""
- PREFIX=$default_PREFIX
- NETMASK=$default_NETMASK
- BROADCAST=$default_BROADCAST
- GATEWAY=$default_GATEWAY
- NO_ALIASROUTING=$default_NO_ALIASROUTING
- ONPARENT=""
- ARPCHECK=$default_ARPCHECK
+ DEVICE=""
+ IPADDR=""
+ IPV6ADDR=""
+ PREFIX=$default_PREFIX
+ NETMASK=$default_NETMASK
+ BROADCAST=$default_BROADCAST
+ GATEWAY=$default_GATEWAY
+ NO_ALIASROUTING=$default_NO_ALIASROUTING
+ ONPARENT=""
+ ARPCHECK=$default_ARPCHECK
}
function is_default_gateway ()
{
- LC_ALL=C /sbin/ip route ls default scope global \
- | awk '$3 == "'"$1"'" { found = 1; } END { exit found == 0; }'
+ LC_ALL=C /sbin/ip route ls default scope global \
+ | awk '$3 == "'"$1"'" { found = 1; } END { exit found == 0; }'
}
- #
- # Read the alias configuration files and enable each aliased
- # device using new_interface()
- #
+#
+# Read the alias configuration files and enable each aliased
+# device using new_interface()
+#
function new_interface ()
{
- ipa=$IPADDR; ipb=${ipa#*.}; ipc=${ipb#*.};
- IPGLOP="${ipa%%.*}_${ipb%%.*}_${ipc%%.*}_${ipc#*.}";
- DEVNUM=${DEVICE#*:}
-
- MATCH='^[0-9A-Za-z_]*$'
- if (LC_ALL=C; [[ ! "$DEVNUM" =~ $MATCH ]]); then
- net_log $"error in $FILE: invalid alias number"
- return 1
- fi
-
- eval "
- ipseen=\$ipseen_${IPGLOP}; devseen=\$devseen_${DEVNUM};
- ipseen_${IPGLOP}=$FILE; devseen_${DEVNUM}=$FILE;
- ";
-
- if [ -n "$ipseen" ]; then
- net_log $"error in $FILE: already seen ipaddr $IPADDR in $ipseen"
- return 1
- fi
-
- if [ -n "$devseen" ]; then
- net_log $"error in $FILE: already seen device $parent_device:$DEVNUM in $devseen"
- return 1
- fi
-
- if [ -z "$DEVICE" -o -z "$IPADDR" ]; then
- if [ -n "$IPV6ADDR" -a -n "$DEVICE" ] && [[ "$IPV6INIT" != [nN0]* ]]; then
- /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
- return $?
- fi
- net_log $"error in $FILE: didn't specify device or ipaddr"
- return 1
- fi
-
- if [ -z "$NETMASK" -a -z "$PREFIX" ]; then
- net_log $"error iN $FILE: didn't specify netmask or prefix"
- fi
-
- if [ -z "$PREFIX" ]; then
- eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
- fi
-
- if [ -z "$BROADCAST" -o "$BROADCAST" = "$default_BROADCAST" ]; then
- eval $(/bin/ipcalc --broadcast ${IPADDR}/${PREFIX})
- fi
-
- if [ "$no_devices_are_up" = "yes" ]; then
- setup_this=yes
- else
-
- setup_this=""
-
- eval "
- rdev_addr=\$rdev_${DEVNUM}_addr;
- rdev_pb=\$rdev_${DEVNUM}_pb;
- rdev_mark=\$rdev_${DEVNUM}_mark;
- rdevip=\$rdevip_${IPGLOP};
- ";
-
- if [ -n "$rdev_addr" ]; then
- if [ "$rdev_addr" = "${IPADDR}" ]; then
- newmark=keep
- if [ "$rdev_pb" != "${PREFIX}_${BROADCAST}" ]; then
- setup_this=freshen
- else
- setup_this=no
- fi
- else
- if [ "$rdev_mark" != "remove" ]; then
- /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM}
- do_netreport=yes
- fi
- newmark=remove
- setup_this=yes
- fi
- if [ -n "$rdev_mark" -a "$rdev_mark" != "$newmark" ]; then
- net_log $"error in ifcfg-${parent_device}: files"
- return 1
- fi
- eval " rdev_${DEVNUM}_mark=\$newmark ";
- else
- setup_this=yes
- fi
-
- if [ -n "$rdevip" -a "$rdevip" != "${DEVNUM}" ]; then
- eval " mark_remove=\$rdev_${rdevip}_mark ";
- if [ -n "$mark_remove" -a "$mark_remove" != "remove" ]; then
- net_log $"error in ifcfg-${parent_device}: files"
- return 1
- fi
- if [ "$mark_remove" != "remove" ]; then
- eval " rdev_${rdevip}_mark=remove ";
- /sbin/ip addr flush dev $parent_device label $parent_device:$rdevip
- do_netreport=yes
- fi
- fi
-
- fi
-
- if [ "$setup_this" = "freshen" ] ; then
- # we can do the freshen stuff right now
- /sbin/ip addr change ${IPADDR}/${PREFIX} brd ${BROADCAST}
- fi
-
- if [ "$setup_this" = "yes" ] ; then
- if [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \
- is_available ${parent_device} && \
- ( grep -qswi "up" /sys/class/net/${parent_device}/operstate || grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then
- echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..."
- /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR}
- if [ $? = 1 ]; then
- net_log $"Error, some other host already uses address ${IPADDR}."
- return 1
- fi
- fi
-
- /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE}
-
- [[ "$IPV6INIT" != [nN0]* ]] && /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
-
- if [ "$NO_ALIASROUTING" != yes ]; then
-
- GATEWAYDEV=$network_GATEWAYDEV;
-
- if [ -n "${GATEWAY}" -a \
- \( -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" \) ]; then
- # set up default gateway, if it isn't already there
- if ! is_default_gateway "$GATEWAY"; then
- ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE}
- fi
- fi
-
- /etc/sysconfig/network-scripts/ifup-routes ${DEVICE} ${NAME}
-
- do_netreport=yes
- ifuplocal_queue="$ifuplocal_queue $DEVICE"
-
- fi
-
- fi
-
+ ipa=$IPADDR; ipb=${ipa#*.}; ipc=${ipb#*.};
+ IPGLOP="${ipa%%.*}_${ipb%%.*}_${ipc%%.*}_${ipc#*.}";
+ DEVNUM=${DEVICE#*:}
+
+ MATCH='^[0-9A-Za-z_]*$'
+ if (LC_ALL=C; [[ ! "$DEVNUM" =~ $MATCH ]]); then
+ net_log $"error in $FILE: invalid alias number"
+ return 1
+ fi
+
+ eval "
+ ipseen=\$ipseen_${IPGLOP}; devseen=\$devseen_${DEVNUM};
+ ipseen_${IPGLOP}=$FILE; devseen_${DEVNUM}=$FILE;
+ ";
+
+ if [ -n "$ipseen" ]; then
+ net_log $"error in $FILE: already seen ipaddr $IPADDR in $ipseen"
+ return 1
+ fi
+
+ if [ -n "$devseen" ]; then
+ net_log $"error in $FILE: already seen device $parent_device:$DEVNUM in $devseen"
+ return 1
+ fi
+
+ if [ -z "$DEVICE" -o -z "$IPADDR" ]; then
+ if [ -n "$IPV6ADDR" -a -n "$DEVICE" ] && [[ "$IPV6INIT" != [nN0]* ]]; then
+ /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
+ return $?
+ fi
+ net_log $"error in $FILE: didn't specify device or ipaddr"
+ return 1
+ fi
+
+ if [ -z "$NETMASK" -a -z "$PREFIX" ]; then
+ net_log $"error iN $FILE: didn't specify netmask or prefix"
+ fi
+
+ if [ -z "$PREFIX" ]; then
+ eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
+ fi
+
+ if [ -z "$BROADCAST" -o "$BROADCAST" = "$default_BROADCAST" ]; then
+ eval $(/bin/ipcalc --broadcast ${IPADDR}/${PREFIX})
+ fi
+
+ if [ "$no_devices_are_up" = "yes" ]; then
+ setup_this=yes
+ else
+
+ setup_this=""
+
+ eval "
+ rdev_addr=\$rdev_${DEVNUM}_addr;
+ rdev_pb=\$rdev_${DEVNUM}_pb;
+ rdev_mark=\$rdev_${DEVNUM}_mark;
+ rdevip=\$rdevip_${IPGLOP};
+ ";
+
+ if [ -n "$rdev_addr" ]; then
+ if [ "$rdev_addr" = "${IPADDR}" ]; then
+ newmark=keep
+ if [ "$rdev_pb" != "${PREFIX}_${BROADCAST}" ]; then
+ setup_this=freshen
+ else
+ setup_this=no
+ fi
+ else
+ if [ "$rdev_mark" != "remove" ]; then
+ /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM}
+ do_netreport=yes
+ fi
+ newmark=remove
+ setup_this=yes
+ fi
+ if [ -n "$rdev_mark" -a "$rdev_mark" != "$newmark" ]; then
+ net_log $"error in ifcfg-${parent_device}: files"
+ return 1
+ fi
+ eval " rdev_${DEVNUM}_mark=\$newmark ";
+ else
+ setup_this=yes
+ fi
+
+ if [ -n "$rdevip" -a "$rdevip" != "${DEVNUM}" ]; then
+ eval " mark_remove=\$rdev_${rdevip}_mark ";
+ if [ -n "$mark_remove" -a "$mark_remove" != "remove" ]; then
+ net_log $"error in ifcfg-${parent_device}: files"
+ return 1
+ fi
+ if [ "$mark_remove" != "remove" ]; then
+ eval " rdev_${rdevip}_mark=remove ";
+ /sbin/ip addr flush dev $parent_device label $parent_device:$rdevip
+ do_netreport=yes
+ fi
+ fi
+
+ fi
+
+ if [ "$setup_this" = "freshen" ] ; then
+ # we can do the freshen stuff right now
+ /sbin/ip addr change ${IPADDR}/${PREFIX} brd ${BROADCAST}
+ fi
+
+ if [ "$setup_this" = "yes" ] ; then
+ if [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \
+ is_available ${parent_device} && \
+ ( grep -qswi "up" /sys/class/net/${parent_device}/operstate || grep -qswi "1" /sys/class/net/${parent_device}/carrier ) ; then
+ echo $"Determining if ip address ${IPADDR} is already in use for device ${parent_device}..."
+ /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR}
+ if [ $? = 1 ]; then
+ net_log $"Error, some other host already uses address ${IPADDR}."
+ return 1
+ fi
+ fi
+
+ /sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} \
+ dev ${parent_device} label ${DEVICE}
+
+ [[ "$IPV6INIT" != [nN0]* ]] && \
+ /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
+
+ if [ "$NO_ALIASROUTING" != yes ]; then
+
+ GATEWAYDEV=$network_GATEWAYDEV;
+
+ if [ -n "${GATEWAY}" -a \
+ \( -z "${GATEWAYDEV}" -o "${GATEWAYDEV}" = "${DEVICE}" \) ]; then
+ # set up default gateway, if it isn't already there
+ if ! is_default_gateway "$GATEWAY"; then
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY} dev ${DEVICE}
+ fi
+ fi
+
+ /etc/sysconfig/network-scripts/ifup-routes ${DEVICE} ${NAME}
+
+ do_netreport=yes
+ ifuplocal_queue="$ifuplocal_queue $DEVICE"
+ fi
+ fi
}
-if [ "$BASH_VERSINFO" ]; then shopt -s nullglob; else allow_null_glob_expansion=foo; fi
+if [ "$BASH_VERSINFO" ]; then
+ shopt -s nullglob
+else
+ allow_null_glob_expansion=foo
+fi
for FILE in ifcfg-${parent_device}:* ; do
- is_ignored_file "$FILE" && continue
- ini_env;
- . ./$FILE;
- [ -z "$DEVICE" ] && DEVICE=${FILE##ifcfg-}
- [ "$ONPARENT" != "no" -a "$ONPARENT" != "NO" ] && new_interface;
- unset DEVICE
+ is_ignored_file "$FILE" && continue
+ ini_env
+ . ./$FILE
+ [ -z "$DEVICE" ] && DEVICE=${FILE##ifcfg-}
+ [ "$ONPARENT" != "no" -a "$ONPARENT" != "NO" ] && new_interface
+ unset DEVICE
done
for FILE in ifcfg-${parent_device}-range* ; do
- is_ignored_file "$FILE" && continue
- ini_env;
- . ./$FILE;
-
- ipaddr_prefix=${IPADDR_START%.*}
- ipaddr_startnum=${IPADDR_START##*.}
- ipaddr_endnum=${IPADDR_END##*.}
-
- if [ "${IPADDR_START%.*}" != "${IPADDR_END%.*}" ]; then
- net_log $"error in $FILE: IPADDR_START and IPADDR_END don't agree"; continue
- fi
-
- if [ $ipaddr_startnum -gt $ipaddr_endnum ]; then
- net_log $"error in $FILE: IPADDR_START greater than IPADDR_END"; continue
- fi
-
- ipaddr_num=$ipaddr_startnum
- ipaddr_clonenum=$CLONENUM_START
-
- while [ $ipaddr_num -le $ipaddr_endnum ]; do
- IPADDR="$ipaddr_prefix.$ipaddr_num"
- DEVICE="$parent_device:$ipaddr_clonenum"
- IPV6INIT="no"
- [ "$ONPARENT" != "no" -a "$ONPARENT" != "NO" ] && new_interface;
- ipaddr_num=$(($ipaddr_num+1))
- ipaddr_clonenum=$(($ipaddr_clonenum+1))
- done
-
+ is_ignored_file "$FILE" && continue
+ ini_env
+ . ./$FILE
+
+ ipaddr_prefix=${IPADDR_START%.*}
+ ipaddr_startnum=${IPADDR_START##*.}
+ ipaddr_endnum=${IPADDR_END##*.}
+
+ if [ "${IPADDR_START%.*}" != "${IPADDR_END%.*}" ]; then
+ net_log $"error in $FILE: IPADDR_START and IPADDR_END don't agree"
+ continue
+ fi
+
+ if [ $ipaddr_startnum -gt $ipaddr_endnum ]; then
+ net_log $"error in $FILE: IPADDR_START greater than IPADDR_END"
+ continue
+ fi
+
+ ipaddr_num=$ipaddr_startnum
+ ipaddr_clonenum=$CLONENUM_START
+
+ while [ $ipaddr_num -le $ipaddr_endnum ]; do
+ IPADDR="$ipaddr_prefix.$ipaddr_num"
+ DEVICE="$parent_device:$ipaddr_clonenum"
+ IPV6INIT="no"
+ [ "$ONPARENT" != "no" -a "$ONPARENT" != "NO" ] && new_interface
+ ipaddr_num=$(($ipaddr_num+1))
+ ipaddr_clonenum=$(($ipaddr_clonenum+1))
+ done
done
- #
- # Remove any devices that should not be around
- #
- for DEVNUM in $rdev_LIST ; do
- eval " rdev_mark=\$rdev_${DEVNUM}_mark ";
- if [ -z "$rdev_mark" ]; then
- /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM}
- do_netreport=yes
- fi
- done
- #
- # Notify of new device creation
- #
+#
+# Remove any devices that should not be around
+#
+for DEVNUM in $rdev_LIST ; do
+ eval " rdev_mark=\$rdev_${DEVNUM}_mark "
+ if [ -z "$rdev_mark" ]; then
+ /sbin/ip addr flush dev $parent_device label $parent_device:${DEVNUM}
+ do_netreport=yes
+ fi
+done
+#
+# Notify of new device creation
+#
if [ -n "$do_netreport" ]; then
- do_netreport
+ do_netreport
fi
if [ -x /sbin/ifup-local ]; then
- for DEVICE in $ifuplocal_queue ; do
- /sbin/ifup-local ${DEVICE}
- done
+ for DEVICE in $ifuplocal_queue ; do
+ /sbin/ifup-local ${DEVICE}
+ done
fi
diff --git a/sysconfig/network-scripts/ifup-bnep b/sysconfig/network-scripts/ifup-bnep
index 5aff2777..bc696625 100755
--- a/sysconfig/network-scripts/ifup-bnep
+++ b/sysconfig/network-scripts/ifup-bnep
@@ -13,43 +13,43 @@ source_config
# On hotplug events, just bring the virtual device up as if it's normal Ethernet
if [ -n "$IN_HOTPLUG" ]; then
- exec sh -x /etc/sysconfig/network-scripts/ifup-eth ${CONFIG} $2
+ exec sh -x /etc/sysconfig/network-scripts/ifup-eth ${CONFIG} $2
fi
start_panu()
{
- PANDARGS="--persist --pidfile=/var/run/pand-${DEVICE}.pid --ethernet=${DEVICE} --autozap"
- [ "${CACHE}" != "no" -a "${CACHE}" != "NO" ] && PANDARGS="${PANDARGS} --cache"
- if [ "${REMOTEBDADDR}" = "" ]; then
- PANDARGS="${PANDARGS} --search"
- else
- PANDARGS="${PANDARGS} --connect ${REMOTEBDADDR}"
- fi
- /usr/bin/pand ${PANDARGS}
+ PANDARGS="--persist --pidfile=/var/run/pand-${DEVICE}.pid --ethernet=${DEVICE} --autozap"
+ [ "${CACHE}" != "no" -a "${CACHE}" != "NO" ] && PANDARGS="${PANDARGS} --cache"
+ if [ "${REMOTEBDADDR}" = "" ]; then
+ PANDARGS="${PANDARGS} --search"
+ else
+ PANDARGS="${PANDARGS} --connect ${REMOTEBDADDR}"
+ fi
+ /usr/bin/pand ${PANDARGS}
}
start_nap()
{
- :
+ :
}
start_gn()
{
- :
+ :
}
case "$ROLE" in
- PANU)
- start_panu
- ;;
- NAP)
- start_nap
- ;;
- GN)
- start_gn
- ;;
- *)
- echo Unknown BNEP mode :$ROLE
- ;;
+PANU)
+ start_panu
+ ;;
+NAP)
+ start_nap
+ ;;
+GN)
+ start_gn
+ ;;
+*)
+ echo Unknown BNEP mode :$ROLE
+ ;;
esac
diff --git a/sysconfig/network-scripts/ifup-ctc b/sysconfig/network-scripts/ifup-ctc
index 39d6a09c..83f754a0 100755
--- a/sysconfig/network-scripts/ifup-ctc
+++ b/sysconfig/network-scripts/ifup-ctc
@@ -19,9 +19,8 @@ CONFIG=$1
[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
source_config
-if [ "$2" = "boot" -a "${ONBOOT}" = "no" ]
-then
- exit
+if [ "$2" = "boot" -a "${ONBOOT}" = "no" ] ; then
+ exit
fi
[ -n "${MTU}" ] && ip link set dev ${DEVICE} mtu ${MTU}
@@ -32,22 +31,22 @@ ip link set up dev ${DEVICE}
# quite a while...
timeout=0
while ! ping -w 30 -c 1 ${GATEWAY} &>/dev/null; do
- timeout=$(($timeout + 1))
- if [ $timeout = 20 ]; then
- net_log $"ERROR: ${DEVICE} did not come up!"
- break
- fi
+ timeout=$(($timeout + 1))
+ if [ $timeout = 20 ]; then
+ net_log $"ERROR: ${DEVICE} did not come up!"
+ break
+ fi
done
if [ "${NETWORK}" != "" ] ; then
- ip route add to ${GATEWAY} metric 1 dev ${DEVICE}
+ ip route add to ${GATEWAY} metric 1 dev ${DEVICE}
fi
if [ "${GATEWAY}" != "" ]; then
- if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
- # set up default gateway
- ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
- fi
+ if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
+ # set up default gateway
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
+ fi
fi
/etc/sysconfig/network-scripts/ifup-post $1
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 5b71374e..eda3c457 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -40,49 +40,49 @@ is_available ${REALDEVICE}
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."
- exit 1
+ net_log $"Device ${DEVICE} has different MAC address than expected, ignoring."
+ exit 1
fi
fi
# If the device is a bridge, create it with brctl, if available.
if [ "${TYPE}" = "Bridge" ]; then
- if [ ! -x /usr/sbin/brctl ]; then
- net_log $"Bridge support not available: brctl not found"
- exit 1
- fi
- if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then
- /usr/sbin/brctl addbr -- ${DEVICE} || exit 1
- fi
- [ -n "${DELAY}" ] && /usr/sbin/brctl setfd -- ${DEVICE} ${DELAY}
- [ -n "${STP}" ] && /usr/sbin/brctl stp -- ${DEVICE} ${STP}
- [ -n "${PRIO}" ] && /usr/sbin/brctl setbridgeprio ${DEVICE} ${PRIO}
- [ -n "${AGEING}" ] && /usr/sbin/brctl setageing ${DEVICE} ${AGEING}
- # add the bits to setup driver parameters here
- for arg in $BRIDGING_OPTS ; do
- key=${arg%%=*};
- value=${arg##*=};
- if [ "${key}" != "multicast_router" -a "${key}" != "hash_max" -a "${key}" != "multicast_snooping" ]; then
- echo $value > /sys/class/net/${DEVICE}/bridge/$key
- fi
- done
- # set LINKDELAY (used as timeout when calling check_link_down())
- # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the
- # minimum time required for /sys/class/net/$REALDEVICE/carrier to
- # become 1 after "ip link set dev $DEVICE up" is called.
- if [ "${STP}" = "yes" -o "${STP}" = "on" ]; then
- TMPD=7
- [ -n "${DELAY}" ] && TMPD=$(expr ${DELAY} \* 2 + ${TMPD})
- [ 0$LINKDELAY -lt $TMPD ] && LINKDELAY=$TMPD
- fi
+ if [ ! -x /usr/sbin/brctl ]; then
+ net_log $"Bridge support not available: brctl not found"
+ exit 1
+ fi
+ if [ ! -d /sys/class/net/${DEVICE}/bridge ]; then
+ /usr/sbin/brctl addbr -- ${DEVICE} || exit 1
+ fi
+ [ -n "${DELAY}" ] && /usr/sbin/brctl setfd -- ${DEVICE} ${DELAY}
+ [ -n "${STP}" ] && /usr/sbin/brctl stp -- ${DEVICE} ${STP}
+ [ -n "${PRIO}" ] && /usr/sbin/brctl setbridgeprio ${DEVICE} ${PRIO}
+ [ -n "${AGEING}" ] && /usr/sbin/brctl setageing ${DEVICE} ${AGEING}
+ # add the bits to setup driver parameters here
+ for arg in $BRIDGING_OPTS ; do
+ key=${arg%%=*};
+ value=${arg##*=};
+ if [ "${key}" != "multicast_router" -a "${key}" != "hash_max" -a "${key}" != "multicast_snooping" ]; then
+ echo $value > /sys/class/net/${DEVICE}/bridge/$key
+ fi
+ done
+ # set LINKDELAY (used as timeout when calling check_link_down())
+ # to at least (${DELAY} * 2) + 7 if STP is enabled. This is the
+ # minimum time required for /sys/class/net/$REALDEVICE/carrier to
+ # become 1 after "ip link set dev $DEVICE up" is called.
+ if [ "${STP}" = "yes" -o "${STP}" = "on" ]; then
+ TMPD=7
+ [ -n "${DELAY}" ] && TMPD=$(expr ${DELAY} \* 2 + ${TMPD})
+ [ 0$LINKDELAY -lt $TMPD ] && LINKDELAY=$TMPD
+ fi
fi
# Create tap device.
if [ "${TYPE}" = "Tap" ]; then
- [ -n "${OWNER}" ] && OWNER="user ${OWNER}"
- TUNMODE="mode tap"
- [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
- ip tuntap add ${TUNMODE} ${OWNER} dev ${DEVICE} > /dev/null
+ [ -n "${OWNER}" ] && OWNER="user ${OWNER}"
+ TUNMODE="mode tap"
+ [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
+ ip tuntap add ${TUNMODE} ${OWNER} dev ${DEVICE} > /dev/null
fi
# Team master initialization.
@@ -92,12 +92,12 @@ fi
# now check the real state
is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || {
- if [ -n "$alias" ]; then
- net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
- else
- net_log $"Device ${DEVICE} does not seem to be present, delaying initialization."
- fi
- exit 1
+ if [ -n "$alias" ]; then
+ net_log $"$alias device ${DEVICE} does not seem to be present, delaying initialization."
+ else
+ net_log $"Device ${DEVICE} does not seem to be present, delaying initialization."
+ fi
+ exit 1
}
@@ -105,10 +105,10 @@ is_available_wait ${REALDEVICE} ${DEVTIMEOUT} || {
# available as a configuration option in the config file, forcing the kernel
# to think an ethernet card has a different MAC address than it really has.
if [ -n "${MACADDR}" ]; then
- ip link set dev ${DEVICE} address ${MACADDR}
+ ip link set dev ${DEVICE} address ${MACADDR}
fi
if [ -n "${MTU}" ]; then
- ip link set dev ${DEVICE} mtu ${MTU}
+ ip link set dev ${DEVICE} mtu ${MTU}
fi
# is the device wireless? If so, configure wireless device specifics
@@ -125,8 +125,8 @@ fi
if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
install_bonding_driver ${MASTER}
grep -wq "${DEVICE}" /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null || {
- /sbin/ip link set dev ${DEVICE} down
- echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
+ /sbin/ip link set dev ${DEVICE} down
+ echo "+${DEVICE}" > /sys/class/net/${MASTER}/bonding/slaves 2>/dev/null
}
ethtool_set
@@ -139,8 +139,8 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then
install_bonding_driver ${DEVICE}
/sbin/ip link set dev ${DEVICE} up
for device in $(LANG=C grep -l "^[[:space:]]*MASTER=['\"]\?${DEVICE}['\"]\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-*) ; do
- is_ignored_file "$device" && continue
- /sbin/ifup ${device##*/} || net_log "Unable to start slave device ${device##*/} for master ${DEVICE}." warning
+ is_ignored_file "$device" && continue
+ /sbin/ifup ${device##*/} || net_log "Unable to start slave device ${device##*/} for master ${DEVICE}." warning
done
[ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
@@ -149,39 +149,39 @@ if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
value=${arg##*=};
- if [ "${key}" = "primary" ]; then
+ if [ "${key}" = "primary" ]; then
echo $value > /sys/class/net/${DEVICE}/bonding/$key
- fi
+ fi
done
fi
# If the device is part of a bridge, add the device to the bridge
if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
- if [ ! -d /sys/class/net/${BRIDGE}/bridge ]; then
- /usr/sbin/brctl addbr -- ${BRIDGE} 2>/dev/null
- fi
- /sbin/ip addr flush dev ${DEVICE} 2>/dev/null
- /sbin/ip link set dev ${DEVICE} up
- ethtool_set
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
- /usr/sbin/brctl addif -- ${BRIDGE} ${DEVICE}
- # add the bits to setup driver parameters here
- for arg in $BRIDGING_OPTS ; do
- key=${arg%%=*};
- value=${arg##*=};
- echo $value > /sys/class/net/${DEVICE}/brport/$key
- done
- # Upon adding a device to a bridge,
- # it's necessary to make radvd reload its config
- [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
- exit 0
+ if [ ! -d /sys/class/net/${BRIDGE}/bridge ]; then
+ /usr/sbin/brctl addbr -- ${BRIDGE} 2>/dev/null
+ fi
+ /sbin/ip addr flush dev ${DEVICE} 2>/dev/null
+ /sbin/ip link set dev ${DEVICE} up
+ ethtool_set
+ [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+ /usr/sbin/brctl addif -- ${BRIDGE} ${DEVICE}
+ # add the bits to setup driver parameters here
+ for arg in $BRIDGING_OPTS ; do
+ key=${arg%%=*};
+ value=${arg##*=};
+ echo $value > /sys/class/net/${DEVICE}/brport/$key
+ done
+ # Upon adding a device to a bridge,
+ # it's necessary to make radvd reload its config
+ [ -r /var/run/radvd/radvd.pid ] && kill -HUP $(cat /var/run/radvd/radvd.pid)
+ exit 0
fi
-
+
if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
if [[ "${PERSISTENT_DHCLIENT}" = [yY1]* ]]; then
- ONESHOT="";
+ ONESHOT="";
else
- ONESHOT="-1";
+ ONESHOT="-1";
fi;
generate_config_file_name
generate_lease_file_name
@@ -189,110 +189,110 @@ if [ -n "${DYNCONFIG}" ] && [ -x /sbin/dhclient ]; then
echo
echo -n $"Determining IP information for ${DEVICE}..."
if [[ "${PERSISTENT_DHCLIENT}" != [yY1]* ]] && check_link_down ${DEVICE}; then
- echo $" failed; no link present. Check cable?"
- exit 1
+ echo $" failed; no link present. Check cable?"
+ exit 1
fi
ethtool_set
if /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
- echo $" done."
- dhcpipv4="good"
+ echo $" done."
+ dhcpipv4="good"
else
- echo $" failed."
- if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then
- exit 1
- fi
- if [[ "$IPV6INIT" = [nN0]* || "$DHCPV6C" != [yY1]* ]] ; then
- exit 1
- fi
- net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
+ echo $" failed."
+ if [[ "${IPV4_FAILURE_FATAL}" = [Yy1]* ]] ; then
+ exit 1
+ fi
+ if [[ "$IPV6INIT" = [nN0]* || "$DHCPV6C" != [yY1]* ]] ; then
+ exit 1
+ fi
+ net_log "Unable to obtain IPv4 DHCP address ${DEVICE}." warning
fi
-# end dynamic device configuration
+ # end dynamic device configuration
else
if [ -z "${IPADDR}" -a -z "${IPADDR0}" -a -z "${IPADDR1}" -a -z "${IPADDR2}" ]; then
- # enable device without IP, useful for e.g. PPPoE
- ip link set dev ${REALDEVICE} up
- ethtool_set
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+ # enable device without IP, useful for e.g. PPPoE
+ ip link set dev ${REALDEVICE} up
+ 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}."
- exit 1
- fi
- ethtool_set
+ expand_config
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+ [ -n "${ARP}" ] && \
+ ip link set dev ${REALDEVICE} $(toggle_value arp $ARP)
- if [ "${DEVICE}" = "lo" ]; then
- SCOPE="scope host"
- else
- SCOPE=${SCOPE:-}
- fi
-
- if [ -n "$SRCADDR" ]; then
- SRC="src $SRCADDR"
- else
- SRC=
- fi
-
- # set IP address(es)
- for idx in {0..256} ; do
- if [ -z "${ipaddr[$idx]}" ]; then
- break
+ if ! ip link set dev ${REALDEVICE} up ; then
+ net_log $"Failed to bring up ${DEVICE}."
+ exit 1
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
+ ethtool_set
+
+ [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+
+ if [ "${DEVICE}" = "lo" ]; then
+ SCOPE="scope host"
+ else
+ SCOPE=${SCOPE:-}
+ fi
+
+ if [ -n "$SRCADDR" ]; then
+ SRC="src $SRCADDR"
+ 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
+ if [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] ; then
/sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${REALDEVICE} ${ipaddr[$idx]}
if [ $? = 1 ]; then
net_log $"Error, some other host 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 ! 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}."
+ if [ -n "$SRCADDR" ]; then
+ sysctl -w "net.ipv4.conf.${SYSCTLDEVICE}.arp_filter=1" >/dev/null 2>&1
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 [ "${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 [ "${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 &
+ # 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} \
+ 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} \
+ ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} ||
+ net_log $"Error adding default gateway for ${REALDEVICE}."
+ fi
fi
-
- # 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} \
- 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} \
- ${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} ||
- net_log $"Error adding default gateway for ${REALDEVICE}."
- fi
- fi
fi
fi
@@ -336,4 +336,3 @@ if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
fi
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
-
diff --git a/sysconfig/network-scripts/ifup-ippp b/sysconfig/network-scripts/ifup-ippp
index 8405c8d9..848b8670 100755
--- a/sysconfig/network-scripts/ifup-ippp
+++ b/sysconfig/network-scripts/ifup-ippp
@@ -20,7 +20,7 @@ CONFIG=$1
source_config
if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
- exit
+ exit
fi
if [ ! -f /var/lock/subsys/isdn ] && [ -x /etc/init.d/isdn ] ; then
@@ -46,7 +46,7 @@ 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
@@ -116,15 +116,15 @@ function addprovider()
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"
+ # 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
@@ -160,7 +160,7 @@ function addprovider()
# 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
@@ -179,7 +179,7 @@ function addprovider()
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
@@ -188,12 +188,12 @@ function addprovider()
options="$options ipcp-accept-local"
else
if [ "$DIALIN" != "on" ]; then
- options="$options noipdefault"
+ 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"
@@ -208,10 +208,10 @@ function addprovider()
[ -z "$SLAVE_CALLBACK" ] && SLAVE_CALLBACK="$CALLBACK"
[ -z "$SLAVE_CBDELAY" ] && SLAVE_CBDELAY="$CBDELAY"
if [ "$DIALIN" != "on" ] ; then
- [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="auto"
+ [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="auto"
else
- # Master should not dial by default on incoming MPPP
- [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="$DIALMODE"
+ # Master should not dial by default on incoming MPPP
+ [ -z "$SLAVE_DIALMODE" ] && SLAVE_DIALMODE="$DIALMODE"
fi
slave=$SLAVE_DEVICE
@@ -259,7 +259,7 @@ function addprovider()
if [ "$GATEWAY" = "0.0.0.0" ]; then
if [ "$DIALIN" != "on" ]; then
- options="$options ipcp-accept-remote"
+ options="$options ipcp-accept-remote"
fi
options="$IPADDR:$GATEWAY $options"
else
@@ -277,16 +277,16 @@ function addprovider()
# BSD-Compression scheme
if [ "$BSDCOMP" = "on" ] ; then
- options="$options bsdcomp 9,9"
+ options="$options bsdcomp 9,9"
else
- options="$options -bsdcomp"
+ 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"
+ # 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
@@ -309,10 +309,10 @@ function addprovider()
# 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"
@@ -369,12 +369,12 @@ function addprovider()
# Setup IPv6
if [[ "$IPV6INIT" != [nN0]* && ! -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
+ # 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
}
diff --git a/sysconfig/network-scripts/ifup-plip b/sysconfig/network-scripts/ifup-plip
index c3b9efa1..2cea68b4 100755
--- a/sysconfig/network-scripts/ifup-plip
+++ b/sysconfig/network-scripts/ifup-plip
@@ -6,9 +6,8 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
source_config
-if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
-then
- exit
+if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]; then
+ exit
fi
[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
@@ -19,10 +18,10 @@ ip route add ${NETWORK} dev ${DEVICE}
. /etc/sysconfig/network
if [ "${GATEWAY}" != "" ]; then
- if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
- # set up default gateway
- ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
- fi
+ if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
+ # set up default gateway
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
+ fi
fi
/etc/sysconfig/network-scripts/ifup-post $1
diff --git a/sysconfig/network-scripts/ifup-plusb b/sysconfig/network-scripts/ifup-plusb
index ce5a0321..1b29afeb 100755
--- a/sysconfig/network-scripts/ifup-plusb
+++ b/sysconfig/network-scripts/ifup-plusb
@@ -19,7 +19,7 @@ source_config
if [ "foo$2" = "fooboot" -a "${ONBOOT}" = "no" ]
then
- exit
+ exit
fi
[ -z "$PREFIX" ] && eval $(/bin/ipcalc --prefix ${IPADDR} ${NETMASK})
@@ -34,10 +34,10 @@ ip link set up dev ${DEVICE}
. /etc/sysconfig/network
if [ "${GATEWAY}" != "" ]; then
- if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
- # set up default gateway
- ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
- fi
+ if [ "${GATEWAYDEV}" = "" -o "${GATEWAYDEV}" = "${DEVICE}" ]; then
+ # set up default gateway
+ ip route replace default ${METRIC:+metric $METRIC} via ${GATEWAY}
+ fi
fi
/etc/sysconfig/network-scripts/ifup-post $1
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index c1d83551..8685da37 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -24,79 +24,79 @@ fi
if [ "$PEERDNS" != "no" ] ||[ -n "$RESOLV_MODS" -a "$RESOLV_MODS" != "no" ]; then
- [ -n "$MS_DNS1" ] && DNS1=$MS_DNS1
- [ -n "$MS_DNS2" ] && DNS2=$MS_DNS2
-
- if [ -z "$DNS1" -a -n "$DNS2" ]; then
- DNS1=$DNS2
- DNS2=
- fi
-
- if ( [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf ) ||
- ( [ -n "$DNS2" ] && ! grep -q "^nameserver $DNS2" /etc/resolv.conf ) &&
- tr=$(mktemp /tmp/XXXXXX) ; then
- current_replacement="$DNS1"
- next_replacement="$DNS2"
- search=
- (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do
- case $answer in
- nameserver*|EOF)
- if [ -n "$current_replacement" ] ; then
- echo "nameserver $current_replacement" >> $tr
- if [ -n "$next_replacement" ] ; then
- current_replacement="$next_replacement"
- next_replacement=
- else
- current_replacement=
- fi
- else
- if [ "$answer" != EOF ] ; then
- echo "$answer" >> $tr
- fi
- fi
- ;;
- domain*|search*)
- if [ -n "$DOMAIN" ]; then
- echo "$answer" | while read key value ; do
- search="$search $value"
- done
- else
- echo "$answer" >> $tr
- fi
- ;;
- *)
- echo "$answer" >> $tr
- ;;
- esac
- done
- if [ -n "$DOMAIN" ]; then
- echo "search $DOMAIN $search" >> $tr
+ [ -n "$MS_DNS1" ] && DNS1=$MS_DNS1
+ [ -n "$MS_DNS2" ] && DNS2=$MS_DNS2
+
+ if [ -z "$DNS1" -a -n "$DNS2" ]; then
+ DNS1=$DNS2
+ DNS2=
fi
- # backup resolv.conf
- cp -af /etc/resolv.conf /etc/resolv.conf.save
-
- # maintain permissions
- # but set umask in case it doesn't exist!
- oldumask=$(umask)
- umask 022
- change_resolv_conf $tr
- rm -f $tr
- umask $oldumask
- fi
+ if ( [ -n "$DNS1" ] && ! grep -q "^nameserver $DNS1" /etc/resolv.conf ) ||
+ ( [ -n "$DNS2" ] && ! grep -q "^nameserver $DNS2" /etc/resolv.conf ) &&
+ tr=$(mktemp /tmp/XXXXXX) ; then
+ current_replacement="$DNS1"
+ next_replacement="$DNS2"
+ search=
+ (cat /etc/resolv.conf ; echo EOF ; echo EOF) | while read answer ; do
+ case $answer in
+ nameserver*|EOF)
+ if [ -n "$current_replacement" ] ; then
+ echo "nameserver $current_replacement" >> $tr
+ if [ -n "$next_replacement" ] ; then
+ current_replacement="$next_replacement"
+ next_replacement=
+ else
+ current_replacement=
+ fi
+ else
+ if [ "$answer" != EOF ] ; then
+ echo "$answer" >> $tr
+ fi
+ fi
+ ;;
+ domain*|search*)
+ if [ -n "$DOMAIN" ]; then
+ echo "$answer" | while read key value ; do
+ search="$search $value"
+ done
+ else
+ echo "$answer" >> $tr
+ fi
+ ;;
+ *)
+ echo "$answer" >> $tr
+ ;;
+ esac
+ done
+ if [ -n "$DOMAIN" ]; then
+ echo "search $DOMAIN $search" >> $tr
+ fi
+
+ # backup resolv.conf
+ cp -af /etc/resolv.conf /etc/resolv.conf.save
+
+ # maintain permissions
+ # but set umask in case it doesn't exist!
+ oldumask=$(umask)
+ umask 022
+ change_resolv_conf $tr
+ rm -f $tr
+ umask $oldumask
+ fi
fi
# don't set hostname on ppp/slip connections
if [ "$2" = "boot" -a \
- "${DEVICE}" != lo -a \
- "${DEVICETYPE}" != "ppp" -a \
- "${DEVICETYPE}" != "slip" ]; then
+ "${DEVICE}" != lo -a \
+ "${DEVICETYPE}" != "ppp" -a \
+ "${DEVICETYPE}" != "slip" ]; then
if need_hostname; then
- IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }')
- eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?")
- if [ "$status" = "0" ]; then
- set_hostname $HOSTNAME
- fi
+ IPADDR=$(LANG=C ip -o -4 addr ls dev ${DEVICE} | awk '{ print $4 ; exit }')
+ eval $(/bin/ipcalc --silent --hostname ${IPADDR} ; echo "status=$?")
+ if [ "$status" = "0" ]; then
+ set_hostname $HOSTNAME
+ fi
fi
fi
diff --git a/sysconfig/network-scripts/ifup-routes b/sysconfig/network-scripts/ifup-routes
index ff8d5b56..517c2bbb 100755
--- a/sysconfig/network-scripts/ifup-routes
+++ b/sysconfig/network-scripts/ifup-routes
@@ -1,6 +1,7 @@
#! /bin/bash
#
# adds static routes which go through device $1
+
if [ -z "$1" ]; then
echo $"usage: ifup-routes <net-device> [<nickname>]"
exit 1
@@ -12,14 +13,14 @@ handle_file () {
. $1
routenum=0
while [ "x$(eval echo '$'ADDRESS$routenum)x" != "xx" ]; do
- eval $(ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum))
- line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
- if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
- line="$line via $(eval echo '$'GATEWAY$routenum)"
- fi
- line="$line dev $2"
- /sbin/ip route add $line
- routenum=$(($routenum+1))
+ eval $(ipcalc -p $(eval echo '$'ADDRESS$routenum) $(eval echo '$'NETMASK$routenum))
+ line="$(eval echo '$'ADDRESS$routenum)/$PREFIX"
+ if [ "x$(eval echo '$'GATEWAY$routenum)x" != "xx" ]; then
+ line="$line via $(eval echo '$'GATEWAY$routenum)"
+ fi
+ line="$line dev $2"
+ /sbin/ip route add $line
+ routenum=$(($routenum+1))
done
}
@@ -44,15 +45,15 @@ if [ -n "$2" -a "$2" != "$1" ]; then
fi
for file in $FILES; do
- if [ -f "$file" ]; then
- if grep -Eq '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
- # new format
- handle_file $file ${1%:*}
- else
- # older format
- handle_ip_file $file
- fi
- fi
+ if [ -f "$file" ]; then
+ if grep -Eq '^[[:space:]]*ADDRESS[0-9]+=' $file ; then
+ # new format
+ handle_file $file ${1%:*}
+ else
+ # older format
+ handle_ip_file $file
+ fi
+ fi
done
@@ -69,7 +70,7 @@ if [ -n "$2" -a "$2" != "$1" ]; then
fi
for file in $FILES; do
- if [ -f "$file" ]; then
- handle_ip_file $file
- fi
+ if [ -f "$file" ]; then
+ handle_ip_file $file
+ fi
done
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index 01c8756c..29bf431a 100755
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -55,21 +55,21 @@ 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"
- exit 1
+ net_log $"Device '$DEVICE' isn't supported here, use IPV6_AUTOTUNNEL setting and restart (IPv6) networking"
+ exit 1
fi
if [ -z "$IPV6TUNNELIPV4" ]; then
- net_log $"Missing remote IPv4 address of tunnel, configuration is not valid"
- exit 1
+ net_log $"Missing remote IPv4 address of tunnel, configuration is not valid"
+ exit 1
fi
# Test device status
ipv6_test_device_status $DEVICE
if [ $? = 0 ]; then
- # device is already up
- net_log $"Device '$DEVICE' is already up, please shutdown first"
- exit 1
+ # device is already up
+ net_log $"Device '$DEVICE' is already up, please shutdown first"
+ exit 1
fi
# Create tunnel
@@ -77,31 +77,31 @@ ipv6_add_tunnel_device $DEVICE $IPV6TUNNELIPV4 "" $IPV6TUNNELIPV4LOCAL || exit 1
# Set IPv6 MTU, if given
if [ -n "$IPV6_MTU" ]; then
- ipv6_set_mtu $DEVICE $IPV6_MTU
+ ipv6_set_mtu $DEVICE $IPV6_MTU
fi
# Apply local IPv6 address, if given (numbered tunnel)
if [ -n "$IPV6ADDR" ]; then
- ipv6_add_addr_on_device $DEVICE $IPV6ADDR
+ ipv6_add_addr_on_device $DEVICE $IPV6ADDR
fi
# Setup additional IPv6 addresses from list, if given
if [ -n "$IPV6ADDR_SECONDARIES" ]; then
- for ipv6addr in $IPV6ADDR_SECONDARIES; do
- ipv6_add_addr_on_device $DEVICE $ipv6addr
- done
+ for ipv6addr in $IPV6ADDR_SECONDARIES; do
+ ipv6_add_addr_on_device $DEVICE $ipv6addr
+ done
fi
# Setup default IPv6 route, check are done by function
if [ -n "$IPV6_DEFAULTDEV" -o -n "$IPV6_DEFAULTGW" ]; then
- ipv6_set_default_route "$IPV6_DEFAULTGW" "$IPV6_DEFAULTDEV" "$DEVICE"
+ ipv6_set_default_route "$IPV6_DEFAULTGW" "$IPV6_DEFAULTDEV" "$DEVICE"
fi
# Setup additional static IPv6 routes on specified interface, if given
if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
- LC_ALL=C grep -w "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do
- ipv6_add_route $ipv6route :: $DEVICE
- done
+ LC_ALL=C grep -w "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device ipv6route args; do
+ ipv6_add_route $ipv6route :: $DEVICE
+done
fi
# Setup static routes
diff --git a/sysconfig/network-scripts/ifup-tunnel b/sysconfig/network-scripts/ifup-tunnel
index af54a72e..5a1df54c 100755
--- a/sysconfig/network-scripts/ifup-tunnel
+++ b/sysconfig/network-scripts/ifup-tunnel
@@ -37,25 +37,25 @@ if [ "$PEER_OUTER_IPADDR" = "$PEER_INNER_IPADDR" ]; then
fi
case "$TYPE" in
- GRE)
- MODE=gre
- proto=-4
- /sbin/modprobe ip_gre
- ;;
- IPIP)
- MODE=ipip
- proto=-4
- /sbin/modprobe ipip
- ;;
- IPIP6)
- MODE=ipip6
- proto=-6
- /sbin/modprobe ip6_tunnel
- ;;
- *)
- net_log $"Invalid tunnel type $TYPE"
- exit 1
- ;;
+GRE)
+ MODE=gre
+ proto=-4
+ /sbin/modprobe ip_gre
+ ;;
+IPIP)
+ MODE=ipip
+ proto=-4
+ /sbin/modprobe ipip
+ ;;
+IPIP6)
+ MODE=ipip6
+ proto=-6
+ /sbin/modprobe ip6_tunnel
+ ;;
+*)
+ net_log $"Invalid tunnel type $TYPE"
+ exit 1
+ ;;
esac
# Generic tunnel devices are not supported here
diff --git a/sysconfig/network-scripts/ifup-wireless b/sysconfig/network-scripts/ifup-wireless
index 99651004..702b6199 100755
--- a/sysconfig/network-scripts/ifup-wireless
+++ b/sysconfig/network-scripts/ifup-wireless
@@ -38,20 +38,20 @@ shopt -s nocasematch
case "$MODE" in
managed)
if [ "$ESSID" ]; then
- $IW dev "$DEVICE" set type managed
- $IW dev "$DEVICE" connect -w "$ESSID" $FREQ $KEYS
+ $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
+ $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"
+ $IW dev "$DEVICE" set type monitor
+ $IW dev "$DEVICE" set freq "$FREQ"
fi
;;
esac