Re: [PATCH] cfg80211/nl80211: add a port authorized event

2017-10-03 Thread Johannes Berg
On Mon, 2017-10-02 at 23:09 +0200, Arend van Spriel wrote:
> On 29-09-17 14:21, Johannes Berg wrote:
> > From: Avraham Stern 
> > 
> > Add an event that indicates that a connection is authorized
> > (i.e. the 4 way handshake was performed by the driver). This event
> > should be sent by the driver after sending a connect/roamed event.
> 
> So is this event required for drivers supporting 4-way handshake 
> offload. If so, the "should" above might need to be "shall" and I
> have some changes to do in brcmfmac ;-)

I'm not sure it's *required*? I guess it would be for 802.1X on the
host/4-way-HS in the device, but not necessarily for the other cases?

johannes


Re: [PATCH] cfg80211/nl80211: add a port authorized event

2017-10-02 Thread Arend van Spriel

On 29-09-17 14:21, Johannes Berg wrote:

From: Avraham Stern 

Add an event that indicates that a connection is authorized
(i.e. the 4 way handshake was performed by the driver). This event
should be sent by the driver after sending a connect/roamed event.


So is this event required for drivers supporting 4-way handshake 
offload. If so, the "should" above might need to be "shall" and I have 
some changes to do in brcmfmac ;-)


Regards,
Arend


[PATCH] cfg80211/nl80211: add a port authorized event

2017-09-29 Thread Johannes Berg
From: Avraham Stern 

Add an event that indicates that a connection is authorized
(i.e. the 4 way handshake was performed by the driver). This event
should be sent by the driver after sending a connect/roamed event.

This is useful for networks that require 802.1X authentication.
In cases that the driver supports 4 way handshake offload, but the
802.1X authentication is managed by user space, the driver needs to
inform user space right after the 802.11 association was completed
so user space can initialize its 802.1X state machine etc.
However, it is also possible that the AP will choose to skip the
802.1X authentication (e.g. when PMKSA caching is used) and proceed
with the 4 way handshake immediately. In this case the driver needs
to inform user space that 802.1X authentication is no longer required
(e.g. to prevent user space from disconnecting since it did not get
any EAPOLs from the AP).

This is also useful for roaming, in which case it is possible that
the driver used the Fast Transition protocol so 802.1X is not
required.

Since there will now be a dedicated notification indicating that the
connection is authorized, the authorized flag can be removed from the
roamed event. Drivers can send the new port authorized event right
after sending the roamed event to indicate the new AP is already
authorized. This therefore reserves the old PORT_AUTHORIZED attribute.

Signed-off-by: Avraham Stern 
Signed-off-by: Johannes Berg 
---
 include/net/cfg80211.h   | 21 +
 include/uapi/linux/nl80211.h | 28 ---
 net/wireless/core.h  |  5 +
 net/wireless/nl80211.c   | 34 ++---
 net/wireless/nl80211.h   |  2 ++
 net/wireless/sme.c   | 45 +++-
 net/wireless/util.c  |  3 +++
 7 files changed, 119 insertions(+), 19 deletions(-)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index cc1996081463..8b8118a7fadb 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5428,9 +5428,6 @@ cfg80211_connect_timeout(struct net_device *dev, const u8 
*bssid,
  * @req_ie_len: association request IEs length
  * @resp_ie: association response IEs (may be %NULL)
  * @resp_ie_len: assoc response IEs length
- * @authorized: true if the 802.1X authentication was done by the driver or is
- * not needed (e.g., when Fast Transition protocol was used), false
- * otherwise. Ignored for networks that don't use 802.1X authentication.
  */
 struct cfg80211_roam_info {
struct ieee80211_channel *channel;
@@ -5440,7 +5437,6 @@ struct cfg80211_roam_info {
size_t req_ie_len;
const u8 *resp_ie;
size_t resp_ie_len;
-   bool authorized;
 };
 
 /**
@@ -5464,6 +5460,23 @@ struct cfg80211_roam_info {
 void cfg80211_roamed(struct net_device *dev, struct cfg80211_roam_info *info,
 gfp_t gfp);
 
+/**
+ * cfg80211_port_authorized - notify cfg80211 of successful security 
association
+ *
+ * @dev: network device
+ * @bssid: the BSSID of the AP
+ * @gfp: allocation flags
+ *
+ * This function should be called by a driver that supports 4 way handshake
+ * offload after a security association was successfully established (i.e.,
+ * the 4 way handshake was completed successfully). The call to this function
+ * should be preceded with a call to cfg80211_connect_result(),
+ * cfg80211_connect_done(), cfg80211_connect_bss() or cfg80211_roamed() to
+ * indicate the 802.11 association.
+ */
+void cfg80211_port_authorized(struct net_device *dev, const u8 *bssid,
+ gfp_t gfp);
+
 /**
  * cfg80211_disconnected - notify cfg80211 that connection was dropped
  *
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 59ba6ca66a0d..95832ce03a44 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -569,13 +569,14 @@
  * authentication/association or not receiving a response from the AP.
  * Non-zero %NL80211_ATTR_STATUS_CODE value is indicated in that case as
  * well to remain backwards compatible.
- * @NL80211_CMD_ROAM: notifcation indicating the card/driver roamed by itself.
- * When the driver roamed in a network that requires 802.1X authentication,
- * %NL80211_ATTR_PORT_AUTHORIZED should be set if the 802.1X authentication
- * was done by the driver or if roaming was done using Fast Transition
- * protocol (in which case 802.1X authentication is not needed). If
- * %NL80211_ATTR_PORT_AUTHORIZED is not set, user space is responsible for
- * the 802.1X authentication.
+ * When establishing a security association, drivers that support 4 way
+ * handshake offload should send %NL80211_CMD_PORT_AUTHORIZED event when
+ * the 4 way handshake is completed successfully.
+ * @NL80211_CMD_ROAM: Notification indicating the card/driver roamed by itself.
+ * When a security association was established with the new AP (e.g. i