Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Evergreen:11.2
sysconfig
sysconfig-ifup-dhcp-dhcpcd-config-sync.bnc51821...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File sysconfig-ifup-dhcp-dhcpcd-config-sync.bnc518219.diff of Package sysconfig
From ab1c0052856a2d2efbaf292076029d68a9ca6801 Mon Sep 17 00:00:00 2001 From: mt <mt@bf393798-0adf-0310-9952-bd479070b6c1> Date: Wed, 16 Dec 2009 21:39:35 +0000 Subject: [PATCH] Synchronized ifup-dhcp and dhcpcd configuration steps to report status after dhcpcd really finished all its steps (bnc#518219). git-svn-id: https://svn.suse.de/svn/sysconfig/branches/opensuse-11.2@2069 bf393798-0adf-0310-9952-bd479070b6c1 --- scripts/dhcpcd-hook | 29 +++++++++++++++++++++-------- scripts/ifup-dhcp | 47 ++++++++++++++++++++++++++++++----------------- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/scripts/dhcpcd-hook b/scripts/dhcpcd-hook index 2fcb5f4..5c5ff45 100755 --- a/scripts/dhcpcd-hook +++ b/scripts/dhcpcd-hook @@ -133,6 +133,9 @@ hostname_changed() case $state in up) + write_cached_config_data dhcp4_state up $INTERFACE + commit_cached_config_data $INTERFACE + $debug && $log_dbg "Running ifup $INTERFACE -o dhcp" ifup $INTERFACE -o dhcp @@ -141,12 +144,11 @@ up) -i $INTERFACE $NC_OPTIONS \ -l $leaseinfo 2>&1 | $log_dbg - if hostname_changed ; then - # reload syslog so it knows the new hostname - /etc/init.d/syslog reload - fi ;; down) + write_cached_config_data dhcp4_state down $INTERFACE + commit_cached_config_data $INTERFACE + # We now call PRE_DOWN_SCRIPT directly from ifdown, because it was called # POST from here (after IP address was removed). Thus we don't need this # $debug && $log_dbg "Running ifdown $INTERFACE -o dhcp" @@ -158,6 +160,9 @@ down) 2>&1 | $log_dbg ;; new) + write_cached_config_data dhcp4_state new $INTERFACE + commit_cached_config_data $INTERFACE + $debug && $log_dbg "new IP address: $IPADDR" $debug && NC_OPTIONS="-v" @@ -165,15 +170,23 @@ new) -i $INTERFACE $NC_OPTIONS \ < $leaseinfo 2>&1 | $log_dbg + $debug && $log_dbg "Running ifdown $INTERFACE -o dhcp" + ifdown $INTERFACE -o dhcp + $debug && $log_dbg "Running ifup $INTERFACE -o dhcp" + ifup $INTERFACE -o dhcp + ;; +complete) + # dhcpcd finished all requested configuration steps ... + # check if hostname changed and reload syslog when needed if hostname_changed ; then # reload syslog so it knows the new hostname /etc/init.d/syslog reload fi - $debug && $log_dbg "Running ifdown $INTERFACE -o dhcp" - ifdown $INTERFACE -o dhcp - $debug && $log_dbg "Running ifup $INTERFACE -o dhcp" - ifup $INTERFACE -o dhcp + $debug && $log_dbg "DHCP4 configuration of $INTERFACE is complete" + + write_cached_config_data dhcp4_state complete $INTERFACE + commit_cached_config_data $INTERFACE ;; esac diff --git a/scripts/ifup-dhcp b/scripts/ifup-dhcp index f2f0a3a..cad54ae 100755 --- a/scripts/ifup-dhcp +++ b/scripts/ifup-dhcp @@ -47,7 +47,7 @@ test "$DEBUG" = "EXTRA" && . scripts/extradebug # check arguments and how we are called (in case of links) # SCRIPTNAME=${0##*/} -debug $* +debug "$SCRIPTNAME $*" case "${SCRIPTNAME}" in ifup-*) ACTION=start ;; @@ -555,7 +555,7 @@ case "$ACTION" in # remember the hostname to handle a change later write_cached_config_data hostname "`hostname 2>/dev/null`" $INTERFACE - commit_cached_config_data $INTERFACE + commit_cached_config_data $INTERFACE debug "Activating interface $INTERFACE" if ! is_iface_up $INTERFACE ; then @@ -590,14 +590,19 @@ case "$ACTION" in case "$DHCLIENT" in (dhcpcd) test -n "$DHCP4_STATUS" || { - start_dhcp4_dhcpcd - DHCP4_STARTED="yes" + start_dhcp4_dhcpcd && { + DHCP4_STARTED="yes" + write_cached_config_data dhcp4_client $DHCLIENT $INTERFACE + write_cached_config_data dhcp4_state started $INTERFACE + commit_cached_config_data $INTERFACE + } || DHCP4_STATUS=$? } ;; (dhclient) test -n "$DHCP4_STATUS" || { - start_dhcp4_dhclient - DHCP4_STARTED="yes" + start_dhcp4_dhclient && { + DHCP4_STARTED="yes" + } || DHCP4_STATUS=$? } ;; esac @@ -606,8 +611,9 @@ case "$ACTION" in case "$DHCLIENT6" in (dhcp6c) test -n "$DHCP6_STATUS" || { - start_dhcp6_dhcp6c - DHCP6_STARTED="yes" + start_dhcp6_dhcp6c && { + DHCP6_STARTED="yes" + } || DHCP6_STATUS=$? } ;; #(dhclient) @@ -620,8 +626,9 @@ case "$ACTION" in ;; esac done + ### FIXME # don't hurry too much... - [ "x$DHCP6_STARTED" = xyes -o "x$DHCP4_STARTED" = xyes ] && sleep 1 + ###[ "x$DHCP6_STARTED" = xyes -o "x$DHCP4_STARTED" = xyes ] && sleep 1 # # in case we've started at least one client, wait the specified @@ -630,9 +637,7 @@ case "$ACTION" in DHCP4_MESSAGE='' DHCP6_MESSAGE='' - # - # TODO: does one the actual clients still exit on infinite lease?? - # (dhcpcd does not do this any more) + typeset -i wusleep=100000 typeset -i wab_max=${DHCLIENT_WAIT_AT_BOOT:-15}; let wab_max\*=10 for ((wab_cnt=0; wab_cnt<=wab_max; wab_cnt++)); do @@ -652,7 +657,8 @@ case "$ACTION" in fi [ -n "$DHCP4_STATUS" ] && continue - if [ -e $info -a ! $info -ot $stamp ]; then + state=`read_cached_config_data dhcp4_state $INTERFACE` + if [ "x$state" = "xcomplete" -a -e $info -a ! $info -ot $stamp ]; then IP='' ; NM='' ; HN='' while read line ; do case "$line" in @@ -730,7 +736,10 @@ case "$ACTION" in done if [ -z "$DHCP4_STATUS" -o -z "$DHCP6_STATUS" ] ; then ((wab_cnt % 20 == 1)) && message_n .\ - usleep 100000 + usleep $wusleep + else + # ok, we have status from both clients now => done + break fi done message " " @@ -962,8 +971,10 @@ case "$ACTION" in #if [ $STATUS -eq $R_SUCCESS ] ; then # delete primary flag from cache file if needed - delete_from_cached_config_data primary yes $INTERFACE - commit_cached_config_data $INTERFACE + delete_from_cached_config_data primary yes $INTERFACE + delete_from_cached_config_data 'dhcp4_*' '' $INTERFACE + delete_from_cached_config_data 'dhcp6_*' '' $INTERFACE + commit_cached_config_data $INTERFACE # This is useful for pcmcia interfaces... before the modules can be # unloaded, the device must be unused. @@ -996,7 +1007,9 @@ case "$ACTION" in stamp=/var/lib/dhcpcd/dhcpcd-$INTERFACE.timestamp info=/var/lib/dhcpcd/dhcpcd-$INTERFACE.info - if [ \( -e $info -a ! $info -ot $stamp \) -a -n \ + state=`read_cached_config_data dhcp4_state $INTERFACE` + if [ "x$state" = "xcomplete" -a \ + \( -e $info -a ! $info -ot $stamp \) -a -n \ "`ip -o -f inet addr show $INTERFACE`" ]; then while read line ; do case "$line" in -- 1.6.4.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor