Fix p2p on DFS channel issue: p2p_dfs_chan_enable is NOT enabled on p2p interface

When wpa_supplicant init p2p dev interface, it reads config items from p2p_supplicant_overlay.conf. But when init p2p wlan interface, the config file name is null. We have to save the config items to global p2p data struct.

Bug: 272298287
Test: Manually verified it working from logs
Change-Id: I211a36515bfa76ea23c077cc9e43fc811d9e139f
diff --git a/src/p2p/p2p.c b/src/p2p/p2p.c
index 5d50726..a1fe121 100644
--- a/src/p2p/p2p.c
+++ b/src/p2p/p2p.c
@@ -2960,6 +2960,14 @@
 }
 
 
+bool is_p2p_dfs_chan_enabled(struct p2p_data *p2p)
+{
+	if (p2p)
+		return p2p->cfg->p2p_dfs_chan_enable;
+	return false;
+}
+
+
 struct p2p_data * p2p_init(const struct p2p_config *cfg)
 {
 	struct p2p_data *p2p;
diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h
index 27bdac3..7784128 100644
--- a/src/p2p/p2p.h
+++ b/src/p2p/p2p.h
@@ -508,6 +508,11 @@
 	bool p2p_6ghz_disable;
 
 	/**
+	 * p2p_dfs_chan_enable - Enable p2p Go to operate on dfs channel
+	 */
+	bool p2p_dfs_chan_enable;
+
+	/**
 	 * pri_dev_type - Primary Device Type (see WPS)
 	 */
 	u8 pri_dev_type[8];
@@ -2114,6 +2119,7 @@
 			     const struct p2p_channels *cli_chan);
 
 bool is_p2p_6ghz_disabled(struct p2p_data *p2p);
+bool is_p2p_dfs_chan_enabled(struct p2p_data *p2p);
 
 /**
  * p2p_set_best_channels - Update best channel information
diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c
index 5cf6730..09c11e0 100644
--- a/wpa_supplicant/p2p_supplicant.c
+++ b/wpa_supplicant/p2p_supplicant.c
@@ -3993,7 +3993,7 @@
 		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
+		bool check_dfs_supported = (is_p2p_dfs_chan_enabled(wpa_s->global->p2p)
 							&& is_dfs_global_op_class(o->op_class));
 
 		if ((!check_dfs_supported && o->p2p == NO_P2P_SUPP) ||
@@ -4971,6 +4971,7 @@
 	p2p.p2ps_group_capability = p2ps_group_capability;
 	p2p.get_pref_freq_list = wpas_p2p_get_pref_freq_list;
 	p2p.p2p_6ghz_disable = wpa_s->conf->p2p_6ghz_disable;
+	p2p.p2p_dfs_chan_enable = wpa_s->conf->p2p_dfs_chan_enable;
 
 	os_memcpy(wpa_s->global->p2p_dev_addr, wpa_s->own_addr, ETH_ALEN);
 	os_memcpy(p2p.dev_addr, wpa_s->global->p2p_dev_addr, ETH_ALEN);