wiphy: Tweak netdev structure creation order
Because none of the attributes are assigned until after the DeviceAdded signal is emitted, the signal appears with invalid properties. For now, move the netdev structure fill-out into the if statement. If the netdev attributes can change, then these need to be handled separately and appropriate signals to be sent.
This commit is contained in:
parent
77255dbee0
commit
051f49ea85
20
src/wiphy.c
20
src/wiphy.c
|
@ -558,27 +558,27 @@ static void interface_dump_callback(struct l_genl_msg *msg, void *user_data)
|
||||||
L_UINT_TO_PTR(ifindex));
|
L_UINT_TO_PTR(ifindex));
|
||||||
if (!netdev) {
|
if (!netdev) {
|
||||||
struct l_dbus *dbus = dbus_get_bus();
|
struct l_dbus *dbus = dbus_get_bus();
|
||||||
char path[256];
|
|
||||||
|
|
||||||
snprintf(path, sizeof(path), "/%u", ifindex);
|
|
||||||
|
|
||||||
netdev = l_new(struct netdev, 1);
|
netdev = l_new(struct netdev, 1);
|
||||||
netdev->bss_list = l_queue_new();
|
netdev->bss_list = l_queue_new();
|
||||||
|
memcpy(netdev->name, ifname, sizeof(netdev->name));
|
||||||
|
memcpy(netdev->addr, ifaddr, sizeof(netdev->addr));
|
||||||
|
netdev->index = ifindex;
|
||||||
|
netdev->type = iftype;
|
||||||
|
|
||||||
l_queue_push_head(wiphy->netdev_list, netdev);
|
l_queue_push_head(wiphy->netdev_list, netdev);
|
||||||
|
|
||||||
if (!l_dbus_register_interface(dbus, path, IWD_DEVICE_INTERFACE,
|
if (!l_dbus_register_interface(dbus,
|
||||||
setup_device_interface, netdev, NULL))
|
iwd_device_get_path(netdev),
|
||||||
|
IWD_DEVICE_INTERFACE,
|
||||||
|
setup_device_interface,
|
||||||
|
netdev, NULL))
|
||||||
l_info("Unable to register %s interface",
|
l_info("Unable to register %s interface",
|
||||||
IWD_DEVICE_INTERFACE);
|
IWD_DEVICE_INTERFACE);
|
||||||
else
|
else
|
||||||
device_emit_added(netdev);
|
device_emit_added(netdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(netdev->name, ifname, sizeof(netdev->name));
|
|
||||||
memcpy(netdev->addr, ifaddr, sizeof(netdev->addr));
|
|
||||||
netdev->index = ifindex;
|
|
||||||
netdev->type = iftype;
|
|
||||||
|
|
||||||
l_debug("Found interface %s", netdev->name);
|
l_debug("Found interface %s", netdev->name);
|
||||||
|
|
||||||
trigger_scan(wiphy);
|
trigger_scan(wiphy);
|
||||||
|
|
Loading…
Reference in New Issue