From patchwork Fri Sep 11 12:50:08 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 2303243 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=aZ6ZNUXK; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=sipsolutions.net header.i=@sipsolutions.net header.a=rsa-sha256 header.s=mail header.b=RRUf2cDk; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) 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 4hhVCp6BJHz1y1f for ; Sat, 12 Sep 2026 08:51:50 +1000 (AEST) 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:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=nCyjT5ummNJAHmZ/s3DwN503BBQ9ht5Mjpafvh/Rofs=; b=aZ6ZNUXKEoIN+w cdKtbAbiOnZx/piSpXLOV7gn0UqdSZzOJUlDC272uBvlqnK2NJ5oEFbUvx12AOpCEDAcYhXflkY+W QEMRf0cCS6+OOm+jAZHLP90M3V3H3jQk+kdZnyxrFf6tvu4JEDu1KzCOqGiEp4plC1snfBXAsSSzZ v3pz/VsOVUGbirG4PAfr6ml0FUWty6PtE1vD5PbNpDO24K/NBbUc9I0rfkMw+sVrHCfIkVcYXPNh9 SOf85hOaHVnHkMsdhtnBywtaLUlA/9MNYVE1uVQcNcEKflntV+6WmGbwv+q+klfi+JOQaMOqtaW2o /xvGyoktFYkAl4JzZ7bA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x5A4Y-00000000IJh-0X7W; Fri, 11 Sep 2026 22:50:18 +0000 Received: from s3.sipsolutions.net ([2a01:4f8:242:246e::2] helo=sipsolutions.net) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x5A4V-00000000IIw-3LHm for hostap@lists.infradead.org; Fri, 11 Sep 2026 22:50:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Content-Type:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-To:Resent-Cc: Resent-Message-ID:In-Reply-To:References; bh=dy0nEsa5e/PVXI94/roRg4EadTBEYK8J8LutR1S7eCk=; t=1789167015; x=1790376615; b=RRUf2cDkDdEOtej7V5G1GnbtMB1nY4PTQohvzm7ysREZakA7+oN9X3Q5bRK+W5PaLLFNfofH8mG kFvosTGukKx50c65mGHCdpqlZ+5dbH/tB6bjFXU0MeHzVQSaERoYkLd1w4gOOSFVC4wBIdZjzbOA8 gzGlysrz1CH7qwG5f8xKpVMMwM6gygMlFfxs8YZP7GQzHEGwxJPam5s6U+q7V4wbj+dCoqEfzjLHF w1aFti2whR9Ye2Zsc+LdOVtnNbDxW9VvW7udhtBsJDphCkk/tSPHFJWu12fdLA7f8ZqWOXtojeNfL o9TwcsIy09304QarH9+FHKnVQsE0T1n9pFoQ==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__ECDSA_SECP256R1_SHA256__AES_256_GCM:256) (Exim 4.98.2) (envelope-from ) id 1x5A4Q-0000000COXw-2RpA; Sat, 12 Sep 2026 00:50:10 +0200 From: Johannes Berg To: hostap@lists.infradead.org Cc: Johannes Berg Subject: [PATCH 1/2] ctrl_iface: allow setting/reporting IP ID Date: Sat, 12 Sep 2026 00:50:08 +0200 Message-ID: <20260912005007.337c5f3a4749.If134c33bbc5f66a4388fa559356497779ed7b4c0@changeid> X-Mailer: git-send-email 2.55.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260911_155015_841595_2C821BC6 X-CRM114-Status: GOOD ( 12.59 ) X-Spam-Score: -2.1 (--) 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: Johannes Berg Allow access to the IP ID field for both TX and RX to have the ability to check for duplicate packets. Signed-off-by: Johannes Berg --- hostapd/ctrl_iface.c | 30 +++++++++++++++++++++++------- wpa_supplicant/ctrl_iface.c | 30 +++++++++++++++++++++++------- 2 files changed, 46 [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK 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 -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.0 DMARC_MISSING Missing DMARC policy 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: Johannes Berg Allow access to the IP ID field for both TX and RX to have the ability to check for duplicate packets. Signed-off-by: Johannes Berg --- hostapd/ctrl_iface.c | 30 +++++++++++++++++++++++------- wpa_supplicant/ctrl_iface.c | 30 +++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 14 deletions(-) diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c index 49b163aaf4a5..047aa3d154ef 100644 --- a/hostapd/ctrl_iface.c +++ b/hostapd/ctrl_iface.c @@ -2014,7 +2014,7 @@ static void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, struct ip ip; const u8 *pos; unsigned int i; - char extra[30]; + char extra_len[30], extra_id[30]; if (len < sizeof(*eth) + sizeof(ip) || len > HWSIM_PACKETLEN) { wpa_printf(MSG_DEBUG, @@ -2043,11 +2043,18 @@ static void hostapd_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, pos++; } - extra[0] = '\0'; + extra_len[0] = '\0'; + extra_id[0] = '\0'; if (ntohs(ip.ip_len) != HWSIM_IP_LEN) - os_snprintf(extra, sizeof(extra), " len=%d", ntohs(ip.ip_len)); - wpa_msg(hapd->msg_ctx, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", - MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); + os_snprintf(extra_len, sizeof(extra_len), " len=%d", + ntohs(ip.ip_len)); + if (ntohs(ip.ip_id)) + os_snprintf(extra_id, sizeof(extra_id), " id=%d", + ntohs(ip.ip_len)); + wpa_msg(hapd->msg_ctx, MSG_INFO, + "DATA-TEST-RX " MACSTR " " MACSTR "%s%s", + MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), + extra_len, extra_id); } @@ -2105,13 +2112,13 @@ static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) struct ether_header *eth; struct ip *ip; u8 *dpos; - unsigned int i; + unsigned int i, ip_id = 0; size_t send_len = HWSIM_IP_LEN; if (hapd->l2_test == NULL) return -1; - /* format: [len=] */ + /* format: [len=] [id=] */ pos = cmd; used = hwaddr_aton2(pos, dst); @@ -2138,6 +2145,14 @@ static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) send_len = i; } + pos = os_strstr(pos2, " id="); + if (pos) { + i = atoi(pos + 4); + if (i > 0xffff) + return -1; + ip_id = i; + } + eth = (struct ether_header *) &buf[2]; os_memcpy(eth->ether_dhost, dst, ETH_ALEN); os_memcpy(eth->ether_shost, src, ETH_ALEN); @@ -2146,6 +2161,7 @@ static int hostapd_ctrl_iface_data_test_tx(struct hostapd_data *hapd, char *cmd) os_memset(ip, 0, sizeof(*ip)); ip->ip_hl = 5; ip->ip_v = 4; + ip->ip_id = htons(ip_id); ip->ip_ttl = 64; ip->ip_tos = tos; ip->ip_len = htons(send_len); diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index bfca586d9529..6261c616db93 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -10269,7 +10269,7 @@ static void wpas_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, struct ip ip; const u8 *pos; unsigned int i; - char extra[30]; + char extra_len[30], extra_id[30]; if (len < sizeof(*eth) + sizeof(ip) || len > HWSIM_PACKETLEN) { wpa_printf(MSG_DEBUG, @@ -10296,11 +10296,18 @@ static void wpas_data_test_rx(void *ctx, const u8 *src_addr, const u8 *buf, } pos++; } - extra[0] = '\0'; + + extra_len[0] = '\0'; + extra_id[0] = '\0'; if (ntohs(ip.ip_len) != HWSIM_IP_LEN) - os_snprintf(extra, sizeof(extra), " len=%d", ntohs(ip.ip_len)); - wpa_msg(wpa_s, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s", - MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), extra); + os_snprintf(extra_len, sizeof(extra_len), " len=%d", + ntohs(ip.ip_len)); + if (ntohs(ip.ip_id)) + os_snprintf(extra_id, sizeof(extra_id), " id=%d", + ntohs(ip.ip_id)); + wpa_msg(wpa_s, MSG_INFO, "DATA-TEST-RX " MACSTR " " MACSTR "%s%s", + MAC2STR(eth->ether_dhost), MAC2STR(eth->ether_shost), + extra_len, extra_id); } @@ -10352,13 +10359,13 @@ static int wpas_ctrl_iface_data_test_tx(struct wpa_supplicant *wpa_s, char *cmd) struct ether_header *eth; struct ip *ip; u8 *dpos; - unsigned int i; + unsigned int i, ip_id = 0; size_t send_len = HWSIM_IP_LEN; if (wpa_s->l2_test == NULL) return -1; - /* format: [len=] */ + /* format: [len=] [id=]*/ pos = cmd; used = hwaddr_aton2(pos, dst); @@ -10385,6 +10392,14 @@ static int wpas_ctrl_iface_data_test_tx(struct wpa_supplicant *wpa_s, char *cmd) send_len = i; } + pos = os_strstr(pos2, " id="); + if (pos) { + i = atoi(pos + 4); + if (i > 0xffff) + return -1; + ip_id = i; + } + eth = (struct ether_header *) &buf[2]; os_memcpy(eth->ether_dhost, dst, ETH_ALEN); os_memcpy(eth->ether_shost, src, ETH_ALEN); @@ -10393,6 +10408,7 @@ static int wpas_ctrl_iface_data_test_tx(struct wpa_supplicant *wpa_s, char *cmd) os_memset(ip, 0, sizeof(*ip)); ip->ip_hl = 5; ip->ip_v = 4; + ip->ip_id = htons(ip_id); ip->ip_ttl = 64; ip->ip_tos = tos; ip->ip_len = htons(send_len);