mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-23 06:02:37 +01:00
netdev: Use ell's rtnl APIs
This commit is contained in:
parent
1ee7b985aa
commit
0af1207a6c
21
src/netdev.c
21
src/netdev.c
@ -341,7 +341,7 @@ int netdev_set_powered(struct netdev *netdev, bool powered,
|
|||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, netdev->index, powered,
|
l_rtnl_set_powered(rtnl, netdev->index, powered,
|
||||||
netdev_set_powered_result, netdev,
|
netdev_set_powered_result, netdev,
|
||||||
netdev_set_powered_destroy);
|
netdev_set_powered_destroy);
|
||||||
if (!netdev->set_powered_cmd_id)
|
if (!netdev->set_powered_cmd_id)
|
||||||
@ -632,7 +632,8 @@ static void netdev_shutdown_one(void *data, void *user_data)
|
|||||||
struct netdev *netdev = data;
|
struct netdev *netdev = data;
|
||||||
|
|
||||||
if (netdev_get_is_up(netdev))
|
if (netdev_get_is_up(netdev))
|
||||||
rtnl_set_powered(rtnl, netdev->index, false, NULL, NULL, NULL);
|
l_rtnl_set_powered(rtnl, netdev->index, false,
|
||||||
|
NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool netdev_match(const void *a, const void *b)
|
static bool netdev_match(const void *a, const void *b)
|
||||||
@ -986,7 +987,7 @@ static void netdev_operstate_cb(int error, uint16_t type,
|
|||||||
|
|
||||||
static void netdev_connect_ok(struct netdev *netdev)
|
static void netdev_connect_ok(struct netdev *netdev)
|
||||||
{
|
{
|
||||||
rtnl_set_linkmode_and_operstate(rtnl, netdev->index,
|
l_rtnl_set_linkmode_and_operstate(rtnl, netdev->index,
|
||||||
IF_LINK_MODE_DORMANT, IF_OPER_UP,
|
IF_LINK_MODE_DORMANT, IF_OPER_UP,
|
||||||
netdev_operstate_cb,
|
netdev_operstate_cb,
|
||||||
L_UINT_TO_PTR(netdev->index), NULL);
|
L_UINT_TO_PTR(netdev->index), NULL);
|
||||||
@ -3817,7 +3818,7 @@ static void netdev_set_iftype_cb(struct l_genl_msg *msg, void *user_data)
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, netdev->index, true,
|
l_rtnl_set_powered(rtnl, netdev->index, true,
|
||||||
netdev_set_iftype_up_cb, req,
|
netdev_set_iftype_up_cb, req,
|
||||||
netdev_set_iftype_request_destroy);
|
netdev_set_iftype_request_destroy);
|
||||||
if (!netdev->set_powered_cmd_id) {
|
if (!netdev->set_powered_cmd_id) {
|
||||||
@ -3913,7 +3914,7 @@ int netdev_set_iftype(struct netdev *netdev, enum netdev_iftype type,
|
|||||||
l_genl_msg_unref(msg);
|
l_genl_msg_unref(msg);
|
||||||
} else {
|
} else {
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, netdev->index, false,
|
l_rtnl_set_powered(rtnl, netdev->index, false,
|
||||||
netdev_set_iftype_down_cb, req,
|
netdev_set_iftype_down_cb, req,
|
||||||
netdev_set_iftype_request_destroy);
|
netdev_set_iftype_request_destroy);
|
||||||
if (netdev->set_powered_cmd_id)
|
if (netdev->set_powered_cmd_id)
|
||||||
@ -4116,7 +4117,7 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtnl_set_linkmode_and_operstate(rtnl, netdev->index,
|
l_rtnl_set_linkmode_and_operstate(rtnl, netdev->index,
|
||||||
IF_LINK_MODE_DORMANT, IF_OPER_DOWN,
|
IF_LINK_MODE_DORMANT, IF_OPER_DOWN,
|
||||||
netdev_operstate_cb,
|
netdev_operstate_cb,
|
||||||
L_UINT_TO_PTR(netdev->index), NULL);
|
L_UINT_TO_PTR(netdev->index), NULL);
|
||||||
@ -4146,7 +4147,7 @@ static void netdev_set_mac_cb(int error, uint16_t type, const void *data,
|
|||||||
strerror(-error));
|
strerror(-error));
|
||||||
|
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, netdev->index, true,
|
l_rtnl_set_powered(rtnl, netdev->index, true,
|
||||||
netdev_initial_up_cb, netdev, NULL);
|
netdev_initial_up_cb, netdev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4158,7 +4159,7 @@ static bool netdev_check_set_mac(struct netdev *netdev)
|
|||||||
l_debug("Setting initial address on ifindex: %d to: " MAC,
|
l_debug("Setting initial address on ifindex: %d to: " MAC,
|
||||||
netdev->index, MAC_STR(netdev->set_mac_once));
|
netdev->index, MAC_STR(netdev->set_mac_once));
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_mac(rtnl, netdev->index, netdev->set_mac_once,
|
l_rtnl_set_mac(rtnl, netdev->index, netdev->set_mac_once,
|
||||||
netdev_set_mac_cb, netdev, NULL);
|
netdev_set_mac_cb, netdev, NULL);
|
||||||
memset(netdev->set_mac_once, 0, 6);
|
memset(netdev->set_mac_once, 0, 6);
|
||||||
return true;
|
return true;
|
||||||
@ -4183,7 +4184,7 @@ static void netdev_initial_down_cb(int error, uint16_t type, const void *data,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, netdev->index, true,
|
l_rtnl_set_powered(rtnl, netdev->index, true,
|
||||||
netdev_initial_up_cb, netdev, NULL);
|
netdev_initial_up_cb, netdev, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4228,7 +4229,7 @@ static void netdev_getlink_cb(int error, uint16_t type, const void *data,
|
|||||||
cb = powered ? netdev_initial_down_cb : netdev_initial_up_cb;
|
cb = powered ? netdev_initial_down_cb : netdev_initial_up_cb;
|
||||||
|
|
||||||
netdev->set_powered_cmd_id =
|
netdev->set_powered_cmd_id =
|
||||||
rtnl_set_powered(rtnl, ifi->ifi_index, !powered, cb, netdev,
|
l_rtnl_set_powered(rtnl, ifi->ifi_index, !powered, cb, netdev,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user