unsigned short family,
unsigned short type,
unsigned char protocol);
+
+extern int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
+ char __user *optval, int __user *optlen);
+extern int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
+ char __user *optval, int optlen);
#endif /* _INET_CONNECTION_SOCK_H */
int compat_dccp_setsockopt(struct sock *sk, int level, int optname,
char __user *optval, int optlen)
{
- if (level != SOL_DCCP) {
- if (inet_csk(sk)->icsk_af_ops->compat_setsockopt)
- return inet_csk(sk)->icsk_af_ops->compat_setsockopt(sk,
- level, optname, optval, optlen);
- else
- return inet_csk(sk)->icsk_af_ops->setsockopt(sk,
- level, optname, optval, optlen);
- }
+ if (level != SOL_DCCP)
+ return inet_csk_compat_setsockopt(sk, level, optname,
+ optval, optlen);
+
return do_dccp_setsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL_GPL(compat_dccp_setsockopt);
int compat_dccp_getsockopt(struct sock *sk, int level, int optname,
char __user *optval, int __user *optlen)
{
- if (level != SOL_DCCP) {
- if (inet_csk(sk)->icsk_af_ops->compat_setsockopt)
- return inet_csk(sk)->icsk_af_ops->compat_getsockopt(sk,
- level, optname, optval, optlen);
- else
- return inet_csk(sk)->icsk_af_ops->getsockopt(sk,
- level, optname, optval, optlen);
- }
+ if (level != SOL_DCCP)
+ return inet_csk_compat_getsockopt(sk, level, optname,
+ optval, optlen);
return do_dccp_getsockopt(sk, level, optname, optval, optlen);
}
EXPORT_SYMBOL_GPL(compat_dccp_getsockopt);
}
EXPORT_SYMBOL_GPL(inet_csk_ctl_sock_create);
+
+#ifdef CONFIG_COMPAT
+int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname,
+ char __user *optval, int __user *optlen)
+{
+ const struct inet_csk *icsk = inet_csk(sk);
+
+ if (icsk->icsk_af_ops->compat_getsockopt != NULL)
+ return icsk->icsk_af_ops->compat_getsockopt(sk, level, optname,
+ optval, optlen);
+ return icsk->icsk_af_ops->getsockopt(sk, level, optname,
+ optval, optlen);
+}
+
+EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt);
+
+int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname,
+ char __user *optval, int optlen)
+{
+ const struct inet_csk *icsk = inet_csk(sk);
+
+ if (icsk->icsk_af_ops->compat_setsockopt != NULL)
+ return icsk->icsk_af_ops->compat_setsockopt(sk, level, optname,
+ optval, optlen);
+ return icsk->icsk_af_ops->setsockopt(sk, level, optname,
+ optval, optlen);
+}
+
+EXPORT_SYMBOL_GPL(inet_csk_compat_setsockopt);
+#endif
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
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