eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit 99e7e0d977a44b8e3a0fcebc3ce0b183e1b82534
parent 64398f3143a52965fb5905eb85695a17f56f417d
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Sat, 22 Sep 2018 18:48:20 +0200

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()

Diffstat:
Msrc/netdev.c | 8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/netdev.c b/src/netdev.c @@ -4200,7 +4200,9 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data, 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, 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; - if (error != 0) { + if (!error) + netdev->ifi_flags &= ~IFF_UP; + else { l_error("Error taking interface %i down: %s", netdev->index, strerror(-error));