[ICSK] compat: Introduce inet_csk_compat_[gs]etsockopt
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 31b0123..89da253 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -1882,16 +1882,9 @@
int compat_tcp_setsockopt(struct sock *sk, int level,
int optname, char __user *optval, int optlen)
{
- struct inet_connection_sock *icsk = inet_csk(sk);
-
- if (level != SOL_TCP) {
- if (icsk->icsk_af_ops->compat_setsockopt)
- return icsk->icsk_af_ops->compat_setsockopt(sk,
- level, optname, optval, optlen);
- else
- return icsk->icsk_af_ops->setsockopt(sk,
- level, optname, optval, optlen);
- }
+ if (level != SOL_TCP)
+ return inet_csk_compat_setsockopt(sk, level, optname,
+ optval, optlen);
return do_tcp_setsockopt(sk, level, optname, optval, optlen);
}
#endif
@@ -2061,16 +2054,9 @@
int compat_tcp_getsockopt(struct sock *sk, int level,
int optname, char __user *optval, int __user *optlen)
{
- struct inet_connection_sock *icsk = inet_csk(sk);
-
- if (level != SOL_TCP) {
- if (icsk->icsk_af_ops->compat_getsockopt)
- return icsk->icsk_af_ops->compat_getsockopt(sk,
- level, optname, optval, optlen);
- else
- return icsk->icsk_af_ops->getsockopt(sk,
- level, optname, optval, optlen);
- }
+ if (level != SOL_TCP)
+ return inet_csk_compat_getsockopt(sk, level, optname,
+ optval, optlen);
return do_tcp_getsockopt(sk, level, optname, optval, optlen);
}
#endif