1 /* SPDX-License-Identifier: GPL-2.0 */ 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef NET_COMPAT_H 2 #ifndef NET_COMPAT_H 3 #define NET_COMPAT_H 3 #define NET_COMPAT_H 4 4 5 5 6 struct sock; 6 struct sock; 7 7 8 #include <linux/compat.h> 8 #include <linux/compat.h> 9 9 10 struct compat_msghdr { 10 struct compat_msghdr { 11 compat_uptr_t msg_name; /* voi 11 compat_uptr_t msg_name; /* void * */ 12 compat_int_t msg_namelen; 12 compat_int_t msg_namelen; 13 compat_uptr_t msg_iov; /* str 13 compat_uptr_t msg_iov; /* struct compat_iovec * */ 14 compat_size_t msg_iovlen; 14 compat_size_t msg_iovlen; 15 compat_uptr_t msg_control; /* voi 15 compat_uptr_t msg_control; /* void * */ 16 compat_size_t msg_controllen; 16 compat_size_t msg_controllen; 17 compat_uint_t msg_flags; 17 compat_uint_t msg_flags; 18 }; 18 }; 19 19 20 struct compat_mmsghdr { 20 struct compat_mmsghdr { 21 struct compat_msghdr msg_hdr; 21 struct compat_msghdr msg_hdr; 22 compat_uint_t msg_len; 22 compat_uint_t msg_len; 23 }; 23 }; 24 24 25 struct compat_cmsghdr { 25 struct compat_cmsghdr { 26 compat_size_t cmsg_len; 26 compat_size_t cmsg_len; 27 compat_int_t cmsg_level; 27 compat_int_t cmsg_level; 28 compat_int_t cmsg_type; 28 compat_int_t cmsg_type; 29 }; 29 }; 30 30 31 struct compat_rtentry { 31 struct compat_rtentry { 32 u32 rt_pad1; 32 u32 rt_pad1; 33 struct sockaddr rt_dst; /* tar 33 struct sockaddr rt_dst; /* target address */ 34 struct sockaddr rt_gateway; /* gat 34 struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */ 35 struct sockaddr rt_genmask; /* tar 35 struct sockaddr rt_genmask; /* target network mask (IP) */ 36 unsigned short rt_flags; 36 unsigned short rt_flags; 37 short rt_pad2; 37 short rt_pad2; 38 u32 rt_pad3; 38 u32 rt_pad3; 39 unsigned char rt_tos; 39 unsigned char rt_tos; 40 unsigned char rt_class; 40 unsigned char rt_class; 41 short rt_pad4; 41 short rt_pad4; 42 short rt_metric; /* +1 42 short rt_metric; /* +1 for binary compatibility! */ 43 compat_uptr_t rt_dev; /* for 43 compat_uptr_t rt_dev; /* forcing the device at add */ 44 u32 rt_mtu; /* per 44 u32 rt_mtu; /* per route MTU/Window */ 45 u32 rt_window; /* Win 45 u32 rt_window; /* Window clamping */ 46 unsigned short rt_irtt; /* Ini 46 unsigned short rt_irtt; /* Initial RTT */ 47 }; 47 }; 48 48 49 int __get_compat_msghdr(struct msghdr *kmsg, s 49 int __get_compat_msghdr(struct msghdr *kmsg, struct compat_msghdr *msg, 50 struct sockaddr __user 50 struct sockaddr __user **save_addr); 51 int get_compat_msghdr(struct msghdr *, struct 51 int get_compat_msghdr(struct msghdr *, struct compat_msghdr __user *, 52 struct sockaddr __user * 52 struct sockaddr __user **, struct iovec **); 53 int put_cmsg_compat(struct msghdr*, int, int, 53 int put_cmsg_compat(struct msghdr*, int, int, int, void *); 54 54 55 int cmsghdr_from_user_compat_to_kern(struct ms 55 int cmsghdr_from_user_compat_to_kern(struct msghdr *, struct sock *, 56 unsigned 56 unsigned char *, int); 57 57 58 struct compat_group_req { 58 struct compat_group_req { 59 __u32 gr_in 59 __u32 gr_interface; 60 struct __kernel_sockaddr_storage gr_gr 60 struct __kernel_sockaddr_storage gr_group 61 __aligned(4); 61 __aligned(4); 62 } __packed; 62 } __packed; 63 63 64 struct compat_group_source_req { 64 struct compat_group_source_req { 65 __u32 gsr_i 65 __u32 gsr_interface; 66 struct __kernel_sockaddr_storage gsr_g 66 struct __kernel_sockaddr_storage gsr_group 67 __aligned(4); 67 __aligned(4); 68 struct __kernel_sockaddr_storage gsr_s 68 struct __kernel_sockaddr_storage gsr_source 69 __aligned(4); 69 __aligned(4); 70 } __packed; 70 } __packed; 71 71 72 struct compat_group_filter { 72 struct compat_group_filter { 73 union { 73 union { 74 struct { 74 struct { 75 __u32 75 __u32 gf_interface_aux; 76 struct __kernel_sockad 76 struct __kernel_sockaddr_storage gf_group_aux 77 __aligned(4); 77 __aligned(4); 78 __u32 78 __u32 gf_fmode_aux; 79 __u32 79 __u32 gf_numsrc_aux; 80 struct __kernel_sockad 80 struct __kernel_sockaddr_storage gf_slist[1] 81 __aligned(4); 81 __aligned(4); 82 } __packed; 82 } __packed; 83 struct { 83 struct { 84 __u32 84 __u32 gf_interface; 85 struct __kernel_sockad 85 struct __kernel_sockaddr_storage gf_group 86 __aligned(4); 86 __aligned(4); 87 __u32 87 __u32 gf_fmode; 88 __u32 88 __u32 gf_numsrc; 89 struct __kernel_sockad 89 struct __kernel_sockaddr_storage gf_slist_flex[] 90 __aligned(4); 90 __aligned(4); 91 } __packed; 91 } __packed; 92 }; 92 }; 93 } __packed; 93 } __packed; 94 94 95 #endif /* NET_COMPAT_H */ 95 #endif /* NET_COMPAT_H */ 96 96
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.