From bc0b04f3d8b26726757839bf3f806cb0c0e1ecbbbe058615b105b9906452ca04 Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Fri, 12 Mar 2010 15:57:53 +0000 Subject: [PATCH] - Fixed dhclient-script to call ifup -o dhcp and signal "complete" to ifup when all configuration is done (bnc#585380,bnc#518219). OBS-URL: https://build.opensuse.org/package/show/network:dhcp/dhcp?expand=0&rev=9 --- dhcp-3.1.3-dhclient-script.bnc585380.dif | 156 +++++++++++++++++++++++ dhcp.changes | 6 + dhcp.spec | 2 + 3 files changed, 164 insertions(+) create mode 100644 dhcp-3.1.3-dhclient-script.bnc585380.dif diff --git a/dhcp-3.1.3-dhclient-script.bnc585380.dif b/dhcp-3.1.3-dhclient-script.bnc585380.dif new file mode 100644 index 0000000..4c837f0 --- /dev/null +++ b/dhcp-3.1.3-dhclient-script.bnc585380.dif @@ -0,0 +1,156 @@ +--- client/scripts/linux ++++ client/scripts/linux 2010/03/04 13:30:09 +@@ -29,8 +29,7 @@ + # if DHCLIENT_DEBUG is set in sysconfig/network/dhcp + # + SYSCONFIG_CFG_DIR="/etc/sysconfig/network" +-SYSCONFIG_RUN_DIR=`. "$SYSCONFIG_CFG_DIR/scripts/functions" \ +- 2>/dev/null && echo "$RUN_FILES_BASE"` ++. "$SYSCONFIG_CFG_DIR/scripts/functions" + SYSCONFIG_RUN_DIR=${SYSCONFIG_RUN_DIR:-/dev/.sysconfig/network} + eval `grep "^DHCLIENT_DEBUG=" "$SYSCONFIG_CFG_DIR/dhcp" 2>/dev/null` + if [ "$DHCLIENT_DEBUG" = yes ]; then +@@ -40,7 +39,7 @@ if [ "$DHCLIENT_DEBUG" = yes ]; then + echo "$0 $*" + date + echo '----------------' +- set ++ env + echo '----------------' + ) >> /var/log/dhclient-script.log + exec 2>> /var/log/dhclient-script.log +@@ -48,6 +47,10 @@ if [ "$DHCLIENT_DEBUG" = yes ]; then + set -x + fi + ++is_ifup_controlled() ++{ ++ test -f "$SYSCONFIG_RUN_DIR/if-${interface}" ++} + # netconfig makes all "additional" modifications as DNS or NTP + use_netconfig() { + test -x /sbin/netconfig +@@ -94,9 +97,7 @@ netconfig_remove() { + } + set_default_gw_route() + { +- if test -f "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" -o \ +- -f "$SYSCONFIG_RUN_DIR/if-${interface}" ; +- then ++ if is_ifup_controlled ; then + if grep -qs '^primary=yes' "$SYSCONFIG_RUN_DIR/if-${interface}" 2>/dev/null ; + then + eval `grep --no-filename '^[[:space:]]*DHCLIENT_SET_DEFAULT_ROUTE=' \ +@@ -134,9 +135,7 @@ set_default_gw_route() + } + set_hostname() + { +- if test -f "$SYSCONFIG_CFG_DIR/ifcfg-${interface}" -o \ +- -f "$SYSCONFIG_RUN_DIR/if-${interface}" ; +- then ++ if is_ifup_controlled ; then + if grep -qs '^primary=yes' "$SYSCONFIG_RUN_DIR/if-${interface}" 2>/dev/null ; + then + eval `grep --no-filename "^[[:space:]]*DHCLIENT_SET_HOSTNAME=" \ +@@ -157,13 +156,14 @@ set_hostname() + [ "x${current_hostname%%.*}" = "xlocalhost" ] || \ + [ "x${current_hostname%%.*}" != "x${new_host_name%%.*}" ]; then + +- if [ "x${new_host_name%%.*}" != x ]; then ++ if [ "x${new_host_name%%.*}" != "x" ]; then + hostname "${new_host_name%%.*}" + else + if [ -x /usr/bin/host ] ; then + if out=`host -W 2 "$new_ip_address" 2>/dev/null` ; then + _hostname="`echo "$out" | sed 's:^.* ::; s:\..*::'`" +- if [ "x${_hostname}" != x ]; then ++ if [ "x${_hostname}" != "x" -a \ ++ "x${_hostname}" != "x${current_hostname%%.*}" ]; then + hostname "${_hostname}" + fi + fi +@@ -171,6 +171,20 @@ set_hostname() + fi + fi + fi ++ if is_ifup_controlled ; then ++ # check regardless the DHCLIENT_SET_HOSTNAME setting ++ # and whether we've set it above or not, because when ++ # it changed, we've to handle it anyway... ++ local OLD_HOSTNAME=`read_cached_config_data hostname $interface` ++ local CUR_HOSTNAME=`hostname 2>/dev/null` ++ if test "x$OLD_HOSTNAME" != "x$CUR_HOSTNAME" ; then ++ write_cached_config_data hostname "$CUR_HOSTNAME" $interface ++ commit_cached_config_data $interface ++ ++ # reload syslog so it knows the new hostname ++ /etc/init.d/syslog reload ++ fi ++ fi + } + + resolv_conf_dhclient="/var/lib/dhcp/resolv.conf.dhclient.$interface" +@@ -300,7 +314,15 @@ if [ x$reason = xBOUND ] || [ x$reason = + # and clear the ARP cache. + ifconfig $interface inet 0 + ++ if is_ifup_controlled ; then ++ write_cached_config_data dhcp4_state "new" $interface ++ commit_cached_config_data $interface ++ fi ++ elif is_ifup_controlled ; then ++ write_cached_config_data dhcp4_state "up" $interface ++ commit_cached_config_data $interface + fi ++ + if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \ + [ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then + +@@ -328,7 +350,20 @@ if [ x$reason = xBOUND ] || [ x$reason = + make_resolv_conf + fi + ++ if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then ++ if is_ifup_controlled ; then ++ ifdown $interface -o dhcp ++ fi ++ fi ++ + set_hostname ++ if is_ifup_controlled ; then ++ # execute ifservice and if-up.d scripts ++ ifup $interface -o dhcp ++ ++ write_cached_config_data dhcp4_state "complete" $interface ++ commit_cached_config_data $interface ++ fi + + exit_with_hooks 0 + fi +@@ -376,12 +411,26 @@ if [ x$reason = xTIMEOUT ]; then + make_resolv_conf + fi + ++ set_hostname ++ if is_ifup_controlled ; then ++ # execute ifservice and if-up.d scripts ++ ifup $interface -o dhcp ++ ++ write_cached_config_data dhcp4_state "complete" $interface ++ commit_cached_config_data $interface ++ fi ++ + exit_with_hooks 0 + fi + ifconfig $interface inet 0 + exit_with_hooks 1 + fi + ++if is_ifup_controlled ; then ++ write_cached_config_data dhcp4_state "down" $interface ++ commit_cached_config_data $interface ++fi ++ + if use_netconfig ; then + netconfig_remove + else diff --git a/dhcp.changes b/dhcp.changes index aede6ef..d9f4b0b 100644 --- a/dhcp.changes +++ b/dhcp.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Mar 12 15:53:09 UTC 2010 - mt@suse.de + +- Fixed dhclient-script to call ifup -o dhcp and signal "complete" + to ifup when all configuration is done (bnc#585380,bnc#518219). + ------------------------------------------------------------------- Thu Jan 7 20:41:13 CET 2010 - jengelh@medozas.de diff --git a/dhcp.spec b/dhcp.spec index da8b0aa..bdb1412 100644 --- a/dhcp.spec +++ b/dhcp.spec @@ -81,6 +81,7 @@ Patch50: dhcp-3.1.1-dhclient-conf.dif Patch51: dhcp-3.1.3-dhclient-conf.bnc516459.dif Patch60: dhcp-3.1.3-dhclient-script.dif Patch61: dhcp-3.1.3-dhclient-script.bnc555095.dif +Patch62: dhcp-3.1.3-dhclient-script.bnc585380.dif ## Obsoletes: dhcp-base Provides: dhcp-base:/usr/bin/omshell @@ -208,6 +209,7 @@ Authors: %patch51 -p0 %patch60 -p0 %patch61 -p0 +%patch62 -p0 ## find . -type f -name \*.cat\* -exec rm -f {} \; cp -p %{S:2} %{S:3} %{S:11} %{S:12} %{S:14} %{S:32} %{S:33} .