From patchwork Mon Feb 12 10:03:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Chernikov X-Patchwork-Id: 1897835 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=abotqWl4; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=maxlinear.com header.i=@maxlinear.com header.a=rsa-sha256 header.s=selector1 header.b=tETV0aD9; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TYVvm2mqQz23hw for ; Tue, 13 Feb 2024 03:55:46 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=fAHnJIDwmvcrceHxk4sZeeGklgYHM2jVknWzi1itlzI=; b=abotqWl4isNMWu CTUHSkuiehiSB219A+Dw3pbiA2CKXVE7qaduJGTQXaR0Fe83L5DFPEV6FU3TK6Ftz02PQqYfnzklw PJK21ifokctC9Bfa0QS7ozS4u1iDaPomSSlfEWMso4zqVXm2FVcv8Lctoyn5r5/x6Aeazh7YYTP8C Metje0W4KZ9w9b+CkQzLqaoRPo60evH7VRH4iNuYWeBapUquA2JSlZV5y/zCBZJragXsoXncrJomj edEanF2KhFJY1yO8pkxgn5ccSvXTYRaiFSElX3oN4YveivS8G0MEtbu38vzo7ExmyQWFytF9gVESk hZ32+dcNDoPRsqJJYqfg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZZaU-00000006GFe-49HI; Mon, 12 Feb 2024 16:55:22 +0000 Received: from mail-bn8nam12on20700.outbound.protection.outlook.com ([2a01:111:f403:2418::700] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rZTAH-00000004okt-1gNR for hostap@lists.infradead.org; Mon, 12 Feb 2024 10:03:55 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IzKf1EtocOpRa0RWnFxEc9m0k6/Itn6rv3L56EKkxycGFco9Af6X9JnhKbre0BdwBRNZyQ2S42VCehFtYZgiiIL+F6VcjecOxYKEBAPyawzuxfyFLblqCn6y+Va+zFxhDjeRsY2jzX8psEFljRcRJcdNBhlQz5CAl2otA8dWrcB6go0qo4c5sVpAySK7Vh1gTp+bQ72uACwG7U8xQK1qQCJ4OgKCgaSKw74nE22grG4gPqw5ajRorApI1wJS5P48v1kigqGBS9pzqAYmIafkO/Q9OOs0L/DDVdlKRyJ+rtfPSoRvxRrGS9mqGSEMy4liZVpplfXfkRy9mXRtTxKGEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NBK70VuC12d3xiImFr/Tb+9zt+wtptBAZ1OYmQlJWsg=; b=T1GiATKRNYI7MsWp8FORhWtxGeDl+fZ8uvFVhufgqpgHCw2mA9d7KrEkok3NCL0dOitvHg9u/+34I2Gc+BbDlmpAHbRyVJeZuFW4+z5a4pPELT4ZYV8LfhuWddKRYZRUMoC63Hkt+UK1dH32h4OZuu7fsPGYwegWCRWoA+EAXZqDSswGpWYhJr2M66XWm+r4ZZMiwh5PpqBtaM2TzI3JZs8EQjPWLbEi4WpRDBTby/+WWV1f74gux3Xf0mR9r85AHMybH3mjXO1RAWaY9CXYOC6Y9VHpJ8JxCb+HtNAyB5Soa1aKGscp32al/aimZryUMa8pWRT0aivOQ9upUrQtEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=maxlinear.com; dmarc=pass action=none header.from=maxlinear.com; dkim=pass header.d=maxlinear.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maxlinear.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NBK70VuC12d3xiImFr/Tb+9zt+wtptBAZ1OYmQlJWsg=; b=tETV0aD96S7D/8kIJ77W07tllbdxNU29iu6neptObeh3cLmjpKe8ZbQpmAXfy26AkOw5sSUEzxiezUuN6jmZYahtNJvoSeXbopW+4vJ4BdC9GqTFCURiR/KnPvgMdT/pS0IcZUFVto3Ni6qS5Of6Ulhcjm5ey5wRIOUNffQZsiE= Received: from CY8PR19MB7252.namprd19.prod.outlook.com (2603:10b6:930:9b::6) by BL1PR19MB5868.namprd19.prod.outlook.com (2603:10b6:208:398::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.33; Mon, 12 Feb 2024 10:03:44 +0000 Received: from CY8PR19MB7252.namprd19.prod.outlook.com ([fe80::6057:1ca1:3d40:28b6]) by CY8PR19MB7252.namprd19.prod.outlook.com ([fe80::6057:1ca1:3d40:28b6%7]) with mapi id 15.20.7270.036; Mon, 12 Feb 2024 10:03:43 +0000 From: Nikita Chernikov To: "hostap@lists.infradead.org" Subject: [PATCH] Clear and set own report in nr_db if ssid is changed with ctrl iface SET or SIGHUP Thread-Topic: [PATCH] Clear and set own report in nr_db if ssid is changed with ctrl iface SET or SIGHUP Thread-Index: AdpdmdqFrNU7ufKjTBO0O2BU24npxg== Date: Mon, 12 Feb 2024 10:03:43 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=maxlinear.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CY8PR19MB7252:EE_|BL1PR19MB5868:EE_ x-ms-office365-filtering-correlation-id: f98df8e3-ade9-4f9c-bf9a-08dc2bb1e565 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: Wtf3ogEQ/mQLnA/IxCW4Q/esCgLoDBKDL3zosPsTytF9Gpyh/haOpMuICkM8BVmpOn+bGQgPc1NnEoGqhZ3VEHdDMSyqIs7cUSNQMr7y3Td/MHvYWpkwqsU4Oh2JB38SQUWpf+dIq3hVX7SPxp7YPFhYNDH0L2hbb7aeyPHSnaTrlmTDS7aK7fZJknSvb5eNS7DLHeqhKvN9TiCekI3PKGhVOByWqqxU8rTmlp/Fd7k4JWF1I25qhliCnCU4ZeICH7La0ibVpmrYTtrqHwxJVj1ipR0o/0b7b84kSDVPUlLkBx1s1bfzW/WxKqdBlP79lCb8BjylTTHN7g9oJNKs44lj1Rne9MXgrjaIVze7J9U4I5K0gfa0R3MvQxU+Xkj8sTJoXfC+2dwNflheyPzKoiz6wYu3ouW/IGJNWUXp4gNPd0GGsqzZ0W/l3oImfdOYVyJlgKkcb7zUqGSTy/RVNZprs1aaNfO6e2Y35Uu4gLIv8OriJXEivMkhg7T/9P3DT4AvjvINHFEKgkWK9h+v6ut6gflj+3vYwir9Wr85ZIcF8qi/Ep0TkARKhVi72NJ2J2EIekauowg9brbWJDFA8Cj0Y2GBGLzSn5F2YvaAJhU2HyaPO21MA1xbiTj4HsGg x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY8PR19MB7252.namprd19.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(39850400004)(346002)(136003)(366004)(396003)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(8676002)(64756008)(76116006)(66946007)(66556008)(66476007)(66446008)(6916009)(2906002)(33656002)(478600001)(122000001)(86362001)(38100700002)(83380400001)(38070700009)(53546011)(6506007)(7696005)(316002)(9686003)(26005)(41300700001)(71200400001)(8936002)(52536014)(5660300002)(55016003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?VpLdcQ8dwQwvim9bMMEEsjRUmFVx?= =?utf-8?q?Utgf9//EgBCWkxX3+2NbdbNr9tfiD71UPG3yLy3Cw0VfV1DfD+5+LqyNWfBL5xuCI?= =?utf-8?q?XH2VtMJVJTk1uEQQstYZ3B+oTFDzSa7sXezNLusu99GHdsmfZwGvzAembRFm5P5IU?= =?utf-8?q?EjX7IeZ7mfzVc0+SREV5rCDyJxIX8dM2mnDyvhcFSPrVYrgyW4SLj44+0ofKset/k?= =?utf-8?q?OXAYKQoJs5kXyHh3YfxH7fMylIYEMIv3lZG4/M2meWuLBzStIFm27YRUkaq8K4bO3?= =?utf-8?q?zFmz/ZRLc5rrbm1U+gVQxpprQjRNd7cLBteTTdsgUxOWZ8gKvqGrQb0YP/d1bt+zP?= =?utf-8?q?zkfK7NpdnZh7ygVW+KzDjYcJql641hOqMemNmge18KuaL3PcDG81UMKY1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7Ld?= =?utf-8?q?Jz8Y0uz7/iJcwFdC+/lR9LpTXTUnR5jUjUrTsvvIBJXe0IxZfl8BpDS+cFjyNf9z9?= =?utf-8?q?aNJtV7/gwP5rnfiy2Z5U/KXfnxz0Rieg/oUnlpB4vDagod2CfnwEUGXWVcuewk887?= =?utf-8?q?ejMz19Q8ZdOkHIZIiny/orES2bQFLesB+3g6MKo25GWlTwLZ47D/YxZOhl/dzx7Uk?= =?utf-8?q?AFlO9wEtZuVCZrtLmqgrFCmTGI5PafznQBkG5Li30VMb5SvNjvhYF/hWiRoASG+k1?= =?utf-8?q?a1WaeqXUkG4q?= MIME-Version: 1.0 X-OriginatorOrg: maxlinear.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY8PR19MB7252.namprd19.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f98df8e3-ade9-4f9c-bf9a-08dc2bb1e565 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Feb 2024 10:03:43.7579 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: dac28005-13e0-41b8-8280-7663835f2b1d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dR8FpAJANkbJBON/5hcxvGMe0bqoue3s+pCZ9j7ledpwBCf3ZxSzWX4eZA2nGbkBUKOrGAD6HeZ2UWX+l0i6sAc2jPNoBMJZYosRG1/op0g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR19MB5868 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240212_020353_685443_AC7695A0 X-CRM114-Status: GOOD ( 16.38 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: From 1644893ce3bda37dbe4ac342f61886d787d0ad96 Mon Sep 17 00:00:00 2001 From: Nikita Chernikov Date: Thu, 1 Feb 2024 18:05:02 +0200 Subject: [PATCH] Clear and set again own r [...] Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a01:111:f403:2418:0:0:0:700 listed in] [list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 ARC_SIGNED Message has a ARC signature 0.0 ARC_VALID Message has a valid ARC signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Mailman-Approved-At: Mon, 12 Feb 2024 08:55:21 -0800 X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From 1644893ce3bda37dbe4ac342f61886d787d0ad96 Mon Sep 17 00:00:00 2001 From: Nikita Chernikov Date: Thu, 1 Feb 2024 18:05:02 +0200 Subject: [PATCH] Clear and set again own report in nr_db if ssid is changed with ctrl iface SET or SIGHUP To: hostap@lists.infradead.org From: Nikita Chernikov short_ssid in own neighbor report may be out of sync, causing advertising RNR IE with old SSID, when ssid is changed either with ctrl_iface SET or with SIGHUP. Therefore, own report needs to be synced by removing the old entry and setting own report again. Signed-off-by: Nikita Chernikov --- hostapd/ctrl_iface.c | 2 ++ src/ap/hostapd.c | 3 +++ src/ap/neighbor_db.c | 32 ++++++++++++++++++++++++++++++++ src/ap/neighbor_db.h | 1 + 4 files changed, 38 insertions(+) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 015a67aea..ee5dc5c6e 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -1307,6 +1307,8 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd) hostapd_disassoc_deny_mac(hapd); } else if (os_strcasecmp(cmd, "accept_mac_file") == 0) { hostapd_disassoc_accept_mac(hapd); + } else if (os_strcasecmp(cmd, "ssid") == 0) { + hostapd_neighbor_sync_own_report(hapd); } else if (os_strncmp(cmd, "wme_ac_", 7) == 0 || os_strncmp(cmd, "wmm_ac_", 7) == 0) { hapd->parameter_set_count++; diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c index cb464f670..c3b88a069 100644 --- a/src/ap/hostapd.c +++ b/src/ap/hostapd.c @@ -183,6 +183,9 @@ static void hostapd_reload_bss(struct hostapd_data *hapd) hostapd_set_generic_elem(hapd, (u8 *) "", 0); } + if(hostapd_neighbor_sync_own_report(hapd)) + wpa_printf(MSG_DEBUG, "%s: Own neighbor report already in sync", hapd->conf->iface); + ieee802_11_set_beacon(hapd); hostapd_update_wps(hapd); diff --git a/src/ap/neighbor_db.c b/src/ap/neighbor_db.c index 2a25ae20e..f97c6e005 100644 --- a/src/ap/neighbor_db.c +++ b/src/ap/neighbor_db.c @@ -325,3 +325,35 @@ void hostapd_neighbor_set_own_report(struct hostapd_data *hapd) wpabuf_free(nr); #endif /* NEED_AP_MLME */ } + +static struct hostapd_neighbor_entry * +hostapd_neighbor_get_by_short_ssid(struct hostapd_data *hapd, const u8 *bssid) +{ + struct hostapd_neighbor_entry *nr; + + dl_list_for_each(nr, &hapd->nr_db, struct hostapd_neighbor_entry, + list) { + if ((os_memcmp(bssid, nr->bssid, ETH_ALEN) == 0) && + (nr->short_ssid != hapd->conf->ssid.short_ssid)) + return nr; + } + return NULL; +} + +int hostapd_neighbor_sync_own_report(struct hostapd_data *hapd) +{ + struct hostapd_neighbor_entry *nr; + + nr = hostapd_neighbor_get_by_short_ssid(hapd, hapd->own_addr); + if (!nr) + return -1; + + /* Clear old entry due to ssid change */ + hostapd_neighbor_clear_entry(nr); + dl_list_del(&nr->list); + os_free(nr); + + hostapd_neighbor_set_own_report(hapd); + + return 0; +} diff --git a/src/ap/neighbor_db.h b/src/ap/neighbor_db.h index 992671b62..53f714203 100644 --- a/src/ap/neighbor_db.h +++ b/src/ap/neighbor_db.h @@ -20,6 +20,7 @@ int hostapd_neighbor_set(struct hostapd_data *hapd, const u8 *bssid, const struct wpabuf *civic, int stationary, u8 bss_parameters); void hostapd_neighbor_set_own_report(struct hostapd_data *hapd); +int hostapd_neighbor_sync_own_report(struct hostapd_data *hapd); int hostapd_neighbor_remove(struct hostapd_data *hapd, const u8 *bssid, const struct wpa_ssid_value *ssid); void hostapd_free_neighbor_db(struct hostapd_data *hapd);