Re: [PATCH 2/2] dbus-signal for IBSS-RSN-CONNECTED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2016-07-26 at 10:29 -0500, Dan Williams wrote:
> On Tue, 2016-07-12 at 12:05 +0000, Avichal Agarwal wrote:
> > 
> > From 8eb6908732c5e08c803bbffffab156af6acdcfa8 Mon Sep 17 00:00:00
> > 2001
> > From: Avichal Agarwal <avichal.a@xxxxxxxxxxx>
> > Date: Tue, 12 Jul 2016 17:21:24 +0530
> > Subject: [PATCH 2/2] dbus-signal for IBSS-RSN-CONNECTED
> > 
> > this patch will send a dbus signal IbssRsnConnected
> > when two ibss-rsn peers will join each other successfully.
> > this signal will send the address of peer type array of bytes.
> Is this signal actually needed?  It seems redundant with the
> COMPLETED
> state event signal which should also be emitted when joining an IBSS
> network (regardless of whether it's RSN or not).  You also have the
> CurrentBSS property, which should point to the correct peer in the
> scan
> list from which you can get the peer address.
> 
> Yes, this is a short-cut.  But most likely you're already watching
> the
> CurrentBSS property of the supplicant interface object, which will
> point to the IBSS peer (and thus its address) long before COMPLETED
> happens.  So when you get COMPLETED, grab the address from your local
> cache of the scan list, indexed by CurrentBSS.

So never mind most of this, I misunderstood what was going on in this
specific patch.  However...

It does seem useful to indicate whether authentication with specific
IBSS RSN peers has occurred.  However, I feel like the D-Bus interface
should be a bit more detailed here.  For example, if a client misses
the IbssRsnConnected signal for a peer, how can it figure out if that
peer has been connected later?

What I would do here is add another D-Bus interface that the supplicant
interface implements (like .P2PDevice or .WPS) called ".IbssRsn".  This
would have the following properties and signals:

Properties:
-----------
Peers (ao or aay)

Signals:
-----------
PeerAdded (ao or ay)
PeerRemoved (ao or ay)

This way if a client starts after the supplicant has started, or if the
client crashes and restarts, it's possible to read the existing state
and not miss anything.

The question is whether there's anything interesting about IBSS RSN
peers except their address.  "struct ibss_rsn_peer" doesn't have a lot
of interesting stuff in it, so would there be interesting state or
properties in the future?

If so, then we should go "ao" (eg, Peers is an array of object path)
and each peer should be its own object like BSSs are.  Then we can
easily add future properties.

If not, then we can go "aay" (eg, Peers is an array of byte arrays) and
we cannot easily extend this later, but it's simpler.

Dan

> Dan
> 
> > 
> > Signed-off-by: Avichal Agarwal <avichal.a@xxxxxxxxxxx>
> > ---
> >  wpa_supplicant/dbus/dbus_new.c                     |   37 ++++++++
> >  wpa_supplicant/dbus/dbus_new.h                     |    5 +-
> >  wpa_supplicant/ibss_rsn.c                          |    3 +-
> >  wpa_supplicant/notify.c                            |    6 ++
> >  wpa_supplicant/notify.h                            |    3 +
> >  5 files changed, 54 insertions(+), 2 deletions(-)
> > 
> > diff --git a/wpa_supplicant/dbus/dbus_new.c
> > b/wpa_supplicant/dbus/dbus_new.c
> > index 8fa03bb..1300ad5 100644
> > --- a/wpa_supplicant/dbus/dbus_new.c
> > +++ b/wpa_supplicant/dbus/dbus_new.c
> > @@ -1954,6 +1954,35 @@ void
> > wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant
> > *wpa_s,
> >  
> >  #endif /* CONFIG_P2P */
> >  
> > +#ifdef CONFIG_IBSS_RSN
> > 
> > +void wpas_dbus_signal_ibss_rsn_connected(struct wpa_supplicant
> > *wpa_s,
> > 
> > +                                const u8 *peer)
> > 
> > +{
> > 
> > +        struct wpas_dbus_priv *iface;
> > 
> > +        DBusMessage *msg;
> > 
> > +        DBusMessageIter iter,array_iter;
> > 
> > +        iface = wpa_s->global->dbus;
> > 
> > +        /* Do nothing if the control interface is not turned on */
> > 
> > +        if (iface == NULL)
> > 
> > +                return;
> > 
> > +        msg = dbus_message_new_signal(wpa_s->dbus_new_path,
> > 
> > +                                      WPAS_DBUS_NEW_IFACE_INTERFAC
> > E,
> > 
> > +                                      "IbssRsnConnected");
> > 
> > +        if (msg == NULL)
> > 
> > +                return;
> > 
> > +        dbus_message_iter_init_append(msg, &iter);
> > 
> > +	if(!dbus_message_iter_open_container(&iter,
> > DBUS_TYPE_ARRAY,
> > 
> > +                                              DBUS_TYPE_BYTE_AS_ST
> > RI
> > NG,
> > 
> > +                                              &array_iter) ||
> > 
> > +            !dbus_message_iter_append_fixed_array(&array_iter,
> > DBUS_TYPE_BYTE,
> > 
> > +                                                  &peer, 6) ||
> > 
> > +            !dbus_message_iter_close_container(&iter,
> > &array_iter))
> > 
> > +		goto nomem;
> > 
> > +        dbus_connection_send(iface->con, msg, NULL);
> > 
> > +nomem:
> > 
> > +        dbus_message_unref(msg);
> > 
> > +}
> > 
> > +#endif /*CONFIG_IBSS_RSN*/
> >  
> >  /**
> >   * wpas_dbus_signal_prop_changed - Signals change of property
> > @@ -3548,6 +3577,14 @@ static const struct wpa_dbus_signal_desc
> > wpas_dbus_interface_signals[] = {
> >  		  END_ARGS
> >  	  }
> >  	},
> > +#ifdef CONFIG_IBSS_RSN
> > 
> > +	{ "IbssRsnConnected",WPAS_DBUS_NEW_IFACE_INTERFACE,
> > 
> > +	  {
> > 
> > +		 { "peer","ay",ARG_OUT },
> > 
> > +		 END_ARGS
> > 
> > +	  }
> > 
> > +	},
> > 
> > +#endif
> >  	{ NULL, NULL, { END_ARGS } }
> >  };
> >  
> > diff --git a/wpa_supplicant/dbus/dbus_new.h
> > b/wpa_supplicant/dbus/dbus_new.h
> > index d64fcee..38f521d 100644
> > --- a/wpa_supplicant/dbus/dbus_new.h
> > +++ b/wpa_supplicant/dbus/dbus_new.h
> > @@ -237,7 +237,10 @@ void
> > wpas_dbus_signal_p2p_invitation_received(struct wpa_supplicant
> > *wpa_s,
> >  					      const u8 *sa, const
> > u8
> > *dev_addr,
> >  					      const u8 *bssid, int
> > id,
> >  					      int op_freq);
> > -
> > +#ifdef CONFIG_IBSS_RSN
> > 
> > +void wpas_dbus_signal_ibss_rsn_connected(struct wpa_supplicant
> > *wpa_s,
> > 
> > +                               const u8 *peer);
> > 
> > +#endif /*CONFIG_IBSS_RSN*/
> >  #else /* CONFIG_CTRL_IFACE_DBUS_NEW */
> >  
> >  static inline int wpas_dbus_register_interface(struct
> > wpa_supplicant
> > *wpa_s)
> > diff --git a/wpa_supplicant/ibss_rsn.c b/wpa_supplicant/ibss_rsn.c
> > index c00db31..549995d 100644
> > --- a/wpa_supplicant/ibss_rsn.c
> > +++ b/wpa_supplicant/ibss_rsn.c
> > @@ -19,7 +19,7 @@
> >  #include "driver_i.h"
> >  #include "common/ieee802_11_defs.h"
> >  #include "ibss_rsn.h"
> > -
> > +#include "notify.h"
> >  
> >  static void ibss_rsn_auth_timeout(void *eloop_ctx, void
> > *timeout_ctx);
> >  
> > @@ -133,6 +133,7 @@ static void ibss_check_rsn_completed(struct
> > ibss_rsn_peer *peer)
> >  	peer->authentication_status |= IBSS_RSN_REPORTED_PTK;
> >  	wpa_msg(wpa_s, MSG_INFO, IBSS_RSN_COMPLETED MACSTR,
> >  		MAC2STR(peer->addr));
> > +	wpas_notify_ibssrsn_connected(wpa_s,peer->addr);
> >  }
> >  
> > diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
> > index 67e36ae..5cce236 100644
> > --- a/wpa_supplicant/notify.c
> > +++ b/wpa_supplicant/notify.c
> > @@ -148,6 +148,12 @@ void wpas_notify_assoc_status_code(struct
> > wpa_supplicant *wpa_s)
> >  	wpas_dbus_signal_prop_changed(wpa_s,
> > WPAS_DBUS_PROP_ASSOC_STATUS_CODE);
> >  }
> >  
> > +#ifdef CONFIG_IBSS_RSN
> > 
> > +void wpas_notify_ibssrsn_connected(struct wpa_supplicant
> > *wpa_s,const u8 *peer)
> > 
> > +{
> > 
> > +	wpas_dbus_signal_ibss_rsn_connected(wpa_s,peer);
> > 
> > +}
> > 
> > +#endif /*CONFIG_IBSS_RSN*/
> >  
> >  void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
> >  {
> > diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
> > index 8cce0f3..d90c4f3 100644
> > --- a/wpa_supplicant/notify.h
> > +++ b/wpa_supplicant/notify.h
> > @@ -141,5 +141,8 @@ void wpas_notify_network_type_changed(struct
> > wpa_supplicant *wpa_s,
> >  void wpas_notify_p2p_invitation_received(struct wpa_supplicant
> > *wpa_s,
> >  					 const u8 *sa, const u8
> > *go_dev_addr,
> >  					 const u8 *bssid, int id,
> > int op_freq);
> > +#ifdef CONFIG_IBSS_RSN
> > 
> > +void wpas_notify_ibssrsn_connected(struct wpa_supplicant *wpa_s,
> > const u8 *peer);
> > 
> > +#endif /*CONFIG_IBSS_RSN*/
> >  
> >  #endif /* NOTIFY_H */
> _______________________________________________
> Hostap mailing list
> Hostap@xxxxxxxxxxxxxxxxxxx
> http://lists.infradead.org/mailman/listinfo/hostap

_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux