aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Prestwood <prestwoj@gmail.com>2020-03-11 18:52:51 -0400
committerDenis Kenzior <denkenz@gmail.com>2020-03-12 10:46:06 -0500
commit421af060f8846129db7d1d195665d72bf3d6ab6e (patch)
tree63887712a18792465feb4b23d0e249c6235ddc53
parenteb7845ec2949a54fce93906868065d915a4709f7 (diff)
downloadiwd-421af060f8846129db7d1d195665d72bf3d6ab6e.tar.gz
netdev: update use of l_rtnl_set_mac
This API was updated to take an extra boolean which will automatically power up the device while changing the MAC address. Since this is what IWD does anyways we can avoid the need for an intermediate callback and go right into netdev_initial_up_cb.
-rw-r--r--src/netdev.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/netdev.c b/src/netdev.c
index ed633e356..a5071471f 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -4137,20 +4137,6 @@ static void netdev_initial_up_cb(int error, uint16_t type, const void *data,
netdev->events_ready = true;
}
-static void netdev_set_mac_cb(int error, uint16_t type, const void *data,
- uint32_t len, void *user_data)
-{
- struct netdev *netdev = user_data;
-
- if (error)
- l_error("Error setting mac address on %d: %s", netdev->index,
- strerror(-error));
-
- netdev->set_powered_cmd_id =
- l_rtnl_set_powered(rtnl, netdev->index, true,
- netdev_initial_up_cb, netdev, NULL);
-}
-
static bool netdev_check_set_mac(struct netdev *netdev)
{
if (util_mem_is_zero(netdev->set_mac_once, 6))
@@ -4159,8 +4145,8 @@ static bool netdev_check_set_mac(struct netdev *netdev)
l_debug("Setting initial address on ifindex: %d to: " MAC,
netdev->index, MAC_STR(netdev->set_mac_once));
netdev->set_powered_cmd_id =
- l_rtnl_set_mac(rtnl, netdev->index, netdev->set_mac_once,
- netdev_set_mac_cb, netdev, NULL);
+ l_rtnl_set_mac(rtnl, netdev->index, netdev->set_mac_once, true,
+ netdev_initial_up_cb, netdev, NULL);
memset(netdev->set_mac_once, 0, 6);
return true;
}