mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
netdev: Update ifi_flags in rntl_set_powered callbacks
When we detect a new device we either bring it down and then up or only up. The IFF_UP flag in netdev->ifi_flags is updated before that, then we send the two rtnl commands and then fire the NETDEV_WATCH_EVENT_NEW event if either the bring up succeeded or -ERFKILL was returned, so the device may either be UP or DOWN at that point. It seems that a RTNL NEWLINK notification is usually received before the RTNL command callback but I don't think this is guaranteed so update the IFF_UP flag in the callbacks so that the NETDEV_WATCH_EVENT_NEW handlers can reliably use netdev_get_is_up()
This commit is contained in:
parent
64398f3143
commit
99e7e0d977
@ -4200,7 +4200,9 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,
|
|||||||
|
|
||||||
netdev->set_powered_cmd_id = 0;
|
netdev->set_powered_cmd_id = 0;
|
||||||
|
|
||||||
if (error != 0) {
|
if (!error)
|
||||||
|
netdev->ifi_flags |= IFF_UP;
|
||||||
|
else {
|
||||||
l_error("Error bringing interface %i up: %s", netdev->index,
|
l_error("Error bringing interface %i up: %s", netdev->index,
|
||||||
strerror(-error));
|
strerror(-error));
|
||||||
|
|
||||||
@ -4230,7 +4232,9 @@ static void netdev_initial_down_cb(int error, uint16_t type, const void *data,
|
|||||||
{
|
{
|
||||||
struct netdev *netdev = user_data;
|
struct netdev *netdev = user_data;
|
||||||
|
|
||||||
if (error != 0) {
|
if (!error)
|
||||||
|
netdev->ifi_flags &= ~IFF_UP;
|
||||||
|
else {
|
||||||
l_error("Error taking interface %i down: %s", netdev->index,
|
l_error("Error taking interface %i down: %s", netdev->index,
|
||||||
strerror(-error));
|
strerror(-error));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user