[RFC] [PATCH 4/7] Add WPA support to netcfg.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
netcfg-static, add wpa options for when we confgure the network manually.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFIEs4oV8GyuTwyskMRAuqRAJ9jN7yvAbKsCcxmSI5uoTHSs1GrCwCePwBk
hoeHx5x3GEeac0pyPaUI9k8=
=tYkW
-----END PGP SIGNATURE-----
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;
/* 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;
}
Reply to: