Skip to content

Commit

Permalink
Merge remote-tracking branch 'hostap/master' into research
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathy Vanhoef authored and Mathy Vanhoef committed Apr 1, 2018
2 parents 8264fa4 + 208263c commit 1e2fd20
Show file tree
Hide file tree
Showing 33 changed files with 558 additions and 27 deletions.
41 changes: 41 additions & 0 deletions hostapd/config_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,44 @@ static int parse_venue_name(struct hostapd_bss_config *bss, char *pos,
}


static int parse_venue_url(struct hostapd_bss_config *bss, char *pos,
int line)
{
char *sep;
size_t nlen;
struct hostapd_venue_url *url;
int ret = -1;

sep = os_strchr(pos, ':');
if (!sep)
goto fail;
*sep++ = '\0';

nlen = os_strlen(sep);
if (nlen > 254)
goto fail;

url = os_realloc_array(bss->venue_url, bss->venue_url_count + 1,
sizeof(struct hostapd_venue_url));
if (!url)
goto fail;

bss->venue_url = url;
url = &bss->venue_url[bss->venue_url_count++];

url->venue_number = atoi(pos);
url->url_len = nlen;
os_memcpy(url->url, sep, nlen);

ret = 0;
fail:
if (ret)
wpa_printf(MSG_ERROR, "Line %d: Invalid venue_url '%s'",
line, pos);
return ret;
}


