qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: deller@kernel.org
To: "Richard Henderson" <richard.henderson@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@linaro.org>,
	"Laurent Vivier" <laurent@vivier.eu>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@gmail.com>
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	[thread overview]
Message-ID: <20250119044122.9637-4-deller@kernel.org> (raw)
In-Reply-To: <20250119044122.9637-1-deller@kernel.org>

From: Helge Deller <deller@gmx.de>

Fixes those warnings:
 Unsupported host ancillary data: 0/8

Signed-off-by: Helge Deller <deller@gmx.de>

v2: (based on feedback by Laurent Vivier)
- add target_in_pktinfo struct and fix copying target_in_addr fields
---
 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 target_msghdr *target_msgh,
                     (void *) &errh->offender, sizeof(errh->offender));
                 break;
             }
+            case IP_PKTINFO:
+            {
+                struct in_pktinfo *pkti = data;
+                struct target_in_pktinfo *target_pi = target_data;
+
+                __put_user(pkti->ipi_ifindex, &target_pi->ipi_ifindex);
+                target_pi->ipi_spec_dst.s_addr = pkti->ipi_spec_dst.s_addr;
+                target_pi->ipi_addr.s_addr = 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;
 };
 
+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;
 
 #define TARGET_SIGEV_MAX_SIZE 64
-- 
2.47.0



  parent reply	other threads:[~2025-01-19  4:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-19  4:41 [PATCH v3 0/6] linux-user: Add support for various missing netlink sockopt entries deller
2025-01-19  4:41 ` [PATCH v3 1/6] linux-user: netlink: Add missing IFA_PROTO to host_to_target_data_addr_rtattr() deller
2025-01-20 18:29   ` Laurent Vivier
2025-01-19  4:41 ` [PATCH v3 2/6] linux-user: Use unique error messages for cmsg parsing deller
2025-01-19  4:41 ` deller [this message]
2025-01-20 18:10   ` [PATCH v3 3/6] linux-user: netlink: Add IP_PKTINFO " Laurent Vivier
2025-01-19  4:41 ` [PATCH v3 4/6] linux-user: netlink: Add emulation of IP_MULTICAST_IF deller
2025-01-20 18:17   ` Laurent Vivier
2025-01-20 20:42     ` Helge Deller
2025-01-20 20:47       ` Helge Deller
2025-01-19  4:41 ` [PATCH v3 5/6] linux-user: netlink: add netlink neighbour emulation deller
2025-01-19  4:41 ` [PATCH v3 6/6] linux-user: netlink: Add missing QEMU_IFLA entries deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250119044122.9637-4-deller@kernel.org \
    --to=deller@kernel.org \
    --cc=deller@gmx.de \
    --cc=laurent@vivier.eu \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).