Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2229809/?format=api
{ "id": 2229809, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2229809/?format=api", "web_url": "http://patchwork.ozlabs.org/project/hostap/patch/20260428200639.40243-10-andrei.otcheretianski@intel.com/", "project": { "id": 22, "url": "http://patchwork.ozlabs.org/api/1.1/projects/22/?format=api", "name": "HostAP Development", "link_name": "hostap", "list_id": "hostap.lists.infradead.org", "list_email": "hostap@lists.infradead.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20260428200639.40243-10-andrei.otcheretianski@intel.com>", "date": "2026-04-28T20:05:10", "name": "[09/97] NAN: Skip duplicate NDI station add for second NDP with same peer", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "521e6aa0200c93f27e7af4c1cda85effaa63476f", "submitter": { "id": 62065, "url": "http://patchwork.ozlabs.org/api/1.1/people/62065/?format=api", "name": "Andrei Otcheretianski", "email": "andrei.otcheretianski@intel.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/hostap/patch/20260428200639.40243-10-andrei.otcheretianski@intel.com/mbox/", "series": [ { "id": 501927, "url": "http://patchwork.ozlabs.org/api/1.1/series/501927/?format=api", "web_url": "http://patchwork.ozlabs.org/project/hostap/list/?series=501927", "date": "2026-04-28T20:05:05", "name": "NAN: Group keys support, schedule update and more", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501927/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2229809/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2229809/checks/", "tags": {}, "headers": { "Return-Path": "\n <hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=lists.infradead.org header.i=@lists.infradead.org\n header.a=rsa-sha256 header.s=bombadil.20210309 header.b=owoD7MgK;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256\n header.s=Intel header.b=h1SkDcI4;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=none (no SPF record) smtp.mailfrom=lists.infradead.org\n (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org;\n envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from bombadil.infradead.org (bombadil.infradead.org\n [IPv6:2607:7c80:54:3::133])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g4s1Y2Dlgz23gh\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 06:08:01 +1000 (AEST)", "from localhost ([::1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wHoiR-00000002CPH-3xgL;\n\tTue, 28 Apr 2026 20:07:31 +0000", "from mgamail.intel.com ([198.175.65.16])\n\tby bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux))\n\tid 1wHoiO-00000002CHj-2qMs\n\tfor hostap@lists.infradead.org;\n\tTue, 28 Apr 2026 20:07:29 +0000", "from fmviesa001.fm.intel.com ([10.60.135.141])\n by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2026 13:07:29 -0700", "from iapp347.iil.intel.com (HELO 87c02287900a.iil.intel.com)\n ([10.167.28.6])\n by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 28 Apr 2026 13:07:27 -0700" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20210309; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post:\n\tList-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:\n\tMessage-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:\n\tResent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:\n\tList-Owner; bh=0f2G6byKGT0vYixh3pZ5m8F61E+IpGAGhMLJ9dTVcUU=; b=owoD7MgKbMEb1v\n\tQdCwKtHwCl4myCyFv4//hXw0NKF6kqU5NC91P+BZTH8kEUx7LhS1GbyYPij1Th/z/8Q5IpttlKgD+\n\tJeq3BZVMi++ywSzQDfR/91U1OGpR7GMCY96g2JtHprjZJAQ2OihMePhj2ehhRqtBtTSZpAMO8s+sR\n\tQC2pwycUC22UKr/GqbRlgt/i3F50wAPYAZ4hb06xKukUdkOv56ayiQqReZZekvSewzEL1n/vpoANG\n\tIcPwldmaGPXwIWSEi67cGGcc40s9mMQP5UONXDxzQOakgW/ID/P4VHbv88cflYRvIHjQOt8xUtl/b\n\tE6Ggle6xKe7khAO6G7MA==;", "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1777406849; x=1808942849;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=3Tx7zUTyfen72FbRRgVXGEd/bMGQSWR4vEi7urmsia8=;\n b=h1SkDcI42hl+ubNTmbhN/I/o8aA5ifZ6EZdfnoeIwId3+wI20+hBgf0M\n Vc8e3EQnu7R2d/Nhe/heYwh6PKbtaitKuPdx6w0aJA5VpujTPx6fV2Y/6\n NA7ygDjd6EpqJc5HMUSdzvvpoa38LhTvyGXK6RlhkY2RvqgCTJAM9sf4V\n abWR1XcWqS6MpHnJzpQxX+HHbh2TbJtwWt3yjq7jihD/Iy3pIfX0axb86\n gSSzghKVZ/VSOCrraOov1O24EqWY14fhxOMQvAsnVTPSnWRJZldNsXNjy\n EWagb+ao39vErurqdwdAqHfcmAUsgelavkYlzOnwAXRZTI0hOSOK+XN4H\n A==;" ], "X-CSE-ConnectionGUID": [ "sk8dc188Q7aRXlYhv49haw==", "Kb59CoJ1Q2Ge8Spoe/W7Cw==" ], "X-CSE-MsgGUID": [ "0HTcQtHPQ26MAGXei+FvnA==", "Hyx+jCiVS4SxELnFwwqnAg==" ], "X-IronPort-AV": [ "E=McAfee;i=\"6800,10657,11770\"; a=\"78519289\"", "E=Sophos;i=\"6.23,204,1770624000\";\n d=\"scan'208\";a=\"78519289\"", "E=Sophos;i=\"6.23,204,1770624000\";\n d=\"scan'208\";a=\"257609966\"" ], "X-ExtLoop1": "1", "From": "Andrei Otcheretianski <andrei.otcheretianski@intel.com>", "To": "hostap@lists.infradead.org", "Cc": "vamsin@qti.qualcomm.com,\n\tmaheshkkv@google.com,\n\tAndrei Otcheretianski <andrei.otcheretianski@intel.com>", "Subject": "[PATCH 09/97] NAN: Skip duplicate NDI station add for second NDP with\n same peer", "Date": "Tue, 28 Apr 2026 23:05:10 +0300", "Message-ID": "<20260428200639.40243-10-andrei.otcheretianski@intel.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260428200639.40243-1-andrei.otcheretianski@intel.com>", "References": "<20260428200639.40243-1-andrei.otcheretianski@intel.com>", "MIME-Version": "1.0", "X-CRM114-Version": "20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 ", "X-CRM114-CacheID": "sfid-20260428_130728_769737_62BCE1BD ", "X-CRM114-Status": "GOOD ( 19.18 )", "X-Spam-Score": "-4.5 (----)", "X-Spam-Report": "Spam detection software,\n running on the system \"bombadil.infradead.org\",\n has NOT identified this incoming email as spam. The original\n message has been attached to this so you can view it or label\n similar future email. If you have any questions, see\n the administrator of that system for details.\n Content preview: When establishing a second NDP with the same peer using the\n same NDI, the peer's NDI station already exists in the kernel. Attempting\n to add it again fails with -ENOTUNIQ on drivers that set NEEDS_UNI [...]\n Content analysis details: (-4.5 points, 5.0 required)\n pts rule name description\n ---- ----------------------\n --------------------------------------------------\n -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/,\n medium trust\n [198.175.65.16 listed in list.dnswl.org]\n 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record\n -0.0 SPF_PASS SPF: sender matches SPF record\n -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from\n envelope-from domain\n 0.1 DKIM_SIGNED Message has a DKIM or DK signature,\n not necessarily valid\n -0.1 DKIM_VALID Message has at least one valid DKIM or DK\n signature\n -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n author's\n domain\n -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%\n [score: 0.0000]\n -0.1 DKIMWL_WL_HIGH DKIMwl.org - High trust sender", "X-BeenThere": "hostap@lists.infradead.org", "X-Mailman-Version": "2.1.34", "Precedence": "list", "List-Id": "<hostap.lists.infradead.org>", "List-Unsubscribe": "<http://lists.infradead.org/mailman/options/hostap>,\n <mailto:hostap-request@lists.infradead.org?subject=unsubscribe>", "List-Archive": "<http://lists.infradead.org/pipermail/hostap/>", "List-Post": "<mailto:hostap@lists.infradead.org>", "List-Help": "<mailto:hostap-request@lists.infradead.org?subject=help>", "List-Subscribe": "<http://lists.infradead.org/mailman/listinfo/hostap>,\n <mailto:hostap-request@lists.infradead.org?subject=subscribe>", "Content-Type": "text/plain; charset=\"us-ascii\"", "Content-Transfer-Encoding": "7bit", "Sender": "\"Hostap\" <hostap-bounces@lists.infradead.org>", "Errors-To": "hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org" }, "content": "When establishing a second NDP with the same peer using the same NDI,\nthe peer's NDI station already exists in the kernel. Attempting to add\nit again fails with -ENOTUNIQ on drivers that set NEEDS_UNIQUE_STA_ADDR\nand with -EEXIST otherwise. EEXIST error value was ignored by\ndriver_nl80211.c, however -ENOTUNIQ resulted in a failure.\n\nTo fix it, add nan_peer_ndi_in_use() helper to check if the peer NDI is\nalready used by another NDP. Set the new_ndi_sta flag in\nnan_ndp_connection_params to indicate whether a new station needs to\nbe added.\n\nIn wpas_nan_add_ndi_sta(), skip wpa_drv_sta_add() when new_ndi_sta is\nfalse. For security upgrade cases (existing station but new keys),\nset MFP flag via wpa_drv_sta_set_flags().\n\nSigned-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>\n---\n src/nan/nan.c | 19 +++++++++\n src/nan/nan.h | 3 ++\n wpa_supplicant/nan_supplicant.c | 68 ++++++++++++++++++++++-----------\n 3 files changed, 67 insertions(+), 23 deletions(-)", "diff": "diff --git a/src/nan/nan.c b/src/nan/nan.c\nindex 52db635a96..d8d7af8c1d 100644\n--- a/src/nan/nan.c\n+++ b/src/nan/nan.c\n@@ -1437,6 +1437,24 @@ static void nan_ndp_action_notif(struct nan_data *nan, struct nan_peer *peer)\n }\n \n \n+static bool nan_peer_ndi_in_use(struct nan_peer *peer, const u8 *peer_ndi)\n+{\n+\tstruct nan_ndp *ndp;\n+\n+\tdl_list_for_each(ndp, &peer->ndps, struct nan_ndp, list) {\n+\t\tif (ndp->initiator) {\n+\t\t\tif (ether_addr_equal(ndp->resp_ndi, peer_ndi))\n+\t\t\t\treturn true;\n+\t\t} else {\n+\t\t\tif (ether_addr_equal(ndp->init_ndi, peer_ndi))\n+\t\t\t\treturn true;\n+\t\t}\n+\t}\n+\n+\treturn false;\n+}\n+\n+\n static int nan_ndp_connected(struct nan_data *nan, struct nan_peer *peer)\n {\n \tstruct nan_ndp_connection_params params;\n@@ -1465,6 +1483,7 @@ static int nan_ndp_connected(struct nan_data *nan, struct nan_peer *peer)\n \t\t\t\t\t\t params.peer_ndi,\n \t\t\t\t\t\t params.local_ndi);\n \tparams.first_ndp = dl_list_empty(&peer->ndps);\n+\tparams.new_ndi_sta = !nan_peer_ndi_in_use(peer, params.peer_ndi);\n \tif (nan->cfg->ndp_connected &&\n \t nan->cfg->ndp_connected(nan->cfg->cb_ctx, ¶ms)) {\n \t\twpa_printf(MSG_DEBUG, \"NAN: NDP connected notification failed\");\ndiff --git a/src/nan/nan.h b/src/nan/nan.h\nindex 983e81b56c..d53c7c54d7 100644\n--- a/src/nan/nan.h\n+++ b/src/nan/nan.h\n@@ -287,6 +287,8 @@ struct nan_channels {\n * @ssi_len: Service specific information length\n * @install_keys: Whether the new keys should be installed\n * @first_ndp: Whether this is the first NDP with the peer\n+ * @new_ndi_sta: Whether a new NDI station needs to be added (peer_ndi not\n+ * \talready used by another NDP with this peer)\n */\n struct nan_ndp_connection_params {\n \tstruct nan_ndp_id ndp_id;\n@@ -296,6 +298,7 @@ struct nan_ndp_connection_params {\n \tsize_t ssi_len;\n \tbool install_keys;\n \tbool first_ndp;\n+\tbool new_ndi_sta;\n };\n \n /**\ndiff --git a/wpa_supplicant/nan_supplicant.c b/wpa_supplicant/nan_supplicant.c\nindex 93c65694bf..70470a8c9e 100644\n--- a/wpa_supplicant/nan_supplicant.c\n+++ b/wpa_supplicant/nan_supplicant.c\n@@ -452,7 +452,7 @@ static int wpas_nan_configure_nmi_sta_capa(struct wpa_supplicant *wpa_s,\n static int wpas_nan_add_ndi_sta(struct wpa_supplicant *wpa_s,\n \t\t\t\tconst u8 *peer_nmi, const u8 *local_ndi,\n \t\t\t\tconst u8 *peer_ndi, bool install_keys,\n-\t\t\t\tbool first_ndp)\n+\t\t\t\tbool first_ndp, bool new_ndi_sta)\n {\n \tu8 tk[WPA_TK_MAX_LEN];\n \tsize_t tk_len;\n@@ -479,45 +479,63 @@ static int wpas_nan_add_ndi_sta(struct wpa_supplicant *wpa_s,\n \t\treturn -1;\n \t}\n \n-\tos_memset(&sta_params, 0, sizeof(sta_params));\n-\tsta_params.addr = peer_ndi;\n-\tsta_params.nmi_addr = peer_nmi;\n-\tsta_params.flags = WPA_STA_AUTHENTICATED | WPA_STA_ASSOCIATED;\n+\tif (new_ndi_sta) {\n+\t\tos_memset(&sta_params, 0, sizeof(sta_params));\n+\t\tsta_params.addr = peer_ndi;\n+\t\tsta_params.nmi_addr = peer_nmi;\n+\t\tsta_params.flags = WPA_STA_AUTHENTICATED | WPA_STA_ASSOCIATED;\n \n-\t/* Set MFP flag early, to prevent races until keys are installed */\n-\tif (install_keys)\n-\t\tsta_params.flags |= WPA_STA_MFP;\n-\telse\n-\t\tsta_params.flags |= WPA_STA_AUTHORIZED;\n+\t\t/* Set MFP flag early, to prevent races until keys are installed */\n+\t\tif (install_keys)\n+\t\t\tsta_params.flags |= WPA_STA_MFP;\n+\t\telse\n+\t\t\tsta_params.flags |= WPA_STA_AUTHORIZED;\n \n-\tif (wpa_drv_sta_add(ndi_wpa_s, &sta_params)) {\n+\t\tif (wpa_drv_sta_add(ndi_wpa_s, &sta_params)) {\n+\t\t\twpa_printf(MSG_INFO,\n+\t\t\t\t \"NAN: Failed to add NDI station for peer \" MACSTR,\n+\t\t\t\t MAC2STR(peer_ndi));\n+\t\t\treturn -1;\n+\t\t}\n+\t} else {\n \t\twpa_printf(MSG_INFO,\n-\t\t\t \"NAN: Failed to add NDI station for peer \" MACSTR,\n+\t\t\t \"NAN: NDI station already exists for peer \" MACSTR,\n \t\t\t MAC2STR(peer_ndi));\n-\t\treturn -1;\n+\t\t/* Set MFP flag if keys will be installed (security upgrade) */\n+\t\tif (install_keys &&\n+\t\t wpa_drv_sta_set_flags(ndi_wpa_s, peer_ndi, WPA_STA_MFP,\n+\t\t\t\t\t WPA_STA_MFP, ~0)) {\n+\t\t\twpa_printf(MSG_INFO,\n+\t\t\t\t \"NAN: Failed to set MFP flag for peer \" MACSTR,\n+\t\t\t\t MAC2STR(peer_ndi));\n+\t\t\treturn -1;\n+\t\t}\n \t}\n \n \tif (!install_keys) {\n-\t\twpa_printf(MSG_DEBUG,\n-\t\t\t \"NAN: NDI station added without keys for peer \"\n-\t\t\t MACSTR, MAC2STR(peer_ndi));\n+\t\tif (new_ndi_sta)\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: NDI station added without keys for peer \"\n+\t\t\t\t MACSTR, MAC2STR(peer_ndi));\n+\t\telse\n+\t\t\twpa_printf(MSG_DEBUG,\n+\t\t\t\t \"NAN: Using existing NDI station without new keys for peer \"\n+\t\t\t\t MACSTR, MAC2STR(peer_ndi));\n \t\tgoto out_success;\n \t}\n \n \tif (nan_peer_get_tk(wpa_s->nan, peer_nmi, peer_ndi, local_ndi, tk,\n \t\t\t &tk_len, &csid)) {\n \t\twpa_printf(MSG_INFO, \"NAN: Failed to get TK for NDI station\");\n-\t\twpa_drv_sta_remove(ndi_wpa_s, peer_ndi);\n-\t\treturn -1;\n+\t\tgoto remove_sta;\n \t}\n \n \tif (wpas_nan_set_ndi_keys(ndi_wpa_s, peer_ndi, csid, tk, tk_len)) {\n \t\twpa_printf(MSG_INFO,\n \t\t\t \"NAN: Failed to set NDI keys for peer \" MACSTR,\n \t\t\t MAC2STR(peer_ndi));\n-\t\twpa_drv_sta_remove(ndi_wpa_s, peer_ndi);\n \t\tforced_memzero(tk, tk_len);\n-\t\treturn -1;\n+\t\tgoto remove_sta;\n \t}\n \tforced_memzero(tk, tk_len);\n \n@@ -526,8 +544,7 @@ static int wpas_nan_add_ndi_sta(struct wpa_supplicant *wpa_s,\n \t\twpa_printf(MSG_INFO,\n \t\t\t \"NAN: Failed to set authorize for NDI station\");\n \t\twpas_nan_remove_ndi_keys(ndi_wpa_s, peer_ndi);\n-\t\twpa_drv_sta_remove(ndi_wpa_s, peer_ndi);\n-\t\treturn -1;\n+\t\tgoto remove_sta;\n \t}\n \n out_success:\n@@ -544,6 +561,11 @@ out_success:\n \t\twpa_drv_set_operstate(ndi_wpa_s, 1);\n \n \treturn 0;\n+\n+remove_sta:\n+\tif (new_ndi_sta)\n+\t\twpa_drv_sta_remove(ndi_wpa_s, peer_ndi);\n+\treturn -1;\n }\n \n \n@@ -592,7 +614,7 @@ static int wpas_nan_ndp_connected_cb(void *ctx,\n \tif (wpas_nan_add_ndi_sta(wpa_s, params->ndp_id.peer_nmi,\n \t\t\t\t params->local_ndi, params->peer_ndi,\n \t\t\t\t params->install_keys,\n-\t\t\t\t params->first_ndp) < 0) {\n+\t\t\t\t params->first_ndp, params->new_ndi_sta) < 0) {\n \t\twpa_printf(MSG_INFO,\n \t\t\t \"NAN: Failed to add NDI station for NDP connection\");\n \t\treturn -1;\n", "prefixes": [ "09/97" ] }