diff options
Diffstat (limited to 'net/ipv6/udp.c')
-rw-r--r-- | net/ipv6/udp.c | 52 |
1 files changed, 44 insertions, 8 deletions
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index c47648892c04..538ada00646a 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -880,16 +880,13 @@ static int udpv6_destroy_sock(struct sock *sk) | |||
880 | /* | 880 | /* |
881 | * Socket option code for UDP | 881 | * Socket option code for UDP |
882 | */ | 882 | */ |
883 | static int udpv6_setsockopt(struct sock *sk, int level, int optname, | 883 | static int do_udpv6_setsockopt(struct sock *sk, int level, int optname, |
884 | char __user *optval, int optlen) | 884 | char __user *optval, int optlen) |
885 | { | 885 | { |
886 | struct udp_sock *up = udp_sk(sk); | 886 | struct udp_sock *up = udp_sk(sk); |
887 | int val; | 887 | int val; |
888 | int err = 0; | 888 | int err = 0; |
889 | 889 | ||
890 | if (level != SOL_UDP) | ||
891 | return ipv6_setsockopt(sk, level, optname, optval, optlen); | ||
892 | |||
893 | if(optlen<sizeof(int)) | 890 | if(optlen<sizeof(int)) |
894 | return -EINVAL; | 891 | return -EINVAL; |
895 | 892 | ||
@@ -927,15 +924,31 @@ static int udpv6_setsockopt(struct sock *sk, int level, int optname, | |||
927 | return err; | 924 | return err; |
928 | } | 925 | } |
929 | 926 | ||
930 | static int udpv6_getsockopt(struct sock *sk, int level, int optname, | 927 | static int udpv6_setsockopt(struct sock *sk, int level, int optname, |
928 | char __user *optval, int optlen) | ||
929 | { | ||
930 | if (level != SOL_UDP) | ||
931 | return ipv6_setsockopt(sk, level, optname, optval, optlen); | ||
932 | return do_udpv6_setsockopt(sk, level, optname, optval, optlen); | ||
933 | } | ||
934 | |||
935 | #ifdef CONFIG_COMPAT | ||
936 | static int compat_udpv6_setsockopt(struct sock *sk, int level, int optname, | ||
937 | char __user *optval, int optlen) | ||
938 | { | ||
939 | if (level != SOL_UDP) | ||
940 | return compat_ipv6_setsockopt(sk, level, | ||
941 | optname, optval, optlen); | ||
942 | return do_udpv6_setsockopt(sk, level, optname, optval, optlen); | ||
943 | } | ||
944 | #endif | ||
945 | |||
946 | static int do_udpv6_getsockopt(struct sock *sk, int level, int optname, | ||
931 | char __user *optval, int __user *optlen) | 947 | char __user *optval, int __user *optlen) |
932 | { | 948 | { |
933 | struct udp_sock *up = udp_sk(sk); | 949 | struct udp_sock *up = udp_sk(sk); |
934 | int val, len; | 950 | int val, len; |
935 | 951 | ||
936 | if (level != SOL_UDP) | ||
937 | return ipv6_getsockopt(sk, level, optname, optval, optlen); | ||
938 | |||
939 | if(get_user(len,optlen)) | 952 | if(get_user(len,optlen)) |
940 | return -EFAULT; | 953 | return -EFAULT; |
941 | 954 | ||
@@ -964,6 +977,25 @@ static int udpv6_getsockopt(struct sock *sk, int level, int optname, | |||
964 | return 0; | 977 | return 0; |
965 | } | 978 | } |
966 | 979 | ||
980 | static int udpv6_getsockopt(struct sock *sk, int level, int optname, | ||
981 | char __user *optval, int __user *optlen) | ||
982 | { | ||
983 | if (level != SOL_UDP) | ||
984 | return ipv6_getsockopt(sk, level, optname, optval, optlen); | ||
985 | return do_udpv6_getsockopt(sk, level, optname, optval, optlen); | ||
986 | } | ||
987 | |||
988 | #ifdef CONFIG_COMPAT | ||
989 | static int compat_udpv6_getsockopt(struct sock *sk, int level, int optname, | ||
990 | char __user *optval, int __user *optlen) | ||
991 | { | ||
992 | if (level != SOL_UDP) | ||
993 | return compat_ipv6_getsockopt(sk, level, | ||
994 | optname, optval, optlen); | ||
995 | return do_udpv6_getsockopt(sk, level, optname, optval, optlen); | ||
996 | } | ||
997 | #endif | ||
998 | |||
967 | static struct inet6_protocol udpv6_protocol = { | 999 | static struct inet6_protocol udpv6_protocol = { |
968 | .handler = udpv6_rcv, | 1000 | .handler = udpv6_rcv, |
969 | .err_handler = udpv6_err, | 1001 | .err_handler = udpv6_err, |
@@ -1046,6 +1078,10 @@ struct proto udpv6_prot = { | |||
1046 | .destroy = udpv6_destroy_sock, | 1078 | .destroy = udpv6_destroy_sock, |
1047 | .setsockopt = udpv6_setsockopt, | 1079 | .setsockopt = udpv6_setsockopt, |
1048 | .getsockopt = udpv6_getsockopt, | 1080 | .getsockopt = udpv6_getsockopt, |
1081 | #ifdef CONFIG_COMPAT | ||
1082 | .compat_setsockopt = compat_udpv6_setsockopt, | ||
1083 | .compat_getsockopt = compat_udpv6_getsockopt, | ||
1084 | #endif | ||
1049 | .sendmsg = udpv6_sendmsg, | 1085 | .sendmsg = udpv6_sendmsg, |
1050 | .recvmsg = udpv6_recvmsg, | 1086 | .recvmsg = udpv6_recvmsg, |
1051 | .backlog_rcv = udpv6_queue_rcv_skb, | 1087 | .backlog_rcv = udpv6_queue_rcv_skb, |