diff options
author | Jim Pryor <profjim@jimpryor.net> | 2009-08-11 14:05:01 +0200 |
---|---|---|
committer | James Rayner <james@archlinux.org> | 2009-08-15 04:28:27 +0200 |
commit | efc7183790cec4fc2b3425f17201e0e2fea51c44 (patch) | |
tree | 3f50a28ee89f2ce23571a506c0ea684863aba18d /src/connections/ethernet-iproute | |
parent | 77f132cb6eb6b2f6514635862f41254bdaf461ac (diff) | |
download | netctl-efc7183790cec4fc2b3425f17201e0e2fea51c44.tar.gz netctl-efc7183790cec4fc2b3425f17201e0e2fea51c44.tar.xz |
Improve debugging and error-reporting.
Signed-off-by: Jim Pryor <profjim@jimpryor.net>
Diffstat (limited to 'src/connections/ethernet-iproute')
-rw-r--r-- | src/connections/ethernet-iproute | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/connections/ethernet-iproute b/src/connections/ethernet-iproute index 8937f16..046b9a0 100644 --- a/src/connections/ethernet-iproute +++ b/src/connections/ethernet-iproute @@ -22,8 +22,7 @@ ethernet_up() { set_interface up $INTERFACE if ip link show $INTERFACE | fgrep -q "NO-CARRIER"; then - report_fail "No connection" - return 1 + report_iproute "No connection" fi if checkyesno ${AUTH8021X:-no}; then @@ -53,7 +52,8 @@ ethernet_up() { [[ -n "$DNS" ]] && DHCP_OPTIONS="-C resolv.conf $DHCP_OPTIONS" report_debug ethernet_iproute_up dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCP_OPTIONS "$INTERFACE" - if ! dhcpcd -qL -t ${DHCP_TIMEOUT:-10} $DHCP_OPTIONS $INTERFACE; then + dhcpcd -qL -t "${DHCP_TIMEOUT:-10}" $DHCP_OPTIONS "$INTERFACE" 2>&1 | report_debug $(cat) + if [[ "$PIPESTATUS" -ne 0 ]]; then report_iproute "DHCP IP lease attempt failed" fi ;; @@ -67,12 +67,12 @@ ethernet_up() { if [[ -n "$GATEWAY" ]]; then report_debug ethernet_iproute_up ip route add default via "$GATEWAY" if ! ip route add default via $GATEWAY; then - report_iproute "Adding gateway failed" + report_iproute "Adding gateway $GATEWAY failed" fi fi ;; *) - report_iproute "Profile report_iproute: IP must be either 'dhcp' or 'static'" + report_iproute "Profile error: IP must be either 'dhcp' or 'static'" ;; esac @@ -81,7 +81,7 @@ ethernet_up() { report_debug ethernet_iproute_up ip "$line" if ! ip $line; then - report_iproute "Could not configure interface" + report_iproute "Could not configure interface ($line)." fi done fi @@ -115,7 +115,7 @@ ethernet_down() { if [[ "$IP" == "dhcp" ]]; then if [[ -f /var/run/dhcpcd-${INTERFACE}.pid ]]; then report_debug ethernet_iproute_down dhcpcd -qx "$INTERFACE" - dhcpcd -qx $INTERFACE + dhcpcd -qx "$INTERFACE" &>/dev/null fi fi |