mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-01-12 02:42:34 +01:00
wiphy: Set the linkmode and operstate of the link
We need to set the linkmode and operstate after successful authentication. Initial value for linkmode is 1 (user space controlled) and IF_OPER_DORMANT for opermode. After successful authentication, the operstate is set to IF_OPER_UP. More specific details can be seen in kernel sources at https://www.kernel.org/doc/Documentation/networking/operstates.txt
This commit is contained in:
parent
6dbd544a55
commit
7b945d948f
44
src/wiphy.c
44
src/wiphy.c
@ -44,6 +44,7 @@
|
|||||||
#include "src/eapol.h"
|
#include "src/eapol.h"
|
||||||
#include "src/agent.h"
|
#include "src/agent.h"
|
||||||
#include "src/crypto.h"
|
#include "src/crypto.h"
|
||||||
|
#include "src/netdev.h"
|
||||||
|
|
||||||
static struct l_genl *genl = NULL;
|
static struct l_genl *genl = NULL;
|
||||||
static struct l_genl_family *nl80211 = NULL;
|
static struct l_genl_family *nl80211 = NULL;
|
||||||
@ -754,6 +755,9 @@ static void netdev_free(void *data)
|
|||||||
l_queue_destroy(netdev->old_bss_list, bss_free);
|
l_queue_destroy(netdev->old_bss_list, bss_free);
|
||||||
l_io_destroy(netdev->eapol_io);
|
l_io_destroy(netdev->eapol_io);
|
||||||
|
|
||||||
|
netdev_set_linkmode_and_operstate(netdev->index, 0, IF_OPER_DOWN,
|
||||||
|
NULL, NULL);
|
||||||
|
|
||||||
l_free(netdev);
|
l_free(netdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,10 +887,33 @@ static void wiphy_set_tk(uint32_t ifindex, const uint8_t *aa,
|
|||||||
mlme_set_pairwise_key(netdev);
|
mlme_set_pairwise_key(netdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void operstate_cb(bool result, void *user_data)
|
||||||
|
{
|
||||||
|
struct netdev *netdev = user_data;
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
if (netdev->connect_pending)
|
||||||
|
dbus_pending_reply(&netdev->connect_pending,
|
||||||
|
dbus_error_failed(netdev->connect_pending));
|
||||||
|
|
||||||
|
l_error("Setting LinkMode and OperState failed for ifindex %d",
|
||||||
|
netdev->index);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (netdev->connect_pending) {
|
||||||
|
struct l_dbus_message *reply;
|
||||||
|
|
||||||
|
reply = l_dbus_message_new_method_return(
|
||||||
|
netdev->connect_pending);
|
||||||
|
l_dbus_message_set_arguments(reply, "");
|
||||||
|
dbus_pending_reply(&netdev->connect_pending, reply);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void set_station_cb(struct l_genl_msg *msg, void *user_data)
|
static void set_station_cb(struct l_genl_msg *msg, void *user_data)
|
||||||
{
|
{
|
||||||
struct netdev *netdev = user_data;
|
struct netdev *netdev = user_data;
|
||||||
struct l_dbus_message *reply;
|
|
||||||
|
|
||||||
if (l_genl_msg_get_error(msg) < 0) {
|
if (l_genl_msg_get_error(msg) < 0) {
|
||||||
if (netdev->connect_pending)
|
if (netdev->connect_pending)
|
||||||
@ -897,9 +924,8 @@ static void set_station_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = l_dbus_message_new_method_return(netdev->connect_pending);
|
netdev_set_linkmode_and_operstate(netdev->index, 1, IF_OPER_UP,
|
||||||
l_dbus_message_set_arguments(reply, "");
|
operstate_cb, netdev);
|
||||||
dbus_pending_reply(&netdev->connect_pending, reply);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_station_cmd(struct netdev *netdev)
|
static int set_station_cmd(struct netdev *netdev)
|
||||||
@ -1008,7 +1034,6 @@ static void wiphy_set_gtk(uint32_t ifindex, uint8_t key_index,
|
|||||||
|
|
||||||
static void mlme_associate_event(struct l_genl_msg *msg, struct netdev *netdev)
|
static void mlme_associate_event(struct l_genl_msg *msg, struct netdev *netdev)
|
||||||
{
|
{
|
||||||
struct l_dbus_message *reply;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
l_debug("");
|
l_debug("");
|
||||||
@ -1027,10 +1052,8 @@ static void mlme_associate_event(struct l_genl_msg *msg, struct netdev *netdev)
|
|||||||
if (netdev->connected_bss &&
|
if (netdev->connected_bss &&
|
||||||
netdev->connected_bss->network->ssid_security ==
|
netdev->connected_bss->network->ssid_security ==
|
||||||
SCAN_SSID_SECURITY_NONE) {
|
SCAN_SSID_SECURITY_NONE) {
|
||||||
reply = l_dbus_message_new_method_return(
|
netdev_set_linkmode_and_operstate(netdev->index, 1, IF_OPER_UP,
|
||||||
netdev->connect_pending);
|
operstate_cb, netdev);
|
||||||
l_dbus_message_set_arguments(reply, "");
|
|
||||||
dbus_pending_reply(&netdev->connect_pending, reply);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1647,6 +1670,9 @@ static void interface_dump_callback(struct l_genl_msg *msg, void *user_data)
|
|||||||
IWD_DEVICE_INTERFACE);
|
IWD_DEVICE_INTERFACE);
|
||||||
else
|
else
|
||||||
device_emit_added(netdev);
|
device_emit_added(netdev);
|
||||||
|
|
||||||
|
netdev_set_linkmode_and_operstate(netdev->index, 1,
|
||||||
|
IF_OPER_DORMANT, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_scheduled_scan(wiphy, netdev, scheduled_scan_interval);
|
setup_scheduled_scan(wiphy, netdev, scheduled_scan_interval);
|
||||||
|
Loading…
Reference in New Issue
Block a user