From cdffd72173c189a44fd2b27dab00e78c876b18ef Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 31 Jul 2014 19:11:31 +0300 Subject: [PATCH] Add WLAN-HESSID into RADIUS messages This adds hostapd support for the new WLAN-HESSID attribute defined in RFC 7268. This attribute contains the HESSID and it is added whenever Interworking is enabled and HESSID is configured. Signed-off-by: Jouni Malinen --- src/ap/ieee802_1x.c | 16 ++++++++++++++++ src/radius/radius.c | 1 + src/radius/radius.h | 1 + 3 files changed, 18 insertions(+) diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 9035094..c5285aa 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -435,6 +435,22 @@ int add_common_radius_attr(struct hostapd_data *hapd, return -1; } +#ifdef CONFIG_INTERWORKING + if (hapd->conf->interworking && + !is_zero_ether_addr(hapd->conf->hessid)) { + os_snprintf(buf, sizeof(buf), RADIUS_802_1X_ADDR_FORMAT, + MAC2STR(hapd->conf->hessid)); + buf[sizeof(buf) - 1] = '\0'; + if (!hostapd_config_get_radius_attr(req_attr, + RADIUS_ATTR_WLAN_HESSID) && + !radius_msg_add_attr(msg, RADIUS_ATTR_WLAN_HESSID, + (u8 *) buf, os_strlen(buf))) { + wpa_printf(MSG_ERROR, "Could not add WLAN-HESSID"); + return -1; + } + } +#endif /* CONFIG_INTERWORKING */ + if (sta && add_common_radius_sta_attr(hapd, req_attr, sta, msg) < 0) return -1; diff --git a/src/radius/radius.c b/src/radius/radius.c index 730056a..8bcf2f5 100644 --- a/src/radius/radius.c +++ b/src/radius/radius.c @@ -235,6 +235,7 @@ static struct radius_attr_type radius_attrs[] = { RADIUS_ATTR_EAP_KEY_NAME, "EAP-Key-Name", RADIUS_ATTR_HEXDUMP }, { RADIUS_ATTR_MOBILITY_DOMAIN_ID, "Mobility-Domain-Id", RADIUS_ATTR_INT32 }, + { RADIUS_ATTR_WLAN_HESSID, "WLAN-HESSID", RADIUS_ATTR_TEXT }, }; #define RADIUS_ATTRS ARRAY_SIZE(radius_attrs) diff --git a/src/radius/radius.h b/src/radius/radius.h index ff7224d..4ff7391 100644 --- a/src/radius/radius.h +++ b/src/radius/radius.h @@ -93,6 +93,7 @@ enum { RADIUS_ATTR_USER_NAME = 1, RADIUS_ATTR_ERROR_CAUSE = 101, RADIUS_ATTR_EAP_KEY_NAME = 102, RADIUS_ATTR_MOBILITY_DOMAIN_ID = 177, + RADIUS_ATTR_WLAN_HESSID = 181, }; -- 2.1.4