* [PATCH 02/13] ie: add ie_parse_owe_transition_from_data
@ 2021-09-15 17:36 James Prestwood
0 siblings, 0 replies; 3+ messages in thread
From: James Prestwood @ 2021-09-15 17:36 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2598 bytes --]
This is a parser for the WFA OWE Transition element. For now the
optional band/channel bytes will not be parsed as hostapd does not
yet support these and would also require the 802.11 appendix E-1
to be added to IWD. Because of this OWE Transition networks are
assumed to be on the same channel as their open counterpart.
---
src/ie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
src/ie.h | 3 +++
2 files changed, 46 insertions(+)
diff --git a/src/ie.c b/src/ie.c
index 1ce1d8a5..286b6a49 100644
--- a/src/ie.c
+++ b/src/ie.c
@@ -1343,6 +1343,8 @@ bool is_ie_wfa_ie(const uint8_t *data, uint8_t len, uint8_t oi_type)
return false;
else if (oi_type == IE_WFA_OI_HS20_INDICATION && len != 5 && len != 7)
return false;
+ else if (oi_type == IE_WFA_OI_OWE_TRANSITION && len < 12)
+ return false;
else if (len < 4) /* OI not handled, but at least check length */
return false;
@@ -2492,3 +2494,44 @@ int ie_parse_network_cost(const void *data, size_t len,
*flags = l_get_le16(ie + 8);
return 0;
}
+
+int ie_parse_owe_transition(const void *data, size_t len, uint8_t *bssid,
+ char ssid[33])
+{
+ const uint8_t *ie = data;
+ size_t slen;
+
+ if (len < 14 || ie[0] != IE_TYPE_VENDOR_SPECIFIC)
+ return -ENOMSG;
+
+ if (!is_ie_wfa_ie(ie + 2, len - 2, IE_WFA_OI_OWE_TRANSITION))
+ return -ENOMSG;
+
+ slen = l_get_u8(ie + 12);
+ if (slen > 32)
+ return -ENOMSG;
+
+ /*
+ * WFA OWE Specification 2.3.1
+ *
+ * "Band Info and Channel Info are optional fields. If configured,
+ * both fields shall be included in an OWE Transition Mode element"
+ *
+ * TODO: Support Band/Channel bytes:
+ * For the time being the OWE transition AP is assumed to be on the same
+ * channel as the open AP. This means there should be no band/channel
+ * bytes at the end of the IE. Currently hostapd has no support for this
+ * so it can be skipped. In addition 802.11 Appendix E-1 needs to be
+ * encoded as a table to map Country/operating class to channels to make
+ * any sense of it.
+ */
+ if (len != slen + 13)
+ return -ENOMSG;
+
+ memcpy(bssid, ie + 6, 6);
+
+ memcpy(ssid, ie + 13, slen);
+ ssid[slen] = '\0';
+
+ return 0;
+}
diff --git a/src/ie.h b/src/ie.h
index 4e1c5433..fdd7f34c 100644
--- a/src/ie.h
+++ b/src/ie.h
@@ -630,3 +630,6 @@ void ie_build_fils_ip_addr_response(
int ie_parse_network_cost(const void *data, size_t len,
uint16_t *flags, uint16_t *level);
+
+int ie_parse_owe_transition(const void *data, size_t len, uint8_t *bssid,
+ char ssid[33]);
--
2.31.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 02/13] ie: add ie_parse_owe_transition_from_data
@ 2021-09-15 20:14 Denis Kenzior
0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2021-09-15 20:14 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 178 bytes --]
> See [1] for reasons why
>
Whoops, I guess I forgot to include [1]. Here it is:
https://hamberg.no/erlend/posts/2013-02-18-static-array-indices.html
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 02/13] ie: add ie_parse_owe_transition_from_data
@ 2021-09-15 19:45 Denis Kenzior
0 siblings, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2021-09-15 19:45 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 2287 bytes --]
Hi James,
On 9/15/21 12:36 PM, James Prestwood wrote:
> This is a parser for the WFA OWE Transition element. For now the
> optional band/channel bytes will not be parsed as hostapd does not
> yet support these and would also require the 802.11 appendix E-1
> to be added to IWD. Because of this OWE Transition networks are
> assumed to be on the same channel as their open counterpart.
> ---
> src/ie.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> src/ie.h | 3 +++
> 2 files changed, 46 insertions(+)
>
<snip>
> +
> +int ie_parse_owe_transition(const void *data, size_t len, uint8_t *bssid,
> + char ssid[33])
Can we change the signature as follows:
int ie_parse_owe_transition(const void *data,
size_t len,
uint8_t out_bssid[static 6],
char out_ssid[static 33])
See [1] for reasons why
> +{
> + const uint8_t *ie = data;
> + size_t slen;
> +
> + if (len < 14 || ie[0] != IE_TYPE_VENDOR_SPECIFIC)
> + return -ENOMSG;
> +
> + if (!is_ie_wfa_ie(ie + 2, len - 2, IE_WFA_OI_OWE_TRANSITION))
> + return -ENOMSG;
> +
> + slen = l_get_u8(ie + 12);
> + if (slen > 32)
> + return -ENOMSG;
> +
> + /*
> + * WFA OWE Specification 2.3.1
> + *
> + * "Band Info and Channel Info are optional fields. If configured,
> + * both fields shall be included in an OWE Transition Mode element"
> + *
> + * TODO: Support Band/Channel bytes:
> + * For the time being the OWE transition AP is assumed to be on the same
> + * channel as the open AP. This means there should be no band/channel
> + * bytes at the end of the IE. Currently hostapd has no support for this
> + * so it can be skipped. In addition 802.11 Appendix E-1 needs to be
> + * encoded as a table to map Country/operating class to channels to make
> + * any sense of it.
> + */
> + if (len != slen + 13)
> + return -ENOMSG;
> +
> + memcpy(bssid, ie + 6, 6);
> +
> + memcpy(ssid, ie + 13, slen);
> + ssid[slen] = '\0';
So we have to be careful here since ssid is not guaranteed to be utf8. This is
why the scan_bss and handshake_state structures store ssid + length. For
anything user-visible we enforce SSID to be UTF8, but in the case of OWE Hidden
BSS it should be acceptable to have an SSID that isn't.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-15 20:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-15 17:36 [PATCH 02/13] ie: add ie_parse_owe_transition_from_data James Prestwood
2021-09-15 19:45 Denis Kenzior
2021-09-15 20:14 Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.