diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2006-03-21 01:46:16 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:46:16 -0500 |
commit | dec73ff0293d59076d1fd8f4a264898ecfc457ec (patch) | |
tree | 251a87b4b98d073fcd3753e01eea5ea44aaf9570 /net | |
parent | d1d47beef8ecaeedc368f00780d02cfa5e540005 (diff) |
[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>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/proto.c | 23 | ||||
-rw-r--r-- | net/ipv4/inet_connection_sock.c | 30 | ||||
-rw-r--r-- | net/ipv4/tcp.c | 26 |
3 files changed, 43 insertions, 36 deletions
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 59b214995f28..6d7aef9647de 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -522,14 +522,10 @@ EXPORT_SYMBOL_GPL(dccp_setsockopt); | |||
522 | int compat_dccp_setsockopt(struct sock *sk, int level, int optname, | 522 | int compat_dccp_setsockopt(struct sock *sk, int level, int optname, |
523 | char __user *optval, int optlen) | 523 | char __user *optval, int optlen) |
524 | { | 524 | { |
525 | if (level != SOL_DCCP) { | 525 | if (level != SOL_DCCP) |
526 | if (inet_csk(sk)->icsk_af_ops->compat_setsockopt) | 526 | return inet_csk_compat_setsockopt(sk, level, optname, |
527 | return inet_csk(sk)->icsk_af_ops->compat_setsockopt(sk, | 527 | optval, optlen); |
528 | level, optname, optval, optlen); | 528 | |
529 | else | ||
530 | return inet_csk(sk)->icsk_af_ops->setsockopt(sk, | ||
531 | level, optname, optval, optlen); | ||
532 | } | ||
533 | return do_dccp_setsockopt(sk, level, optname, optval, optlen); | 529 | return do_dccp_setsockopt(sk, level, optname, optval, optlen); |
534 | } | 530 | } |
535 | EXPORT_SYMBOL_GPL(compat_dccp_setsockopt); | 531 | EXPORT_SYMBOL_GPL(compat_dccp_setsockopt); |
@@ -619,14 +615,9 @@ EXPORT_SYMBOL_GPL(dccp_getsockopt); | |||
619 | int compat_dccp_getsockopt(struct sock *sk, int level, int optname, | 615 | int compat_dccp_getsockopt(struct sock *sk, int level, int optname, |
620 | char __user *optval, int __user *optlen) | 616 | char __user *optval, int __user *optlen) |
621 | { | 617 | { |
622 | if (level != SOL_DCCP) { | 618 | if (level != SOL_DCCP) |
623 | if (inet_csk(sk)->icsk_af_ops->compat_setsockopt) | 619 | return inet_csk_compat_getsockopt(sk, level, optname, |
624 | return inet_csk(sk)->icsk_af_ops->compat_getsockopt(sk, | 620 | optval, optlen); |
625 | level, optname, optval, optlen); | ||
626 | else | ||
627 | return inet_csk(sk)->icsk_af_ops->getsockopt(sk, | ||
628 | level, optname, optval, optlen); | ||
629 | } | ||
630 | return do_dccp_getsockopt(sk, level, optname, optval, optlen); | 621 | return do_dccp_getsockopt(sk, level, optname, optval, optlen); |
631 | } | 622 | } |
632 | EXPORT_SYMBOL_GPL(compat_dccp_getsockopt); | 623 | EXPORT_SYMBOL_GPL(compat_dccp_getsockopt); |
diff --git a/net/ipv4/inet_connection_sock.c b/net/ipv4/inet_connection_sock.c index 359f48cec99a..9f6b44ca28a8 100644 --- a/net/ipv4/inet_connection_sock.c +++ b/net/ipv4/inet_connection_sock.c | |||
@@ -667,3 +667,33 @@ int inet_csk_ctl_sock_create(struct socket **sock, unsigned short family, | |||
667 | } | 667 | } |
668 | 668 | ||
669 | EXPORT_SYMBOL_GPL(inet_csk_ctl_sock_create); | 669 | EXPORT_SYMBOL_GPL(inet_csk_ctl_sock_create); |
670 | |||
671 | #ifdef CONFIG_COMPAT | ||
672 | int inet_csk_compat_getsockopt(struct sock *sk, int level, int optname, | ||
673 | char __user *optval, int __user *optlen) | ||
674 | { | ||
675 | const struct inet_csk *icsk = inet_csk(sk); | ||
676 | |||
677 | if (icsk->icsk_af_ops->compat_getsockopt != NULL) | ||
678 | return icsk->icsk_af_ops->compat_getsockopt(sk, level, optname, | ||
679 | optval, optlen); | ||
680 | return icsk->icsk_af_ops->getsockopt(sk, level, optname, | ||
681 | optval, optlen); | ||
682 | } | ||
683 | |||
684 | EXPORT_SYMBOL_GPL(inet_csk_compat_getsockopt); | ||
685 | |||
686 | int inet_csk_compat_setsockopt(struct sock *sk, int level, int optname, | ||
687 | char __user *optval, int optlen) | ||
688 | { | ||
689 | const struct inet_csk *icsk = inet_csk(sk); | ||
690 | |||
691 | if (icsk->icsk_af_ops->compat_setsockopt != NULL) | ||
692 | return icsk->icsk_af_ops->compat_setsockopt(sk, level, optname, | ||
693 | optval, optlen); | ||
694 | return icsk->icsk_af_ops->setsockopt(sk, level, optname, | ||
695 | optval, optlen); | ||
696 | } | ||
697 | |||
698 | EXPORT_SYMBOL_GPL(inet_csk_compat_setsockopt); | ||
699 | #endif | ||
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 31b0123a9699..89da253e33f0 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -1882,16 +1882,9 @@ int tcp_setsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
1882 | int compat_tcp_setsockopt(struct sock *sk, int level, | 1882 | int compat_tcp_setsockopt(struct sock *sk, int level, |
1883 | int optname, char __user *optval, int optlen) | 1883 | int optname, char __user *optval, int optlen) |
1884 | { | 1884 | { |
1885 | struct inet_connection_sock *icsk = inet_csk(sk); | 1885 | if (level != SOL_TCP) |
1886 | 1886 | return inet_csk_compat_setsockopt(sk, level, optname, | |
1887 | if (level != SOL_TCP) { | 1887 | optval, optlen); |
1888 | if (icsk->icsk_af_ops->compat_setsockopt) | ||
1889 | return icsk->icsk_af_ops->compat_setsockopt(sk, | ||
1890 | level, optname, optval, optlen); | ||
1891 | else | ||
1892 | return icsk->icsk_af_ops->setsockopt(sk, | ||
1893 | level, optname, optval, optlen); | ||
1894 | } | ||
1895 | return do_tcp_setsockopt(sk, level, optname, optval, optlen); | 1888 | return do_tcp_setsockopt(sk, level, optname, optval, optlen); |
1896 | } | 1889 | } |
1897 | #endif | 1890 | #endif |
@@ -2061,16 +2054,9 @@ int tcp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, | |||
2061 | int compat_tcp_getsockopt(struct sock *sk, int level, | 2054 | int compat_tcp_getsockopt(struct sock *sk, int level, |
2062 | int optname, char __user *optval, int __user *optlen) | 2055 | int optname, char __user *optval, int __user *optlen) |
2063 | { | 2056 | { |
2064 | struct inet_connection_sock *icsk = inet_csk(sk); | 2057 | if (level != SOL_TCP) |
2065 | 2058 | return inet_csk_compat_getsockopt(sk, level, optname, | |
2066 | if (level != SOL_TCP) { | 2059 | optval, optlen); |
2067 | if (icsk->icsk_af_ops->compat_getsockopt) | ||
2068 | return icsk->icsk_af_ops->compat_getsockopt(sk, | ||
2069 | level, optname, optval, optlen); | ||
2070 | else | ||
2071 | return icsk->icsk_af_ops->getsockopt(sk, | ||
2072 | level, optname, optval, optlen); | ||
2073 | } | ||
2074 | return do_tcp_getsockopt(sk, level, optname, optval, optlen); | 2060 | return do_tcp_getsockopt(sk, level, optname, optval, optlen); |
2075 | } | 2061 | } |
2076 | #endif | 2062 | #endif |