[PATCH v2, 1/2] Add hw mode config for 80211ah

JUN-KYU SHIN jk.shin at newratek.com
Mon Nov 21 17:37:34 PST 2022


Patch for using 802.11ah (S1G) by config file.

Signed-off-by: JUN-KYU SHIN <jk.shin at newratek.com>
---
 hostapd/config_file.c             | 2 ++
 src/ap/hw_features.c              | 2 ++
 src/common/defs.h                 | 1 +
 src/drivers/driver_nl80211_capa.c | 8 +++++++-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 5715ded42..feb122ddd 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3096,6 +3096,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 			conf->hw_mode = HOSTAPD_MODE_IEEE80211AD;
 		else if (os_strcmp(pos, "any") == 0)
 			conf->hw_mode = HOSTAPD_MODE_IEEE80211ANY;
+		else if (os_strcmp(pos, "ah") == 0)
+			conf->hw_mode = HOSTAPD_MODE_IEEE80211AH;
 		else {
 			wpa_printf(MSG_ERROR, "Line %d: unknown hw_mode '%s'",
 				   line, pos);
diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c
index ed5ff41d3..851daf3dc 100644
--- a/src/ap/hw_features.c
+++ b/src/ap/hw_features.c
@@ -1157,6 +1157,8 @@ const char * hostapd_hw_mode_txt(int mode)
 		return "IEEE 802.11g";
 	case HOSTAPD_MODE_IEEE80211AD:
 		return "IEEE 802.11ad";
+	case HOSTAPD_MODE_IEEE80211AH:
+		return "IEEE 802.11ah";
 	default:
 		return "UNKNOWN";
 	}
diff --git a/src/common/defs.h b/src/common/defs.h
index 3e658cbcf..6edb7d946 100644
--- a/src/common/defs.h
+++ b/src/common/defs.h
@@ -375,6 +375,7 @@ enum hostapd_hw_mode {
 	HOSTAPD_MODE_IEEE80211G,
 	HOSTAPD_MODE_IEEE80211A,
 	HOSTAPD_MODE_IEEE80211AD,
+	HOSTAPD_MODE_IEEE80211AH
 	HOSTAPD_MODE_IEEE80211ANY,
 	NUM_HOSTAPD_MODES
 };
diff --git a/src/drivers/driver_nl80211_capa.c b/src/drivers/driver_nl80211_capa.c
index 512bbb6de..d3e42f551 100644
--- a/src/drivers/driver_nl80211_capa.c
+++ b/src/drivers/driver_nl80211_capa.c
@@ -2089,7 +2089,9 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
 	for (m = 0; m < *num_modes; m++) {
 		if (!modes[m].num_channels)
 			continue;
-		if (modes[m].channels[0].freq < 2000) {
+		if (modes[m].channels[0].freq < 1000) {
+			modes[m].mode = HOSTAPD_MODE_IEEE80211AH;
+		} else if (modes[m].channels[0].freq < 2000) {
 			modes[m].num_channels = 0;
 			continue;
 		} else if (modes[m].channels[0].freq < 4000) {
@@ -2132,6 +2134,8 @@ wpa_driver_nl80211_postprocess_modes(struct hostapd_hw_modes *modes,
 			return modes; /* 802.11b already included */
 		if (modes[m].mode == HOSTAPD_MODE_IEEE80211G)
 			mode11g_idx = m;
+		if (modes[m].mode == HOSTAPD_MODE_IEEE80211AH)
+			return modes;
 	}
 
 	if (mode11g_idx < 0)
@@ -2514,6 +2518,8 @@ static const char * modestr(enum hostapd_hw_mode mode)
 		return "802.11a";
 	case HOSTAPD_MODE_IEEE80211AD:
 		return "802.11ad";
+	case HOSTAPD_MODE_IEEE80211AH:
+		return "802.11ah";
 	default:
 		return "?";
 	}
-- 
2.25.1




More information about the Hostap mailing list