aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-08-30 12:09:08 +0100
committerColin Guthrie <colin@mageia.org>2014-08-30 12:09:08 +0100
commitea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be (patch)
tree5913ccda5f0cf4e3e62fd2d0b070bef9b357a9b5 /sysconfig
parentf7d3fead844d504c88ef4bd2bd3b2a5d168cd1eb (diff)
parente2d575550ef975cb3cf5456060d75a66cd63aee4 (diff)
downloadinitscripts-ea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be.tar
initscripts-ea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be.tar.gz
initscripts-ea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be.tar.bz2
initscripts-ea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be.tar.xz
initscripts-ea427ad757e8b7c2c4bf7a2cd4176ebaefcbf3be.zip
Merge tag 'initscripts-9.55-1' into distro/mga
Tag as initscripts-9.55-1 Conflicts: Makefile lang.csh lang.sh po/Makefile ppp/ip-down ppp/ip-up rc.d/init.d/network service sysconfig.txt sysconfig/init sysconfig/network-scripts/ifdown-ppp sysconfig/network-scripts/ifup sysconfig/network-scripts/ifup-eth sysconfig/network-scripts/ifup-ippp sysconfig/network-scripts/ifup-ppp sysconfig/network-scripts/ifup-wireless sysconfig/network-scripts/network-functions sysctl.conf systemd/fedora-storage-init Notes: ppp support was dropped upstream so we will need to merge it into the ppp package as Fedora has done. The fedora-storage-init stuff has been dropped. LVM+Raid is typically initialised automatically now via udev rules etc. We should try and follow suit, but may need to add the legacy script back in for now.
Diffstat (limited to 'sysconfig')
-rw-r--r--sysconfig/init11
-rw-r--r--sysconfig/init.s3905
-rwxr-xr-xsysconfig/network-scripts/ifdown13
-rwxr-xr-xsysconfig/network-scripts/ifdown-eth20
-rwxr-xr-xsysconfig/network-scripts/ifdown-post2
-rwxr-xr-xsysconfig/network-scripts/ifdown-ppp56
-rwxr-xr-xsysconfig/network-scripts/ifdown-tunnel4
-rwxr-xr-xsysconfig/network-scripts/ifup22
-rwxr-xr-xsysconfig/network-scripts/ifup-aliases11
-rwxr-xr-xsysconfig/network-scripts/ifup-eth125
-rw-r--r--sysconfig/network-scripts/ifup-ipv65
-rwxr-xr-xsysconfig/network-scripts/ifup-ipx41
-rwxr-xr-xsysconfig/network-scripts/ifup-post4
-rwxr-xr-xsysconfig/network-scripts/ifup-ppp178
-rw-r--r--sysconfig/network-scripts/ifup-sit6
-rwxr-xr-xsysconfig/network-scripts/ifup-tunnel13
-rwxr-xr-xsysconfig/network-scripts/ifup-wireless203
-rw-r--r--sysconfig/network-scripts/network-functions58
18 files changed, 210 insertions, 567 deletions
diff --git a/sysconfig/init b/sysconfig/init
index cf2eb896..fc874e10 100644
--- a/sysconfig/init
+++ b/sysconfig/init
@@ -15,14 +15,3 @@ SETCOLOR_FAILURE="echo -en \\033[1;31m"
SETCOLOR_WARNING="echo -en \\033[1;33m"
# terminal sequence to reset to the default color.
SETCOLOR_NORMAL="echo -en \\033[0;39m"
-# default kernel loglevel on boot (syslog will reset this)
-LOGLEVEL=3
-# Set to anything other than 'no' to allow hotkey interactive startup...
-PROMPT=yes
-# Set to 'yes' to allow probing for devices with swap signatures
-AUTOSWAP=no
-# What ttys should gettys be started on?
-ACTIVE_CONSOLES=/dev/tty[1-6]
-# Set to '/sbin/sulogin' to prompt for password on single-user mode
-# Set to '/sbin/sushell' otherwise
-SINGLE=/sbin/sushell
diff --git a/sysconfig/init.s390 b/sysconfig/init.s390
index 802732da..d28446c9 100644
--- a/sysconfig/init.s390
+++ b/sysconfig/init.s390
@@ -19,8 +19,3 @@ SETCOLOR_NORMAL=
LOGLEVEL=3
# Set to anything other than 'no' to allow hotkey interactive startup...
PROMPT=no
-# What ttys should gettys be started on?
-ACTIVE_CONSOLES=/dev/console
-# Set to '/sbin/sulogin' to prompt for password on single-user mode
-# Set to '/sbin/sushell' otherwise
-SINGLE=/sbin/sushell
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index 34a10c53..7b6e2857 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -12,14 +12,14 @@ cd /etc/sysconfig/network-scripts
CONFIG=$1
[ -z "$CONFIG" ] && {
- echo $"usage: ifdown <device name>" >&2
+ echo $"usage: ifdown <configuration>" >&2
exit 1
}
need_config "${CONFIG}"
[ -f "$CONFIG" ] || {
- echo $"usage: ifdown <device name>" >&2
+ echo $"usage: ifdown <configuration>" >&2
exit 1
}
@@ -43,11 +43,14 @@ fi
if [ "$_use_nm" = "true" ]; then
if [ -n "$UUID" -a -z "$DEVICE" ]; then
- DEVICE=$(nmcli -t --fields uuid,devices con status | awk -F ':' "\$1 == \"$UUID\" { print \$2 }")
+ 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
- nmcli dev disconnect iface "$DEVICE"
- exit $?
+ if ! LC_ALL=C nmcli -t -f STATE,DEVICE dev status | egrep -q "^(failed|disconnected|unmanaged|unavailable):$DEVICE$"; then
+ nmcli dev disconnect "$DEVICE"
+ exit $?
+ fi
+ exit 0
fi
echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2
exit 0
diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth
index 56ea2725..3e613bec 100755
--- a/sysconfig/network-scripts/ifdown-eth
+++ b/sysconfig/network-scripts/ifdown-eth
@@ -13,7 +13,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
. /etc/init.d/functions
@@ -34,6 +34,10 @@ source_config
# Check to make sure the device is actually up
check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "bootp" ] && [ -n "$VLAN" -a "$VLAN" != "yes" ] && exit 0
+if [ -n "${TEAM_MASTER}" ] && [ ! "${DEVICETYPE}" = "TeamPort" ] && [ -x ./ifdown-TeamPort ]; then
+ ./ifdown-TeamPort ${CONFIG} $2
+fi
+
if [ "${SLAVE}" != "yes" -o -z "${MASTER}" ]; then
if [ -n "${HWADDR}" -a -z "${MACADDR}" ]; then
FOUNDMACADDR=$(get_hwaddr ${REALDEVICE})
@@ -56,7 +60,7 @@ fi
fi
if is_bonding_device ${DEVICE} ; then
- for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do
+ 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##*/}
done
@@ -139,9 +143,9 @@ fi
# instance instead.
if [ -d "/sys/class/net/${REALDEVICE}" ]; then
if [ "${REALDEVICE}" = "${DEVICE}" ]; then
- ip addr flush dev ${REALDEVICE} 2>/dev/null
+ ip addr flush dev ${REALDEVICE} scope global 2>/dev/null
else
- ip addr flush dev ${REALDEVICE} label ${DEVICE} 2>/dev/null
+ ip addr flush dev ${REALDEVICE} label ${DEVICE} scope global 2>/dev/null
fi
if [ "${SLAVE}" = "yes" -a -n "${MASTER}" ]; then
@@ -171,7 +175,13 @@ if [ -n "${BRIDGE}" ] && [ -x /usr/sbin/brctl ]; then
fi
if [ "${TYPE}" = "Tap" ]; then
- tunctl -d "${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
+ ./ifdown-Team ${CONFIG} $2
fi
# wait up to 5 seconds for device to actually come down...
diff --git a/sysconfig/network-scripts/ifdown-post b/sysconfig/network-scripts/ifdown-post
index 78fbd8a6..ce356f1e 100755
--- a/sysconfig/network-scripts/ifdown-post
+++ b/sysconfig/network-scripts/ifdown-post
@@ -45,7 +45,7 @@ fi
# Inform firewall
if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then
- /usr/bin/firewall-cmd --remove --interface="${DEVICE}" > /dev/null 2>&1
+ /usr/bin/firewall-cmd --remove-interface="${DEVICE}" > /dev/null 2>&1
fi
# Notify programs that have requested notification
diff --git a/sysconfig/network-scripts/ifdown-ppp b/sysconfig/network-scripts/ifdown-ppp
deleted file mode 100755
index 99b1b09e..00000000
--- a/sysconfig/network-scripts/ifdown-ppp
+++ /dev/null
@@ -1,56 +0,0 @@
-#! /bin/bash
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$1
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$1
-source_config
-
-if [ "$TYPE" = "xDSL" ] && [ -x /usr/sbin/adsl-stop ] ; then
- adsl-stop
- exit $?
-fi
-
-CONFIG=${CONFIG##ifcfg-}
-
-if [ "${DEMAND}" = "yes" ] && [ -f /var/run/ppp-${CONFIG}.pid ] ; then
- PID=$(head -1 /var/run/ppp-${CONFIG}.pid)
- kill -TERM ${PID}
- sleep 2
- [ ! -d /proc/${PID} ] && exit 0
- sleep 5
- [ ! -d /proc/${PID} ] && exit 0
- kill -TERM ${PID}
- [ ! -d /proc/${PID} ] && exit 0
- exit 1
-fi
-
-if [ "$TYPE" = "ADSL" ]; then
- file=/var/run/${DEVICE}.pid
-else
- file=/var/run/pppwatch-${DEVICE}.pid
-fi
-
-if [ ! -f $file ]; then
- # ppp isn't running, or we didn't start it
- exit 0
-fi
-
-PID=$(cat $file)
-[ -n "${PID}" ] || exit 1
-
-kill -TERM ${PID} > /dev/null 2>&1
-[ ! -d /proc/${PID} ] && exit 0
-sleep 2
-[ ! -d /proc/${PID} ] && exit 0
-sleep 5
-[ ! -d /proc/${PID} ] && exit 0
-sleep 10
-[ ! -d /proc/${PID} ] && exit 0
-
-# killing ppp-watch twice in a row causes it to send a SIGKILL to pppd pgrp
-kill -TERM ${PID} > /dev/null 2>&1
-[ ! -d /proc/${PID} ] && exit 0
-
-exit 1
diff --git a/sysconfig/network-scripts/ifdown-tunnel b/sysconfig/network-scripts/ifdown-tunnel
index e04effe7..d2ac6922 100755
--- a/sysconfig/network-scripts/ifdown-tunnel
+++ b/sysconfig/network-scripts/ifdown-tunnel
@@ -12,7 +12,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Thanks to:
# - Razvan Corneliu C.R. Vilt <razvan.vilt@linux360.ro>
@@ -32,7 +32,7 @@ need_config "$CONFIG"
source_config
# Generic tunnel devices are not supported here
-if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 ]; then
+if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 -o "$DEVICE" = ip6tnl0 ]; then
net_log $"Device '$DEVICE' isn't supported as a valid GRE device name."
exit 1
fi
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 18dad676..0380ec9e 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -13,7 +13,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TEXTDOMAIN=initscripts
@@ -30,7 +30,7 @@ cd /etc/sysconfig/network-scripts
CONFIG=${1}
[ -z "${CONFIG}" ] && {
- echo $"Usage: ifup <device name>" >&2
+ echo $"Usage: ifup <configuration>" >&2
exit 1
}
@@ -38,7 +38,7 @@ need_config "${CONFIG}"
[ -f "${CONFIG}" ] || {
echo $"$0: configuration for ${1} not found." >&2
- echo $"Usage: ifup <device name>" >&2
+ echo $"Usage: ifup <configuration>" >&2
exit 1
}
@@ -69,12 +69,16 @@ then
fi
if [ "$_use_nm" = "true" ]; then
- if [ -n "$UUID" ]; then
- nmcli con up uuid "$UUID"
- exit $?
+ if [ -z "$UUID" ]; then
+ echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2
+ exit 0
fi
- echo $"$0: interface ${CONFIG} is controlled by NetworkManager; skipping." >&2
- exit 0
+ if [ "foo$2" = "fooboot" ] && [ "${TYPE}" = "Wireless" ]; then
+ exit 0
+ fi
+ is_nm_handling ${DEVICE} && exit 0
+ nmcli con up uuid "$UUID"
+ exit $?
fi
# Ethernet 802.1Q VLAN support
@@ -133,6 +137,8 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then
}
fi
fi
+
+ /usr/lib/systemd/systemd-sysctl --prefix "/proc/sys/net/ipv4/conf/${DEVICE}" --prefix "/proc/sys/net/ipv6/conf/${DEVICE}"
fi
# signalling the start of connection
diff --git a/sysconfig/network-scripts/ifup-aliases b/sysconfig/network-scripts/ifup-aliases
index a647044f..c92a431d 100755
--- a/sysconfig/network-scripts/ifup-aliases
+++ b/sysconfig/network-scripts/ifup-aliases
@@ -139,6 +139,7 @@ function ini_env ()
GATEWAY=$default_GATEWAY
NO_ALIASROUTING=$default_NO_ALIASROUTING
ONPARENT=""
+ ARPCHECK=""
}
function is_default_gateway ()
@@ -256,9 +257,17 @@ function new_interface ()
fi
if [ "$setup_this" = "yes" ] ; then
+ [ "${parent_device}" != "lo" ] && [ "${ARPCHECK}" != "no" ] && \
+ is_available ${parent_device} && \
+ grep -qswi "up" /sys/class/net/${parent_device}/operstate && \
+ if ! /sbin/arping -q -c 2 -w ${ARPING_WAIT:-3} -D -I ${parent_device} ${IPADDR} ; then
+ net_log $"Error, some other host already uses address ${IPADDR}."
+ return 1
+ fi
+
/sbin/ip addr add ${IPADDR}/${PREFIX} brd ${BROADCAST} dev ${parent_device} label ${DEVICE}
- [ "$IPV6INIT" = "yes" ] && /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
+ [[ "$IPV6INIT" != [nN0]* ]] && /etc/sysconfig/network-scripts/ifup-ipv6 ${DEVICE}
if [ "$NO_ALIASROUTING" != yes ]; then
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index e51fdf53..573003b9 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -13,7 +13,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
TEXTDOMAIN=initscripts
@@ -70,6 +70,8 @@ if [ "${TYPE}" = "Bridge" ]; then
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%%=*};
@@ -78,24 +80,17 @@ if [ "${TYPE}" = "Bridge" ]; then
done
fi
-# If the device is a tap device, create it with tunctl, if available.
+# Create tap device.
if [ "${TYPE}" = "Tap" ]; then
- if [ ! -x /usr/sbin/tunctl -a ! -x /usr/bin/tunctl ]; then
- net_log $"Tap support not available: tunctl not found"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
- fi
- # load the correct module if necessary (#54748)
- if [ ! -c /dev/net/tun ]; then
- if ! modprobe tun > /dev/null 2>&1; then
- echo $"No TUN/TAP support available in kernel for device ${DEVICE}"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
- fi
- fi
+ [ -n "${OWNER}" ] && OWNER="user ${OWNER}"
+ TUNMODE="mode tap"
+ [[ ${DEVICE} == tun* ]] && TUNMODE="mode tun"
+ ip tuntap add ${TUNMODE} ${OWNER} dev ${DEVICE} > /dev/null
+fi
- [ -n "${OWNER}" ] && OWNER="-u ${OWNER}"
- tunctl ${OWNER} -t ${DEVICE} > /dev/null
+# Team master initialization.
+if [ -n "${TEAM_CONFIG}" ] && [ ! "${DEVICETYPE}" = "Team" ] && [ -x ./ifup-Team ]; then
+ ./ifup-Team ${CONFIG} $2
fi
# now check the real state
@@ -177,6 +172,13 @@ if [ -n "${MTU}" ]; then
ip link set dev ${DEVICE} mtu ${MTU}
fi
+# Team slave device?
+if [ -n "${TEAM_MASTER}" ] && [ ! "${DEVICETYPE}" = "TeamPort" ] && [ -x ./ifup-TeamPort ]; then
+ ./ifup-TeamPort ${CONFIG} $2
+ ethtool_set
+ exit 0
+fi
+
# slave device?
if [ "${SLAVE}" = yes -a "${ISALIAS}" = no -a "${MASTER}" != "" ]; then
install_bonding_driver ${MASTER}
@@ -192,38 +194,15 @@ fi
# Bonding initialization. For DHCP, we need to enslave the devices early,
# so it can actually get an IP.
if [ "$ISALIAS" = no ] && is_bonding_device ${DEVICE} ; then
-
- /sbin/ip link set dev ${DEVICE} down
-
- # add the bits to setup driver parameters here
- for arg in $BONDING_OPTS ; do
- key=${arg%%=*};
- value=${arg##*=};
- if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then
- OLDIFS=$IFS;
- IFS=',';
- for arp_ip in $value; do
- if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then
- echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key
- fi
- done
- IFS=$OLDIFS;
- elif [ "${key}" = "arp_ip_target" ]; then
- if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then
- echo "$value" > /sys/class/net/${DEVICE}/bonding/$key
- fi
- elif [ "${key}" != "primary" ]; then
- echo $value > /sys/class/net/${DEVICE}/bonding/$key
- fi
- done
-
+ install_bonding_driver ${DEVICE}
/sbin/ip link set dev ${DEVICE} up
- [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
- for device in $(LANG=C egrep -l "^[[:space:]]*MASTER=\"?${DEVICE}\"?[[:space:]]*$" /etc/sysconfig/network-scripts/ifcfg-*) ; do
+ 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##*/}
done
+ [ -n "${LINKDELAY}" ] && /bin/sleep ${LINKDELAY}
+
# add the bits to setup the needed post enslavement parameters
for arg in $BONDING_OPTS ; do
key=${arg%%=*};
@@ -382,6 +361,7 @@ if [ -n "${DYNCONFIG}" ]; then
if $DHCP_CLIENT $DHCP_ARGS ; then
mdv-network-event dhcp_success ${DEVICE}
echo $" done."
+ dhcpipv4="good"
else
mdv-network-event dhcp_failure ${DEVICE}
# Associate a zeroconf IP address to an alias of the interface
@@ -398,8 +378,15 @@ if [ -n "${DYNCONFIG}" ]; then
fi
mdv-network-event zcip_failure ${DEVICE}
echo $" failed."
- mdv-network-event connection_failure ${DEVICE}
- exit 1
+ 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
@@ -445,11 +432,13 @@ else
fi
if ! LC_ALL=C ip addr ls ${REALDEVICE} | LC_ALL=C grep -q "${ipaddr[$idx]}/${prefix[$idx]}" ; then
- [ "${REALDEVICE}" != "lo" ] && [ "${arpcheck[$idx]}" != "no" ] && \
- if ! /sbin/arping -q -c 2 -w 3 -D -I ${REALDEVICE} ${ipaddr[$idx]} ; then
- net_log $"Error, some other host already uses address ${ipaddr[$idx]}."
- mdv-network-event connection_failure ${DEVICE}
- exit 1
+ 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]}."
+ mdv-network-event connection_failure ${DEVICE}
+ exit 1
+ fi
fi
if ! ip addr add ${ipaddr[$idx]}/${prefix[$idx]} \
@@ -488,7 +477,7 @@ else
elif [ "${GATEWAYDEV}" = "${DEVICE}" ]; then
ip route replace default ${METRIC:+metric $METRIC} \
${SRC} ${WINDOW:+window $WINDOW} dev ${REALDEVICE} ||
- net_log $"Erorr adding default gateway for ${REALDEVICE}."
+ net_log $"Error adding default gateway for ${REALDEVICE}."
fi
fi
fi
@@ -499,16 +488,38 @@ if [ "${NOZEROCONF}" != "yes" -a "${ISALIAS}" = "no" -a "${REALDEVICE}" != "lo"
ip route add 169.254.0.0/16 dev ${REALDEVICE} metric $((1000 + $(cat /sys/class/net/${REALDEVICE}/ifindex))) scope link
fi
+# Inform firewall which network zone (empty means default) this interface belongs to
+if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then
+ /usr/bin/firewall-cmd --zone="${ZONE}" --change-interface="${DEVICE}" > /dev/null 2>&1
+fi
+
+if [ "${TYPE}" = "Bridge" ]; then
+ for arg in $BRIDGING_OPTS ; do
+ key=${arg%%=*};
+ value=${arg##*=};
+ if [ "${key}" = "multicast_router" -o "${key}" = "hash_max" ]; then
+ echo $value > /sys/class/net/${DEVICE}/bridge/$key
+ fi
+ done
+fi
+
# IPv6 initialisation?
/etc/sysconfig/network-scripts/ifup-ipv6 ${CONFIG}
if [[ "${DHCPV6C}" = [Yy1]* ]] && [ -x /sbin/dhclient ]; then
generate_config_file_name 6
generate_lease_file_name 6
- /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE}
-fi
-
-if [ "${IPX}" = yes ]; then
- /etc/sysconfig/network-scripts/ifup-ipx ${DEVICE}
+ echo
+ echo -n $"Determining IPv6 information for ${DEVICE}..."
+ if /sbin/dhclient -6 -1 ${DHCPV6C_OPTIONS} ${DHCLIENTCONF} -lf ${LEASEFILE} -pf /var/run/dhclient6-${DEVICE}.pid -H ${DHCP_HOSTNAME:-${HOSTNAME%%.*}} ${DEVICE} ; then
+ echo $" done."
+ else
+ echo $" failed."
+ if [ "${dhcpipv4}" = "good" -o -n "${IPADDR}" ]; then
+ net_log "Unable to obtain IPv6 DHCP address ${DEVICE}." warning
+ else
+ exit 1
+ fi
+ fi
fi
exec /etc/sysconfig/network-scripts/ifup-post ${CONFIG} ${2}
diff --git a/sysconfig/network-scripts/ifup-ipv6 b/sysconfig/network-scripts/ifup-ipv6
index 509e49f3..4d84afee 100644
--- a/sysconfig/network-scripts/ifup-ipv6
+++ b/sysconfig/network-scripts/ifup-ipv6
@@ -65,8 +65,8 @@ source_config
REALDEVICE=${DEVICE%%:*}
DEVICE=$REALDEVICE
-# Test whether IPv6 configuration is enabled for this interface, else stop
-[ "$IPV6INIT" = "yes" ] || exit 0
+# Test whether IPv6 configuration is disabled for this interface
+[[ "$IPV6INIT" = [nN0]* ]] && exit 0
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
@@ -127,6 +127,7 @@ fi
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.forwarding=$ipv6_local_forwarding >/dev/null 2>&1
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_ra=$ipv6_local_auto >/dev/null 2>&1
/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.accept_redirects=$ipv6_local_auto >/dev/null 2>&1
+/sbin/sysctl -e -w net.ipv6.conf.$SYSCTLDEVICE.autoconf=$ipv6_local_auto >/dev/null 2>&1
# Set IPv6 MTU, if given
if [ -n "$IPV6_MTU" ]; then
diff --git a/sysconfig/network-scripts/ifup-ipx b/sysconfig/network-scripts/ifup-ipx
deleted file mode 100755
index dbd294a8..00000000
--- a/sysconfig/network-scripts/ifup-ipx
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/bin/bash
-# configures IPX on $1 if appropriate
-
-PATH=/sbin:/usr/sbin:/bin:/usr/bin
-
-if [ "$1" = "" ]; then
- echo $"usage: $0 <net-device>"
- exit 1
-fi
-
-# cannot configure IPX with non-existent utilities
-[ -x /sbin/ipx_interface ] || exit 0
-
-. /etc/sysconfig/network
-
-case $IPX in yes|true) ;; *) exit 0 ;; esac
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-CONFIG=$1
-[ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
-source_config
-
-for frametype in 802.2 802.3 ETHERII SNAP ; do
- framename=${frametype/./_}
- eval ACT=\$IPXACTIVE_$framename
- case $ACT in
- yes|true)
- eval PRIM=\$IPXPRIMARY_$framename
- case $PRIM in
- yes|true) primary=-p ;;
- *) primary= ;;
- esac
- eval NUM=\$IPXNETNUM_$framename
- /sbin/ipx_interface add $primary $1 $frametype $NUM
- ;;
- esac
-done
-
-exit 0
diff --git a/sysconfig/network-scripts/ifup-post b/sysconfig/network-scripts/ifup-post
index 2937bd3d..61cfc446 100755
--- a/sysconfig/network-scripts/ifup-post
+++ b/sysconfig/network-scripts/ifup-post
@@ -1,4 +1,4 @@
-
+#!/bin/sh
cd /etc/sysconfig/network-scripts
. ./network-functions
@@ -99,7 +99,7 @@ fi
# Inform firewall which network zone (empty means default) this interface belongs to
if [ -x /usr/bin/firewall-cmd -a "${REALDEVICE}" != "lo" ]; then
- /usr/bin/firewall-cmd --zone="${ZONE}" --change --interface="${DEVICE}" > /dev/null 2>&1
+ /usr/bin/firewall-cmd --zone="${ZONE}" --change-interface="${DEVICE}" > /dev/null 2>&1
fi
# Notify programs that have requested notification
diff --git a/sysconfig/network-scripts/ifup-ppp b/sysconfig/network-scripts/ifup-ppp
deleted file mode 100755
index d53f3d70..00000000
--- a/sysconfig/network-scripts/ifup-ppp
+++ /dev/null
@@ -1,178 +0,0 @@
-#! /bin/bash
-
-. /etc/init.d/functions
-
-cd /etc/sysconfig/network-scripts
-. ./network-functions
-
-# ifup-post for PPP is handled through /etc/ppp/ip-up
-if [ "${1}" = daemon ] ; then
- # we've been called from ppp-watch, so don't invoke it for persistence
- shift
- # do not detach connection so that ppp-watch can monitor it
- DETACH=nodetach
-else
- # just in case a full path to the configuration file is passed in
- CONFIG=${1##*/} # CONFIG=$(basename $1)
- [ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
- source_config
- # don't start ppp-watch by xDSL and ADSL
- if [ "${DEMAND}" != yes -a "$TYPE" != "xDSL" -a "$TYPE" != "ADSL" ] ; then
- # let ppp-watch do the right thing
- exec /sbin/ppp-watch "${CONFIG##ifcfg-}" "$2"
- fi
- # detach connection not to hang boot
- DETACH=updetach
-fi
-
-CONFIG=$1
-[ -f "${CONFIG}" ] || CONFIG=ifcfg-${1}
-source_config
-
-if [ -z "${DISCONNECTTIMEOUT}" ]; then
- DISCONNECTTIMEOUT=2
-fi
-
-if [ -z "${RETRYTIMEOUT}" ]; then
- RETRYTIMEOUT=30
-fi
-
-if [ -z "${IDLETIMEOUT}" ]; then
- IDLETIMEOUT=600
-fi
-
-if [ "${2}" = "boot" -a "${ONBOOT}" = "no" ]; then
- exit
-fi
-
-[ -x /usr/sbin/pppd ] || {
- echo $"pppd does not exist or is not executable"
- echo $"ifup-ppp for ${DEVICE} exiting"
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"pppd does not exist or is not executable for ${DEVICE}"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
-}
-
-# check that xDSL connection
-if [ "$TYPE" = "xDSL" ] ; then
- if [ -x /usr/sbin/adsl-start ] ; then
- adsl-start
- exit $?
- else
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"adsl-start does not exist or is not executable for ${DEVICE}"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
- fi
-fi
-
-PEERCONF=/etc/ppp/peers/${DEVNAME}
-
-if [ "${DEBUG}" = "yes" ]; then
- CHATDBG="-v"
-fi
-
-if [ ! -f ${PEERCONF} ]; then
- if [ -z "${WVDIALSECT}" ] ; then
- CHATSCRIPT=/etc/sysconfig/network-scripts/chat-${DEVNAME}
- [ -f ${CHATSCRIPT} ] || {
- echo $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist"
- echo $"ifup-ppp for ${DEVNAME} exiting"
- /usr/bin/logger -p daemon.info -t ifup-ppp \
- $"/etc/sysconfig/network-scripts/chat-${DEVNAME} does not exist for ${DEVICE}"
- mdv-network-event connection_failure ${DEVICE}
- exit 1
- }
- fi
- /usr/bin/logger -s -p daemon.notice -t ifup-ppp \
- $"Setting up a new ${PEERCONF} config file"
- if [ -f /etc/ppp/peers/${DEVICE} ]; then
- cp -f /etc/ppp/peers/${DEVICE} ${PEERCONF}
- else
- touch ${PEERCONF}
- fi
- if [ "${WVDIALSECT}" ]; then
- echo "connect \"/usr/bin/wvdial --remotename ${DEVNAME} --chat '${WVDIALSECT}'\"" >> ${PEERCONF}
- else
- echo "connect \"/usr/sbin/chat ${CHATDBG} -f ${CHATSCRIPT}\"" >> ${PEERCONF}
- fi
-fi
-
-opts="lock"
-if [ "${HARDFLOWCTL}" != no ] ; then
- opts="$opts modem crtscts"
-fi
-if [ "${ESCAPECHARS}" != yes ] ; then
- opts="$opts asyncmap 00000000"
-fi
-if [ "${DEFROUTE}" != no ] ; then
- # pppd will no longer delete an existing default route
- # so we have to help it out a little here.
- DEFRT=$(ip route list match 0.0.0.0/0 dev ${DEVICE})
- [ -n "${DEFRT}" ] && echo "$DEFRT" > /etc/default-routes
- [ -n "${DEFRT}" ] && echo "$DEFRT" | while read spec; do
- ip route del $spec;
- done
- opts="$opts defaultroute multipledefaultroutes"
-fi
-if [ "${PEERDNS}" != no ] ; then
- cp -f /etc/resolv.conf /etc/resolv.conf.save
- opts="$opts usepeerdns"
-fi
-if [ -n "${MRU}" ] ; then
- opts="$opts mru ${MRU}"
-fi
-if [ -n "${MTU}" ] ; then
- opts="$opts mtu ${MTU}"
-fi
-if [ -n "${IPADDR}${REMIP}" ] ; then
- # if either IP address is set, the following will work.
- opts="$opts ${IPADDR}:${REMIP}"
-fi
-if [ -n "${PAPNAME}" ] ; then
- opts="$opts user ${PAPNAME} remotename ${DEVNAME}"
-fi
-if [ "${DEBUG}" = yes ] ; then
- opts="$opts debug"
-fi
-
-if [ "${DEMAND}" = yes ] ; then
- opts="$opts demand ktune idle ${IDLETIMEOUT} holdoff ${RETRYTIMEOUT}"
- exec=
-else
- opts="$opts $DETACH"
- exec=exec
-fi
-
-if [ "$TYPE" != "xDSL" -a "$TYPE" != "ADSL" ] ; then
- CELLULAR_PIN=$(cat pin-${DEVICE} 2>/dev/null)
- if [ -n "$CELLULAR_PIN" -a -x /usr/sbin/comgt ]; then
- COMGTPIN=$CELLULAR_PIN comgt PIN -d $MODEMPORT
- fi
-fi
-
-# ATM bridging support, enabled if ATM_ADDR is defined (VCI.VPI)
-# useful for pppoe over USB modems
-if [ -n "${ATM_ADDR}" -a -n "${ATM_DEVICE}" -a -x /usr/sbin/br2684ctl ]; then
- br2684ctl -b -c 0 -a ${ATM_ADDR}
- ifconfig ${ATM_DEVICE} up
-fi
-
-(logger -p daemon.info -t ifup-ppp \
- $"pppd started for ${DEVNAME} on ${MODEMPORT} at ${LINESPEED}" &)&
-
-$exec pppd $opts ${MODEMPORT} ${LINESPEED} \
- ipparam ${DEVNAME} linkname ${DEVNAME} call ${DEVNAME}\
- noauth \
- ${PPPOPTIONS} || exit
-
-if [ "${DEMAND}" = "yes" ] ; then
- # pppd is a tad slow to write the pid-file.
- sleep 2
- if [ -f /var/run/ppp-${DEVNAME}.pid ] ; then
- REALDEVICE=$(tail -1 /var/run/ppp-${DEVNAME}.pid)
- /etc/sysconfig/network-scripts/ifup-routes ${REALDEVICE} ${DEVNAME}
- fi
-fi
-
diff --git a/sysconfig/network-scripts/ifup-sit b/sysconfig/network-scripts/ifup-sit
index 1d395e99..e83ef058 100644
--- a/sysconfig/network-scripts/ifup-sit
+++ b/sysconfig/network-scripts/ifup-sit
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
#
# ifup-sit
#
@@ -43,8 +43,8 @@ source_config
REALDEVICE=${DEVICE%%:*}
[ "$DEVICE" != "$REALDEVICE" ] && exit 0
-# Test whether IPv6 configuration is enabled for this interface, else stop
-[ "$IPV6INIT" = "yes" ] || exit 0
+# Test whether IPv6 configuration is disabled for this interface
+[[ "$IPV6INIT" = [nN0]* ]] && exit 0
[ -f /etc/sysconfig/network-scripts/network-functions-ipv6 ] || exit 1
. /etc/sysconfig/network-scripts/network-functions-ipv6
diff --git a/sysconfig/network-scripts/ifup-tunnel b/sysconfig/network-scripts/ifup-tunnel
index b235bfe0..a4762127 100755
--- a/sysconfig/network-scripts/ifup-tunnel
+++ b/sysconfig/network-scripts/ifup-tunnel
@@ -12,7 +12,7 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# Thanks to:
# - Razvan Corneliu C.R. Vilt <razvan.vilt@linux360.ro>
@@ -39,12 +39,19 @@ 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
@@ -52,7 +59,7 @@ case "$TYPE" in
esac
# Generic tunnel devices are not supported here
-if [ "$DEVICE" = gre0 -o "$DEVICE" = tunl0 ]; then
+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
@@ -60,7 +67,7 @@ fi
# Create the tunnel
# The outer addresses are those of the underlying (public) network.
-/sbin/ip tunnel add "$DEVICE" mode "$MODE" \
+/sbin/ip $proto tunnel add "$DEVICE" mode "$MODE" \
${MY_OUTER_IPADDR:+local "$MY_OUTER_IPADDR"} \
${PEER_OUTER_IPADDR:+remote "$PEER_OUTER_IPADDR"} \
${KEY:+key "$KEY"} ${TTL:+ttl "$TTL"}
diff --git a/sysconfig/network-scripts/ifup-wireless b/sysconfig/network-scripts/ifup-wireless
index 828af727..21d7b145 100755
--- a/sysconfig/network-scripts/ifup-wireless
+++ b/sysconfig/network-scripts/ifup-wireless
@@ -15,195 +15,44 @@
#
# 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-# Configure wireless network device options. See iwconfig(8) for more info.
-# Mageia prefixes the following variables with WIRELESS_ prefix.
+# Configure wireless network device options. See iw(8) for more info.
# 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
+# Mageia Extension:
# WIRELESS_ENC_KEY: Encryption key for WEP.
-# WIRELESS_ENC_MODE: Security mode, e.g: 'open' or 'restricted'
-# WIRELESS_XSUPPLICANT: Enabling xsupplicant support
-# WIRELESS_XSUPPLICANT_FILE: Custom location for xsupplicant.conf file
-
+#
# Only meant to be called from ifup.
-# unify variables common to RH and 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}
-
-# Mode need to be first : some settings apply only in a specific mode !
-if [ -n "$MODE" ] ; then
- # for some cards, the mode can only be set with the card is down
- # so we bring the card down (and suspending ifplugd if it is running)
- # in order to do so (mdv bug #43166)
- ifplugd -S -i $DEVICE 2>/dev/null
- /sbin/ip link set dev $DEVICE down
- iwconfig $DEVICE mode $MODE
- ifplugd -R -i $DEVICE 2>/dev/null
-fi
-
-# Set link up (some cards require this.)
-/sbin/ip link set dev ${DEVICE} up
-
-# Setup the card nickname
-# This is a bit hackish, but should do the job right...
-if [ -n "$ESSID" -o -n "$MODE" ] ; then
- NICKNAME=$(/bin/hostname)
- iwconfig $DEVICE nick "$NICKNAME" >/dev/null 2>&1
-fi
-if [ -n "$WIRELESS_NICK" ] ; then
- iwconfig $DEVICE nick $WIRELESS_NICK >/dev/null 2>&1
-elif [ -n "$ESSID" ] || [ -n "$MODE" ] ; then
- # This is a bit hackish, but should do the job right...
- NICKNAME=`/bin/hostname`
- iwconfig $DEVICE nick $NICKNAME >/dev/null 2>&1
-fi
-
-# Regular stuff...
-# network id
-if [ -n "$NWID" ] ; then
- iwconfig $DEVICE nwid $NWID
-fi
-
-# frequency and channel
-if [ -n "$FREQ" -a "$MODE" != "Managed" ] ; then
- iwconfig $DEVICE freq $FREQ
-elif [ -n "$CHANNEL" -a "$MODE" != "Managed" ] ; then
- iwconfig $DEVICE channel $CHANNEL
-fi
-
-# sensitivity
-if [ -n "$SENS" ] ; then
- iwconfig $DEVICE sens $SENS
-fi
+IW=${IW:-iw}
-# rate
-if [ -n "$RATE" ] ; then
- iwconfig $DEVICE rate "$RATE"
-fi
+[ "$KEY" ] && KEYS="key d:0:$KEY"
+# For Mageia Style config...
+[ "$WIRELESS_ENC_KEY" ] && KEYS="key d:0:$WIRELESS_ENC_KEY"
-# 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
+shopt -s nocasematch
-# 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
+case "$MODE" in
+managed)
+ if [ "$ESSID" ]; then
+ $IW dev "$DEVICE" set type managed
+ $IW dev "$DEVICE" connect -w "$ESSID" $FREQ $KEYS
fi
-fi
-
-# security mode
-if [ -n "$SECURITYMODE" ]; then
- iwconfig $DEVICE enc $SECURITYMODE
-fi
-
-# power
-if [ -n "$POWER" ] ; then
- iwconfig $DEVICE power $POWER
-fi
-
-# rts
-if [ -n "$RTS" ] ; then
- iwconfig $DEVICE rts $RTS
-fi
-
-# fragmentation
-if [ -n "$FRAG" ] ; then
- iwconfig $DEVICE frag $FRAG
-fi
-
-# 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
-
-# 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
-
-# settings for xsupplicant
-if [ -n "$WIRELESS_XSUPPLICANT" -a -x /usr/sbin/xsupplicant ]; then
- if [ -f /var/run/console.lock ] ; then
- WIRELESS_XSUPPLICANT_FILE=/home/$(cat /var/run/console.lock)/.xsupplicant.conf
- elif [ -f /etc/xsupplicant.conf ] ; then
- WIRELESS_XSUPPLICANT_FILE=/etc/xsupplicant.conf
+ ;;
+ad-hoc)
+ if [ -n "$ESSID" -a -n "$FREQ" ]; then
+ $IW dev "$DEVICE" set type ibss
+ $IW dev "$DEVICE" ibss join "$ESSID" "$FREQ" $KEYS
fi
- if [ -n "$WIRELESS_XSUPPLICANT_FILE" ]; then
- iwconfig $DEVICE key on
- ifconfig $DEVICE allmulti
- /usr/sbin/xsupplicant -i ${DEVICE} -c ${WIRELESS_XSUPPLICANT_FILE} &
+ ;;
+monitor)
+ if [ "$FREQ" ]; then
+ $IW dev "$DEVICE" set type monitor
+ $IW dev "$DEVICE" set freq "$FREQ"
fi
-fi
+ ;;
+esac
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index ac5917dc..def167a7 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -24,7 +24,7 @@ get_hwaddr ()
get_config_by_device ()
{
- LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \
+ LANG=C grep -l "^[[:space:]]*DEVICE=\"\?${1}\"\?\([[:space:]#]\|$\)" \
/etc/sysconfig/network-scripts/ifcfg-* \
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
}
@@ -143,10 +143,7 @@ source_config ()
CTC)
DEVICETYPE="ctc"
;;
- IUCV)
- DEVICETYPE="iucv"
- ;;
- GRE | IPIP)
+ GRE | IPIP | IPIP6)
DEVICETYPE="tunnel"
;;
SIT | sit)
@@ -155,6 +152,9 @@ source_config ()
InfiniBand | infiniband)
DEVICETYPE="ib"
;;
+ OVS*)
+ DEVICETYPE="ovs"
+ ;;
esac
if [ -n "$HWADDR" ]; then
HWADDR=$(echo $HWADDR | awk '{ print toupper($0) }')
@@ -172,9 +172,10 @@ source_config ()
else
ISALIAS=no
fi
- ! is_false $NM_CONTROLLED && is_nm_running && _use_nm=true
- if [ -z "$UUID" -a "$_use_nm" = "true" ]; then
+ if ! is_false $NM_CONTROLLED && is_nm_running; then
+ nmcli con load "/etc/sysconfig/network-scripts/$CONFIG"
UUID=$(get_uuid_by_config $CONFIG)
+ [ -n "$UUID" ] && _use_nm=true
fi
}
@@ -289,6 +290,12 @@ is_nm_active ()
LANG=C LC_ALL=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:connected$"
}
+is_nm_handling ()
+{
+ [ -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 ()
{
[ -x /usr/bin/nmcli ] && \
@@ -443,9 +450,40 @@ is_wireless_device ()
install_bonding_driver ()
{
- [ -d "/sys/class/net/$1" ] && return 0
[ ! -f /sys/class/net/bonding_masters ] && ( modprobe bonding || return 1 )
- echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null
+ if ! grep -sqw "$1" /sys/class/net/bonding_masters; then
+ echo "+$1" > /sys/class/net/bonding_masters 2>/dev/null
+ fi
+ (
+ # Set config here
+ need_config "$1"
+ source_config
+ if [ -f /sys/class/net/${DEVICE}/bonding/slaves -a $(wc -l < /sys/class/net/${DEVICE}/bonding/slaves) -eq 0 ]; then
+ /sbin/ip link set dev ${DEVICE} down
+
+ # add the bits to setup driver parameters here
+ for arg in $BONDING_OPTS ; do
+ key=${arg%%=*};
+ value=${arg##*=};
+ if [ "${key}" = "arp_ip_target" -a "${value:0:1}" != "+" ]; then
+ OLDIFS=$IFS;
+ IFS=',';
+ for arp_ip in $value; do
+ if ! grep -q $arp_ip /sys/class/net/${DEVICE}/bonding/$key; then
+ echo +$arp_ip > /sys/class/net/${DEVICE}/bonding/$key
+ fi
+ done
+ IFS=$OLDIFS;
+ elif [ "${key}" = "arp_ip_target" ]; then
+ if ! grep -q ${value#+} /sys/class/net/${DEVICE}/bonding/$key; then
+ echo "$value" > /sys/class/net/${DEVICE}/bonding/$key
+ fi
+ elif [ "${key}" != "primary" ]; then
+ echo $value > /sys/class/net/${DEVICE}/bonding/$key
+ fi
+ done
+ fi
+ )
return 0
}
@@ -495,7 +533,7 @@ change_resolv_conf ()
if [ $r -eq 0 ]; then
[ -x /sbin/restorecon ] && /sbin/restorecon /etc/resolv.conf >/dev/null 2>&1 # reset the correct context
/usr/bin/logger -p local7.notice -t "NET" -i "$0 : updated /etc/resolv.conf";
- [ -n "$(/bin/pidof nscd)" ] && [ ! -e "$RESOLVCONF_FLAGFILE" ] && /usr/sbin/nscd -i hosts; # invalidate cache
+ [ -e /var/run/nscd/socket ] && /usr/sbin/nscd -i hosts; # invalidate cache
fi;
return $r;
}