[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [RFC] [PATCH 4/7] Add WPA support to netcfg.



Glenn Saberton <gsaberton@foomagic.org> writes:

> netcfg-static, add wpa options for when we confgure the network manually.
>
> diff --git a/packages/netcfg/netcfg-static.c b/packages/netcfg/netcfg-static.c
> index 8feac2c..f938b93 100644
> --- a/packages/netcfg/netcfg-static.c
> +++ b/packages/netcfg/netcfg-static.c
> @@ -32,8 +32,19 @@ int main(int argc, char** argv)
>      int num_interfaces = 0;
>      static struct debconfclient *client;
>      static int requested_wireless_tools = 0;
> +    int requested_wpa_supplicant = 0;
>      
> -    enum { BACKUP, GET_INTERFACE, GET_HOSTNAME_ONLY, GET_STATIC, WCONFIG, WCONFIG_ESSID, WCONFIG_WEP, QUIT} state = GET_INTERFACE;
> +    enum { BACKUP, \
> +           GET_INTERFACE, \
> +           GET_HOSTNAME_ONLY, \
> +           GET_STATIC, \
> +           WCONFIG, \
> +           WCONFIG_ESSID, \
> +           WCONFIG_SECURITY, \
> +           WCONFIG_WEP, \
> +           WCONFIG_WPA, \
> +           QUIT} 
> +    state = GET_INTERFACE;

Same here. Please move the style change to another patch.

>      /* initialize libd-i */
>      di_system_init("netcfg-static");
> @@ -91,7 +102,17 @@ int main(int argc, char** argv)
>              if (netcfg_wireless_set_essid (client, interface, NULL))
>                  state = BACKUP;
>              else
> -                state = WCONFIG_WEP;
> +                state = WCONFIG_SECURITY;
> +            break;
> +
> +        case WCONFIG_SECURITY:
> +            if (netcfg_wireless_set_security (client, interface) == GO_BACK)
> +                state = WCONFIG_ESSID;
> +            else
> +                if (netcfg_wireless_set_security (client, interface) == REPLY_WPA)
> +                    state = WCONFIG_WPA;
> +                else
> +                    state = WCONFIG_WEP;
>              break;
>              
>          case WCONFIG_WEP:
> @@ -100,7 +121,19 @@ int main(int argc, char** argv)
>              else
>                  state = GET_STATIC;
>              break;
> -            
> +
> +        case WCONFIG_WPA:
> +            if (requested_wpa_supplicant == 0) {
> +                di_exec_shell_log("apt-install wpasupplicant");
> +                requested_wpa_supplicant = 1;
> +            }
> +
> +            if (netcfg_set_passphrase(client, interface) == GO_BACK)
> +                state = WCONFIG_ESSID;
> +            else
> +                state = GET_STATIC;
> +            break;
> +
>          case QUIT:
>              return 0;
>          }
>

-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://otavio.ossystems.com.br
---------------------------------------------
"Microsoft sells you Windows ... Linux gives
 you the whole house."


Reply to: