Skip to content

Commit 63287de

Browse files
author
Al Viro
committed
lift compat definitions of mcast [sg]etsockopt requests into net/compat.h
We want to get rid of compat_mc_[sg]etsockopt() and to have that stuff handled without compat_alloc_user_space(), extra copying through userland, etc. To do that we'll need ipv4 and ipv6 instances of ->compat_[sg]etsockopt() to manipulate the 32bit variants of mcast requests, so we need to move the definitions of those out of net/compat.c and into a public header. This patch just does a mechanical move to include/net/compat.h Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent f78cdbd commit 63287de

2 files changed

Lines changed: 24 additions & 25 deletions

File tree

‎include/net/compat.h‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,28 @@ int compat_mc_getsockopt(struct sock *, int, int, char __user *, int __user *,
7474
int (*)(struct sock *, int, int, char __user *,
7575
int __user *));
7676

77+
struct compat_group_req {
78+
__u32 gr_interface;
79+
struct __kernel_sockaddr_storage gr_group
80+
__aligned(4);
81+
} __packed;
82+
83+
struct compat_group_source_req {
84+
__u32 gsr_interface;
85+
struct __kernel_sockaddr_storage gsr_group
86+
__aligned(4);
87+
struct __kernel_sockaddr_storage gsr_source
88+
__aligned(4);
89+
} __packed;
90+
91+
struct compat_group_filter {
92+
__u32 gf_interface;
93+
struct __kernel_sockaddr_storage gf_group
94+
__aligned(4);
95+
__u32 gf_fmode;
96+
__u32 gf_numsrc;
97+
struct __kernel_sockaddr_storage gf_slist[1]
98+
__aligned(4);
99+
} __packed;
100+
77101
#endif /* NET_COMPAT_H */

‎net/compat.c‎

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -448,34 +448,9 @@ COMPAT_SYSCALL_DEFINE5(getsockopt, int, fd, int, level, int, optname,
448448
return __compat_sys_getsockopt(fd, level, optname, optval, optlen);
449449
}
450450

451-
struct compat_group_req {
452-
__u32 gr_interface;
453-
struct __kernel_sockaddr_storage gr_group
454-
__aligned(4);
455-
} __packed;
456-
457-
struct compat_group_source_req {
458-
__u32 gsr_interface;
459-
struct __kernel_sockaddr_storage gsr_group
460-
__aligned(4);
461-
struct __kernel_sockaddr_storage gsr_source
462-
__aligned(4);
463-
} __packed;
464-
465-
struct compat_group_filter {
466-
__u32 gf_interface;
467-
struct __kernel_sockaddr_storage gf_group
468-
__aligned(4);
469-
__u32 gf_fmode;
470-
__u32 gf_numsrc;
471-
struct __kernel_sockaddr_storage gf_slist[1]
472-
__aligned(4);
473-
} __packed;
474-
475451
#define __COMPAT_GF0_SIZE (sizeof(struct compat_group_filter) - \
476452
sizeof(struct __kernel_sockaddr_storage))
477453

478-
479454
int compat_mc_setsockopt(struct sock *sock, int level, int optname,
480455
char __user *optval, unsigned int optlen,
481456
int (*setsockopt)(struct sock *, int, int, char __user *, unsigned int))

0 commit comments

Comments
 (0)