配置Becon frame中的Carplay的Interworking和Vendor Specific字段信息
最近在搞Carplay投屏,需要配置Becon frame中的Interworking和Vendor Specific字段信息,特此简单总结下:
1. Interworking
要支持Interworking字段信息,需要如下配置:
-
确认wifi firmware 固件是否支持802.11u
wifi firmware 固件需支持 802.11u的协议,这个就需要 wifi固件厂商提供支持802.11u的wifi固件。 -
配置
hostapd.conf
中添加interworking=1
如下是我这边配置的hostapd.conf
,用于开启5G wifi hostap
,固定信道149
interface=wlan0
ctrl_interface=/var/run/hostapd
driver=nl80211
ssid=SoftAp-123
# 5G 149
channel=149
hw_mode=a
ieee80211ac=1
ignore_broadcast_ssid=0
# Enable Interworking service
interworking=1
- 确认wifi 驱动是否支持
Interworking
(1) 开启宏控:WL11U
(2) 驱动中是否支持写Interworking becon data
我这边之前之所以一直不支持Interworking
的原因就是 wifi驱动就没有写Interworking becon
的代码,后来在FAE 的支持下,添加了如下增加IE becon data
的代码:
static s32
wl_cfg80211_start_ap(
struct wiphy *wiphy,
struct net_device *dev,
struct cfg80211_ap_settings *info)
{
......
#ifdef WL11U
bcm_tlv_t *interworking_ie;
#endif /* WL11U */
......
#ifdef WL11U
printk("Add interworking IE from beacon data\r\n");
/* Add interworking IE from beacon data */
if ((interworking_ie = wl_cfg80211_find_interworking_ie(
(u8 *)info->beacon.beacon_ies, info->beacon.beacon_ies_len)) != NULL) {
err = wl_cfg80211_add_iw_ie(cfg, dev, bssidx,
VNDR_IE_CUSTOM_FLAG, interworking_ie->id,
interworking_ie->data, interworking_ie->len);
if (unlikely(err)) {
WL_ERR(("Failed to add interworking IE"));
}
} else if (cfg->iw_ie_len != 0) {
/* we have to clear IW IE and disable gratuitous APR */
wl_cfg80211_add_iw_ie(cfg, dev, bssidx,
VNDR_IE_CUSTOM_FLAG,
DOT11_MNG_INTERWORKING_ID,
0, 0);
(void)wldev_iovar_setint_bsscfg(dev, "grat_arp", 0,bssidx);
cfg->wl11u = FALSE;
cfg->iw_ie_len = 0;
memset(cfg->iw_ie, 0, IW_IES_MAX_BUF_LEN);
/* we don't care about error */
}
#endif /* WL11U */
/* Set IEs to FW */
if ((err = wl_cfg80211_set_ies(dev, &info->beacon, bssidx)) < 0)
WL_ERR(("Set IEs failed \n"));
......
}
2. Vendor Specific字段信息
参考Carplay官方文档:《Accessory Interface Specification R29.pdf》
2.1 IE 字段信息,配置hostapd.conf
# Enable Interworking service
interworking=1
# Access Network Type
# 0 = Private network
# 1 = Private network with guest access
# 2 = Chargeable public network
# 3 = Free public network
# 4 = Personal device network
# 5 = Emergency services only network
# 14 = Test or experimental
# 15 = Wildcard
access_network_type=3
# Whether the network provides connectivity to the Internet
# 0 = Unspecified
# 1 = Network provides connectivity to the Internet
internet=0
# Additional Step Required for Access
# Note: This is only used with open network, i.e., ASRA shall ne set to 0 if
# RSN is used.
asra=0
# Emergency services reachable
esr=0
# Unauthenticated emergency service accessible
uesa=0
# Venue Info (optional)
# The available values are defined in IEEE Std 802.11u-2011, 7.3.1.34.
# Example values (group,type):
# 0,0 = Unspecified
# 1,7 = Convention Center
# 1,13 = Coffee Shop
# 2,0 = Unspecified Business
# 7,1 Private Residence
venue_group=10
venue_type=3
2.2 Vendor Specific字段信息,配置hostapd.conf
从文档中看到,我们需要配置这些信息:
The following parameters are required, see Payload (page 409):
● Name
● Manufacturer
● Model
● OUI
● Bluetooth MAC Address
● Device ID
这个信息,配置参考:
参考前面的文档,我们知道 :
规则就是:
dd + len + 00a040 + 01 + len + payload + 02 + len + payload + ......
如下所示:
# BT MAC: 80:c5:f2:a9:32:1c
vendor_elements=dd3B00a04000000200220106646f6e676c6502053132333435030641423132333404040050F204060680c5f2a9321c070680c5f2a9321cdd0400a04000
# dd
# 0x3B ---> total len: 33+12+3+6 + 5=59
# 00a040 ---> apple
# reference: BMW: 0000020022
# 01 06
# 646f6e676c65 ---> name: dongle len: 06
# 02 05
# 3132333435 ---> Manufacturer: 12345 len: 05
# 03 06
# 414231323334 ---> model: AB1234 len: 06
# 04 04
# 0050F204 ---> oui: 0050F204 len: 04
# 06 06
# 80c5f2a9321c ----> mac: 80:c5:f2:a9:32:1c len:06
# 07 06
# 80c5f2a9321c ----> Device ID: 80:c5:f2:a9:32:1d len:06
# reference: BMW: dd 04 00 a0 40 00 --> add end, len:
3. 抓sniffer log解析
配置好后抓包解析,结果如下: