diff options
author | Dmitry Mishin <dim@openvz.org> | 2006-03-21 01:45:21 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:45:21 -0500 |
commit | 3fdadf7d27e3fbcf72930941884387d1f4936f04 (patch) | |
tree | 167072cf1e60b6b307610563614b435ff0caa52d /include | |
parent | c750360938b403e6cc193d293cfbcb099dd6c60e (diff) |
[NET]: {get|set}sockopt compatibility layer
This patch extends {get|set}sockopt compatibility layer in order to
move protocol specific parts to their place and avoid huge universal
net/compat.c file in the future.
Signed-off-by: Dmitry Mishin <dim@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/net.h | 4 | ||||
-rw-r--r-- | include/linux/netfilter.h | 9 | ||||
-rw-r--r-- | include/net/inet_connection_sock.h | 6 | ||||
-rw-r--r-- | include/net/ip.h | 4 | ||||
-rw-r--r-- | include/net/ipv6.h | 10 | ||||
-rw-r--r-- | include/net/sctp/structs.h | 10 | ||||
-rw-r--r-- | include/net/sock.h | 12 | ||||
-rw-r--r-- | include/net/tcp.h | 6 |
8 files changed, 61 insertions, 0 deletions
diff --git a/include/linux/net.h b/include/linux/net.h index 28195a2d8ff0..152fa6551fd8 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -149,6 +149,10 @@ struct proto_ops { | |||
149 | int optname, char __user *optval, int optlen); | 149 | int optname, char __user *optval, int optlen); |
150 | int (*getsockopt)(struct socket *sock, int level, | 150 | int (*getsockopt)(struct socket *sock, int level, |
151 | int optname, char __user *optval, int __user *optlen); | 151 | int optname, char __user *optval, int __user *optlen); |
152 | int (*compat_setsockopt)(struct socket *sock, int level, | ||
153 | int optname, char __user *optval, int optlen); | ||
154 | int (*compat_getsockopt)(struct socket *sock, int level, | ||
155 | int optname, char __user *optval, int __user *optlen); | ||
152 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, | 156 | int (*sendmsg) (struct kiocb *iocb, struct socket *sock, |
153 | struct msghdr *m, size_t total_len); | 157 | struct msghdr *m, size_t total_len); |
154 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, | 158 | int (*recvmsg) (struct kiocb *iocb, struct socket *sock, |
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 468896939843..412e52ca9720 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h | |||
@@ -80,10 +80,14 @@ struct nf_sockopt_ops | |||
80 | int set_optmin; | 80 | int set_optmin; |
81 | int set_optmax; | 81 | int set_optmax; |
82 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); | 82 | int (*set)(struct sock *sk, int optval, void __user *user, unsigned int len); |
83 | int (*compat_set)(struct sock *sk, int optval, | ||
84 | void __user *user, unsigned int len); | ||
83 | 85 | ||
84 | int get_optmin; | 86 | int get_optmin; |
85 | int get_optmax; | 87 | int get_optmax; |
86 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); | 88 | int (*get)(struct sock *sk, int optval, void __user *user, int *len); |
89 | int (*compat_get)(struct sock *sk, int optval, | ||
90 | void __user *user, int *len); | ||
87 | 91 | ||
88 | /* Number of users inside set() or get(). */ | 92 | /* Number of users inside set() or get(). */ |
89 | unsigned int use; | 93 | unsigned int use; |
@@ -246,6 +250,11 @@ int nf_setsockopt(struct sock *sk, int pf, int optval, char __user *opt, | |||
246 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, | 250 | int nf_getsockopt(struct sock *sk, int pf, int optval, char __user *opt, |
247 | int *len); | 251 | int *len); |
248 | 252 | ||
253 | int compat_nf_setsockopt(struct sock *sk, int pf, int optval, | ||
254 | char __user *opt, int len); | ||
255 | int compat_nf_getsockopt(struct sock *sk, int pf, int optval, | ||
256 | char __user *opt, int *len); | ||
257 | |||
249 | /* Packet queuing */ | 258 | /* Packet queuing */ |
250 | struct nf_queue_handler { | 259 | struct nf_queue_handler { |
251 | int (*outfn)(struct sk_buff *skb, struct nf_info *info, | 260 | int (*outfn)(struct sk_buff *skb, struct nf_info *info, |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 363a067403ee..ae61331366f0 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -50,6 +50,12 @@ struct inet_connection_sock_af_ops { | |||
50 | char __user *optval, int optlen); | 50 | char __user *optval, int optlen); |
51 | int (*getsockopt)(struct sock *sk, int level, int optname, | 51 | int (*getsockopt)(struct sock *sk, int level, int optname, |
52 | char __user *optval, int __user *optlen); | 52 | char __user *optval, int __user *optlen); |
53 | int (*compat_setsockopt)(struct sock *sk, | ||
54 | int level, int optname, | ||
55 | char __user *optval, int optlen); | ||
56 | int (*compat_getsockopt)(struct sock *sk, | ||
57 | int level, int optname, | ||
58 | char __user *optval, int __user *optlen); | ||
53 | void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); | 59 | void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); |
54 | int sockaddr_len; | 60 | int sockaddr_len; |
55 | }; | 61 | }; |
diff --git a/include/net/ip.h b/include/net/ip.h index fab3d5b3ab1c..8fe6156ca9b0 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -356,6 +356,10 @@ extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb); | |||
356 | extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); | 356 | extern int ip_cmsg_send(struct msghdr *msg, struct ipcm_cookie *ipc); |
357 | extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); | 357 | extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, int optlen); |
358 | extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); | 358 | extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen); |
359 | extern int compat_ip_setsockopt(struct sock *sk, int level, | ||
360 | int optname, char __user *optval, int optlen); | ||
361 | extern int compat_ip_getsockopt(struct sock *sk, int level, | ||
362 | int optname, char __user *optval, int __user *optlen); | ||
359 | extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); | 363 | extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *)); |
360 | 364 | ||
361 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); | 365 | extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len); |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index c893a1ce4b39..6d6f0634ae41 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -520,6 +520,16 @@ extern int ipv6_getsockopt(struct sock *sk, int level, | |||
520 | int optname, | 520 | int optname, |
521 | char __user *optval, | 521 | char __user *optval, |
522 | int __user *optlen); | 522 | int __user *optlen); |
523 | extern int compat_ipv6_setsockopt(struct sock *sk, | ||
524 | int level, | ||
525 | int optname, | ||
526 | char __user *optval, | ||
527 | int optlen); | ||
528 | extern int compat_ipv6_getsockopt(struct sock *sk, | ||
529 | int level, | ||
530 | int optname, | ||
531 | char __user *optval, | ||
532 | int __user *optlen); | ||
523 | 533 | ||
524 | extern void ipv6_packet_init(void); | 534 | extern void ipv6_packet_init(void); |
525 | 535 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 072f407848a6..eba99f375517 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -514,6 +514,16 @@ struct sctp_af { | |||
514 | int optname, | 514 | int optname, |
515 | char __user *optval, | 515 | char __user *optval, |
516 | int __user *optlen); | 516 | int __user *optlen); |
517 | int (*compat_setsockopt) (struct sock *sk, | ||
518 | int level, | ||
519 | int optname, | ||
520 | char __user *optval, | ||
521 | int optlen); | ||
522 | int (*compat_getsockopt) (struct sock *sk, | ||
523 | int level, | ||
524 | int optname, | ||
525 | char __user *optval, | ||
526 | int __user *optlen); | ||
517 | struct dst_entry *(*get_dst) (struct sctp_association *asoc, | 527 | struct dst_entry *(*get_dst) (struct sctp_association *asoc, |
518 | union sctp_addr *daddr, | 528 | union sctp_addr *daddr, |
519 | union sctp_addr *saddr); | 529 | union sctp_addr *saddr); |
diff --git a/include/net/sock.h b/include/net/sock.h index f63d0d56712c..ec226f31dc2a 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -520,6 +520,14 @@ struct proto { | |||
520 | int (*getsockopt)(struct sock *sk, int level, | 520 | int (*getsockopt)(struct sock *sk, int level, |
521 | int optname, char __user *optval, | 521 | int optname, char __user *optval, |
522 | int __user *option); | 522 | int __user *option); |
523 | int (*compat_setsockopt)(struct sock *sk, | ||
524 | int level, | ||
525 | int optname, char __user *optval, | ||
526 | int optlen); | ||
527 | int (*compat_getsockopt)(struct sock *sk, | ||
528 | int level, | ||
529 | int optname, char __user *optval, | ||
530 | int __user *option); | ||
523 | int (*sendmsg)(struct kiocb *iocb, struct sock *sk, | 531 | int (*sendmsg)(struct kiocb *iocb, struct sock *sk, |
524 | struct msghdr *msg, size_t len); | 532 | struct msghdr *msg, size_t len); |
525 | int (*recvmsg)(struct kiocb *iocb, struct sock *sk, | 533 | int (*recvmsg)(struct kiocb *iocb, struct sock *sk, |
@@ -816,6 +824,10 @@ extern int sock_common_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
816 | struct msghdr *msg, size_t size, int flags); | 824 | struct msghdr *msg, size_t size, int flags); |
817 | extern int sock_common_setsockopt(struct socket *sock, int level, int optname, | 825 | extern int sock_common_setsockopt(struct socket *sock, int level, int optname, |
818 | char __user *optval, int optlen); | 826 | char __user *optval, int optlen); |
827 | extern int compat_sock_common_getsockopt(struct socket *sock, int level, | ||
828 | int optname, char __user *optval, int __user *optlen); | ||
829 | extern int compat_sock_common_setsockopt(struct socket *sock, int level, | ||
830 | int optname, char __user *optval, int optlen); | ||
819 | 831 | ||
820 | extern void sk_common_release(struct sock *sk); | 832 | extern void sk_common_release(struct sock *sk); |
821 | 833 | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index 457e224de468..9418f4d1afbb 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -353,6 +353,12 @@ extern int tcp_getsockopt(struct sock *sk, int level, | |||
353 | extern int tcp_setsockopt(struct sock *sk, int level, | 353 | extern int tcp_setsockopt(struct sock *sk, int level, |
354 | int optname, char __user *optval, | 354 | int optname, char __user *optval, |
355 | int optlen); | 355 | int optlen); |
356 | extern int compat_tcp_getsockopt(struct sock *sk, | ||
357 | int level, int optname, | ||
358 | char __user *optval, int __user *optlen); | ||
359 | extern int compat_tcp_setsockopt(struct sock *sk, | ||
360 | int level, int optname, | ||
361 | char __user *optval, int optlen); | ||
356 | extern void tcp_set_keepalive(struct sock *sk, int val); | 362 | extern void tcp_set_keepalive(struct sock *sk, int val); |
357 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, | 363 | extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk, |
358 | struct msghdr *msg, | 364 | struct msghdr *msg, |