diff options
Diffstat (limited to 'net-scripts/net.modules.d')
-rw-r--r-- | net-scripts/net.modules.d/ifplugd | 4 | ||||
-rw-r--r-- | net-scripts/net.modules.d/iwconfig | 1 | ||||
-rw-r--r-- | net-scripts/net.modules.d/netplugd | 4 | ||||
-rw-r--r-- | net-scripts/net.modules.d/pppd | 23 | ||||
-rw-r--r-- | net-scripts/net.modules.d/wpa_supplicant | 27 |
5 files changed, 35 insertions, 24 deletions
diff --git a/net-scripts/net.modules.d/ifplugd b/net-scripts/net.modules.d/ifplugd index 2d6024c..a92d79c 100644 --- a/net-scripts/net.modules.d/ifplugd +++ b/net-scripts/net.modules.d/ifplugd @@ -98,11 +98,11 @@ ifplugd_pre_start() { eindent - eval timeout=\"\$\{plug_timeout_${ifvar}\:-10}\" + eval timeout=\"\$\{plug_timeout_${ifvar}\:--1}\" if [[ ${timeout} == "0" ]]; then ewarn "WARNING: infinite timeout set for ${iface} to come up" elif [[ ${timeout} -lt 0 ]]; then - ewarn "WARNING: negative timeout set for ${iface}" + einfo "Backgrounding ..." exit 0 fi diff --git a/net-scripts/net.modules.d/iwconfig b/net-scripts/net.modules.d/iwconfig index 7c389b3..5fafae9 100644 --- a/net-scripts/net.modules.d/iwconfig +++ b/net-scripts/net.modules.d/iwconfig @@ -325,7 +325,6 @@ iwconfig_associate() { local iface="$1" mode="${2:-managed}" local mac="$3" wep_required="$4" w="(WEP Disabled)" local dessid="${ESSID//\\\\/\\\\}" key - wep_required="${wep_required:-off}" iwconfig "${iface}" mode "${mode}" 2>/dev/null if [[ ${ESSID} == "any" ]]; then diff --git a/net-scripts/net.modules.d/netplugd b/net-scripts/net.modules.d/netplugd index 966b5da..8903292 100644 --- a/net-scripts/net.modules.d/netplugd +++ b/net-scripts/net.modules.d/netplugd @@ -85,11 +85,11 @@ netplugd_pre_start() { eindent - eval timeout=\"\$\{plug_timeout_${ifvar}\:-10}\" + eval timeout=\"\$\{plug_timeout_${ifvar}\:--1}\" if [[ ${timeout} == "0" ]]; then ewarn "WARNING: infinite timeout set for ${iface} to come up" elif [[ ${timeout} -lt 0 ]]; then - ewarn "WARNING: negative timeout set for ${iface}" + einfo "Backgrounding ..." exit 0 fi diff --git a/net-scripts/net.modules.d/pppd b/net-scripts/net.modules.d/pppd index fb0e15e..779797c 100644 --- a/net-scripts/net.modules.d/pppd +++ b/net-scripts/net.modules.d/pppd @@ -142,8 +142,8 @@ pppd_start() { # Load any commandline options eval opts=\"\$\{pppd_${ifvar}\[@\]}\" - # We don't work if nodetach or unit is set - for i in nodetach updetach unit ; do + # We don't work if unit, no detach or linkname is set. + for i in unit nodetach linkname ; do if [[ " ${opts} " == *" ${i} "* ]]; then eerror "The option \"${i}\" is not allowed" return 1 @@ -158,9 +158,9 @@ pppd_start() { [[ " ${opts} " != *" mru "* ]] && opts="${opts} mru ${mtu}" fi - # Detach if we're not idling - [[ " ${opts} " != *" idle "* && " ${opts} " != *" updetach "* ]] \ - && opts="${opts} updetach" + # Set linkname because we need /var/run/ppp-${linkname}.pid + # This pidfile has the advantage of being there, even if ${iface} interface was never started + opts="linkname ${iface} ${opts}" # Setup auth info [[ -n ${username} ]] && opts="user \"${username}\" ${opts}" @@ -228,11 +228,13 @@ pppd_start() { [[ ${insert_link_in_opts} -eq 0 ]] || opts="${link} ${opts}" ebegin "Running pppd" - i=$( eval /usr/sbin/pppd ${opts} ) + i=$( eval /usr/sbin/pppd ${opts} 2>&1 ) eend $? "${i}" || return 1 - local addr=$( interface_get_address "${iface}" ) - einfo "${iface} received address ${addr}" + if [[ " ${opts} " == *" updetach "* ]]; then + local addr=$( interface_get_address "${iface}" ) + einfo "${iface} received address ${addr}" + fi } # bool pppd_stop(char *iface) @@ -242,11 +244,12 @@ pppd_start() { # Returns 0 (true) if no process to kill or it terminates successfully, # otherwise non-zero (false) pppd_stop() { - local iface="$1" pidfile="/var/run/$1.pid" + local iface="$1" pidfile="/var/run/ppp-$1.pid" [[ ! -s ${pidfile} ]] && return 0 - local pid=$(<"${pidfile}") + local pid + read pid <"${pidfile}" #PID is the first line of the pidfile einfo "Stopping pppd on ${iface}" kill -s TERM "${pid}" process_finished "${pid}" /usr/sbin/pppd diff --git a/net-scripts/net.modules.d/wpa_supplicant b/net-scripts/net.modules.d/wpa_supplicant index 24e432a..06a7296 100644 --- a/net-scripts/net.modules.d/wpa_supplicant +++ b/net-scripts/net.modules.d/wpa_supplicant @@ -106,8 +106,7 @@ wpa_supplicant_kill() { pidfile="/var/run/wpa_cli-${iface}.pid" if ! clean_pidfile "${pidfile}" ; then ${report} && ebegin "Stopping wpa_cli on ${iface}" - start-stop-daemon --stop --exec /bin/wpa_cli \ - --pidfile "${pidfile}" + start-stop-daemon --stop --exec /bin/wpa_cli --pidfile "${pidfile}" ${report} && eend "$?" fi @@ -116,7 +115,7 @@ wpa_supplicant_kill() { if ! clean_pidfile "${pidfile}" ; then ${report} && ebegin "Stopping wpa_supplicant on ${iface}" start-stop-daemon --stop --exec /sbin/wpa_supplicant \ - --pidfile "${pidfile}" + --pidfile "${pidfile}" ${report} && eend "$?" else # Support wpa_supplicant-0.3.x @@ -130,7 +129,7 @@ wpa_supplicant_kill() { # If wpa_supplicant exits uncleanly, we need to remove the stale dir [[ -S "/var/run/wpa_supplicant/${iface}" ]] \ - && rm -f "/var/run/wpa_supplicant/${iface}" + && rm -f "/var/run/wpa_supplicant/${iface}" } # bool wpa_supplicant_associate(char *interface) @@ -140,12 +139,12 @@ wpa_supplicant_kill() { wpa_supplicant_associate() { local iface="$1" ifvar=$( bash_variable "$1" ) timeout i eval timeout=\"\$\{associate_timeout_${ifvar}\}\" - [[ -z ${timeout} ]] && eval timeout=\"\$\{wpa_timeout_${ifvar}:-60\}\" + [[ -z ${timeout} ]] && eval timeout=\"\$\{wpa_timeout_${ifvar}:--1\}\" if [[ ${timeout} == "0" ]]; then ewarn "WARNING: infinite timeout set for association on ${iface}" elif [[ ${timeout} -lt 0 ]]; then - ewarn "WARNING: negative timeout set for ${iface}" + einfo "Backgrounding ..." exit 0 fi @@ -187,8 +186,7 @@ wpa_supplicant_associate() { # Start wpa_supplicant on an interface and wait for association # Returns 0 (true) when successful, non-zero otherwise wpa_supplicant_pre_start() { - local iface="$1" opts timeout action=false - local cfgfile="/etc/wpa_supplicant.conf" + local iface="$1" opts timeout action=false cfgfile local actfile="/sbin/wpa_cli.action" # We don't configure wireless if we're being called from @@ -242,6 +240,15 @@ wpa_supplicant_pre_start() { ebegin "Starting wpa_supplicant on ${iface}" + cfgfile="${opts##* -c}" + if [[ -n ${cfgfile} && ${cfgfile} != "${opts}" ]]; then + [[ ${cfgfile:0:1} == " " ]] && cfgfile="${cfgfile# *}" + cfgfile="${cfgfile%% *}" + else + cfgfile="/etc/wpa_supplicant.conf" + opts="${opts} -c/etc/wpa_supplicant.conf" + fi + if [[ ! -f ${cfgfile} ]]; then eend 1 "configuration file ${cfgfile} not found!" return 1 @@ -275,7 +282,8 @@ wpa_supplicant_pre_start() { fi start-stop-daemon --start --exec /sbin/wpa_supplicant \ - -- ${opts} -B -c/etc/wpa_supplicant.conf -i"${iface}" + --pidfile "/var/run/wpa_supplicant-${iface}.pid" \ + -- ${opts} -B -i"${iface}" eend "$?" || return 1 # Starting wpa_supplication-0.4.0, we can get wpa_cli to @@ -284,6 +292,7 @@ wpa_supplicant_pre_start() { mark_service_inactive "net.${iface}" ebegin "Starting wpa_cli on ${iface}" start-stop-daemon --start --exec /bin/wpa_cli \ + --pidfile "/var/run/wpa_cli-${iface}.pid" \ -- -a"${actfile}" -i"${iface}" \ -P"/var/run/wpa_cli-${iface}.pid" -B eend "$?" || return 1 |