static int parse_3gpp_cell_net(struct hostapd_bss_config *bss, char *buf,
int line)
{
Expand Down Expand Up @@ -3380,6 +3418,9 @@ static int hostapd_config_fill(struct hostapd_config *conf,
} else if (os_strcmp(buf, "venue_name") == 0) {
if (parse_venue_name(bss, pos, line) < 0)
return 1;
} else if (os_strcmp(buf, "venue_url") == 0) {
if (parse_venue_url(bss, pos, line) < 0)
return 1;
} else if (os_strcmp(buf, "network_auth_type") == 0) {
u8 auth_type;
u16 redirect_url_len;
Expand Down
9 changes: 9 additions & 0 deletions hostapd/hostapd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,15 @@ wpa_group_rekey=8640000
# (double quoted string, printf-escaped string)
#venue_name=P"eng:Example\nvenue"

# Venue URL information
# This parameter can be used to configure one or more Venue URL Duples to
# provide additional information corresponding to Venue Name information.
# Each entry has a Venue Number value separated by colon from the Venue URL
# string. Venue Number indicates the corresponding venue_name entry (1 = 1st
# venue_name, 2 = 2nd venue_name, and so on; 0 = no matching venue_name)
#venue_url=1:http://www.example.com/info-eng
#venue_url=2:http://www.example.com/info-fin

# Network Authentication Type
# This parameter indicates what type of network authentication is used in the
# network.
Expand Down
1 change: 1 addition & 0 deletions src/ap/ap_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ void hostapd_config_free_bss(struct hostapd_bss_config *conf)

os_free(conf->roaming_consortium);
os_free(conf->venue_name);
os_free(conf->venue_url);
os_free(conf->nai_realm_data);
os_free(conf->network_auth_type);
os_free(conf->anqp_3gpp_cell_net);
Expand Down
10 changes: 10 additions & 0 deletions src/ap/ap_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ struct hostapd_lang_string {
u8 name[252];
};

struct hostapd_venue_url {
u8 venue_number;
u8 url_len;
u8 url[254];
};

#define MAX_NAI_REALMS 10
#define MAX_NAI_REALMLEN 255
#define MAX_NAI_EAP_METHODS 5
Expand Down Expand Up @@ -504,6 +510,10 @@ struct hostapd_bss_config {
unsigned int venue_name_count;
struct hostapd_lang_string *venue_name;

/* Venue URL duples */
unsigned int venue_url_count;
struct hostapd_venue_url *venue_url;

/* IEEE 802.11u - Network Authentication Type */
u8 *network_auth_type;
size_t network_auth_type_len;
Expand Down
34 changes: 32 additions & 2 deletions src/ap/gas_serv.c
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ static void anqp_add_capab_list(struct hostapd_data *hapd,
#endif /* CONFIG_FILS */
if (get_anqp_elem(hapd, ANQP_CAG))
wpabuf_put_le16(buf, ANQP_CAG);
if (get_anqp_elem(hapd, ANQP_VENUE_URL))
if (hapd->conf->venue_url || get_anqp_elem(hapd, ANQP_VENUE_URL))
wpabuf_put_le16(buf, ANQP_VENUE_URL);
if (get_anqp_elem(hapd, ANQP_ADVICE_OF_CHARGE))
wpabuf_put_le16(buf, ANQP_ADVICE_OF_CHARGE);
Expand Down Expand Up @@ -328,6 +328,29 @@ static void anqp_add_venue_name(struct hostapd_data *hapd, struct wpabuf *buf)
}


static void anqp_add_venue_url(struct hostapd_data *hapd, struct wpabuf *buf)
{
if (anqp_add_override(hapd, buf, ANQP_VENUE_URL))
return;

if (hapd->conf->venue_url) {
u8 *len;
unsigned int i;

len = gas_anqp_add_element(buf, ANQP_VENUE_URL);
for (i = 0; i < hapd->conf->venue_url_count; i++) {
struct hostapd_venue_url *url;

url = &hapd->conf->venue_url[i];
wpabuf_put_u8(buf, 1 + url->url_len);
wpabuf_put_u8(buf, url->venue_number);
wpabuf_put_data(buf, url->url, url->url_len);
}
gas_anqp_set_element_len(buf, len);
}
}


static void anqp_add_network_auth_type(struct hostapd_data *hapd,
struct wpabuf *buf)
{
Expand Down Expand Up @@ -946,6 +969,10 @@ gas_serv_build_gas_resp_payload(struct hostapd_data *hapd,
continue;
}
#endif /* CONFIG_FILS */
if (extra_req[i] == ANQP_VENUE_URL) {
anqp_add_venue_url(hapd, buf);
continue;
}
anqp_add_elem(hapd, buf, extra_req[i]);
}

Expand Down Expand Up @@ -1082,7 +1109,10 @@ static void rx_anqp_query_list_id(struct hostapd_data *hapd, u16 info_id,
"ANQP: FILS Realm Information (local)");
} else
#endif /* CONFIG_FILS */
if (!get_anqp_elem(hapd, info_id)) {
if (info_id == ANQP_VENUE_URL && hapd->conf->venue_url) {
wpa_printf(MSG_DEBUG,
"ANQP: Venue URL (local)");
} else if (!get_anqp_elem(hapd, info_id)) {
wpa_printf(MSG_DEBUG, "ANQP: Unsupported Info Id %u",
info_id);
break;
Expand Down
10 changes: 8 additions & 2 deletions src/ap/wpa_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -4737,7 +4737,8 @@ int wpa_auth_resend_m3(struct wpa_state_machine *sm,
pos = ieee80211w_kde_add(sm, pos);
if (pos - opos >= WPA_IGTK_KDE_PREFIX_LEN) {
poc_log(sm->addr, "Msg 3/4: including IGTK with %s RSC\n", maxrsc ? "max" : "zero");
opos += 2 + RSN_SELECTOR_LEN + 2; /* skip KDE header and keyid */
/* skip KDE header and keyid */
opos += 2 + RSN_SELECTOR_LEN + 2;
os_memset(opos, maxrsc ? 0x88 : 0, 6); /* clear PN */
}
#endif /* CONFIG_IEEE80211W */
Expand Down Expand Up @@ -4845,8 +4846,13 @@ int wpa_auth_resend_group_m1(struct wpa_state_machine *sm,
pos = ieee80211w_kde_add(sm, pos);
if (pos - opos >= WPA_IGTK_KDE_PREFIX_LEN) {
poc_log(sm->addr, "Group message 1: including IGTK with %s RSC\n", maxrsc ? "max" : "zero");
opos += 2 + RSN_SELECTOR_LEN + 2; /* skip KDE header and keyid */
/* skip KDE header and keyid */
opos += 2 + RSN_SELECTOR_LEN + 2;
os_memset(opos, maxrsc ? 0x88 : 0, 6); /* clear PN */
if (pos - opos >=
2 + RSN_SELECTOR_LEN + WPA_IGTK_KDE_PREFIX_LEN) {

os_memset(opos, 0, 6); /* clear PN */
}
#endif /* CONFIG_IEEE80211W */
kde_len = pos - kde;
Expand Down
18 changes: 17 additions & 1 deletion src/common/qca-vendor.h
Original file line number Diff line number Diff line change
Expand Up @@ -2881,6 +2881,8 @@ enum qca_wlan_vendor_tdls_trigger_mode {
* limit feature.
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER: Select the SAR power
* limits configured by %QCA_NL80211_VENDOR_SUBCMD_SET_SAR.
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0: Select the SAR power
* limits version 2.0 configured by %QCA_NL80211_VENDOR_SUBCMD_SET_SAR.
*
* This enumerates the valid set of values that may be supplied for
* attribute %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT in an instance of
Expand All @@ -2896,6 +2898,7 @@ enum qca_vendor_attr_sar_limits_selections {
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_BDF4 = 4,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_NONE = 5,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER = 6,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0 = 7,
};

/**
Expand Down Expand Up @@ -2942,7 +2945,12 @@ enum qca_vendor_attr_sar_limits_spec_modulations {
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN, and
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_MODULATION and always
* contains as a payload the attribute
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT.
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT,
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX.
* Either %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT or
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX is
* needed based upon the value of
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SAR_ENABLE.
*
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_BAND: Optional (u32) value to
* indicate for which band this specification applies. Valid
Expand All @@ -2967,6 +2975,13 @@ enum qca_vendor_attr_sar_limits_spec_modulations {
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT: Required (u32)
* value to specify the actual power limit value in units of 0.5
* dBm (i.e., a value of 11 represents 5.5 dBm).
* This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_USER.
*
* @QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX: Required (u32)
* value to indicate SAR V2 indices (0 - 11) to select SAR V2 profiles.
* This is required, when %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT is
* %QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SELECT_V2_0.
*
* These attributes are used with %QCA_NL80211_VENDOR_SUBCMD_SET_SAR_LIMITS
* and %QCA_NL80211_VENDOR_SUBCMD_GET_SAR_LIMITS.
Expand All @@ -2980,6 +2995,7 @@ enum qca_vendor_attr_sar_limits {
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_CHAIN = 5,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_MODULATION = 6,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT = 7,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_SPEC_POWER_LIMIT_INDEX = 8,

QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_AFTER_LAST,
QCA_WLAN_VENDOR_ATTR_SAR_LIMITS_MAX =
Expand Down
1 change: 1 addition & 0 deletions src/common/wpa_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ extern "C" {
/** EAP authentication failed due to no response received */
#define WPA_EVENT_EAP_TIMEOUT_FAILURE "CTRL-EVENT-EAP-TIMEOUT-FAILURE "
#define WPA_EVENT_EAP_TIMEOUT_FAILURE2 "CTRL-EVENT-EAP-TIMEOUT-FAILURE2 "
#define WPA_EVENT_EAP_ERROR_CODE "EAP-ERROR-CODE "
/** Network block temporarily disabled (e.g., due to authentication failure) */
#define WPA_EVENT_TEMP_DISABLED "CTRL-EVENT-SSID-TEMP-DISABLED "
/** Temporarily disabled network block re-enabled */
Expand Down
9 changes: 9 additions & 0 deletions src/drivers/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -4585,6 +4585,15 @@ enum wpa_event_type {
* change event.
*/
EVENT_STATION_OPMODE_CHANGED,

/**
* EVENT_INTERFACE_MAC_CHANGED - Notify that interface MAC changed
*
* This event is emitted when the MAC changes while the interface is
* enabled. When an interface was disabled and becomes enabled, it
* must be always assumed that the MAC possibly changed.
*/
EVENT_INTERFACE_MAC_CHANGED,
};


Expand Down
1 change: 1 addition & 0 deletions src/drivers/driver_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ const char * event_to_string(enum wpa_event_type event)
E2S(EXTERNAL_AUTH);
E2S(PORT_AUTHORIZED);
E2S(STATION_OPMODE_CHANGED);
E2S(INTERFACE_MAC_CHANGED);
}

return "UNKNOWN";
Expand Down
11 changes: 7 additions & 4 deletions src/drivers/driver_nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -952,7 +952,7 @@ nl80211_find_drv(struct nl80211_global *global, int idx, u8 *buf, size_t len,


static void nl80211_refresh_mac(struct wpa_driver_nl80211_data *drv,
int ifindex)
int ifindex, int notify)
{
struct i802_bss *bss;
u8 addr[ETH_ALEN];
Expand All @@ -971,6 +971,9 @@ static void nl80211_refresh_mac(struct wpa_driver_nl80211_data *drv,
ifindex, bss->ifname,
MAC2STR(bss->addr), MAC2STR(addr));
os_memcpy(bss->addr, addr, ETH_ALEN);
if (notify)
wpa_supplicant_event(drv->ctx,
EVENT_INTERFACE_MAC_CHANGED, NULL);
}
}

Expand Down Expand Up @@ -1042,11 +1045,11 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
namebuf[0] = '\0';
if (if_indextoname(ifi->ifi_index, namebuf) &&
linux_iface_up(drv->global->ioctl_sock, namebuf) > 0) {
/* Re-read MAC address as it may have changed */
nl80211_refresh_mac(drv, ifi->ifi_index);
wpa_printf(MSG_DEBUG, "nl80211: Ignore interface down "
"event since interface %s is up", namebuf);
drv->ignore_if_down_event = 0;
/* Re-read MAC address as it may have changed */
nl80211_refresh_mac(drv, ifi->ifi_index, 1);
return;
}
wpa_printf(MSG_DEBUG, "nl80211: Interface down (%s/%s)",
Expand Down Expand Up @@ -1092,7 +1095,7 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
"removed", drv->first_bss->ifname);
} else {
/* Re-read MAC address as it may have changed */
nl80211_refresh_mac(drv, ifi->ifi_index);
nl80211_refresh_mac(drv, ifi->ifi_index, 0);

wpa_printf(MSG_DEBUG, "nl80211: Interface up");
drv->if_disabled = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/drivers/driver_nl80211_capa.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,10 @@ static void wiphy_info_ext_feature_flags(struct wiphy_info_data *info,
if (ext_feature_isset(ext_features, len,
NL80211_EXT_FEATURE_MFP_OPTIONAL))
capa->flags |= WPA_DRIVER_FLAGS_MFP_OPTIONAL;

if (ext_feature_isset(ext_features, len,
NL80211_EXT_FEATURE_DFS_OFFLOAD))
capa->flags |= WPA_DRIVER_FLAGS_DFS_OFFLOAD;
}


Expand Down
3 changes: 3 additions & 0 deletions src/drivers/driver_nl80211_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,9 @@ static void nl80211_radar_event(struct wpa_driver_nl80211_data *drv,
wpa_supplicant_event(drv->ctx, EVENT_DFS_PRE_CAC_EXPIRED,
&data);
break;
case NL80211_RADAR_CAC_STARTED:
wpa_supplicant_event(drv->ctx, EVENT_DFS_CAC_STARTED, &data);
break;
default:
wpa_printf(MSG_DEBUG, "nl80211: Unknown radar event %d "
"received", event_type);
Expand Down
Loading

0 comments on commit 1e2fd20

Please sign in to comment.