[PATCH 3/4] notify: Do not raise any signal from a P2P management interface

Arend van Spriel arend at broadcom.com
Thu Oct 23 04:37:32 EDT 2014


On 10/23/14 10:31, Tomasz Bursztyka wrote:
> Such interface is not registered on DBus, thus there is no need to raise
> any signal from it.

Could this be done in one place instead of sprinkling these if statements?

Regards,
Arend

> Signed-off-by: Tomasz Bursztyka<tomasz.bursztyka at linux.intel.com>
> ---
>   wpa_supplicant/notify.c | 102 ++++++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 102 insertions(+)
>
> diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
> index 617ce84..c8cfa47 100644
> --- a/wpa_supplicant/notify.c
> +++ b/wpa_supplicant/notify.c
> @@ -48,6 +48,9 @@ void wpas_notify_supplicant_deinitialized(struct wpa_global *global)
>
>   int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return 0;
> +
>   	if (wpas_dbus_register_iface(wpa_s))
>   		return -1;
>
> @@ -60,6 +63,9 @@ int wpas_notify_iface_added(struct wpa_supplicant *wpa_s)
>
>   void wpas_notify_iface_removed(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	/* unregister interface in old DBus ctrl iface */
>   	wpas_dbus_unregister_iface(wpa_s);
>
> @@ -72,6 +78,9 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
>   			       enum wpa_states new_state,
>   			       enum wpa_states old_state)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	/* notify the old DBus API */
>   	wpa_supplicant_dbus_notify_state_change(wpa_s, new_state,
>   						old_state);
> @@ -101,30 +110,45 @@ void wpas_notify_state_changed(struct wpa_supplicant *wpa_s,
>
>   void wpas_notify_disconnect_reason(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_DISCONNECT_REASON);
>   }
>
>
>   void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_NETWORK);
>   }
>
>
>   void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_AP_SCAN);
>   }
>
>
>   void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_BSS);
>   }
>
>
>   void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_CURRENT_AUTH_MODE);
>   }
>
> @@ -132,6 +156,9 @@ void wpas_notify_auth_changed(struct wpa_supplicant *wpa_s)
>   void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
>   					 struct wpa_ssid *ssid)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_network_enabled_changed(wpa_s, ssid);
>   }
>
> @@ -139,6 +166,9 @@ void wpas_notify_network_enabled_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_network_selected(struct wpa_supplicant *wpa_s,
>   				  struct wpa_ssid *ssid)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_network_selected(wpa_s, ssid->id);
>   }
>
> @@ -148,12 +178,18 @@ void wpas_notify_network_request(struct wpa_supplicant *wpa_s,
>   				 enum wpa_ctrl_req_type rtype,
>   				 const char *default_txt)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_network_request(wpa_s, ssid, rtype, default_txt);
>   }
>
>
>   void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	/* notify the old DBus API */
>   	wpa_supplicant_dbus_notify_scanning(wpa_s);
>
> @@ -164,12 +200,18 @@ void wpas_notify_scanning(struct wpa_supplicant *wpa_s)
>
>   void wpas_notify_scan_done(struct wpa_supplicant *wpa_s, int success)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_scan_done(wpa_s, success);
>   }
>
>
>   void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	/* notify the old DBus API */
>   	wpa_supplicant_dbus_notify_scan_results(wpa_s);
>
> @@ -180,6 +222,9 @@ void wpas_notify_scan_results(struct wpa_supplicant *wpa_s)
>   void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
>   				const struct wps_credential *cred)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   #ifdef CONFIG_WPS
>   	/* notify the old DBus API */
>   	wpa_supplicant_dbus_notify_wps_cred(wpa_s, cred);
> @@ -192,6 +237,9 @@ void wpas_notify_wps_credential(struct wpa_supplicant *wpa_s,
>   void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
>   			       struct wps_event_m2d *m2d)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   #ifdef CONFIG_WPS
>   	wpas_dbus_signal_wps_event_m2d(wpa_s, m2d);
>   #endif /* CONFIG_WPS */
> @@ -201,6 +249,9 @@ void wpas_notify_wps_event_m2d(struct wpa_supplicant *wpa_s,
>   void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
>   				struct wps_event_fail *fail)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   #ifdef CONFIG_WPS
>   	wpas_dbus_signal_wps_event_fail(wpa_s, fail);
>   #endif /* CONFIG_WPS */
> @@ -209,6 +260,9 @@ void wpas_notify_wps_event_fail(struct wpa_supplicant *wpa_s,
>
>   void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   #ifdef CONFIG_WPS
>   	wpas_dbus_signal_wps_event_success(wpa_s);
>   #endif /* CONFIG_WPS */
> @@ -218,6 +272,9 @@ void wpas_notify_wps_event_success(struct wpa_supplicant *wpa_s)
>   void wpas_notify_network_added(struct wpa_supplicant *wpa_s,
>   			       struct wpa_ssid *ssid)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	/*
>   	 * Networks objects created during any P2P activities should not be
>   	 * exposed out. They might/will confuse certain non-P2P aware
> @@ -250,6 +307,9 @@ void wpas_notify_persistent_group_removed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
>   				 struct wpa_ssid *ssid)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	if (wpa_s->next_ssid == ssid)
>   		wpa_s->next_ssid = NULL;
>   	if (wpa_s->wpa)
> @@ -263,6 +323,9 @@ void wpas_notify_network_removed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
>   			   u8 bssid[], unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_register_bss(wpa_s, bssid, id);
>   	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_ADDED "%u " MACSTR,
>   		     id, MAC2STR(bssid));
> @@ -272,6 +335,9 @@ void wpas_notify_bss_added(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
>   			     u8 bssid[], unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_unregister_bss(wpa_s, bssid, id);
>   	wpa_msg_ctrl(wpa_s, MSG_INFO, WPA_EVENT_BSS_REMOVED "%u " MACSTR,
>   		     id, MAC2STR(bssid));
> @@ -281,6 +347,9 @@ void wpas_notify_bss_removed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
>   				  unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_FREQ, id);
>   }
>
> @@ -288,6 +357,9 @@ void wpas_notify_bss_freq_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
>   				    unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_SIGNAL,
>   					  id);
>   }
> @@ -296,6 +368,9 @@ void wpas_notify_bss_signal_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
>   				     unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_PRIVACY,
>   					  id);
>   }
> @@ -304,6 +379,9 @@ void wpas_notify_bss_privacy_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
>   				  unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_MODE, id);
>   }
>
> @@ -311,6 +389,9 @@ void wpas_notify_bss_mode_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
>   				   unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPA, id);
>   }
>
> @@ -318,6 +399,9 @@ void wpas_notify_bss_wpaie_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
>   				   unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RSN, id);
>   }
>
> @@ -325,6 +409,9 @@ void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
>   				 unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   #ifdef CONFIG_WPS
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
>   #endif /* CONFIG_WPS */
> @@ -334,6 +421,9 @@ void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
>   				   unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_IES, id);
>   }
>
> @@ -341,24 +431,36 @@ void wpas_notify_bss_ies_changed(struct wpa_supplicant *wpa_s,
>   void wpas_notify_bss_rates_changed(struct wpa_supplicant *wpa_s,
>   				   unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_RATES, id);
>   }
>
>
>   void wpas_notify_bss_seen(struct wpa_supplicant *wpa_s, unsigned int id)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_AGE, id);
>   }
>
>
>   void wpas_notify_blob_added(struct wpa_supplicant *wpa_s, const char *name)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_blob_added(wpa_s, name);
>   }
>
>
>   void wpas_notify_blob_removed(struct wpa_supplicant *wpa_s, const char *name)
>   {
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
>   	wpas_dbus_signal_blob_removed(wpa_s, name);
>   }
>



More information about the HostAP mailing list