* [PATCH v2 1/4] ap: add Name property
@ 2021-02-01 23:52 James Prestwood
2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: James Prestwood @ 2021-02-01 23:52 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
Its useful being able to refer to the network Name/SSID once
an AP is started. For example opening an iwctl session with an
already started AP provides no way of obtaining the SSID.
---
src/ap.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
v2:
* changed 'SSID' to 'Name'
diff --git a/src/ap.c b/src/ap.c
index 37dd05b9..f33d73e1 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2971,12 +2971,18 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
l_dbus_property_changed(dbus_get_bus(),
netdev_get_path(ap_if->netdev),
IWD_AP_INTERFACE, "Started");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Name");
break;
case AP_EVENT_STOPPING:
l_dbus_property_changed(dbus_get_bus(),
netdev_get_path(ap_if->netdev),
IWD_AP_INTERFACE, "Started");
+ l_dbus_property_changed(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_INTERFACE, "Name");
if (!ap_if->pending)
ap_if->ap = NULL;
@@ -3112,6 +3118,22 @@ static bool ap_dbus_property_get_started(struct l_dbus *dbus,
return true;
}
+static bool ap_dbus_property_get_name(struct l_dbus *dbus,
+ struct l_dbus_message *message,
+ struct l_dbus_message_builder *builder,
+ void *user_data)
+{
+ struct ap_if_data *ap_if = user_data;
+
+ if (!ap_if->ap || !ap_if->ap->config || !ap_if->ap->started)
+ return false;
+
+ l_dbus_message_builder_append_basic(builder, 's',
+ ap_if->ap->config->ssid);
+
+ return true;
+}
+
static void ap_setup_interface(struct l_dbus_interface *interface)
{
l_dbus_interface_method(interface, "Start", 0, ap_dbus_start, "",
@@ -3123,6 +3145,8 @@ static void ap_setup_interface(struct l_dbus_interface *interface)
l_dbus_interface_property(interface, "Started", 0, "b",
ap_dbus_property_get_started, NULL);
+ l_dbus_interface_property(interface, "Name", 0, "s",
+ ap_dbus_property_get_name, NULL);
}
static void ap_destroy_interface(void *user_data)
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/4] doc: document Name property on AP interface
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
@ 2021-02-01 23:52 ` James Prestwood
2021-02-01 23:52 ` [PATCH v2 3/4] client: ap: show Name in 'ap <wlan> show' James Prestwood
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2021-02-01 23:52 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 549 bytes --]
---
doc/access-point-api.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/doc/access-point-api.txt b/doc/access-point-api.txt
index 9682b3c7..68ba23c5 100644
--- a/doc/access-point-api.txt
+++ b/doc/access-point-api.txt
@@ -40,3 +40,8 @@ Methods void Start(string ssid, string psk)
Properties boolean Started [readonly]
Reflects whether an access point has been started.
+
+ string Name [readonly, optional]
+
+ The SSID being broadcast for a started AP (omitted if
+ AP has not been started)
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/4] client: ap: show Name in 'ap <wlan> show'
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
@ 2021-02-01 23:52 ` James Prestwood
2021-02-01 23:52 ` [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop James Prestwood
2021-02-02 21:55 ` [PATCH v2 1/4] ap: add Name property Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2021-02-01 23:52 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2793 bytes --]
This will show some basic AP information like Started and
network Name. Some cleanup was done to make the AP interface
and client table columns line up.
---
client/ap.c | 45 ++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
v2:
* Added cleanup of 'name'
* Delayed check of diagnostic interface until after the AP
properties are displayed.
diff --git a/client/ap.c b/client/ap.c
index 7130bb9a..b0386c60 100644
--- a/client/ap.c
+++ b/client/ap.c
@@ -34,6 +34,7 @@
struct ap {
bool started;
+ char *name;
};
static void *ap_create(void)
@@ -45,6 +46,9 @@ static void ap_destroy(void *data)
{
struct ap *ap = data;
+ if (ap->name)
+ l_free(ap->name);
+
l_free(ap);
}
@@ -74,8 +78,35 @@ static void update_started(void *data, struct l_dbus_message_iter *variant)
ap->started = value;
}
+static const char *get_name_tostr(const void *data)
+{
+ const struct ap *ap = data;
+
+ if (!ap->name)
+ return "";
+
+ return ap->name;
+}
+
+static void update_name(void *data, struct l_dbus_message_iter *variant)
+{
+ struct ap *ap = data;
+ const char *name;
+
+ if (ap->name)
+ l_free(ap->name);
+
+ if (!l_dbus_message_iter_get_variant(variant, "s", &name)) {
+ ap->name = NULL;
+ return;
+ }
+
+ ap->name = l_strdup(name);
+}
+
static const struct proxy_interface_property ap_properties[] = {
{ "Started", "b", update_started, get_started_tostr },
+ { "Name", "s", update_name, get_name_tostr },
{ }
};
@@ -212,9 +243,9 @@ static void ap_get_diagnostics_callback(struct l_dbus_message *message,
while (l_dbus_message_iter_next_entry(&array, &iter)) {
sprintf(client_num, "Client %u", idx++);
- display_table_header(client_num, "%-*s%-*s",
+ display_table_header(client_num, " %-*s%-*s",
20, "Property", 20, "Value");
- diagnostic_display(&iter, "", 20, 20);
+ diagnostic_display(&iter, " ", 20, 20);
display_table_footer();
}
}
@@ -223,12 +254,20 @@ static enum cmd_status cmd_show(const char *device_name, char **argv, int argc)
{
const struct proxy_interface *ap_diagnostic =
device_proxy_find(device_name, IWD_AP_DIAGNOSTIC_INTERFACE);
+ const struct proxy_interface *ap_i =
+ device_proxy_find(device_name, IWD_ACCESS_POINT_INTERFACE);
- if (!ap_diagnostic) {
+ if (!ap_i) {
display("No ap on device: '%s'\n", device_name);
return CMD_STATUS_INVALID_VALUE;
}
+ proxy_properties_display(ap_i, "Access Point Interface", MARGIN, 20, 20);
+ display_table_footer();
+
+ if (!ap_diagnostic)
+ return CMD_STATUS_DONE;
+
proxy_interface_method_call(ap_diagnostic, "GetDiagnostics", "",
ap_get_diagnostics_callback);
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
2021-02-01 23:52 ` [PATCH v2 3/4] client: ap: show Name in 'ap <wlan> show' James Prestwood
@ 2021-02-01 23:52 ` James Prestwood
2021-02-02 21:55 ` [PATCH v2 1/4] ap: add Name property Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: James Prestwood @ 2021-02-01 23:52 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]
The diagnostic interface serves no purpose until the AP has
been started. Any calls on it will return an error so instead
it makes more sense to bring it up when the AP is started, and
down when the AP is stopped.
---
src/ap.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index f33d73e1..8ea26a0d 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -2966,6 +2966,11 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
if (L_WARN_ON(!ap_if->pending))
break;
+ l_dbus_object_add_interface(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_DIAGNOSTIC_INTERFACE,
+ ap_if);
+
reply = l_dbus_message_new_method_return(ap_if->pending);
dbus_pending_reply(&ap_if->pending, reply);
l_dbus_property_changed(dbus_get_bus(),
@@ -2977,6 +2982,10 @@ static void ap_if_event_func(enum ap_event_type type, const void *event_data,
break;
case AP_EVENT_STOPPING:
+ l_dbus_object_remove_interface(dbus_get_bus(),
+ netdev_get_path(ap_if->netdev),
+ IWD_AP_DIAGNOSTIC_INTERFACE);
+
l_dbus_property_changed(dbus_get_bus(),
netdev_get_path(ap_if->netdev),
IWD_AP_INTERFACE, "Started");
@@ -3265,16 +3274,12 @@ static void ap_add_interface(struct netdev *netdev)
/* setup ap dbus interface */
l_dbus_object_add_interface(dbus_get_bus(),
netdev_get_path(netdev), IWD_AP_INTERFACE, ap_if);
- l_dbus_object_add_interface(dbus_get_bus(), netdev_get_path(netdev),
- IWD_AP_DIAGNOSTIC_INTERFACE, ap_if);
}
static void ap_remove_interface(struct netdev *netdev)
{
l_dbus_object_remove_interface(dbus_get_bus(),
netdev_get_path(netdev), IWD_AP_INTERFACE);
- l_dbus_object_remove_interface(dbus_get_bus(), netdev_get_path(netdev),
- IWD_AP_DIAGNOSTIC_INTERFACE);
}
static void ap_netdev_watch(struct netdev *netdev,
--
2.26.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/4] ap: add Name property
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
` (2 preceding siblings ...)
2021-02-01 23:52 ` [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop James Prestwood
@ 2021-02-02 21:55 ` Denis Kenzior
3 siblings, 0 replies; 5+ messages in thread
From: Denis Kenzior @ 2021-02-02 21:55 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 427 bytes --]
Hi James,
On 2/1/21 5:52 PM, James Prestwood wrote:
> Its useful being able to refer to the network Name/SSID once
> an AP is started. For example opening an iwctl session with an
> already started AP provides no way of obtaining the SSID.
> ---
> src/ap.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> v2:
> * changed 'SSID' to 'Name'
>
All applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-02-02 21:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01 23:52 [PATCH v2 1/4] ap: add Name property James Prestwood
2021-02-01 23:52 ` [PATCH v2 2/4] doc: document Name property on AP interface James Prestwood
2021-02-01 23:52 ` [PATCH v2 3/4] client: ap: show Name in 'ap <wlan> show' James Prestwood
2021-02-01 23:52 ` [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop James Prestwood
2021-02-02 21:55 ` [PATCH v2 1/4] ap: add Name property Denis Kenzior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox