[arch-projects] [netcfg] [PATCH 2/4] Remove extra start_wpa/stop_wpa when not scanning

Jouke Witteveen j.witteveen at gmail.com
Mon Jul 2 19:16:07 EDT 2012


On Mon, Jul 2, 2012 at 11:07 PM, Henrik Hallberg <henrik at k2h.se> wrote:
> Unless $SCAN is enabled, an unnecessary start_wpa/stop_wpa pair was run.
> ---
>  src/connections/wireless | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/src/connections/wireless b/src/connections/wireless
> index 44a25b4..4384bd1 100644
> --- a/src/connections/wireless
> +++ b/src/connections/wireless
> @@ -31,14 +31,15 @@ wireless_up() {
>      else
>          WPA_CONF=$(make_wpa_config_file $INTERFACE)
>      fi
> -    report_debug wireless_up start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"
> -    if ! start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"; then
> -        report_fail "wpa_supplicant did not start, possible configuration error"
> -        return 1
> -    fi
>
>      # Scan for network's existence first
>      if checkyesno "${SCAN:-no}"; then
> +        report_debug wireless_up start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"
> +        if ! start_wpa "$INTERFACE" "$WPA_CONF" "$WPA_DRIVER" "$WPA_OPTS"; then
> +            report_fail "wpa_supplicant did not start, possible configuration error"
> +            return 1
> +        fi
> +
>          report_debug wireless_up scanning
>          local OLDESSID="$ESSID"
>          if [[ -n "$AP" ]]; then
> @@ -52,10 +53,10 @@ wireless_up() {
>              stop_wpa "$INTERFACE"
>              return 1
>          fi
> -    fi
>
> -    report_debug wireless_up stop_wpa "$INTERFACE"
> -    stop_wpa "$INTERFACE"
> +        report_debug wireless_up stop_wpa "$INTERFACE"
> +        stop_wpa "$INTERFACE"
> +    fi
>
>      # Build configuration file
>      case "$SECURITY" in
> --
> 1.7.11.1
>

These changes look fine to me, but shitty code remains shitty code.
I'm not a big fan of the current organization of the code and the
distribution across connections/wireless and 8021x.


More information about the arch-projects mailing list