[PATCH] netdev: Initialize signal level during connection attempt
by Jesse Lentz
The call to netdev_rssi_level_init() in netdev_connect_common() is
currently a no-op, because netdev->connected has not yet been set at
this stage of the connection attempt. Because netdev_rssi_level_init()
is only used twice, it's been replaced by two inlined calls to
netdev_set_rssi_level_idx().
---
src/netdev.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index 8b2143fd..ece2aab3 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -1025,12 +1025,6 @@ static void netdev_cqm_event_rssi_threshold(struct netdev *netdev,
netdev->event_filter(netdev, event, NULL, netdev->user_data);
}
-static void netdev_rssi_level_init(struct netdev *netdev)
-{
- if (netdev->connected && netdev->rssi_levels_num)
- netdev_set_rssi_level_idx(netdev);
-}
-
static void netdev_cqm_event_rssi_value(struct netdev *netdev, int rssi_val)
{
bool new_rssi_low;
@@ -4043,7 +4037,10 @@ build_cmd_connect:
netdev->handshake = hs;
netdev->sm = sm;
netdev->cur_rssi = bss->signal_strength / 100;
- netdev_rssi_level_init(netdev);
+
+ if (netdev->rssi_levels_num)
+ netdev_set_rssi_level_idx(netdev);
+
netdev_cqm_rssi_update(netdev);
if (!wiphy_has_ext_feature(netdev->wiphy,
@@ -5651,11 +5648,14 @@ int netdev_set_rssi_report_levels(struct netdev *netdev, const int8_t *levels,
}
done:
- if (levels_num)
+ netdev->rssi_levels_num = levels_num;
+
+ if (levels_num) {
memcpy(netdev->rssi_levels, levels, levels_num);
- netdev->rssi_levels_num = levels_num;
- netdev_rssi_level_init(netdev);
+ if (netdev->connected)
+ netdev_set_rssi_level_idx(netdev);
+ }
netdev_rssi_polling_update(netdev);
--
2.36.0
2 months, 3 weeks
[PATCH 1/2] Initial signal level notification
by Jesse Lentz
After registration of a SignalLevelAgent, make iwd inform the client of
the initial signal level via a "Changed" method call.
---
src/netdev.c | 5 +++++
src/netdev.h | 1 +
src/station.c | 19 ++++++++++++++-----
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index e483edf8..8b2143fd 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -450,6 +450,11 @@ const char *netdev_get_path(struct netdev *netdev)
return path;
}
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev)
+{
+ return netdev->cur_rssi_level_idx;
+}
+
static void netdev_set_powered_result(int error, uint16_t type,
const void *data,
uint32_t len, void *user_data)
diff --git a/src/netdev.h b/src/netdev.h
index 0094d5f9..f093c499 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -145,6 +145,7 @@ bool netdev_get_4addr(struct netdev *netdev);
const char *netdev_get_name(struct netdev *netdev);
bool netdev_get_is_up(struct netdev *netdev);
const char *netdev_get_path(struct netdev *netdev);
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev);
struct handshake_state *netdev_handshake_state_new(struct netdev *netdev);
struct handshake_state *netdev_get_handshake(struct netdev *netdev);
diff --git a/src/station.c b/src/station.c
index 2d85054c..61dd690b 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3716,6 +3716,7 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
{
struct station *station = user_data;
const char *path, *sender;
+ struct l_dbus_message *reply;
struct l_dbus_message_iter level_iter;
int8_t levels[16];
int err;
@@ -3758,12 +3759,20 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
l_debug("agent %s path %s", sender, path);
- /*
- * TODO: send an initial notification in a oneshot idle callback,
- * if state is connected.
- */
+ reply = l_dbus_message_new_method_return(message);
+ l_dbus_send(dbus, reply);
- return l_dbus_message_new_method_return(message);
+ if (station->connected_network)
+ {
+ struct netdev *netdev = station->netdev;
+ uint8_t level = netdev_get_rssi_level_idx(netdev);
+
+ station_signal_agent_notify(station->signal_agent,
+ netdev_get_path(netdev),
+ level);
+ }
+
+ return NULL;
}
static struct l_dbus_message *station_dbus_signal_agent_unregister(
--
2.36.0
3 months
[PATCH 1/2] Initial signal level notification
by Jesse Lentz
After registration of a SignalLevelAgent, make iwd inform the client of
the initial signal level via a "Changed" method call.
---
src/netdev.c | 5 +++++
src/netdev.h | 1 +
src/station.c | 16 ++++++++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/src/netdev.c b/src/netdev.c
index e483edf8..8b2143fd 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -450,6 +450,11 @@ const char *netdev_get_path(struct netdev *netdev)
return path;
}
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev)
+{
+ return netdev->cur_rssi_level_idx;
+}
+
static void netdev_set_powered_result(int error, uint16_t type,
const void *data,
uint32_t len, void *user_data)
diff --git a/src/netdev.h b/src/netdev.h
index 0094d5f9..f093c499 100644
--- a/src/netdev.h
+++ b/src/netdev.h
@@ -145,6 +145,7 @@ bool netdev_get_4addr(struct netdev *netdev);
const char *netdev_get_name(struct netdev *netdev);
bool netdev_get_is_up(struct netdev *netdev);
const char *netdev_get_path(struct netdev *netdev);
+uint8_t netdev_get_rssi_level_idx(struct netdev *netdev);
struct handshake_state *netdev_handshake_state_new(struct netdev *netdev);
struct handshake_state *netdev_get_handshake(struct netdev *netdev);
diff --git a/src/station.c b/src/station.c
index 2d85054c..7be256fe 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3709,6 +3709,16 @@ static void signal_agent_disconnect(struct l_dbus *dbus, void *user_data)
netdev_set_rssi_report_levels(station->netdev, NULL, 0);
}
+static void signal_agent_notify_initial(void *user_data)
+{
+ struct station *station = user_data;
+ struct netdev *netdev = station->netdev;
+
+ station_signal_agent_notify(station->signal_agent,
+ netdev_get_path(netdev),
+ netdev_get_rssi_level_idx(netdev));
+}
+
static struct l_dbus_message *station_dbus_signal_agent_register(
struct l_dbus *dbus,
struct l_dbus_message *message,
@@ -3758,10 +3768,8 @@ static struct l_dbus_message *station_dbus_signal_agent_register(
l_debug("agent %s path %s", sender, path);
- /*
- * TODO: send an initial notification in a oneshot idle callback,
- * if state is connected.
- */
+ if (station->connected_network)
+ l_idle_oneshot(signal_agent_notify_initial, station, NULL);
return l_dbus_message_new_method_return(message);
}
--
2.36.0
3 months
[PATCH] Allow SignalLevelAgent method calls in dbus policy
by Jesse Lentz
The SignalLevelAgent API is currently broken by the system bus's
security policy, which blocks iwd's outgoing method call messages. This
patch punches a hole for method calls on the
net.connman.iwd.SignalLevelAgent interface.
---
src/iwd-dbus.conf | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/iwd-dbus.conf b/src/iwd-dbus.conf
index 4b3636e0..7fc2e68c 100644
--- a/src/iwd-dbus.conf
+++ b/src/iwd-dbus.conf
@@ -11,6 +11,7 @@
<allow own="net.connman.iwd"/>
<allow send_destination="net.connman.iwd"/>
<allow send_interface="net.connman.iwd.Agent"/>
+ <allow send_interface="net.connman.iwd.SignalLevelAgent"/>
</policy>
<policy group="wheel">
--
2.36.0
3 months
Disable DNS in IWD
by Gino McCarty
There appears to be no method for having IWD disable DNS Updates
is there some method that is undocumented available?
NameResolvingService=none
I want to have IWD manage my connections and use the internal DHCP daemon
but I do not want systemd-resolved or resolveconf being updated
I run my own DNS daemon
The only solution I can think of to this issue is to disable iwd connection management entirely
EnableNetworkConfiguration=false
though i would prefer not to
Thank You,
Gino
3 months
[PATCH v3 1/2] netconfig: Add multiple levels to IWD_DHCP_DEBUG
by Michael Johnson
Allows granularly specifying the DHCP logging level. This allows the
user to tailor the output to what they need. By default, always display
info, errors and warnings to match the rest of iwd.
Setting `IWD_DHCP_DEBUG` to "debug", "info", "warn", "error" will limit
the logging to that level or higher allowing the default logging
verbosity to be reduced.
Setting `IWD_DHCP_DEBUG` to "1" as per the current behavior will
continue to enable debug level logging.
---
src/netconfig.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 6694a0e9..0042a55d 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -1621,6 +1621,8 @@ struct netconfig *netconfig_new(uint32_t ifindex)
struct netdev *netdev = netdev_find(ifindex);
struct netconfig *netconfig;
struct l_icmp6_client *icmp6;
+ const char *debug_level = NULL;
+ int dhcp_priority = L_LOG_INFO;
if (!netconfig_list)
return NULL;
@@ -1640,9 +1642,22 @@ struct netconfig *netconfig_new(uint32_t ifindex)
netconfig_ipv4_dhcp_event_handler,
netconfig, NULL);
- if (getenv("IWD_DHCP_DEBUG"))
- l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
- "[DHCPv4] ", NULL);
+ debug_level = getenv("IWD_DHCP_DEBUG");
+ if (debug_level != NULL) {
+ if (strcmp("debug", debug_level) == 0)
+ dhcp_priority = L_LOG_DEBUG;
+ else if (strcmp("info", debug_level) == 0)
+ dhcp_priority = L_LOG_INFO;
+ else if (strcmp("warn", debug_level) == 0)
+ dhcp_priority = L_LOG_WARNING;
+ else if (strcmp("error", debug_level) == 0)
+ dhcp_priority = L_LOG_ERR;
+ else /* Default for backwards compatibility */
+ dhcp_priority = L_LOG_DEBUG;
+ }
+
+ l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
+ "[DHCPv4] ", NULL, dhcp_priority);
netconfig->dhcp6_client = l_dhcp6_client_new(ifindex);
l_dhcp6_client_set_event_handler(netconfig->dhcp6_client,
--
2.25.1
3 months
[PATCH v2 1/2] netconfig: Add multiple levels to IWD_DHCP_DEBUG
by Michael Johnson
Allows granularly specifying the DHCP logging level. This allows the
user to tailor the output to what they need. By default always display
errors and warnings.
1 = INFO
2 = DEBUG
---
src/netconfig.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 6694a0e9..da9969f2 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -1621,6 +1621,8 @@ struct netconfig *netconfig_new(uint32_t ifindex)
struct netdev *netdev = netdev_find(ifindex);
struct netconfig *netconfig;
struct l_icmp6_client *icmp6;
+ const char *debug_level = NULL;
+ int dhcp_priority = L_LOG_WARNING;
if (!netconfig_list)
return NULL;
@@ -1640,9 +1642,18 @@ struct netconfig *netconfig_new(uint32_t ifindex)
netconfig_ipv4_dhcp_event_handler,
netconfig, NULL);
- if (getenv("IWD_DHCP_DEBUG"))
- l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
- "[DHCPv4] ", NULL);
+ debug_level = getenv("IWD_DHCP_DEBUG");
+ if (debug_level != NULL)
+ {
+ // Convert from user 1 or 2 to L_LOG_*
+ if (*debug_level == '1')
+ dhcp_priority = L_LOG_INFO;
+ else if (*debug_level == '2')
+ dhcp_priority = L_LOG_DEBUG;
+ }
+
+ l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
+ "[DHCPv4] ", NULL, dhcp_priority);
netconfig->dhcp6_client = l_dhcp6_client_new(ifindex);
l_dhcp6_client_set_event_handler(netconfig->dhcp6_client,
--
2.25.1
3 months
[PATCH] netconfig: Enable DHCP info+ logging by default
by Michael Johnson
The rest of iwd logs info, warn, and errors by default so this patch
just copies that behavior for the DHCP client. Debug logging is enabled
via the IWD_DHCP_DEBUG env as before.
---
src/netconfig.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 6694a0e9..91f2b9ff 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -1621,6 +1621,7 @@ struct netconfig *netconfig_new(uint32_t ifindex)
struct netdev *netdev = netdev_find(ifindex);
struct netconfig *netconfig;
struct l_icmp6_client *icmp6;
+ int dhcp_debug = L_LOG_INFO;
if (!netconfig_list)
return NULL;
@@ -1641,8 +1642,10 @@ struct netconfig *netconfig_new(uint32_t ifindex)
netconfig, NULL);
if (getenv("IWD_DHCP_DEBUG"))
- l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
- "[DHCPv4] ", NULL);
+ dhcp_debug = L_LOG_DEBUG;
+
+ l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
+ "[DHCPv4] ", NULL, dhcp_debug);
netconfig->dhcp6_client = l_dhcp6_client_new(ifindex);
l_dhcp6_client_set_event_handler(netconfig->dhcp6_client,
--
2.25.1
3 months
[PATCH 1/2] netconfig: Add multiple levels to IWD_DHCP_DEBUG
by Michael Johnson
Allows granularly specifying the DHCP logging level. This allows the
user to tailor the output to what they need. By default always display
errors and warnings.
1 = INFO
2 = DEBUG
---
src/netconfig.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/netconfig.c b/src/netconfig.c
index 6694a0e9..7dd35b2f 100644
--- a/src/netconfig.c
+++ b/src/netconfig.c
@@ -1621,6 +1621,8 @@ struct netconfig *netconfig_new(uint32_t ifindex)
struct netdev *netdev = netdev_find(ifindex);
struct netconfig *netconfig;
struct l_icmp6_client *icmp6;
+ const char *debug_level = NULL;
+ int dhcp_priority = L_LOG_WARNING;
if (!netconfig_list)
return NULL;
@@ -1640,9 +1642,18 @@ struct netconfig *netconfig_new(uint32_t ifindex)
netconfig_ipv4_dhcp_event_handler,
netconfig, NULL);
- if (getenv("IWD_DHCP_DEBUG"))
- l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
- "[DHCPv4] ", NULL);
+ debug_level = getenv("IWD_DHCP_DEBUG");
+ if (debug_level != NULL)
+ {
+ // Convert from user 1 or 2 to L_LOG_*
+ if (*debug_level == '1')
+ dhcp_priority = L_LOG_INFO;
+ else if (*debug_level == '2')
+ dhcp_priority = L_LOG_DEBUG;
+ }
+
+ l_dhcp_client_set_debug(netconfig->dhcp_client, do_debug,
+ "[DHCPv4] ", NULL, dhcp_priority);
netconfig->dhcp6_client = l_dhcp6_client_new(ifindex);
l_dhcp6_client_set_event_handler(netconfig->dhcp6_client,
--
2.25.1
3 months
DHCP renewal stops after disconnect
by Michael Johnson
Hey,
I'm encountering a couple of issues with the DHCP client in iwd
specifically when the network environment is flaky.
The major issue I have is when the iwd client is disconnected either
from a channel change or just a low signal. The DHCP client gets a new
lease when it connects but never asks for a lease renewal which
eventually means it loses it after the expiration. This paste shows
the logs of this happening https://pastebin.com/yGJbUmVR (I have
enabled IWD_DHCP_DEBUG=1 to get more data but I am still waiting for
it to happen again).
My plan is to see if I can reproduce the issue on a smaller scale (we
have ~130 clients running and it happens maybe twice a day) and once I
can reproduce I will update iwd and ell to see if that fixes it (I'm
using version 1.21 iwd and 0.47 ell). I looked through the new commits
since my versions and there was nothing explicitly about this but
c78ad1bb and b02c2034 look possibly related?
For now, I wonder if you know of an obvious place that a disconnect
might not be cleaning up the DHCP state fully which causes the T1
timer not to be set?
As for the second minor issue, it seems like iwd doesn't retry sending
a DHCPREQUEST once it's passed the T1 timer and in the RENEW state
which I believe it should based on
http://www.tcpipguide.com/free/t_DHCPLeaseRenewalandRebindingProcesses-2.htm.
I have seen the first request being lost due to a bad signal and then
iwd didn't try again until T2 which is a more complete renewal. This
doesn't cause any interruption but does cause the lease to be removed
before being renewed.
Kind Regards,
Michael Johnson
3 months