From 768537921e82423fe3440fa105bd4697e7b5c88d Mon Sep 17 00:00:00 2001
From: Sunil <sunilravi@google.com>
Date: Tue, 19 Jul 2022 00:04:20 +0000
Subject: [PATCH] P2P: Set operating class along with operating channel width

While setting up the P2P GO interface, wpa_supplicant sets the operating
channel width to CHANWIDTH_USE_HT in cases where it fails to set 80 MHz
bandwidth. In the same flow, update the operating class, too, according
to the channel width. This is to avoid setting up the operational
channel width back to 80 MHz from hostapd interface setup.

Signed-off-by: Sunil <sunilravi@google.com>
---
 wpa_supplicant/ap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 7de924945..67f2d8ac1 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -175,6 +175,9 @@ no_vht:
 	hostapd_set_oper_centr_freq_seg0_idx(
 		conf, conf->channel + conf->secondary_channel * 2);
 	hostapd_set_oper_chwidth(conf, CONF_OPER_CHWIDTH_USE_HT);
+	ieee80211_freq_to_channel_ext(ssid->frequency, 0,
+				      conf->vht_oper_chwidth,
+				      &conf->op_class, &conf->channel);
 }