From 75ce550de93101947c8ebecb3ca49cc002d7df30 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 16 Jun 2016 14:49:57 -0500 Subject: [PATCH] netdev: Move operstate operations out of wiphy.c Also make netdev_set_linkmode_and_operstate static --- src/netdev.c | 8 +++++++- src/netdev.h | 4 ---- src/wiphy.c | 6 ------ 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index b8ba4e6e..7c60346c 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -103,7 +103,7 @@ static size_t rta_add_u8(void *rta_buf, unsigned short type, uint8_t value) return RTA_SPACE(sizeof(uint8_t)); } -void netdev_set_linkmode_and_operstate(uint32_t ifindex, +static void netdev_set_linkmode_and_operstate(uint32_t ifindex, uint8_t linkmode, uint8_t operstate, netdev_command_func_t callback, void *user_data) { @@ -175,6 +175,9 @@ static void netdev_free(void *data) netdev->associate_msg = NULL; } + netdev_set_linkmode_and_operstate(netdev->index, 0, IF_OPER_DOWN, + NULL, NULL); + l_free(netdev); } @@ -1014,6 +1017,9 @@ static void netdev_get_interface_callback(struct l_genl_msg *msg, l_queue_push_tail(netdev_list, netdev); + netdev_set_linkmode_and_operstate(netdev->index, 1, + IF_OPER_DORMANT, NULL, NULL); + l_debug("Found interface %s[%d]", netdev->name, netdev->index); device_create(wiphy, netdev); } diff --git a/src/netdev.h b/src/netdev.h index 9af4f5a0..1279a3d7 100644 --- a/src/netdev.h +++ b/src/netdev.h @@ -53,10 +53,6 @@ typedef void (*netdev_event_func_t)(struct netdev *netdev, typedef void (*netdev_disconnect_cb_t)(struct netdev *netdev, bool result, void *user_data); -void netdev_set_linkmode_and_operstate(uint32_t ifindex, - uint8_t linkmode, uint8_t operstate, - netdev_command_func_t cb, void *user_data); - const uint8_t *netdev_get_address(struct netdev *netdev); uint32_t netdev_get_ifindex(struct netdev *netdev); uint32_t netdev_get_iftype(struct netdev *netdev); diff --git a/src/wiphy.c b/src/wiphy.c index 8c95da9b..517b5b02 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -655,9 +655,6 @@ struct device *device_create(struct wiphy *wiphy, struct netdev *netdev) __device_watch_call_added(device); - netdev_set_linkmode_and_operstate(device->index, 1, - IF_OPER_DORMANT, NULL, NULL); - scan_ifindex_add(device->index); device_enter_state(device, DEVICE_STATE_AUTOCONNECT); @@ -700,9 +697,6 @@ static void device_free(void *user) l_io_destroy(device->eapol_io); scan_ifindex_remove(device->index); - netdev_set_linkmode_and_operstate(device->index, 0, IF_OPER_DOWN, - NULL, NULL); - l_free(device); }