diff options
author | Colin Guthrie <colin@mageia.org> | 2011-11-03 22:26:54 +0000 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2011-11-03 22:26:54 +0000 |
commit | 1e6179bf54cbc84b4ad33480e7f2f713418bb28a (patch) | |
tree | 794b2654be506d551421bcc47d3ad97822e2861c /sysconfig/network-scripts/network-functions | |
parent | 87589b49d1543595188dcb26aa5a09d33e5e0a4e (diff) | |
parent | 6ce3e4700baa4e37e6b16e4160c00b2ebea58d81 (diff) | |
download | initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.gz initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.bz2 initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.tar.xz initscripts-1e6179bf54cbc84b4ad33480e7f2f713418bb28a.zip |
Merge commit 'initscripts-9.34-1' into mga-34
This brings our fully patched initscripts branch up to version 9.34.
Some code was not easily merged and thus not all functionality relating
to multiple IP addresses per interface were merged in.
Conflicts:
Makefile
lang.csh
lang.sh
prefdm
rc.d/init.d/functions
rc.d/init.d/netfs
rc.d/init.d/network
rc.d/rc
rc.d/rc.local
rc.d/rc.sysinit
service
sysconfig.txt
sysconfig/network-scripts/ifdown-eth
sysconfig/network-scripts/ifup-eth
sysconfig/network-scripts/ifup-ipv6
sysconfig/network-scripts/ifup-sit
sysconfig/network-scripts/ifup-tunnel
sysconfig/network-scripts/network-functions
systemd/system/fedora-sysinit-unhack.service
Diffstat (limited to 'sysconfig/network-scripts/network-functions')
-rw-r--r-- | sysconfig/network-scripts/network-functions | 63 |
1 files changed, 58 insertions, 5 deletions
diff --git a/sysconfig/network-scripts/network-functions b/sysconfig/network-scripts/network-functions index 37e088a0..5ca3abe6 100644 --- a/sysconfig/network-scripts/network-functions +++ b/sysconfig/network-scripts/network-functions @@ -53,7 +53,7 @@ get_config_by_name () get_device_by_hwaddr () { - LANG=C ip -o link | grep -v link/ieee802.11 | awk -F ': ' -vIGNORECASE=1 "/$1/ { print \$2 }" + LANG=C ip -o link | awk -F ': ' -vIGNORECASE=1 '!/link\/ieee802\.11/ && /'"$1"'/ { print $2 }' } need_config () @@ -150,7 +150,21 @@ source_config () is_true $NM_CONTROLLED && USE_NM=true } - +ethtool_set() +{ + oldifs=$IFS; + IFS=';'; + for opts in $ETHTOOL_OPTS ; do + IFS=$oldifs; + if [[ "${opts}" =~ [[:space:]]*- ]]; then + /sbin/ethtool $opts + else + /sbin/ethtool -s ${REALDEVICE} $opts + fi + IFS=';'; + done + IFS=$oldifs; +} expand_config () { @@ -166,6 +180,8 @@ expand_config () eval $(/bin/ipcalc --broadcast ${IPADDR} ${NETMASK}) fi + [ -n "$DHCP_HOSTNAME" ] && DHCP_HOSTNAME=${DHCP_HOSTNAME%%.*} + if [ -z "${NETWORK}" ]; then eval $(/bin/ipcalc --network ${IPADDR} ${NETMASK}) fi @@ -188,9 +204,8 @@ do_netreport () ( cd /var/run/netreport || exit for i in * ; do if [ -f $i ]; then - OWNER=$(ls -l $i | awk '{ print $3 }') - if [ "$(id -u)" = "0" ]; then + OWNER=$(stat -c %U $i) su -s /bin/bash $OWNER -c "kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1" > /dev/null 2>&1 else kill -SIGIO $i >/dev/null 2>&1 || rm -f $i >/dev/null 2>&1 @@ -214,7 +229,7 @@ is_nm_active () is_nm_device_unmanaged () { - LANG=C LC_ALL=C nmcli -t --fields device,state dev status 2>/dev/null | grep -q "^${1}:unmanaged$" + LANG=C LC_ALL=C nmcli -t --fields GENERAL dev list iface "${1}" 2>/dev/null | awk -F ':' '/GENERAL.STATE/ { if ($2 == "unmanaged") exit 0 ; else exit 1; }' } # Sets $alias to the device module if $? != 0 @@ -438,3 +453,41 @@ clear_resolv_conf () rm -f /etc/resolv.conf.save fi } + +# Logging function +# +# Usage: net_log <message> <err|warning|info> <optional file/function name> +# +# Default level is 'err'. + +net_log() { + local message="$1" + local level="$2" + local name="$3" + + [ -z "$message" ] && return 1 + [ -z "$level" ] && level=err + [ -z "$name" ] && name=$0 + + case $level in + 'debug') + local txt_level=$"DEBUG " + ;; + 'err') + local txt_level=$"ERROR " + ;; + 'warning') + local txt_level=$"WARN " + ;; + 'info') + local txt_level=$"INFO " + ;; + esac + + echo "$txt_level: [$name] $message" + + if [ -x /usr/bin/logger ]; then + /usr/bin/logger -p daemon.$level -t "$name" "$message" + fi + return 0 +} |