Page MenuHomeFreeBSD

D38792.diff
No OneTemporary

D38792.diff

diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -2097,7 +2097,7 @@
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.h b/sys/compat/linux/linux_socket.h
--- a/sys/compat/linux/linux_socket.h
+++ b/sys/compat/linux/linux_socket.h
@@ -336,11 +336,13 @@
/* 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_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 @@
} 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_ */
diff --git a/sys/compat/linux/linux_socket.c b/sys/compat/linux/linux_socket.c
--- a/sys/compat/linux/linux_socket.c
+++ b/sys/compat/linux/linux_socket.c
@@ -72,6 +72,16 @@
#include <compat/linux/linux_time.h>
#include <compat/linux/linux_util.h>
+_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 *,

File Metadata

Mime Type
text/plain
Expires
Sat, Jan 31, 8:55 AM (11 h, 20 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28110931
Default Alt Text
D38792.diff (2 KB)

Event Timeline