netconfig: Move EnableNetworkConfiguration check to station

Allow p2p to use netconfig even if not enabled for Infrastructure mode
connections.
This commit is contained in:
Andrew Zaborowski 2020-04-30 15:48:42 +02:00 committed by Denis Kenzior
parent 270bbbf25a
commit c8edd36234
2 changed files with 18 additions and 18 deletions

View File

@ -1193,28 +1193,11 @@ void netconfig_destroy(struct netconfig *netconfig)
static int netconfig_init(void) static int netconfig_init(void)
{ {
bool enabled;
uint32_t r; uint32_t r;
if (netconfig_list) if (netconfig_list)
return -EALREADY; return -EALREADY;
if (!l_settings_get_bool(iwd_get_config(), "General",
"EnableNetworkConfiguration",
&enabled)) {
if (l_settings_get_bool(iwd_get_config(), "General",
"enable_network_config", &enabled))
l_warn("[General].enable_network_config is deprecated,"
" use [General].EnableNetworkConfiguration");
else
enabled = false;
}
if (!enabled) {
l_info("netconfig: Network configuration is disabled.");
return 0;
}
rtnl = iwd_get_rtnl(); rtnl = iwd_get_rtnl();
r = l_netlink_register(rtnl, RTNLGRP_IPV4_IFADDR, r = l_netlink_register(rtnl, RTNLGRP_IPV4_IFADDR,

View File

@ -58,6 +58,7 @@ static struct l_queue *station_list;
static uint32_t netdev_watch; static uint32_t netdev_watch;
static uint32_t mfp_setting; static uint32_t mfp_setting;
static bool anqp_disabled; static bool anqp_disabled;
static bool netconfig_enabled;
struct station { struct station {
enum station_state state; enum station_state state;
@ -3098,7 +3099,8 @@ static struct station *station_create(struct netdev *netdev)
l_dbus_object_add_interface(dbus, netdev_get_path(netdev), l_dbus_object_add_interface(dbus, netdev_get_path(netdev),
IWD_STATION_INTERFACE, station); IWD_STATION_INTERFACE, station);
station->netconfig = netconfig_new(netdev_get_ifindex(netdev)); if (netconfig_enabled)
station->netconfig = netconfig_new(netdev_get_ifindex(netdev));
station->anqp_pending = l_queue_new(); station->anqp_pending = l_queue_new();
@ -3250,6 +3252,21 @@ static int station_init(void)
&anqp_disabled)) &anqp_disabled))
anqp_disabled = true; anqp_disabled = true;
if (!l_settings_get_bool(iwd_get_config(), "General",
"EnableNetworkConfiguration",
&netconfig_enabled)) {
if (l_settings_get_bool(iwd_get_config(), "General",
"enable_network_config",
&netconfig_enabled))
l_warn("[General].enable_network_config is deprecated,"
" use [General].EnableNetworkConfiguration");
else
netconfig_enabled = false;
}
if (!netconfig_enabled)
l_info("station: Network configuration is disabled.");
return 0; return 0;
} }