diff options
-rw-r--r-- | src/ethernet.subr | 14 | ||||
-rw-r--r-- | src/netcfg | 6 | ||||
-rw-r--r-- | src/network.subr | 9 | ||||
-rw-r--r-- | src/ppp.subr | 2 | ||||
-rw-r--r-- | src/wireless.subr | 16 |
5 files changed, 27 insertions, 20 deletions
diff --git a/src/ethernet.subr b/src/ethernet.subr index 62f944f..39ae11a 100644 --- a/src/ethernet.subr +++ b/src/ethernet.subr @@ -16,12 +16,12 @@ ethernet_up() { if [ ! -e /sys/class/net/$INTERFACE ]; then if ! echo "$INTERFACE"|grep ":"; then - err "Interface $INTERFACE does not exist" + err_append "Interface $INTERFACE does not exist" fi fi if ! mii_check $INTERFACE; then - err "No connection available" + err_append "No connection available" return 1 fi @@ -33,7 +33,7 @@ ethernet_up() { if checkyesno $DHCLIENT; then rm -r /var/run/dhclient-${INTERFACE}.pid >/dev/null 2>&1 if ! dhclient -q -e TIMEOUT=$DHCP_TIMEOUT -pf /var/run/dhclient-${INTERFACE}.pid; then - err "DHCP IP lease attempt failed" + err_append "DHCP IP lease attempt failed" return 1 fi else @@ -43,7 +43,7 @@ ethernet_up() { [ -n $DNS1 ] && DHCP_OPTIONS="-R $DHCP_OPTIONS" # Start dhcpcd if ! dhcpcd -L -t $DHCP_TIMEOUT $DHCP_OPTIONS $INTERFACE; then - err "DHCP IP lease attempt failed" + err_append "DHCP IP lease attempt failed" return 1 fi fi @@ -51,14 +51,14 @@ ethernet_up() { ;; static) if ! ifconfig $INTERFACE $IFOPTS up; then - err "Could not bring interface up" + err_append "Could not bring interface up" return 1 fi # bring up the default route (gateway) if [ "$GATEWAY" ]; then if ! route add default gw $GATEWAY; then - err "Adding gateway $GATEWAY failed" + err_append "Adding gateway $GATEWAY failed" return 1 fi fi @@ -68,7 +68,7 @@ ethernet_up() { # set the hostname if [ "$HOSTNAME" ]; then if ! hostname $HOSTNAME; then - err "Cannot set hostname" + err_append "Cannot set hostname" return 1 fi fi @@ -4,10 +4,14 @@ . /etc/rc.d/functions . /usr/lib/network/network.subr -err() { +err_append() { stat_append " - $*" } +err() { + printhl "$*" +} + NETCFG_VER=2.0.0 PROFILE_DIR="/etc/network.d/" SUBR_DIR="/usr/lib/network/" diff --git a/src/network.subr b/src/network.subr index 69477bc..b1d8e12 100644 --- a/src/network.subr +++ b/src/network.subr @@ -5,11 +5,14 @@ PROFILE_DIR="/etc/network.d" ## # err msg # output specified message +err_append() { +echo -n $* +} + err() { echo $* } - ### Profile loading ## # load_profile profile @@ -88,7 +91,7 @@ profile_up() if check_iface $INTERFACE; then if checkyesno $CHECK; then - err "Interface $INTERFACE already in use" + err_append "Interface $INTERFACE already in use" stat_fail && return 1 else interface_down $INTERFACE || return 1 @@ -127,7 +130,7 @@ profile_down() stat_busy "$1 down" if [ "$(get_iface_prof $INTERFACE)" == "external" ]; then - err "$interface was connected by another application" + err_append "$interface was connected by another application" stat_fail return 1 fi diff --git a/src/ppp.subr b/src/ppp.subr index c05ebd7..b659881 100644 --- a/src/ppp.subr +++ b/src/ppp.subr @@ -6,7 +6,7 @@ ppp_up() { /usr/sbin/pppd call $PEER updetach child-timeout $PPP_TIMEOUT linkname $(basename $PEER) if [ $? -ne 0 ]; then - err "pppd connection failed" + err_append "pppd connection failed" exit 1 fi } diff --git a/src/wireless.subr b/src/wireless.subr index 5b9bd57..69550bc 100644 --- a/src/wireless.subr +++ b/src/wireless.subr @@ -16,7 +16,7 @@ wpa_check() done wpa_cli terminate >/dev/null 2>&1 - err "Wireless association failed." + err_append "Wireless association failed." return 1 } @@ -35,7 +35,7 @@ wep_check() let timeout++ done - err "Wireless association failed." + err_append "Wireless association failed." return 1 } @@ -91,7 +91,7 @@ start_wpa() sleep 1 if [ ! -f /var/run/wpa_supplicant_${INTERFACE}.pid ]; then - err "wpa_supplicant did not start, possible configuration error" + err_append "wpa_supplicant did not start, possible configuration error" return 1 fi } @@ -101,7 +101,7 @@ wireless_up() { load_profile $1 if [ ! -d /sys/class/net/$INTERFACE/wireless ]; then - err "Interface $INTERFACE is not a wireless interface" + err_append "Interface $INTERFACE is not a wireless interface" return 1 fi @@ -121,7 +121,7 @@ wireless_up() { if checkyesno $SCAN; then if ! find_essid $INTERFACE "$ESSID"; then - err "Network unavailable" + err_append "Network unavailable" return 1 fi fi @@ -137,7 +137,7 @@ wireless_up() { fi if ! eval iwconfig $INTERFACE $WEP_OPTS; then - err "Could not set wireless configuration" + err_append "Could not set wireless configuration" return 1 fi @@ -148,7 +148,7 @@ wireless_up() { # Temporary bugfix for broken drivers... http://bbs.archlinux.org/viewtopic.php?id=36384 if ! eval iwconfig $INTERFACE mode managed essid "\"$ESSID\""; then - err "Could not set wireless configuration" + err_append "Could not set wireless configuration" return 1 fi @@ -159,7 +159,7 @@ wireless_up() { # Generate configuration if ! wpa_passphrase "$ESSID" "$KEY" >> $WPA_CONF; then - err "Configuration generation failed: `cat $WPA_CONF`" + err_append "Configuration generation failed: `cat $WPA_CONF`" return 1 fi |