Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH v2 4/4] ap: tie diagnostic interface to AP Start/Stop
Date: Mon, 01 Feb 2021 15:52:17 -0800	[thread overview]
Message-ID: <20210201235217.46602-4-prestwoj@gmail.com> (raw)
In-Reply-To: <20210201235217.46602-1-prestwoj@gmail.com>

[-- 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

  parent reply	other threads:[~2021-02-01 23:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2021-02-02 21:55 ` [PATCH v2 1/4] ap: add Name property Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210201235217.46602-4-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox