aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2002-06-26 02:30:42 +0000
committerBill Nottingham <notting@redhat.com>2002-06-26 02:30:42 +0000
commitb344e5585a4894d6de30aefa3c54b2e692382cbd (patch)
treea07c95c7b941e3a6c2e2434302bb8fbb42810086
parentafc5d1bea9291d6f082ee6a0ed356367979f3c05 (diff)
downloadinitscripts-b344e5585a4894d6de30aefa3c54b2e692382cbd.tar
initscripts-b344e5585a4894d6de30aefa3c54b2e692382cbd.tar.gz
initscripts-b344e5585a4894d6de30aefa3c54b2e692382cbd.tar.bz2
initscripts-b344e5585a4894d6de30aefa3c54b2e692382cbd.tar.xz
initscripts-b344e5585a4894d6de30aefa3c54b2e692382cbd.zip
dhclient support <dsainty@redhat.com>
-rwxr-xr-xsysconfig/network-scripts/ifdown6
-rwxr-xr-xsysconfig/network-scripts/ifup28
2 files changed, 31 insertions, 3 deletions
diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown
index a646ff70..95f11001 100755
--- a/sysconfig/network-scripts/ifdown
+++ b/sysconfig/network-scripts/ifdown
@@ -69,6 +69,12 @@ fi
retcode=0
if [ "$BOOTPROTO" = bootp -o "$BOOTPROTO" = dhcp ]; then
+ [ -n "`pidof -x dhclient`" ] && {
+ if [ -f "/var/run/dhclient-${DEVICE}.pid" ]; then
+ kill `cat /var/run/dhclient-${DEVICE}.pid` >/dev/null 2>&1
+ retcode=$?
+ fi
+ }
[ -n "`pidof -x dhcpcd`" ] && {
if [ -f "/etc/dhcpc/dhcpcd-${DEVICE}.pid" ]; then
kill `cat /etc/dhcpc/dhcpcd-${DEVICE}.pid` >/dev/null 2>&1
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup
index 8320d2f5..da639adb 100755
--- a/sysconfig/network-scripts/ifup
+++ b/sysconfig/network-scripts/ifup
@@ -134,19 +134,39 @@ if [ -f /etc/sysconfig/ipchains -a \
FWACTIVE=1
export FWACTIVE
fi
-
+
+# Remove any temporary references which were previously added to dhclient config
+if [ -w /etc/dhclient-${DEVICE}.conf ] && [ -x /sbin/dhclient ] ; then
+ grep -v "# temporary RHL ifup addition" /etc/dhclient-${DEVICE}.conf > /etc/dhclient-${DEVICE}.conf.ifupnew 2> /dev/null
+ cat /etc/dhclient-${DEVICE}.conf.ifupnew > /etc/dhclient-${DEVICE}.conf
+ rm -f /etc/dhclient-${DEVICE}.conf.ifupnew
+fi
+
if [ -n "${DYNCONFIG}" ]; then
PUMPARGS=$PUMPARGS
DHCPCDARGS="$DHCPCDARGS -n"
+ DHCLIENTARGS="${DHCLIENTARGS} -1 -q -lf /var/lib/dhcp/dhclient-${DEVICE}.leases -pf /var/run/dhclient-${DEVICE}.pid -cf /etc/dhclient-${DEVICE}.conf"
if [ -n "${DHCP_HOSTNAME}" ]; then
+ # Send a host-name to the DHCP server (requ. by some dhcp servers).
PUMPARGS="${PUMPARGS} -h ${DHCP_HOSTNAME}"
DHCPCDARGS="${DHCPCDARGS} -h ${DHCP_HOSTNAME}"
+ if [ -x /sbin/dhclient ] ; then
+ if [ -w /etc/dhclient-${DEVICE}.conf ] ; then
+ if ! grep "send *host-name *\"${DHCP_HOSTNAME}\"" /etc/dhclient-${DEVICE}.conf > /dev/null 2>&1 ; then
+ echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf
+ fi
+ elif ! [ -e /etc/dhclient-${DEVICE}.conf ] ; then
+ echo "send host-name \"${DHCP_HOSTNAME}\"; # temporary RHL ifup addition" >> /etc/dhclient-${DEVICE}.conf
+ fi
+ fi
fi
if need_hostname; then
+ # Set hostname of host to host-name option supplied by DHCP.
PUMPARGS="${PUMPARGS} --lookup-hostname"
DHCPCDARGS="${DHCPCDARGS} -H"
fi
if [ "${PEERDNS}" = "no" ]; then
+ # Do not update/replace resolv.conf.
PUMPARGS="${PUMPARGS} -d"
DHCPCDARGS="${DHCPCDARGS} -R"
fi
@@ -165,9 +185,11 @@ if [ -n "${DYNCONFIG}" ]; then
FWHACK=1
fi
- if [ -x /sbin/dhcpcd ] && /sbin/dhcpcd ${DHCPCDARGS} ${DEVICE} ; then
+ if [ -x /sbin/dhclient ] && /sbin/dhclient ${DHCLIENTARGS} ${DEVICE} ; then
+ echo $" done."
+ elif [ -z "`pidof -x dhclient`" ] && [ -x /sbin/dhcpcd ] && /sbin/dhcpcd ${DHCLIENTARGS} ${DEVICE} ; then
echo $" done."
- elif [ -z "`pidof -x dhcpcd`" ] && [ -x /sbin/pump ] && /sbin/pump ${PUMPARGS} -i ${DEVICE}; then
+ elif [ -z "`pidof -x dhclient`" ] && [ -z "`pidof -x dhcpcd`" ] && [ -x /sbin/pump ] && /sbin/pump ${PUMPARGS} -i ${DEVICE}; then
echo $" done."
else
echo $" failed."