From 19b993175e7af945024fe80cbd8331014e6d018d Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Tue, 31 Jul 2018 12:05:00 +0100 Subject: Finish up dhcp start block Signed-off-by: Robby Workman --- rc.inet1 | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc.inet1 b/rc.inet1 index 165672c..61be5b8 100644 --- a/rc.inet1 +++ b/rc.inet1 @@ -169,9 +169,8 @@ if_up() { . /etc/rc.d/rc.wireless ${1} start fi IF_UP=0 - # Slackware historically favours DHCP over fixed IP to configure interfaces, so keep that tradition. + # Slackware historically favours DHCP over fixed IP to configure interfaces, so keep that tradition: if [ "${USE_DHCP[$i]}" = "yes" ] || [ "${USE_DHCP6[$i]}" = "yes" ]; then # use dhcpcd to bring interface up -# FIXME: This block needs some attention after talking to Robby: # Disable v6 IP auto configuration before trying to set up the interface: [ "${USE_DHCP6[$i]}" = "yes" ] && echo "0" >/proc/sys/net/ipv6/conf/$1/autoconf # Declare DHCP_OPTIONS array before adding new options to it: @@ -192,8 +191,11 @@ if_up() { echo "Polling for DHCP server on interface ${1}:" # 15 seconds should be a reasonable default DHCP timeout. 30 was too much. echo "/etc/rc.d/rc.inet1: /sbin/dhcpcd -L -t ${DHCP_TIMEOUT[$i]:-15} ${DHCP_OPTIONS[@]} ${1}" | $LOGGER - /sbin/dhcpcd -L -t "${DHCP_TIMEOUT[$i]:-15}" "${DHCP_OPTIONS[@]}" ${1} - IF_UP=1 + if /sbin/dhcpcd -L -t "${DHCP_TIMEOUT[$i]:-15}" "${DHCP_OPTIONS[@]}" ${1}; then + IF_UP=1 + else + echo "/etc/rc.d/rc.inet1: failed to obtain DHCP lease for ${1}" | $LOGGER + fi fi if [ "${USE_DHCP[$i]}" != "yes" ] && [ -n "${IPADDR[$i]}" ]; then # use a fixed v4 IP to bring interface up if [ -z "${NETMASK[$i]}"; then -- cgit v1.2.3