Add a new config item p2p_dfs_chan_enable for WFD GO

The item can be overwritten by p2p_supplicant_overlay.conf

Bug: 272298287
Test: Manually verified it working from logs.
Change-Id: I3de7ee1523ceae4116830afd7a4bae4794f81274
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index 18abd53..a5d4d81 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -5396,6 +5396,7 @@
 	{ FUNC(p2p_device_persistent_mac_addr), 0 },
 	{ INT(p2p_interface_random_mac_addr), 0 },
 	{ INT(p2p_6ghz_disable), 0 },
+	{ INT(p2p_dfs_chan_enable), 0 },
 #endif /* CONFIG_P2P */
 	{ FUNC(country), CFG_CHANGED_COUNTRY },
 	{ INT(bss_max_count), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index dbb79dd..e1f30c2 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -854,8 +854,8 @@
 	int p2p_add_cli_chan;
 	int p2p_ignore_shared_freq;
 	int p2p_optimize_listen_chan;
-
 	int p2p_6ghz_disable;
+	int p2p_dfs_chan_enable;
 
 	struct wpabuf *wps_vendor_ext_m1;
 
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index a5fdc9a..5cf6730 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3993,8 +3993,10 @@
 		const struct oper_class_map *o = &global_op_class[op];
 		unsigned int ch;
 		struct p2p_reg_class *reg = NULL, *cli_reg = NULL;
+		bool check_dfs_supported = (wpa_s->conf->p2p_dfs_chan_enable
+							&& is_dfs_global_op_class(o->op_class));
 
-		if (o->p2p == NO_P2P_SUPP ||
+		if ((!check_dfs_supported && o->p2p == NO_P2P_SUPP) ||
 		    (is_6ghz_op_class(o->op_class) && p2p_disable_6ghz))
 			continue;