[PATCH] P2P: Also allow 5GHz 125:165,169 channels in p2p operations

Purushottam Kushwaha p.kushwaha
Fri Jun 12 03:22:42 PDT 2015


Some Countries allow operation in 5GHz 125: 165,169 channels.
Allow at supplicant level to facilitate connection in these channels.

Signed-off-by: Purushottam Kushwaha <p.kushwaha at samsung.com>
---
 src/common/ieee802_11_common.c | 6 ++++++
 src/p2p/p2p_utils.c            | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index e23007a..6187444 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -782,7 +782,13 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan)
 			return -1;
 		return 5000 + 5 * chan;
 	case 124: /* channels 149,153,157,161 */
+		if (chan < 149 || chan > 161)
+			return -1;
+		return 5000 + 5 * chan;
 	case 125: /* channels 149,153,157,161,165,169 */
+		if (chan < 149 || chan > 169)
+			return -1;
+		return 5000 + 5 * chan;
 	case 126: /* channels 149,157; 40 MHz */
 	case 127: /* channels 153,161; 40 MHz */
 		if (chan < 149 || chan > 161)
diff --git a/src/p2p/p2p_utils.c b/src/p2p/p2p_utils.c
index f32751d..eee3c5a 100644
--- a/src/p2p/p2p_utils.c
+++ b/src/p2p/p2p_utils.c
@@ -101,6 +101,15 @@ int p2p_freq_to_channel(unsigned int freq, u8 *op_class, u8 *channel)
 		return 0;
 	}
 
+	if (freq >= 5745 && freq <= 5845) {
+		if ((freq - 5000) % 5)
+			return -1;
+
+		*op_class = 125; /* 5 GHz, channels 149..169 */
+		*channel = (freq - 5000) / 5;
+		return 0;
+	}
+
 	if (freq >= 58320 && freq <= 64800) {
 		if ((freq - 58320) % 2160)
 			return -1;
-- 
1.9.1



More information about the Hostap mailing list