From nobody Sun May 5 19:12:35 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; 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 ARC-Seal: i=1; a=rsa-sha256; t=1605544850; cv=none; d=zohomail.com; s=zohoarc; b=X8W4KLvho1zZ6pU0fyW8ovGCojrzfhJVRDedMD1H2okhu4uxrrocURZDVI6027Fmp913XWFG7DKNMmto6Pqj2+/8MDJZ+p+sfkTzbEjWLJG5LWWCfCKKhovLdEBiSB3BF005iRXZsdgVJUxe7eiscsOgdkuhfDNjND3SLGdKUns= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1605544850; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=mTTh5mLeaqhPi+6MyMO307D2bQixQNFN8rvzWqsIc7E=; b=Y1FssD63hGF+L2+vgO3jNd5672cR4YqdL0oGO/YtjaPxcWBJXNM14KSTuuvqKDoBNGFaeaFbdmFfRxEMi/s/KPbHX6/JTyaU0/p+kSSB5Ll4hNaZPX7o1ZQFy7zZCniyv0DPbc9rFBcyATb5+nuIZjTBggDra/rxc5K68QuAA10= ARC-Authentication-Results: i=1; mx.zohomail.com; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1605544850108682.6671980631437; Mon, 16 Nov 2020 08:40:50 -0800 (PST) Received: from localhost ([::1]:50854 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kehYf-0000Cv-1H for importer@patchew.org; Mon, 16 Nov 2020 11:40:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36744) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kehUY-0003Ko-FS for qemu-devel@nongnu.org; Mon, 16 Nov 2020 11:36:34 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:41137) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kehUU-0000B9-98 for qemu-devel@nongnu.org; Mon, 16 Nov 2020 11:36:34 -0500 Received: from localhost.localdomain ([82.252.130.226]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MpUQm-1jvRaf0tOG-00ptPw; Mon, 16 Nov 2020 17:36:25 +0100 From: Laurent Vivier To: qemu-devel@nongnu.org Subject: [PATCH] linux-user,netlink: fix message translation with ip command Date: Mon, 16 Nov 2020 17:36:22 +0100 Message-Id: <20201116163622.791442-1-laurent@vivier.eu> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:9v2BGnJssJVI/mDdbuUo5vXHFucjRyAA4BlW4D/WU5zDybzK7uE WOG3XuzSG8N/MNi4wGJDveZgQDXC5DojxFS7pIwmorxbT2JXIp9C+R2SBVD51Hvh7BoMOFT rUJL1JWjnVF9XeYbBb87g1GhxnZTVMk0GDbl2g1d8Cpxav2alTHDb6CmCjHjUhs5iEHmlyx 8Z8t3NqTo/EzePl8SJ0Xg== X-UI-Out-Filterresults: notjunk:1;V03:K0:uQTl5TL1zQU=:puaPLIJfL0nk+b/XSb3H46 k30qUkb6gNRgoRtgt1W8jxF6SJY1gtH77gGa1rw3MuJbcP6m6j+x2jFRCTuz9XNxXRSWoqqAA hZ4Q4dsECtDen8LKcxFGa8su3bOgnwg+CsJPD0HLK8Kfc/MT28Wi4RAOWp08HWdBJ8Hd90Ezr IbTzlDsBJ+1s0o+7jCcLyhgIMhOP2WEJwVhewJgoe0bqn9g2R3ld0Y8yHsMEDbAxkW8yNFEJh NphShp7SXulbDNX4EwPAvZriQGxvVywYnnkTSbAH+rtxfd+4ZDBLkqJDhk5kJKeRTJ9D2ECaK f4Lq6SHuUH2ElQDYtU8WB2usjeo+kk4jFlm4npi8O492mnE2ccYs7XSYYKTiQ13Ws8nXxEDYL od48ZIqst15CpFCl0O/AbkVOWAutnqj29SRPW9JjeuaMVGbYhLUkBBxd9CVpWWS5DBz7+kmeO JkK4AacRkg== 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: none client-ip=212.227.126.135; envelope-from=laurent@vivier.eu; helo=mout.kundenserver.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/16 11:36:25 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" With iproute2-5.8.0, the route, link and addr show commands fail: root@sid:~# ip addr show RTNETLINK answers: Unknown error 352321537 Dump terminated root@sid:~# ip link show RTNETLINK answers: Unknown error 352321537 Dump terminated root@sid:~# ip route show RTNETLINK answers: Unknown error 352321537 Dump terminated This patch correctly decodes the GETROUTE and GETLINK commands and adds the RTA_TABLE message. Signed-off-by: Laurent Vivier --- linux-user/fd-trans.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/linux-user/fd-trans.c b/linux-user/fd-trans.c index 1486c81aaa27..7551c883304a 100644 --- a/linux-user/fd-trans.c +++ b/linux-user/fd-trans.c @@ -1160,6 +1160,7 @@ static abi_long target_to_host_data_route_rtattr(stru= ct rtattr *rtattr) break; /* u32 */ case QEMU_RTA_PRIORITY: + case QEMU_RTA_TABLE: case QEMU_RTA_OIF: u32 =3D RTA_DATA(rtattr); *u32 =3D tswap32(*u32); @@ -1200,11 +1201,10 @@ static abi_long target_to_host_data_route(struct nl= msghdr *nlh) struct rtmsg *rtm; =20 switch (nlh->nlmsg_type) { - case RTM_GETLINK: - break; case RTM_NEWLINK: case RTM_DELLINK: case RTM_SETLINK: + case RTM_GETLINK: if (nlh->nlmsg_len >=3D NLMSG_LENGTH(sizeof(*ifi))) { ifi =3D NLMSG_DATA(nlh); ifi->ifi_type =3D tswap16(ifi->ifi_type); @@ -1225,10 +1225,9 @@ static abi_long target_to_host_data_route(struct nlm= sghdr *nlh) NLMSG_LENGTH(sizeof(*ifa))); } break; - case RTM_GETROUTE: - break; case RTM_NEWROUTE: case RTM_DELROUTE: + case RTM_GETROUTE: if (nlh->nlmsg_len >=3D NLMSG_LENGTH(sizeof(*rtm))) { rtm =3D NLMSG_DATA(nlh); rtm->rtm_flags =3D tswap32(rtm->rtm_flags); --=20 2.28.0