From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261752; cv=none; d=zohomail.com; s=zohoarc; b=IwIQ851c5YcPMTZprv62SSmfc2Ko7Ftr2IPgArGlpjcpWm+dYNUnHiebDKY1YwaDIGScaqWMFwG+C4UM87nkmga3PX5UW1X4p5NXSidzNLXuTCUpyfI7R0ecKwORE/z9E9d8x0jvXiO5wETkJAyAFmoG5/Pm9pFH0RFg6w3zspg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261752; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=L2mDQxx3rh1gJs2pvIkpVg7cvMgGuyf6uRiUmsnGSpk=; b=UhXE2TjN3Vmm8T3QnK+1WR2u7+cRGTT8A4cI1UTlgUM6LORZft3Sz+taz/Kpajs8AHcnob80AdAgtNbNRTyfTYTV4Fq7Fo9SV8pOpQcci9GqqubPL5AxRCZ5kw31zninJyZZFbhYk/RnCPw0uaxBKGw5sE1Ot7lzNnPHpGCt9eI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261752515473.78636549412556; Sat, 18 Jan 2025 20:42:32 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN7w-0005Tl-CR; Sat, 18 Jan 2025 23:41:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7u-0005TO-Ny for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:34 -0500 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7t-0003X1-6a for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:34 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id D95965C03EC; Sun, 19 Jan 2025 04:40:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFB46C4CEE2; Sun, 19 Jan 2025 04:41:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261688; bh=PF3vG23YlFSjPb37uVPotxsYubEj0ljU7NCWJ+lvwYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LcX1oYELxwt47lRW1Nh/RMAei4+/etMxhLEzGQdgRwgRnkFlWi3eeIneINCy1c8gm mq8h4HBahoHbnZI3scW63qG31Jeqjkpg/1myqfN7C6J6odwOT/gE+cX+kdWmzHb4mg JuXUkWA+u13Whv/7dlLvfLZSGUjup2qIJKzTirju0ill+iOKl11GFU32aR+tVA/KEg ZmjIeCEkLazhgX564MOcg27nbdptp852K7CKEP0a+CS3190HbTv73GwULDi3cvYXp+ rP3jCePGSiuZQL5KktwWnR2ls5zRL/LRihFYukB271frfr8is7nw9vB73wnVo30X9P SqTTIw13YqN3g== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 1/6] linux-user: netlink: Add missing IFA_PROTO to host_to_target_data_addr_rtattr() Date: Sun, 19 Jan 2025 05:41:17 +0100 Message-ID: <20250119044122.9637-2-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261753504019000 Content-Type: text/plain; charset="utf-8" From: Helge Deller Fixes this warning: Unknown host IFA type: 11 Signed-off-by: Helge Deller Reviewed-by: Laurent Vivier --- linux-user/fd-trans.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index c04a97c73a..a86ed2f4b4 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -1140,6 +1140,7 @@ static abi_long host_to_target_data_addr_rtattr(struc= t rtattr *rtattr) /* binary: depends on family type */ case IFA_ADDRESS: case IFA_LOCAL: + case IFA_PROTO: break; /* string */ case IFA_LABEL: --=20 2.47.0 From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261790; cv=none; d=zohomail.com; s=zohoarc; b=O+/4nzpBs8XsK37T1AVYIRHbH4zrmQonQ0VqxbLu1g8a6EMnJh1HtouYRqDifVIPoNxuPP20gD4+G7ZD1R3ZjYw+i+CcViFQwVRLJPF84SpCyx+hhUx7GvnyH80l5qPfmx5zuI4HmxTOdWLEcKVnHPGa2JwY1fp3VrdTsDVHMKc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261790; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=RBDqbv36d7rMU7mYNOQTbjQXNZ6ueYYWCeGW74FJuak=; b=V/ch2dU8icZmZVN7/jHF71+sGsJJy7oUlBM0ZM3Vzh8owNAjMlCCfA1cVOoBICoBp5PIuiaP8bS9/mzK8LFoM/E/WMekjGvNKhKCwCFOFW9hPot/mqdwoHqNlCPKr9fm7rvjk8ikhCokhlqGLD5WFWxtLt3Xy2MK1Pievm2UwDk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261790853707.0492368307904; Sat, 18 Jan 2025 20:43:10 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN7x-0005Ua-N1; Sat, 18 Jan 2025 23:41:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7v-0005Tg-R8 for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:35 -0500 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7t-0003X2-6d for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:35 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id AFEFE5C0703; Sun, 19 Jan 2025 04:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FF04C4CED6; Sun, 19 Jan 2025 04:41:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261690; bh=f4X9zMW2UNRK6C5YvFLwtVaulKW3SQq3pLWgREWOxYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlXj4YMi3GNC+fAkbfQNq24x3sxoquhS7S71cXGh7ltGbo5kC+MHF0ghVGzl7NZCD KDEdD7N/zUX+1afSglCPNBFLRRvbJWqidw8zLksrc/xgVRhsisHXvWuen4oHrfp5v6 Qi0zhURDJdvnVqMFwvsvCe7emjgXVZjMjHnJWvZyq/ZL1Rgs+1CBpZf5eQ0NkSJqOV wi/g4n3GXbbhwODwPPbFENh+LpVf1suuTh2FukEU9jaLMTuF2x7/8We6kp5ZYQNviq F5m6dnfyjdzag6uDxe44jjYkkK5fjHsFN/XAid9+Zki2TzlvqLYnfVDpVRs+/CHVdI mZYiyTbUOWGPA== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 2/6] linux-user: Use unique error messages for cmsg parsing Date: Sun, 19 Jan 2025 05:41:18 +0100 Message-ID: <20250119044122.9637-3-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:4641:c500::1; envelope-from=deller@kernel.org; helo=dfw.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261791468019000 From: Helge Deller Avoid using the same error message for two different code paths as it complicates determining the one which actually triggered. Signed-off-by: Helge Deller Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 78c7c0b34e..a157abc40c 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1827,7 +1827,7 @@ static inline abi_long target_to_host_cmsg(struct msg= hdr *msgh, *dst =3D tswap32(*dst); } } else { - qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n", + qemu_log_mask(LOG_UNIMP, "Unsupported target ancillary data: %= d/%d\n", cmsg->cmsg_level, cmsg->cmsg_type); memcpy(data, target_data, len); } @@ -2049,7 +2049,7 @@ static inline abi_long host_to_target_cmsg(struct tar= get_msghdr *target_msgh, =20 default: unimplemented: - qemu_log_mask(LOG_UNIMP, "Unsupported ancillary data: %d/%d\n", + qemu_log_mask(LOG_UNIMP, "Unsupported host ancillary data: %d/= %d\n", cmsg->cmsg_level, cmsg->cmsg_type); memcpy(target_data, data, MIN(len, tgt_len)); if (tgt_len > len) { --=20 2.47.0 From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261776; cv=none; d=zohomail.com; s=zohoarc; b=K5OZuMTl5V8lSfI4bm/q4/IugYyT+IQ7KojbNA8/qdSNLJL6TtuIvwhGn1Vp6eQiZ5e22VOOcGrs0rk6zi0FfCy+HyzKgqYzi3v6MhP1BHKQET6CSKEXZaO4l70ChtR6niSjvC70nu+vdjOyOKNLQySaxd+GDB79ZxrsCVIHGww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261776; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=shuXpfT0s5mp2M/+OXETXs/FssiCQjbljfi3cMqFMrU=; b=n0oCOXQgcgEDd+uNP+NIkVQ6T75WM2tXQ/7p8Htx6kOqtQcUSgDt7y0FYDnB7tvKwUTzb+G9rwXSKDZYUri6wvKDAk39Ie8y+qHKiizChVTaQvyiXZFmaGanSNIewd+KbcoQf2+NEca9UkO3JkSeaRSSrnlGB/EIItNhvepLsPM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261776719552.0183538659084; Sat, 18 Jan 2025 20:42:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN7x-0005UJ-45; Sat, 18 Jan 2025 23:41:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7v-0005Tj-UN for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:36 -0500 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7t-0003XD-RY for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:35 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 640B0A4005E; Sun, 19 Jan 2025 04:39:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76AC8C4CED6; Sun, 19 Jan 2025 04:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261691; bh=BS3tR4Akvbj/4B9tMkagVRFMT0yEiYwE3uNPhrWhlsg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfE26Vx+AVNqDuRtKLbiHymO/YNa6WvEIaom2YMqRN5gwCDFMjfLtc24iZrMu2KgL v7ZOwOKrA4ncxK3I2co48dCY9AGQ3gwOqcO0su8nyo1FTKqQrYu++erM+GJq1wKjws rtglb0GB1R+rB1CpQvng4yQs1lt9YLWXl/6vzr9XF0nVGcegGjVolPFsvYtytbUmAB ngOFNHe+pQQC+ne0OAbBlF0BOoZSvtFsancb6/53ztqmHc4y8QvVXgywnBYith2HO3 iVUutAYWNaxhyAEGTsxEJcmAdQMhdoApJQKtR0xXQEyJMRCkaF1dqRTALBQ55vSEcI Lf+codCDM2lBg== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 3/6] linux-user: netlink: Add IP_PKTINFO cmsg parsing Date: Sun, 19 Jan 2025 05:41:19 +0100 Message-ID: <20250119044122.9637-4-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:45d1:ec00::3; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261777278019000 Content-Type: text/plain; charset="utf-8" From: Helge Deller Fixes those warnings: Unsupported host ancillary data: 0/8 Signed-off-by: Helge Deller v2: (based on feedback by Laurent Vivier) - add target_in_pktinfo struct and fix copying target_in_addr fields Reviewed-by: Laurent Vivier --- linux-user/syscall.c | 10 ++++++++++ linux-user/syscall_defs.h | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index a157abc40c..df8609b4d8 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -1998,6 +1998,16 @@ static inline abi_long host_to_target_cmsg(struct ta= rget_msghdr *target_msgh, (void *) &errh->offender, sizeof(errh->offender)); break; } + case IP_PKTINFO: + { + struct in_pktinfo *pkti =3D data; + struct target_in_pktinfo *target_pi =3D target_data; + + __put_user(pkti->ipi_ifindex, &target_pi->ipi_ifindex); + target_pi->ipi_spec_dst.s_addr =3D pkti->ipi_spec_dst.s_ad= dr; + target_pi->ipi_addr.s_addr =3D pkti->ipi_addr.s_addr; + break; + } default: goto unimplemented; } diff --git a/linux-user/syscall_defs.h b/linux-user/syscall_defs.h index faad9147c9..86d773add7 100644 --- a/linux-user/syscall_defs.h +++ b/linux-user/syscall_defs.h @@ -2622,6 +2622,12 @@ struct target_ucred { abi_uint gid; }; =20 +struct target_in_pktinfo { + abi_int ipi_ifindex; + struct target_in_addr ipi_spec_dst; + struct target_in_addr ipi_addr; +}; + typedef abi_int target_timer_t; =20 #define TARGET_SIGEV_MAX_SIZE 64 --=20 2.47.0 From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261785; cv=none; d=zohomail.com; s=zohoarc; b=PObzHMWHRXHgO7BHo7qu45CsFu95+ictPTkWH+x8HklPsctGM9wm/I/hIVRl6uAzxZN8GBk/Ewb73r/CL+DvrU7mnReizsYOKa8jYRwwgwHgjYjYXLIy6IujvKMmjI9l0YhWbOZ1WZGidWi/WQApwqejJ+f0bPHVKCFdPLY0CJI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261785; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=NDt2cww75sBp1UU0S9zcObAGzeMEXlzSgRsnYX7Bayo=; b=fxOy0loc6gF8piJBJzjLGto0ndnlIdjDn8JKg9cR8RIroMHXM1GMCZVtefln743lphCJvtPzHamwz0F3ZOQTvQ032ula+u3gijBCT1dph82UnxfGhC4lbLQ11TDI7eYmf2ZdtRcb9dB6vded4wuGZxUbe8Rt8MSgKNOfa5bWLkg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261785696612.9911573104133; Sat, 18 Jan 2025 20:43:05 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN7x-0005Ub-Oo; Sat, 18 Jan 2025 23:41:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7w-0005U3-8r for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:36 -0500 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7u-0003XO-Ih for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:36 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 3B144A40221; Sun, 19 Jan 2025 04:39:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E1BCC4CEE2; Sun, 19 Jan 2025 04:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261693; bh=UoKNIg1BVV2B35JmDx3qsOSk4IWWs53EChpYtm/qpbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkQwfM+xaJ5JDOCzXlLwXBLILhYw//05iRlgT0DOkyUlHi3lYdH+fLeOAsYQw7bQN 8q7iXy/YjVhfO1hOuUNWRKYUmsqhR/4uG5OEg5vo0xjoDqEAtH5L3v/GXrTHtXf/5Y i1hfN9qJPXbOGzfr/NbfAY4QTuGleW0iJBljZDUew6mPOpT7Ddw+zus1BTb08h7Oql uWPwrizfKCyvSfRqgxuh3Mxbv8oCSmPj1LaMyD6/r0us6RzMGFJZ6CCOMRgZVJmQyo J3xSkl8duxrKnk8WPo+931fQNYobeu374XLz+BCQ9+oQhPloxXhNtJJoUY9ugzw35v f+1a1lrqp/6fQ== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 4/6] linux-user: netlink: Add emulation of IP_MULTICAST_IF Date: Sun, 19 Jan 2025 05:41:20 +0100 Message-ID: <20250119044122.9637-5-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2604:1380:45d1:ec00::3; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261787404019000 Content-Type: text/plain; charset="utf-8" From: Helge Deller Add IP_MULTICAST_IF and share the code with IP_ADD_MEMBERSHIP / IP_DROP_MEM= BERSHIP. Sharing the code makes sense, because the manpage of ip(7) says: IP_MULTICAST_IF (since Linux 1.2) Set the local device for a multicast socket. The argument for setsockopt(2) is an ip_mreqn or (since Linux 3.5) ip_mreq structure similar to IP_ADD_MEMBERSHIP, or an in_addr structure. (The kernel determines which structure is being passed based on the size passed in optlen.) For getsockopt(2), the argument is an in_addr structure. Signed-off-by: Helge Deller v2: (based on feedback by Laurent Vivier) - refined commit message and restructure the copying of ip_mreqn fields diff --git a/linux-user/syscall.c b/linux-user/syscall.c index bbe2560927..4360543e20 100644 Reviewed-by: Laurent Vivier --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2130,16 +2130,23 @@ static abi_long do_setsockopt(int sockfd, int level= , int optname, } ret =3D get_errno(setsockopt(sockfd, level, optname, &val, siz= eof(val))); break; + case IP_MULTICAST_IF: case IP_ADD_MEMBERSHIP: case IP_DROP_MEMBERSHIP: { struct ip_mreqn ip_mreq; struct target_ip_mreqn *target_smreqn; + int min_size; QEMU_BUILD_BUG_ON(sizeof(struct ip_mreq) !=3D sizeof(struct target_ip_mreq)); - if (optlen < sizeof (struct target_ip_mreq) || + if (optname =3D=3D IP_MULTICAST_IF) { + min_size =3D sizeof(struct in_addr); + } else { + min_size =3D sizeof(struct target_ip_mreq); + } + if (optlen < min_size || optlen > sizeof (struct target_ip_mreqn)) { return -TARGET_EINVAL; } @@ -2149,7 +2156,9 @@ static abi_long do_setsockopt(int sockfd, int level, = int optname, return -TARGET_EFAULT; } ip_mreq.imr_multiaddr.s_addr =3D target_smreqn->imr_multiaddr.= s_addr; - ip_mreq.imr_address.s_addr =3D target_smreqn->imr_address.s_ad= dr; + if (optlen >=3D sizeof(struct target_ip_mreq)) { + ip_mreq.imr_address.s_addr =3D target_smreqn->imr_address.= s_addr; + } if (optlen =3D=3D sizeof(struct target_ip_mreqn)) { ip_mreq.imr_ifindex =3D tswapal(target_smreqn->imr_ifindex= ); optlen =3D sizeof(struct ip_mreqn); --- linux-user/syscall.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/linux-user/syscall.c b/linux-user/syscall.c index df8609b4d8..6ee02383da 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -2130,16 +2130,23 @@ static abi_long do_setsockopt(int sockfd, int level= , int optname, } ret =3D get_errno(setsockopt(sockfd, level, optname, &val, siz= eof(val))); break; + case IP_MULTICAST_IF: case IP_ADD_MEMBERSHIP: case IP_DROP_MEMBERSHIP: { struct ip_mreqn ip_mreq; struct target_ip_mreqn *target_smreqn; + int min_size; =20 QEMU_BUILD_BUG_ON(sizeof(struct ip_mreq) !=3D sizeof(struct target_ip_mreq)); =20 - if (optlen < sizeof (struct target_ip_mreq) || + if (optname =3D=3D IP_MULTICAST_IF) { + min_size =3D sizeof(struct in_addr); + } else { + min_size =3D sizeof(struct target_ip_mreq); + } + if (optlen < min_size || optlen > sizeof (struct target_ip_mreqn)) { return -TARGET_EINVAL; } @@ -2149,13 +2156,14 @@ static abi_long do_setsockopt(int sockfd, int level= , int optname, return -TARGET_EFAULT; } ip_mreq.imr_multiaddr.s_addr =3D target_smreqn->imr_multiaddr.= s_addr; - ip_mreq.imr_address.s_addr =3D target_smreqn->imr_address.s_ad= dr; - if (optlen =3D=3D sizeof(struct target_ip_mreqn)) { - ip_mreq.imr_ifindex =3D tswapal(target_smreqn->imr_ifindex= ); - optlen =3D sizeof(struct ip_mreqn); + if (optlen >=3D sizeof(struct target_ip_mreq)) { + ip_mreq.imr_address.s_addr =3D target_smreqn->imr_address.= s_addr; + if (optlen >=3D sizeof(struct target_ip_mreqn)) { + __put_user(target_smreqn->imr_ifindex, &ip_mreq.imr_if= index); + optlen =3D sizeof(struct ip_mreqn); + } } unlock_user(target_smreqn, optval_addr, 0); - ret =3D get_errno(setsockopt(sockfd, level, optname, &ip_mreq,= optlen)); break; } --=20 2.47.0 From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261759; cv=none; d=zohomail.com; s=zohoarc; b=DWKpvs6JxAd9G1PAdFdc7kxhWLztmY+hIRJc0+paxRMmqbAQii+Xe2Aa9tBDjAQtR2GNteTamiZ/8buhuyjRWTeNZarHBiCSX2v1HXvOKpY7qmq1D0epibYNl02Cq0QNYwLnvIKAqNWj5GrbLlKaeqdC3rxxwpFXGg2bVWR1iG8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261759; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=BqWV1yYpcFVlF6VepdLjW6NzOp+PtG49togtsvDZIto=; b=fley82qKogsdtfiAx8gh8PV9j494GchemSpCAQSms/RfkIWhIg8CbRVx7jfkKnqqkDLLsVsjd1S1UVvIr3dplVtTtgeUSDjVIM0xmzi7ZrO52tFyR6pw0DO4NPzrWXGkdH+BmIa4J1p/nk3OUT0YDDwlPKAXe6+tiJx1W+ZoJBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261759569232.07970961828767; Sat, 18 Jan 2025 20:42:39 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN80-0005Vi-H9; Sat, 18 Jan 2025 23:41:40 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7y-0005Ud-FG for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:38 -0500 Received: from nyc.source.kernel.org ([147.75.193.91]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7w-0003Xw-MC for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:38 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 103B5A4005E; Sun, 19 Jan 2025 04:39:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24E02C4CED6; Sun, 19 Jan 2025 04:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261695; bh=VrpxIp6ajcb8m1RwibVb7PCFaMtlMIRUlr7wJ5a/Ea0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxWfnqmjMiuugTYWLxCG1Ml1J9JfBQZjtPay4UL+T6kAnHDdoCB+LkZRoDAAdoHNK sUfYQLeIwLf3XNUbNKo5tOvqOa0Q9TqD2rFLVb33YV7JtbOVoyUMysxrqu/M1IPkno XAVDjMyCbe4sUfbWAn+pVy158CFXs6ngpUIWmiHFS8CiHTYyiEEZFPDwyW8e22JJlG uJE1MrAeUETH2Sw66/zVEtpLVHbgMqCoZ9peNl1N5o90yDHkxgZ0oCG9IfasRF9mg5 FSe4S0JsFlPTRs2vjHVnNNRSgdX2YF6c8adM9q6dLiD68G2XruahZX96FCYkUhmoBK uHQit5/V9+fUA== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 5/6] linux-user: netlink: add netlink neighbour emulation Date: Sun, 19 Jan 2025 05:41:21 +0100 Message-ID: <20250119044122.9637-6-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=147.75.193.91; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261762509019000 Content-Type: text/plain; charset="utf-8" From: Helge Deller Fixes various warnings in the testsuite while building gupnp: gssdp-net-DEBUG: Failed to send netlink message: Operation not supported gupnp-context-DEBUG: Mismatch between host header and host IP (example.com= , expected: 127.0.0.1) gupnp-context-DEBUG: Mismatch between host header and host port (80, expec= ted 4711) gupnp-context-DEBUG: Mismatch between host header and host IP (192.168.1.2= , expected: 127.0.0.1) gupnp-context-DEBUG: Mismatch between host header and host IP (fe80::01, e= xpected: 127.0.0.1) gupnp-context-DEBUG: Mismatch between host header and host port (80, expec= ted 4711) gupnp-context-DEBUG: Failed to parse HOST header from request: Invalid IPv= 6 address ?[fe80::01%1]? in URI gupnp-context-DEBUG: Failed to parse HOST header from request: Invalid IPv= 6 address ?[fe80::01%eth0]? in URI gupnp-context-DEBUG: Failed to parse HOST header from request: Could not p= arse port ?:1? in URI gupnp-context-DEBUG: Mismatch between host header and host IP (example.com= , expected: ::1) gupnp-context-DEBUG: Mismatch between host header and host port (80, expec= ted 4711) gupnp-context-DEBUG: Mismatch between host header and host IP (example.com= , expected: ::1) gupnp-context-DEBUG: Mismatch between host header and host port (80, expec= ted 4711) gupnp-context-DEBUG: Mismatch between host header and host IP (example.com= , expected: ::1) Signed-off-by: Helge Deller Reviewed-by: Laurent Vivier --- linux-user/fd-trans.c | 100 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index a86ed2f4b4..a5e6c6b6f2 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -25,12 +25,16 @@ #ifdef CONFIG_RTNETLINK #include #include +#include #endif #include "qemu.h" #include "user-internals.h" #include "fd-trans.h" #include "signal-common.h" =20 +#define NDM_RTA(r) ((struct rtattr*)(((char*)(r)) + \ + NLMSG_ALIGN(sizeof(struct ndmsg)))) + enum { QEMU_IFLA_BR_UNSPEC, QEMU_IFLA_BR_FORWARD_DELAY, @@ -1210,6 +1214,35 @@ static abi_long host_to_target_data_route_rtattr(str= uct rtattr *rtattr) return 0; } =20 +static abi_long host_to_target_data_neigh_rtattr(struct rtattr *rtattr) +{ + struct nda_cacheinfo *ndac; + uint32_t *u32; + + switch (rtattr->rta_type) { + case NDA_UNSPEC: + case NDA_DST: + case NDA_LLADDR: + break; + case NDA_PROBES: + u32 =3D RTA_DATA(rtattr); + *u32 =3D tswap32(*u32); + break; + case NDA_CACHEINFO: + ndac =3D RTA_DATA(rtattr); + ndac->ndm_confirmed =3D tswap32(ndac->ndm_confirmed); + ndac->ndm_used =3D tswap32(ndac->ndm_used); + ndac->ndm_updated =3D tswap32(ndac->ndm_updated); + ndac->ndm_refcnt =3D tswap32(ndac->ndm_refcnt); + break; + default: + qemu_log_mask(LOG_UNIMP, "Unknown host to target NEIGH type: %d\n", + rtattr->rta_type); + break; + } + return 0; +} + static abi_long host_to_target_link_rtattr(struct rtattr *rtattr, uint32_t rtattr_len) { @@ -1231,12 +1264,20 @@ static abi_long host_to_target_route_rtattr(struct = rtattr *rtattr, host_to_target_data_route_rtattr= ); } =20 +static abi_long host_to_target_neigh_rtattr(struct rtattr *rtattr, + uint32_t rtattr_len) +{ + return host_to_target_for_each_rtattr(rtattr, rtattr_len, + host_to_target_data_neigh_rtattr= ); +} + static abi_long host_to_target_data_route(struct nlmsghdr *nlh) { uint32_t nlmsg_len; struct ifinfomsg *ifi; struct ifaddrmsg *ifa; struct rtmsg *rtm; + struct ndmsg *ndm; =20 nlmsg_len =3D nlh->nlmsg_len; switch (nlh->nlmsg_type) { @@ -1263,6 +1304,17 @@ static abi_long host_to_target_data_route(struct nlm= sghdr *nlh) nlmsg_len - NLMSG_LENGTH(sizeof(*if= a))); } break; + case RTM_NEWNEIGH: + case RTM_DELNEIGH: + case RTM_GETNEIGH: + if (nlh->nlmsg_len >=3D NLMSG_LENGTH(sizeof(*ndm))) { + ndm =3D NLMSG_DATA(nlh); + ndm->ndm_ifindex =3D tswap32(ndm->ndm_ifindex); + ndm->ndm_state =3D tswap16(ndm->ndm_state); + host_to_target_neigh_rtattr(NDM_RTA(ndm), + nlmsg_len - NLMSG_LENGTH(sizeof(*ndm))= ); + } + break; case RTM_NEWROUTE: case RTM_DELROUTE: case RTM_GETROUTE: @@ -1410,6 +1462,35 @@ static abi_long target_to_host_data_addr_rtattr(stru= ct rtattr *rtattr) return 0; } =20 +static abi_long target_to_host_data_neigh_rtattr(struct rtattr *rtattr) +{ + struct nda_cacheinfo *ndac; + uint32_t *u32; + + switch (rtattr->rta_type) { + case NDA_UNSPEC: + case NDA_DST: + case NDA_LLADDR: + break; + case NDA_PROBES: + u32 =3D RTA_DATA(rtattr); + *u32 =3D tswap32(*u32); + break; + case NDA_CACHEINFO: + ndac =3D RTA_DATA(rtattr); + ndac->ndm_confirmed =3D tswap32(ndac->ndm_confirmed); + ndac->ndm_used =3D tswap32(ndac->ndm_used); + ndac->ndm_updated =3D tswap32(ndac->ndm_updated); + ndac->ndm_refcnt =3D tswap32(ndac->ndm_refcnt); + break; + default: + qemu_log_mask(LOG_UNIMP, "Unknown target NEIGH type: %d\n", + rtattr->rta_type); + break; + } + return 0; +} + static abi_long target_to_host_data_route_rtattr(struct rtattr *rtattr) { uint32_t *u32; @@ -1448,6 +1529,13 @@ static void target_to_host_addr_rtattr(struct rtattr= *rtattr, target_to_host_data_addr_rtattr); } =20 +static void target_to_host_neigh_rtattr(struct rtattr *rtattr, + uint32_t rtattr_len) +{ + target_to_host_for_each_rtattr(rtattr, rtattr_len, + target_to_host_data_neigh_rtattr); +} + static void target_to_host_route_rtattr(struct rtattr *rtattr, uint32_t rtattr_len) { @@ -1460,6 +1548,7 @@ static abi_long target_to_host_data_route(struct nlms= ghdr *nlh) struct ifinfomsg *ifi; struct ifaddrmsg *ifa; struct rtmsg *rtm; + struct ndmsg *ndm; =20 switch (nlh->nlmsg_type) { case RTM_NEWLINK: @@ -1486,6 +1575,17 @@ static abi_long target_to_host_data_route(struct nlm= sghdr *nlh) NLMSG_LENGTH(sizeof(*ifa))); } break; + case RTM_NEWNEIGH: + case RTM_DELNEIGH: + case RTM_GETNEIGH: + if (nlh->nlmsg_len >=3D NLMSG_LENGTH(sizeof(*ndm))) { + ndm =3D NLMSG_DATA(nlh); + ndm->ndm_ifindex =3D tswap32(ndm->ndm_ifindex); + ndm->ndm_state =3D tswap16(ndm->ndm_state); + target_to_host_neigh_rtattr(NDM_RTA(ndm), nlh->nlmsg_len - + NLMSG_LENGTH(sizeof(*ndm))); + } + break; case RTM_NEWROUTE: case RTM_DELROUTE: case RTM_GETROUTE: --=20 2.47.0 From nobody Sat Apr 5 15:05:38 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1737261773; cv=none; d=zohomail.com; s=zohoarc; b=llGjJdfaB91MnqN23+JeEa6yrLcpK/GwMNOVqizzlukBzXjRR8b8lTz7hN+38vmR/xZYrfKJKYzEPIyxJeuhDEH9jdvJPa0BiKHOpmlqbMAmZCvGDbJ4S2l9brRHiHcERS/b4TSh3U9rAHL/QloVSOpGU8tUDXne9Vqgz9gdIME= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1737261773; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=nNItBsgivDe5K99JF3vR7S/GppB3k4iPGf5ABv0kT+w=; b=HpWldP9uW3/uQNs+DKEQyjeuCtOOnoLMrczPU1XwkfyirdM7d9P41NGGCiZcPRq6WHCG3yWDUWjvr6kdLNdKeVzGfji2tUyN3FY+ZD/SqOfIrmh8pswRKVSdON1v440SWMRYCg1qT5cXrileiimMivIex9tSX4dcFa8KqzRN8xA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1737261773121987.4448275286954; Sat, 18 Jan 2025 20:42:53 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tZN81-0005Vm-8a; Sat, 18 Jan 2025 23:41:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7z-0005Vb-OY for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:39 -0500 Received: from nyc.source.kernel.org ([147.75.193.91]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZN7y-0003YC-AZ for qemu-devel@nongnu.org; Sat, 18 Jan 2025 23:41:39 -0500 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id DD348A4012B; Sun, 19 Jan 2025 04:39:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFBB4C4CEE2; Sun, 19 Jan 2025 04:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1737261697; bh=hhDwBSEsbXupi99avxyU1H6RABU9+QfFVDRuVvqtm6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fTRfXs+6/khlwJLOY9HrxqwBfEY63dhQJmNmiQooViKJPo+I7VVBT0UC5CV/6wVSU eb2v/8j6p79MYUOYWPBJP9yO++lmF43KDyBG73koL6sw56+3DemNZl8A1qEhaoQTgf OLUnpiddRmoZsJQ8DeuY9uk9zOhDCbhpt5t1/j1b5AhefotBMMQ4m6OPfSIZK7c77X cbnz1jZwJ9KxwuIEI+7XCEFWm/LfqE1HCvKlurQzXkMhVZgQm8yN75AWwHsB23JgqK Z1ZnVmwFYzG81C50Iph+D0AWLxKH31OnEojdN8zj160DKWuML+/LOSpIsL27q28bXY 50smccRtGfkwA== From: deller@kernel.org To: Richard Henderson , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Laurent Vivier , qemu-devel@nongnu.org, Stefan Hajnoczi Cc: deller@gmx.de Subject: [PATCH v3 6/6] linux-user: netlink: Add missing QEMU_IFLA entries Date: Sun, 19 Jan 2025 05:41:22 +0100 Message-ID: <20250119044122.9637-7-deller@kernel.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20250119044122.9637-1-deller@kernel.org> References: <20250119044122.9637-1-deller@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=147.75.193.91; envelope-from=deller@kernel.org; helo=nyc.source.kernel.org X-Spam_score_int: -44 X-Spam_score: -4.5 X-Spam_bar: ---- X-Spam_report: (-4.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.07, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @kernel.org) X-ZM-MESSAGEID: 1737261775646019000 Content-Type: text/plain; charset="utf-8" From: Helge Deller This fixes the following qemu warnings when building debian gupnp package: Unknown host QEMU_IFLA type: 61 Unknown host QEMU_IFLA type: 58 Unknown host QEMU_IFLA type: 59 Unknown host QEMU_IFLA type: 60 Unknown host QEMU_IFLA type: 32820 QEMU_IFLA type 32820 is actually NLA_NESTED | QEMU_IFLA_PROP_LIST (a nested entry), which is why rta_type needs to be masked with NLA_TYPE_MASK. Signed-off-by: Helge Deller Reviewed-by: Laurent Vivier --- linux-user/fd-trans.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index a5e6c6b6f2..6a8775bb55 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -145,6 +145,14 @@ enum { QEMU_IFLA_PROTO_DOWN_REASON, QEMU_IFLA_PARENT_DEV_NAME, QEMU_IFLA_PARENT_DEV_BUS_NAME, + QEMU_IFLA_GRO_MAX_SIZE, + QEMU_IFLA_TSO_MAX_SIZE, + QEMU_IFLA_TSO_MAX_SEGS, + QEMU_IFLA_ALLMULTI, + QEMU_IFLA_DEVLINK_PORT, + QEMU_IFLA_GSO_IPV4_MAX_SIZE, + QEMU_IFLA_GRO_IPV4_MAX_SIZE, + QEMU_IFLA_DPLL_PIN, QEMU___IFLA_MAX }; =20 @@ -986,6 +994,22 @@ static abi_long host_to_target_data_vfinfo_nlattr(stru= ct nlattr *nlattr, return 0; } =20 +static abi_long host_to_target_data_prop_nlattr(struct nlattr *nlattr, + void *context) +{ + switch (nlattr->nla_type) { + /* string */ + case QEMU_IFLA_ALT_IFNAME: + break; + default: + qemu_log_mask(LOG_UNIMP, "Unknown host PROP type: %d\n", + nlattr->nla_type); + break; + } + return 0; +} + + static abi_long host_to_target_data_link_rtattr(struct rtattr *rtattr) { uint32_t *u32; @@ -994,7 +1018,7 @@ static abi_long host_to_target_data_link_rtattr(struct= rtattr *rtattr) struct rtnl_link_ifmap *map; struct linkinfo_context li_context; =20 - switch (rtattr->rta_type) { + switch (rtattr->rta_type & NLA_TYPE_MASK) { /* binary stream */ case QEMU_IFLA_ADDRESS: case QEMU_IFLA_BROADCAST: @@ -1032,6 +1056,12 @@ static abi_long host_to_target_data_link_rtattr(stru= ct rtattr *rtattr) case QEMU_IFLA_CARRIER_DOWN_COUNT: case QEMU_IFLA_MIN_MTU: case QEMU_IFLA_MAX_MTU: + case QEMU_IFLA_GRO_MAX_SIZE: + case QEMU_IFLA_TSO_MAX_SIZE: + case QEMU_IFLA_TSO_MAX_SEGS: + case QEMU_IFLA_ALLMULTI: + case QEMU_IFLA_GSO_IPV4_MAX_SIZE: + case QEMU_IFLA_GRO_IPV4_MAX_SIZE: u32 =3D RTA_DATA(rtattr); *u32 =3D tswap32(*u32); break; @@ -1127,6 +1157,10 @@ static abi_long host_to_target_data_link_rtattr(stru= ct rtattr *rtattr) return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rt= a_len, NULL, host_to_target_data_vfinfo_nl= attr); + case QEMU_IFLA_PROP_LIST: + return host_to_target_for_each_nlattr(RTA_DATA(rtattr), rtattr->rt= a_len, + NULL, + host_to_target_data_prop_nlat= tr); default: qemu_log_mask(LOG_UNIMP, "Unknown host QEMU_IFLA type: %d\n", rtattr->rta_type); --=20 2.47.0