From nobody Sat Mar 04 09:12:46 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PTJyk3zDGz3vnCp; Sat, 4 Mar 2023 09:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PTJyk3SqRz3yHL; Sat, 4 Mar 2023 09:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677921166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LoiSAELPZ3BP8cwT0sSi4COXLeDqY0jHXq/1MRcf3rQ=; b=LiI5IJv2aF09/y1I6Ql4+a7bvbR5G6aHnxtFPTMuELLbqGet8B3/Skj8rXdkVlblbSsySL A2gNO5/JL6fSN2xMRtJHMBje6AyHKUUXu3uEozqGJfkkSNhngtGAheG6YcVkbPje9QrKtk +urHN6tedVQTglzUs2R/EH2bl4OI+yHg1/y4j5wUlavZKBft6OCAKdKydVfG7yLpyU4vzR eqIOGZNUgnGL1B4JdW+YD14Sr58kNgocJWgNN/DfX0DCbw/PkNjxM2MvSsfHyt3noAF/LC 6V63S+aVxeIRgneHpFlVhigKtZR/AuAoG2eKjJgajQ2SxD+pNTmZ7t5nBrv5ZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1677921166; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=LoiSAELPZ3BP8cwT0sSi4COXLeDqY0jHXq/1MRcf3rQ=; b=VuNR4TOrR5NQTQNkWuQw+OoBeBpD1ldNHf2YmTBfx1XdY866VO2P2NRpUViME7ztWnF5Lc rPW4LvZ/6ziX3mB/Iah8imJ1S2E4cUlSmoq/BjZ51OZYbEIDvLtxj7ZbjPIOiAp+WSPggn CAbCC4yqZzjjZCCYOZPXeElU9ahzIUZqeL9JbZ6kl0ro4Enkt42anNquGxMIvkKPlhBERc aPR8mOhMZOF4U7yCgYhuLS72bhAxXHVwPLixRkQOv1JNJ1KYKxMogwvesWMJ3aYJ2QPLK5 d9Wh02G6c3GP0b4hFDteTjlFaqdOK7VvMCKmIN45BDk3Je7raBXdjsSuD6XOUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1677921166; a=rsa-sha256; cv=none; b=h6PW5KBYuIcNxFctrcOV+PKS2ZQiCUXnyHJ+5fr+c/HlPc59dlIfbgPGcW/ba6OHT1i5kJ 5G1Yqttm1Al7qDpx5MS9VhETG5APOh812p7/GfifE3ipsxWCk9ngNxrLTHu9mDe5fdTv7o zE7WemrrBk3VsKK5tdSSBYK3ETYbIkCm66BEHVoATilqnskiahaBT/56jt7N9+EYj1Cep2 qJ1uBJCfZRLL/mjbzgjS7A4KYTXVYXiEL0h+4r1qD7wIfnWiAwXM2nG4vOjzgxVKCWJeHs nd0iiTfRKgD+YBHEvt6n90wZAfbAWFOc6QmcLHZ653RYNytqBa++CcGhYzk2sA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PTJyk2TzxzZ8S; Sat, 4 Mar 2023 09:12:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 3249CkRl078873; Sat, 4 Mar 2023 09:12:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 3249CkwI078872; Sat, 4 Mar 2023 09:12:46 GMT (envelope-from git) Date: Sat, 4 Mar 2023 09:12:46 GMT Message-Id: <202303040912.3249CkwI078872@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dmitry Chagin Subject: git: a927409ce820 - main - linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a927409ce820909c344b8f1323285fd01046cc4f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=a927409ce820909c344b8f1323285fd01046cc4f commit a927409ce820909c344b8f1323285fd01046cc4f Author: Dmitry Chagin AuthorDate: 2023-03-04 09:11:38 +0000 Commit: Dmitry Chagin CommitDate: 2023-03-04 09:11:38 +0000 linux(4): Rename struct l_ifreq members names to avoid conflicts with FreeBSD For now we are using mixed names to access struct ifreq members, some of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts switch to use FreeBSD names. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D38792 --- sys/compat/linux/linux_ioctl.c | 2 +- sys/compat/linux/linux_socket.c | 10 ++++++++++ sys/compat/linux/linux_socket.h | 17 ++++++++++------- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 8551ba180aa4..9f1fdd3a6671 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -2097,7 +2097,7 @@ linux_ioctl_ifname(struct thread *td, struct l_ifreq *uifr) error = copyin(uifr, &ifr, sizeof(ifr)); if (error != 0) return (error); - ret = ifname_bsd_to_linux_idx(ifr.ifr_ifindex, ifr.ifr_name, + ret = ifname_bsd_to_linux_idx(ifr.ifr_index, ifr.ifr_name, LINUX_IFNAMSIZ); if (ret > 0) return (copyout(&ifr, uifr, sizeof(ifr))); diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c index a3a8cc6733c1..3748c1bedd3c 100644 --- a/sys/compat/linux/linux_socket.c +++ b/sys/compat/linux/linux_socket.c @@ -72,6 +72,16 @@ __FBSDID("$FreeBSD$"); #include #include +_Static_assert(offsetof(struct l_ifreq, ifr_ifru) == + offsetof(struct ifreq, ifr_ifru), + "Linux ifreq members names should be equal to FreeeBSD"); +_Static_assert(offsetof(struct l_ifreq, ifr_index) == + offsetof(struct ifreq, ifr_index), + "Linux ifreq members names should be equal to FreeeBSD"); +_Static_assert(offsetof(struct l_ifreq, ifr_name) == + offsetof(struct ifreq, ifr_name), + "Linux ifreq members names should be equal to FreeeBSD"); + #define SECURITY_CONTEXT_STRING "unconfined" static int linux_sendmsg_common(struct thread *, l_int, struct l_msghdr *, diff --git a/sys/compat/linux/linux_socket.h b/sys/compat/linux/linux_socket.h index 9b332a7a9b86..ab9ab2100a96 100644 --- a/sys/compat/linux/linux_socket.h +++ b/sys/compat/linux/linux_socket.h @@ -336,11 +336,13 @@ struct l_ifmap { /* 3 bytes spare */ }; +/* + * Careful changing the declaration of this structure. + * To use FreeBSD names to access the struct l_ifreq members the + * member names of struct l_ifreq should be equal to the FreeBSD. + */ struct l_ifreq { - union { - char ifrn_name[LINUX_IFNAMSIZ]; - } ifr_ifrn; - + char ifr_name[LINUX_IFNAMSIZ]; union { struct l_sockaddr ifru_addr; struct l_sockaddr ifru_dstaddr; @@ -348,7 +350,7 @@ struct l_ifreq { struct l_sockaddr ifru_netmask; struct l_sockaddr ifru_hwaddr; l_short ifru_flags[1]; - l_int ifru_ivalue; + l_int ifru_index; l_int ifru_mtu; struct l_ifmap ifru_map; char ifru_slave[LINUX_IFNAMSIZ]; @@ -357,8 +359,9 @@ struct l_ifreq { } ifr_ifru; }; -#define ifr_name ifr_ifrn.ifrn_name /* Interface name */ +/* + * Define here members which are not exists in the FreeBSD struct ifreq. + */ #define ifr_hwaddr ifr_ifru.ifru_hwaddr /* MAC address */ -#define ifr_ifindex ifr_ifru.ifru_ivalue /* Interface index */ #endif /* _LINUX_SOCKET_H_ */