| Index: plugins/newwifi.c
|
| diff --git a/plugins/newwifi.c b/plugins/newwifi.c
|
| index 7ebc3b691cc941c2a27c9fc4cbb24f325c3254af..8dcdad3582e77c40f223212e9514790b532041f7 100644
|
| --- a/plugins/newwifi.c
|
| +++ b/plugins/newwifi.c
|
| @@ -203,6 +203,14 @@ struct supplicant_scan_request {
|
| #define MAX_SSID_LEN 32 /* 802.11 SSID length (octets) */
|
|
|
| /*
|
| + * Supplicant network modes
|
| + */
|
| +#define SUPPLICANT_NETWORK_MODE_MANAGED 0
|
| +#define SUPPLICANT_NETWORK_MODE_ADHOC 1
|
| +#define SUPPLICANT_NETWORK_MODE_HOSTAP 2
|
| +#define SUPPLICANT_NETWORK_MODE_DEFAULT SUPPLICANT_NETWORK_MODE_MANAGED
|
| +
|
| +/*
|
| * Per-bss state collected from supplicant scan results.
|
| */
|
| struct supplicant_result {
|
| @@ -869,6 +877,34 @@ static void append_wep(DBusMessageIter *dict,
|
| DBUS_TYPE_UINT32, &key_index);
|
| }
|
|
|
| +static void append_mode(DBusMessageIter *dict, struct connman_network *network)
|
| +{
|
| + dbus_int32_t mode_val = SUPPLICANT_NETWORK_MODE_DEFAULT;
|
| + const char *mode_str = connman_network_get_string(network, "WiFi.Mode");
|
| +
|
| + if (g_ascii_strcasecmp(mode_str, "managed") == 0)
|
| + mode_val = SUPPLICANT_NETWORK_MODE_MANAGED;
|
| + else if (g_ascii_strcasecmp(mode_str, "adhoc") == 0) {
|
| + /*
|
| + * NB: wpa_supplicant does not use scan results for
|
| + * configuring IBSS so we need to manually select the
|
| + * frequency.
|
| + */
|
| + dbus_int32_t frequency =
|
| + connman_network_get_uint16(network, "Frequency");
|
| +
|
| + if (frequency != 0)
|
| + connman_dbus_dict_append_variant(dict, "frequency",
|
| + DBUS_TYPE_INT32,
|
| + &frequency);
|
| + mode_val = SUPPLICANT_NETWORK_MODE_ADHOC;
|
| + } else if (g_ascii_strcasecmp(mode_str, "hostap") == 0)
|
| + mode_val = SUPPLICANT_NETWORK_MODE_HOSTAP;
|
| +
|
| + connman_dbus_dict_append_variant(dict, "mode",
|
| + DBUS_TYPE_INT32, &mode_val);
|
| +}
|
| +
|
| /*
|
| * Append properties for the specified network to a dbus message.
|
| */
|
| @@ -910,6 +946,8 @@ static void append_network_properties(struct supplicant_task *task,
|
| DBUS_TYPE_STRING, &key_mgmt);
|
| }
|
|
|
| + append_mode(&dict, network);
|
| +
|
| dbus_message_iter_close_container(array, &dict);
|
| }
|
|
|
|
|