aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2010-03-03 16:28:14 -0500
committerBill Nottingham <notting@redhat.com>2010-03-03 16:28:14 -0500
commit6a8455a700782b40e474963dc42dda3b1d14fc68 (patch)
tree3cea343c175a973f95ce16c9855497944fbe925a
parent3a86ed0b2e6c145ec9cbdf49b36e07b5bb13b36d (diff)
parentbab107339ca07cbbef05ac79bd34b19d8a081fe4 (diff)
downloadinitscripts-6a8455a700782b40e474963dc42dda3b1d14fc68.tar
initscripts-6a8455a700782b40e474963dc42dda3b1d14fc68.tar.gz
initscripts-6a8455a700782b40e474963dc42dda3b1d14fc68.tar.bz2
initscripts-6a8455a700782b40e474963dc42dda3b1d14fc68.tar.xz
initscripts-6a8455a700782b40e474963dc42dda3b1d14fc68.zip
Merge branch 'nm-integration'
-rw-r--r--initscripts.spec1
-rwxr-xr-xsysconfig/network-scripts/ifdown7
-rwxr-xr-xsysconfig/network-scripts/ifup7
-rwxr-xr-xsysconfig/network-scripts/ifup-eth2
-rw-r--r--sysconfig/network-scripts/network-functions43
5 files changed, 54 insertions, 6 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 1d7b5ed3..cbe8aedf 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -40,6 +40,7 @@ Conflicts: dmraid < 1.0.0.rc16-7
Conflicts: e2fsprogs < 1.15
# http://bugzilla.redhat.com/show_bug.cgi?id=252973
Conflicts: nut < 2.2.0
+Conflicts: NetworkManager < 1:0.8.0
Obsoletes: hotplug <= 3:2004_09_23-10.1
Requires(pre): /usr/sbin/groupadd
Requires(post): /sbin/chkconfig, coreutils
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index a0cc0c9e..fd766427 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -16,7 +16,7 @@ CONFIG=$1
exit 1
}
-need_config $CONFIG
+need_config "${CONFIG}"
[ -f "$CONFIG" ] || {
echo $"usage: ifdown <device name>" >&2
@@ -41,6 +41,11 @@ then
exit 0
fi
+if [ "$USE_NM" = "true" ]] && is_nm_active "$DEVICE" ; then
+ nmcli dev disconnect iface "$DEVICE"
+ exit $?
+fi
+
if [ -x /sbin/ifdown-pre-local ]; then
/sbin/ifdown-pre-local ${DEVICE}
fi
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index e3b01478..cc5efc97 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -31,7 +31,7 @@ CONFIG=${1}
exit 1
}
-need_config ${CONFIG}
+need_config "${CONFIG}"
[ -f "${CONFIG}" ] || {
echo $"$0: configuration for ${1} not found." >&2
@@ -65,6 +65,11 @@ then
exit 0
fi
+if [ "$USE_NM" = "true" -a -n "$UUID" ]; then
+ nmcli con up uuid "$UUID"
+ exit $?
+fi
+
# Ethernet 802.1Q VLAN support
if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -x /sbin/vconfig ]; then
VID=""
diff --git a/sysconfig/network-scripts/ifup-eth b/sysconfig/network-scripts/ifup-eth
index 17312863..51d1ae4f 100755
--- a/sysconfig/network-scripts/ifup-eth
+++ b/sysconfig/network-scripts/ifup-eth
@@ -24,7 +24,7 @@ cd /etc/sysconfig/network-scripts
CONFIG=${1}
-need_config ${CONFIG}
+need_config "${CONFIG}"
source_config
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions
index 89baeb45..e498553b 100644
--- a/sysconfig/network-scripts/network-functions
+++ b/sysconfig/network-scripts/network-functions
@@ -20,6 +20,13 @@ get_hwaddr ()
fi
}
+get_config_by_device ()
+{
+ LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \
+ /etc/sysconfig/network-scripts/ifcfg-* \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
get_config_by_hwaddr ()
{
LANG=C grep -il "^[[:space:]]*HWADDR=${1}\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \
@@ -34,11 +41,24 @@ get_config_by_subchannel ()
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
}
+get_config_by_name ()
+{
+ LANG=C grep -E -i -l \
+ "^[[:space:]]*NAME=\"(Auto |System )?${1}\"" \
+ /etc/sysconfig/network-scripts/ifcfg-* \
+ | LC_ALL=C sed -e "$__sed_discard_ignored_files"
+}
+
get_device_by_hwaddr ()
{
LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }"
}
+get_uuid_by_config ()
+{
+ dbus-send --system --print-reply --dest=com.redhat.ifcfgrh1 /com/redhat/ifcfgrh1 com.redhat.ifcfgrh1.GetIfcfgDetails string:"/etc/sysconfig/network-scripts/$1" | awk -F '"' '/string / { print $2 }'
+}
+
need_config ()
{
local nconfig
@@ -47,6 +67,11 @@ need_config ()
[ -f "${CONFIG}" ] && return
CONFIG="${1##*/}"
[ -f "${CONFIG}" ] && return
+ nconfig=$(get_config_by_name "${1}")
+ if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then
+ CONFIG=${nconfig##*/}
+ return
+ fi
local addr=$(get_hwaddr ${1})
if [ -n "$addr" ]; then
nconfig=$(get_config_by_hwaddr ${addr})
@@ -55,9 +80,7 @@ need_config ()
[ -f "${CONFIG}" ] && return
fi
fi
- nconfig=$(LANG=C grep -l "^[[:space:]]*DEVICE=${1}\([[:space:]#]\|$\)" \
- /etc/sysconfig/network-scripts/ifcfg-* \
- | LC_ALL=C sed -e "$__sed_discard_ignored_files")
+ nconfig=$(get_config_by_device ${1})
if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then
CONFIG=${nconfig##*/}
return
@@ -120,6 +143,10 @@ source_config ()
else
ISALIAS=no
fi
+ is_nm_running && USE_NM=true
+ if [ -z "$UUID" -a "$USE_NM" = "true" ]; then
+ UUID=$(get_uuid_by_config $CONFIG)
+ fi
}
@@ -172,6 +199,16 @@ do_netreport ()
)
}
+is_nm_running ()
+{
+ LANG=C nmcli nm status | grep -Eq "NM running:[[:space:]]+running"
+}
+
+is_nm_active ()
+{
+ LANG=C nmcli -t dev status | grep -Eq "^${1}[[:space:]]*.*[[:space:]]*connected"
+}
+
# Sets $alias to the device module if $? != 0
is_available ()
{