diff --git a/ChangeLog b/ChangeLog index 4b3b109722..6926a19cd1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-05-23 Dan Williams + + * src/supplicant-manager/nm-supplicant-settings-verify.c + - Switch 'bssid' from bytes to keyword type + - (validate_type_keyword): allow NULL keyword lists + + * src/supplicant-manager/nm-supplicant-config.c + - (nm_supplicant_config_add_setting_wireless): convert the bssid from + a byte array to string form, which is what the supplicant expects + 2008-05-23 Tambet Ingo Add a flag to NMSettingIP4Config to make it possible to ignore the DNS diff --git a/src/supplicant-manager/nm-supplicant-config.c b/src/supplicant-manager/nm-supplicant-config.c index 58839eba18..23f563cdfc 100644 --- a/src/supplicant-manager/nm-supplicant-config.c +++ b/src/supplicant-manager/nm-supplicant-config.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include "nm-supplicant-config.h" @@ -323,6 +324,9 @@ nm_supplicant_config_get_blobs (NMSupplicantConfig * self) return NM_SUPPLICANT_CONFIG_GET_PRIVATE (self)->blobs; } +#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x" +#define MAC_ARG(x) ((guint8*)(x))[0],((guint8*)(x))[1],((guint8*)(x))[2],((guint8*)(x))[3],((guint8*)(x))[4],((guint8*)(x))[5] + gboolean nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, NMSettingWireless * setting, @@ -383,14 +387,18 @@ nm_supplicant_config_add_setting_wireless (NMSupplicantConfig * self, return FALSE; } - if (setting->bssid) { + if (setting->bssid && setting->bssid->len) { + char *str_bssid; + + str_bssid = g_strdup_printf (MAC_FMT, MAC_ARG (setting->bssid->data)); if (!nm_supplicant_config_add_option (self, "bssid", - (char *) setting->bssid->data, - setting->bssid->len, - FALSE)) { + str_bssid, strlen (str_bssid), + FALSE)) { + g_free (str_bssid); nm_warning ("Error adding BSSID to supplicant config."); return FALSE; } + g_free (str_bssid); } // FIXME: band & channel config items diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c index ef022fef86..4157b99505 100644 --- a/src/supplicant-manager/nm-supplicant-settings-verify.c +++ b/src/supplicant-manager/nm-supplicant-settings-verify.c @@ -83,7 +83,7 @@ const char * phase2_allowed[] = {"auth=PAP", "auth=CHAP", "auth=MSCHAP", static const struct Opt opt_table[] = { { "ssid", TYPE_BYTES, 0, 32,FALSE, NULL }, - { "bssid", TYPE_BYTES, 0, 6, FALSE, NULL }, + { "bssid", TYPE_KEYWORD, 0, 0, FALSE, NULL }, { "scan_ssid", TYPE_INT, 0, 1, FALSE, NULL }, { "mode", TYPE_INT, 0, 1, FALSE, NULL }, { "frequency", TYPE_INT, 2412, 5825, FALSE, NULL }, @@ -177,6 +177,10 @@ validate_type_keyword (const struct Opt * opt, g_return_val_if_fail (opt != NULL, FALSE); g_return_val_if_fail (value != NULL, FALSE); + /* Allow everything */ + if (!opt->str_allowed) + return TRUE; + candidates = g_strsplit (value, " ", 0); if (!candidates) goto out;