commit 83cba4fb1f3a5792388466db9523726c8f71679b
parent b2bfd5837817d4bf20e02eb1fa17df010d28e988
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 9 Sep 2019 09:49:10 -0700
hotspot: implement 'get_vendor_ies'
This op builds up the vendor IEs required for hotspot 2.0. The
version, and optionally the RC are provided in order to correctly
build the HS20 Indication Element and RC Selection element.
Diffstat:
1 file changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/hotspot.c b/src/hotspot.c
@@ -38,6 +38,7 @@
#include "src/ie.h"
#include "src/knownnetworks.h"
#include "src/storage.h"
+#include "src/scan.h"
static struct l_dir_watch *hs20_dir_watch;
static struct l_queue *hs20_settings;
@@ -255,6 +256,39 @@ static bool hotspot_match_nai_realms(const struct network_info *info,
return false;
}
+static const struct iovec *hotspot_network_get_ies(
+ const struct network_info *info,
+ struct scan_bss *bss,
+ size_t *num_elems)
+{
+ static struct iovec iov[2];
+ static uint8_t hs20_ie[7];
+ static uint8_t rc_buf[11];
+ const uint8_t *rc;
+ size_t rc_len;
+ size_t iov_elems = 0;
+
+ ie_build_hs20_indication(bss->hs20_version, hs20_ie);
+
+ iov[iov_elems].iov_base = hs20_ie;
+ iov[iov_elems].iov_len = hs20_ie[1] + 2;
+ iov_elems++;
+
+ rc = hotspot_match_roaming_consortium(info, bss->rc_ie,
+ bss->rc_ie[1] + 2, &rc_len);
+ if (rc) {
+ ie_build_roaming_consortium(rc, rc_len, rc_buf);
+
+ iov[iov_elems].iov_base = rc_buf;
+ iov[iov_elems].iov_len = rc_buf[1] + 2;
+ iov_elems++;
+ }
+
+ *num_elems = iov_elems;
+
+ return iov;
+}
+
static struct network_info_ops hotspot_ops = {
.open = hotspot_network_open,
.touch = hotspot_network_touch,
@@ -264,6 +298,7 @@ static struct network_info_ops hotspot_ops = {
.get_path = hotspot_network_get_path,
.get_name = hotspot_network_get_name,
.get_type = hotspot_network_get_type,
+ .get_extra_ies = hotspot_network_get_ies,
.match_hessid = hotspot_match_hessid,
.match_roaming_consortium = hotspot_match_roaming_consortium,