[PATCH v2 1/7] dbus: add helper for appending a dictionary
by James Prestwood
Arrays of dictionaries are quite common, and for basic
types this API makes things much more convenient by
putting all the enter/append/leave calls in one place.
---
src/dbus.c | 24 ++++++++++++++++++++++++
src/dbus.h | 3 +++
2 files changed, 27 insertions(+)
diff --git a/src/dbus.c b/src/dbus.c
index ceede5c8..d6bfc52d 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -202,6 +202,30 @@ void dbus_pending_reply(struct l_dbus_message **msg,
*msg = NULL;
}
+/*
+ * Convenience helper for appending a dictionary "{sv}". This only works when
+ * the variant is a basic type.
+ */
+bool dbus_append_dict_basic(struct l_dbus_message_builder *builder,
+ const char *name, const char *type,
+ const void *data)
+{
+ if (!l_dbus_message_builder_enter_dict(builder, "sv"))
+ return false;
+ if (!l_dbus_message_builder_append_basic(builder, 's', name))
+ return false;
+ if (!l_dbus_message_builder_enter_variant(builder, type))
+ return false;
+ if (!l_dbus_message_builder_append_basic(builder, type[0], data))
+ return false;
+ if (!l_dbus_message_builder_leave_variant(builder))
+ return false;
+ if (!l_dbus_message_builder_leave_dict(builder))
+ return false;
+
+ return true;
+}
+
struct l_dbus *dbus_get_bus(void)
{
return g_dbus;
diff --git a/src/dbus.h b/src/dbus.h
index 3e2018d8..3a055482 100644
--- a/src/dbus.h
+++ b/src/dbus.h
@@ -51,6 +51,9 @@ struct l_dbus *dbus_get_bus(void);
void dbus_pending_reply(struct l_dbus_message **msg,
struct l_dbus_message *reply);
+bool dbus_append_dict_basic(struct l_dbus_message_builder *builder,
+ const char *name, const char *type,
+ const void *data);
const char *dbus_iftype_to_string(unsigned int iftype);
--
2.26.2
1 year, 6 months
[PATCH 1/8] doc: diagnostic DBus interface definition
by James Prestwood
---
doc/diagnostics.txt | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100644 doc/diagnostics.txt
diff --git a/doc/diagnostics.txt b/doc/diagnostics.txt
new file mode 100644
index 00000000..2354d316
--- /dev/null
+++ b/doc/diagnostics.txt
@@ -0,0 +1,36 @@
+Station diagnostic hierarchy
+=================
+
+Service net.connman.iwd
+Interface net.connman.iwd.StationDiagnostic
+Object path /net/connman/iwd/{phy0,phy1,...}/{1,2,...}
+
+Methods dict GetDiagnostics()
+
+ Get all diagnostic information for this interface. The
+ diagnostics are contained in a single dictionary. Values
+ here are generally low level and not meant for general
+ purpose applications which could get by with the
+ existing Station interface or values which are volatile
+ and change too frequently to be represented as
+ properties. The values in the dictionary may come and
+ go depending on the state of IWD.
+
+ Below is a list of possible diagnostic dictionary
+ values:
+
+ ConnectedBss - MAC address of currently connected BSS.
+
+ RSSI - The RSSI of the currently connected BSS.
+
+ RxRate - Receive rate in 100kbit/s
+
+ RxMCS - Receiving MCS index
+
+ TxRate - Transmission rate in 100kbit/s
+
+ TxMCS - Transmitting MCS index
+
+ Possible errors: net.connman.iwd.Busy
+ net.connman.iwd.Failed
+ net.connman.iwd.NotConnected
--
2.26.2
1 year, 6 months
[PATCH 1/2] eap-tls: Dump server certificate when IWD_TLS_DEBUG set
by Andrew Zaborowski
---
src/eap-tls-common.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/eap-tls-common.c b/src/eap-tls-common.c
index c3eb5ab3..68e2a10c 100644
--- a/src/eap-tls-common.c
+++ b/src/eap-tls-common.c
@@ -583,9 +583,12 @@ static bool eap_tls_tunnel_init(struct eap_state *eap)
return false;
}
- if (getenv("IWD_TLS_DEBUG"))
+ if (getenv("IWD_TLS_DEBUG")) {
l_tls_set_debug(eap_tls->tunnel, eap_tls_tunnel_debug, eap,
NULL);
+ l_tls_set_cert_dump_path(eap_tls->tunnel,
+ "/tmp/iwd-tls-debug-server-cert.pem");
+ }
if (eap_tls->client_cert || eap_tls->client_key) {
if (!l_tls_set_auth_data(eap_tls->tunnel, eap_tls->client_cert,
--
2.27.0
1 year, 7 months
[RFC 0/1] Diagnostic Interface
by James Prestwood
This interface would expose details are may be too low level for a
general purpose application, like a connection manager. Some of these
details are useful though and these will go into this new diagnostic
interface. This interface is also going to be very useful in the
autotesting framework.
The GetDiagnostics() method is somewhat mapped to GET_STATION in
nl80211. Some of these values are too volatile to express as properties
as they change frequently so an application may get them at the time
they are needed.
The additional properties would be purely for autotesting/debugging.
James Prestwood (1):
diagnostic: DBus interface definition
doc/diagnostics.txt | 51 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
create mode 100644 doc/diagnostics.txt
--
2.26.2
1 year, 7 months
[PATCH] netdev: fix asymmetry in handshake events
by James Prestwood
A failed/timed out handshake can sometimes result in no
HANDSHAKE_EVENT_FAILED event. This is because if IWD receives
a deauth before the eapol timeout expires the handshake is
cleaned up without any error being signaled. This ends up being
ok because netdev has its own handshake failed event associated
with the connect attempt which station/others handle
appropriately.
The issue lies more with what a handshake event consumer would
expect. Not receiving a failed event in the case of a failure
is unexpected. Future changes will rely on symmetry of these
events so it is being fixed now.
This case can be detected inside the netdev death event handler
by checking if last_code was ever set. If last_code is zero,
and netdev is not operational we have hit this situation and
netdev needs to manually trigger HANDSHAKE_EVENT_FAILED.
---
src/netdev.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/src/netdev.c b/src/netdev.c
index bf35b1ee..ebbcbbbc 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -869,6 +869,24 @@ static void netdev_disconnect_event(struct l_genl_msg *msg,
l_info("Received Deauthentication event, reason: %hu, from_ap: %s",
reason_code, disconnect_by_ap ? "true" : "false");
+ /*
+ * In some cases of a failed handshake the AP will send a deauth before
+ * IWD's eapol timer expires. This causes asymmetry in the handshake
+ * started/failed events because the eapol timer would get cleaned up by
+ * netdev_connect_free below and no failed event would be sent. We can
+ * detect this because last_code is only set via netdev_handshake_failed
+ * which indicates the handshake failed event DID fire. If no failed
+ * event fired, and netdev is not operational, something went wrong in
+ * the handshake and this deauth event is the AP rejecting it. In this
+ * case signal the failed event which will ultimately clean up the
+ * connection via netdev_handshake_failed.
+ */
+ if (!netdev->operational && !netdev->last_code) {
+ handshake_event(netdev->handshake, HANDSHAKE_EVENT_FAILED,
+ reason_code);
+ return;
+ }
+
event_filter = netdev->event_filter;
event_data = netdev->user_data;
netdev_connect_free(netdev);
--
2.26.2
1 year, 7 months