File sysconfig-ifup-dhcp-status-codes.bnc460093.diff of Package sysconfig
--- scripts/ifup-dhcp
+++ scripts/ifup-dhcp 2009/03/04 17:39:56
@@ -476,16 +476,16 @@ case "$ACTION" in
DHCP4_STATUS=$R_DHCP_BG
if test "$RUN_FROM_RC" = yes; then
print_mesg mesg "DHCP4 client is already running"
- while read a b c d e f g h i; do
- case "$d" in
- 169.254.*) continue ;;
- esac
- print_mesg mesg "IP address: $d"
- DHCP4_STATUS=$R_SUCCESS
- done < <(ip -o -4 addr show $INTERFACE)
else
mesg "DHCP4 client is already running on $INTERFACE"
fi
+ while read a b c d e f g h i; do
+ case "$d" in
+ 169.254.*) continue ;;
+ esac
+ print_mesg mesg "IP address: $d"
+ DHCP4_STATUS=$R_SUCCESS
+ done < <(ip -o -4 addr show $INTERFACE)
fi
#fi
;;
@@ -499,16 +499,16 @@ case "$ACTION" in
DHCP6_STATUS=$R_DHCP_BG
if test "$RUN_FROM_RC" = yes; then
print_mesg mesg "DHCP6 client is already running"
- while read a b c d rest; do
- case "$d" in
- fe80::*) continue ;;
- esac
- print_mesg mesg "IP address: $d"
- DHCP6_STATUS=$R_SUCCESS
- done < <(ip -o -6 addr show $INTERFACE)
else
mesg "DHCP6 client is already running on $INTERFACE"
fi
+ while read a b c d rest; do
+ case "$d" in
+ fe80::*) continue ;;
+ esac
+ print_mesg mesg "IP address: $d"
+ DHCP6_STATUS=$R_SUCCESS
+ done < <(ip -o -6 addr show $INTERFACE)
fi
#fi
;;
@@ -744,21 +744,42 @@ case "$ACTION" in
message "`printf " %-9s DHCP6 continues in background" $INTERFACE`"
fi
fi
- debug "DHCP4: STARTED=$DHCP4_STARTED STATUS=$DHCP4_STATUS"
- debug "DHCP6: STARTED=$DHCP6_STARTED STATUS=$DHCP6_STATUS"
-
- if [ "$DHCP4_STATUS" = $R_SUCCESS -a $DHCP6_STATUS = $R_SUCCESS ] ; then
- exit $R_SUCCESS
- elif [ "$DHCP4_STATUS" = $R_NOTRUNNING -o $DHCP6_STATUS = $R_NOTRUNNING ] ; then
- exit $R_NOTRUNNING
- elif [ "$DHCP4_STATUS" = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
- exit $R_DHCP_BG
- elif [ "$DHCP4_STATUS" != $R_NOTCONFIGURED ] ; then
+ debug "DHCP4(required=$explicit_dhcp4) STARTED=$DHCP4_STARTED STATUS=$DHCP4_STATUS"
+ debug "DHCP6(required=$explicit_dhcp6) STARTED=$DHCP6_STARTED STATUS=$DHCP6_STATUS"
+ [ -z "$DHCP4_STATUS" ] && DHCP4_STATUS=$R_ERROR
+ [ -z "$DHCP6_STATUS" ] && DHCP6_STATUS=$R_ERROR
+
+ case "${explicit_dhcp4}_${explicit_dhcp6}" in
+ (yes_yes) # BOOTPROTO=dhcp4+dhcp6 (need both to report success)
+ if [ $DHCP4_STATUS = $R_SUCCESS -a $DHCP6_STATUS = $R_SUCCESS ] ; then
+ exit $R_SUCCESS
+ elif [ $DHCP4_STATUS = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
+ exit $R_DHCP_BG
+ elif [ $DHCP4_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP4_STATUS
+ elif [ $DHCP6_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP6_STATUS
+ fi
+ ;;
+ (no_no) # BOOTPROTO=dhcp (one is sufficient)
+ if [ $DHCP4_STATUS = $R_SUCCESS -o $DHCP6_STATUS = $R_SUCCESS ] ; then
+ exit $R_SUCCESS
+ elif [ $DHCP4_STATUS = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
+ exit $R_DHCP_BG
+ elif [ $DHCP4_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP4_STATUS
+ elif [ $DHCP6_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP6_STATUS
+ fi
+ ;;
+ (yes_no) # BOOTPROTO=dhcp4
exit $DHCP4_STATUS
- elif [ "$DHCP6_STATUS" != $R_NOTCONFIGURED ] ; then
+ ;;
+ (no_yes) # BOOTPROTO=dhcp6
exit $DHCP6_STATUS
- fi
- exit 0
+ ;;
+ esac
+ exit $R_ERROR
;;
stop)
@@ -1040,17 +1061,40 @@ case "$ACTION" in
;;
esac
done
- if [ "$DHCP4_STATUS" = $R_SUCCESS -a $DHCP6_STATUS = $R_SUCCESS ] ; then
- exit $R_SUCCESS
- elif [ "$DHCP4_STATUS" = $R_NOTRUNNING -o $DHCP6_STATUS = $R_NOTRUNNING ] ; then
- exit $R_NOTRUNNING
- elif [ "$DHCP4_STATUS" = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
- exit $R_DHCP_BG
- elif [ "$DHCP4_STATUS" != $R_NOTCONFIGURED ] ; then
+
+ debug "DHCP4(required=$explicit_dhcp4) STATUS=$DHCP4_STATUS"
+ debug "DHCP6(required=$explicit_dhcp6) STATUS=$DHCP6_STATUS"
+
+ case "${explicit_dhcp4}_${explicit_dhcp6}" in
+ (yes_yes) # BOOTPROTO=dhcp4+dhcp6 (need both to report success)
+ if [ $DHCP4_STATUS = $R_SUCCESS -a $DHCP6_STATUS = $R_SUCCESS ] ; then
+ exit $R_SUCCESS
+ elif [ $DHCP4_STATUS = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
+ exit $R_DHCP_BG
+ elif [ $DHCP4_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP4_STATUS
+ elif [ $DHCP6_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP6_STATUS
+ fi
+ ;;
+ (no_no) # BOOTPROTO=dhcp (one is sufficient)
+ if [ $DHCP4_STATUS = $R_SUCCESS -o $DHCP6_STATUS = $R_SUCCESS ] ; then
+ exit $R_SUCCESS
+ elif [ $DHCP4_STATUS = $R_DHCP_BG -o $DHCP6_STATUS = $R_DHCP_BG ] ; then
+ exit $R_DHCP_BG
+ elif [ $DHCP4_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP4_STATUS
+ elif [ $DHCP6_STATUS != $R_NOTCONFIGURED ] ; then
+ exit $DHCP6_STATUS
+ fi
+ ;;
+ (yes_no) # BOOTPROTO=dhcp4
exit $DHCP4_STATUS
- elif [ "$DHCP6_STATUS" != $R_NOTCONFIGURED ] ; then
+ ;;
+ (no_yes) # BOOTPROTO=dhcp6
exit $DHCP6_STATUS
- fi
- exit $R_NOTCONFIGURED
+ ;;
+ esac
+ exit $R_ERROR
;;
esac