2006-12-19 Dan Williams <dcbw@redhat.com>
Big wpa_supplicant + dbus update; need latest wpa_supplicant from CVS plus a few other patches from wpa_supplicant bugzilla. * src/Makefile.am src/NetworkManagerPolicy.c src/NetworkManagerUtils.c src/NetworkManagerUtils.h src/nm-ap-security-leap.c src/nm-ap-security-wep.c src/nm-ap-security-wpa-eap.c src/nm-ap-security-wpa-psk.c src/nm-ap-security.c src/nm-ap-security.h src/nm-device-802-11-wireless.c src/nm-device-802-11-wireless.h src/supplicant-manager/nm-supplicant-config.c src/supplicant-manager/nm-supplicant-config.h src/supplicant-manager/nm-supplicant-interface.c src/supplicant-manager/nm-supplicant-interface.h src/supplicant-manager/nm-supplicant-marshal.list src/supplicant-manager/nm-supplicant-settings-verify.c src/supplicant-manager/nm-supplicant-settings-verify.h - Move all connection management and association handling to wpa_supplicant over dbus, rather than spawning a private copy git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2192 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -39,7 +39,6 @@
|
||||
#include "nm-device.h"
|
||||
#include "nm-device-802-11-wireless.h"
|
||||
#include "nm-device-802-3-ethernet.h"
|
||||
#include "wpa_ctrl.h"
|
||||
|
||||
#include <netlink/addr.h>
|
||||
#include <netinet/in.h>
|
||||
@@ -716,129 +715,3 @@ int nm_utils_ip4_netmask_to_prefix (guint32 ip4_netmask)
|
||||
return (32 - (i-1));
|
||||
}
|
||||
|
||||
|
||||
#define SUPPLICANT_DEBUG
|
||||
#define RESPONSE_SIZE 2048
|
||||
|
||||
|
||||
static char *
|
||||
kill_newline (char *s, size_t *l)
|
||||
{
|
||||
g_return_val_if_fail (l != NULL, s);
|
||||
|
||||
while ((--(*l) > 0) && (s[*l] != '\n'))
|
||||
;
|
||||
if (s[*l] == '\n')
|
||||
s[*l] = '\0';
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
nm_utils_supplicant_request (struct wpa_ctrl *ctrl,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
size_t len;
|
||||
char * response = NULL;
|
||||
char * command;
|
||||
|
||||
g_return_val_if_fail (ctrl != NULL, NULL);
|
||||
g_return_val_if_fail (format != NULL, NULL);
|
||||
|
||||
va_start (args, format);
|
||||
if (!(command = g_strdup_vprintf (format, args)))
|
||||
return NULL;
|
||||
va_end (args);
|
||||
|
||||
response = g_malloc (RESPONSE_SIZE);
|
||||
len = RESPONSE_SIZE;
|
||||
#ifdef SUPPLICANT_DEBUG
|
||||
nm_info ("SUP: sending command '%s'", command);
|
||||
#endif
|
||||
wpa_ctrl_request (ctrl, command, strlen (command), response, &len, NULL);
|
||||
g_free (command);
|
||||
response[len] = '\0';
|
||||
#ifdef SUPPLICANT_DEBUG
|
||||
{
|
||||
response = kill_newline (response, &len);
|
||||
nm_info ("SUP: response was '%s'", response);
|
||||
}
|
||||
#endif
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
gboolean
|
||||
nm_utils_supplicant_request_with_check (struct wpa_ctrl *ctrl,
|
||||
const char *expected,
|
||||
const char *func,
|
||||
const char *err_msg_cmd,
|
||||
const char *format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
gboolean success = FALSE;
|
||||
size_t len;
|
||||
char * response = NULL;
|
||||
char * command;
|
||||
char * temp;
|
||||
|
||||
g_return_val_if_fail (ctrl != NULL, FALSE);
|
||||
g_return_val_if_fail (expected != NULL, FALSE);
|
||||
g_return_val_if_fail (format != NULL, FALSE);
|
||||
|
||||
va_start (args, format);
|
||||
if (!(command = g_strdup_vprintf (format, args)))
|
||||
goto out;
|
||||
|
||||
response = g_malloc (RESPONSE_SIZE);
|
||||
len = RESPONSE_SIZE;
|
||||
#ifdef SUPPLICANT_DEBUG
|
||||
/* Hack: don't print anything out for SCAN commands since they
|
||||
* happen so often.
|
||||
*/
|
||||
if (strcmp (command, "SCAN") != 0)
|
||||
nm_info ("SUP: sending command '%s'", err_msg_cmd ? err_msg_cmd : command);
|
||||
#endif
|
||||
wpa_ctrl_request (ctrl, command, strlen (command), response, &len, NULL);
|
||||
response[len] = '\0';
|
||||
#ifdef SUPPLICANT_DEBUG
|
||||
/* Hack: don't print anything out for SCAN commands since they
|
||||
* happen so often.
|
||||
*/
|
||||
if (strcmp (command, "SCAN") != 0) {
|
||||
response = kill_newline (response, &len);
|
||||
nm_info ("SUP: response was '%s'", response);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (response)
|
||||
{
|
||||
if (strncmp (response, expected, strlen (expected)) == 0)
|
||||
success = TRUE;
|
||||
else
|
||||
{
|
||||
response = kill_newline (response, &len);
|
||||
temp = g_strdup_printf ("%s: supplicant error for '%s'. Response: '%s'",
|
||||
func, err_msg_cmd ? err_msg_cmd : command, response);
|
||||
nm_warning_str (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
g_free (response);
|
||||
}
|
||||
else
|
||||
{
|
||||
temp = g_strdup_printf ("%s: supplicant error for '%s'. No response.",
|
||||
func, err_msg_cmd ? err_msg_cmd : command);
|
||||
nm_warning_str (temp);
|
||||
g_free (temp);
|
||||
}
|
||||
g_free (command);
|
||||
|
||||
out:
|
||||
va_end (args);
|
||||
return success;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user