dhclient-script: source ifcfg-* because of PEERDNS (#1277253)
This commit is contained in:
parent
262d627cf9
commit
3a458259f5
@ -709,20 +709,74 @@ change_resolv_conf ()
|
|||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
need_config ()
|
get_config_by_name ()
|
||||||
{
|
{
|
||||||
# Do we really need this ?
|
LANG=C grep -E -i -l \
|
||||||
# The original one from /etc/sysconfig/network-scripts/network-functions
|
"^[[:space:]]*NAME=\"(Auto |System )?${1}\"" \
|
||||||
# seems to set CONFIG variable, which we don't use anywhere AFAICT.
|
/etc/sysconfig/network-scripts/ifcfg-* \
|
||||||
:
|
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_hwaddr ()
|
||||||
|
{
|
||||||
|
if [ -f /sys/class/net/${1}/address ]; then
|
||||||
|
awk '{ print toupper($0) }' < /sys/class/net/${1}/address
|
||||||
|
elif [ -d "/sys/class/net/${1}" ]; then
|
||||||
|
LC_ALL= LANG= ip -o link show ${1} 2>/dev/null | \
|
||||||
|
awk '{ print toupper(gensub(/.*link\/[^ ]* ([[:alnum:]:]*).*/,
|
||||||
|
"\\1", 1)); }'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
get_config_by_hwaddr ()
|
||||||
|
{
|
||||||
|
LANG=C grep -il "^[[:space:]]*HWADDR=\"\?${1}\"\?\([[:space:]#]\|$\)" /etc/sysconfig/network-scripts/ifcfg-* \
|
||||||
|
| LC_ALL=C sed -e "$__sed_discard_ignored_files"
|
||||||
|
}
|
||||||
|
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
need_config ()
|
||||||
|
{
|
||||||
|
# A sed expression to filter out the files that is_ignored_file recognizes
|
||||||
|
__sed_discard_ignored_files='/\(~\|\.bak\|\.orig\|\.rpmnew\|\.rpmorig\|\.rpmsave\)$/d'
|
||||||
|
|
||||||
|
local nconfig
|
||||||
|
|
||||||
|
CONFIG="ifcfg-${1}"
|
||||||
|
[ -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})
|
||||||
|
if [ -n "$nconfig" ] ; then
|
||||||
|
CONFIG=${nconfig##*/}
|
||||||
|
[ -f "${CONFIG}" ] && return
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
nconfig=$(get_config_by_device ${1})
|
||||||
|
if [ -n "$nconfig" ] && [ -f "$nconfig" ]; then
|
||||||
|
CONFIG=${nconfig##*/}
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# We need this because of PEERDNS
|
||||||
source_config ()
|
source_config ()
|
||||||
{
|
{
|
||||||
# Do we really need to source /etc/sysconfig/network-scripts/$CONFIG ?
|
CONFIG=${CONFIG##*/}
|
||||||
# I don't think we use for example
|
. /etc/sysconfig/network-scripts/$CONFIG
|
||||||
# DEVNAME, DEVICE, DEVICETYPE, HWADDR, MACADDR, ISALIAS or UUID anywhere.
|
|
||||||
:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
Summary: Dynamic host configuration protocol software
|
Summary: Dynamic host configuration protocol software
|
||||||
Name: dhcp
|
Name: dhcp
|
||||||
Version: 4.3.3
|
Version: 4.3.3
|
||||||
Release: 5%{?dist}
|
Release: 6%{?dist}
|
||||||
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
# NEVER CHANGE THE EPOCH on this package. The previous maintainer (prior to
|
||||||
# dcantrell maintaining the package) made incorrect use of the epoch and
|
# dcantrell maintaining the package) made incorrect use of the epoch and
|
||||||
# that's why it is at 12 now. It should have never been used, but it was.
|
# that's why it is at 12 now. It should have never been used, but it was.
|
||||||
@ -663,6 +663,9 @@ done
|
|||||||
%doc doc/html/
|
%doc doc/html/
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 03 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.3-6
|
||||||
|
- dhclient-script: source ifcfg-* because of PEERDNS (#1277253)
|
||||||
|
|
||||||
* Tue Oct 13 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.3-5
|
* Tue Oct 13 2015 Jiri Popelka <jpopelka@redhat.com> - 12:4.3.3-5
|
||||||
- dhclient-script: fix for gateway not in the end of rfc3442 routes list (#1251644)
|
- dhclient-script: fix for gateway not in the end of rfc3442 routes list (#1251644)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user