[PATCH 12/19] P2PS: add feature capability value presence verification

Ilan Peer ilan.peer
Wed Jun 10 01:43:42 PDT 2015


From: Max Stepanov <Max.Stepanov at intel.com>

Add feature capability presence verification on P2PS provision discovery
request processing. Return 'incompatible parameter' error in a provision
discovery response if this mandatory attribute is missing.

Signed-off-by: Max Stepanov <Max.Stepanov at intel.com>
Reviewed-by: Ilan Peer <ilan.peer at intel.com>
---
 src/p2p/p2p_pd.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/src/p2p/p2p_pd.c b/src/p2p/p2p_pd.c
index 89c9a3a..f9e2911 100644
--- a/src/p2p/p2p_pd.c
+++ b/src/p2p/p2p_pd.c
@@ -548,6 +548,10 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
 			} else if (!conncap) {
 				p2p_dbg(p2p, "Conncap resolution failed");
 				reject = P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
+			} else if (!msg.feature_cap) {
+				p2p_dbg(p2p,
+					"Missing feature capability in Provision Discovery Request");
+				reject = P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
 			}
 
 			if (msg.wps_config_methods & WPS_CONFIG_KEYPAD) {
@@ -637,12 +641,25 @@ void p2p_process_prov_disc_req(struct p2p_data *p2p, const u8 *sa,
 
 				/* Reject this "Deferred Accept* if incompatible
 				 * conncap or method */
-				if (!conncap ||
-				    !(msg.wps_config_methods & method))
+				if (!conncap) {
+					p2p_dbg(p2p,
+						"Incompatible conncap in Follow-On Provision Discovery Request");
+					reject =
+						P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
+
+				} else if (!(msg.wps_config_methods & method)) {
+					p2p_dbg(p2p,
+						"Incompatible config method in Follow-On Provision Discovery Request");
 					reject =
 						P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
-				else
+				} else if (!msg.feature_cap) {
+					p2p_dbg(p2p,
+						"Missing feature capability in Follow-On Provision Discovery Request");
+					reject =
+						P2P_SC_FAIL_INCOMPATIBLE_PARAMS;
+				} else {
 					reject = P2P_SC_SUCCESS;
+				}
 
 				p2p->p2ps_prov->status = reject;
 				p2p->p2ps_prov->conncap = conncap;
-- 
1.9.1




More information about the Hostap mailing list