diff options
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/dccp.h | 8 | ||||
-rw-r--r-- | net/dccp/ipv4.c | 12 | ||||
-rw-r--r-- | net/dccp/ipv6.c | 16 | ||||
-rw-r--r-- | net/dccp/proto.c | 67 |
4 files changed, 91 insertions, 12 deletions
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h index 34e70fb89d4a..47de17208d7a 100644 --- a/net/dccp/dccp.h +++ b/net/dccp/dccp.h | |||
@@ -192,6 +192,14 @@ extern int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
192 | char __user *optval, int __user *optlen); | 192 | char __user *optval, int __user *optlen); |
193 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, | 193 | extern int dccp_setsockopt(struct sock *sk, int level, int optname, |
194 | char __user *optval, int optlen); | 194 | char __user *optval, int optlen); |
195 | #ifdef CONFIG_COMPAT | ||
196 | extern int compat_dccp_getsockopt(struct sock *sk, | ||
197 | int level, int optname, | ||
198 | char __user *optval, int __user *optlen); | ||
199 | extern int compat_dccp_setsockopt(struct sock *sk, | ||
200 | int level, int optname, | ||
201 | char __user *optval, int optlen); | ||
202 | #endif | ||
195 | extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 203 | extern int dccp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
196 | extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, | 204 | extern int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, |
197 | struct msghdr *msg, size_t size); | 205 | struct msghdr *msg, size_t size); |
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 80d450ba6219..8a33c8498d9c 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -994,6 +994,10 @@ static struct inet_connection_sock_af_ops dccp_ipv4_af_ops = { | |||
994 | .net_header_len = sizeof(struct iphdr), | 994 | .net_header_len = sizeof(struct iphdr), |
995 | .setsockopt = ip_setsockopt, | 995 | .setsockopt = ip_setsockopt, |
996 | .getsockopt = ip_getsockopt, | 996 | .getsockopt = ip_getsockopt, |
997 | #ifdef CONFIG_COMPAT | ||
998 | .compat_setsockopt = compat_ip_setsockopt, | ||
999 | .compat_getsockopt = compat_ip_getsockopt, | ||
1000 | #endif | ||
997 | .addr2sockaddr = inet_csk_addr2sockaddr, | 1001 | .addr2sockaddr = inet_csk_addr2sockaddr, |
998 | .sockaddr_len = sizeof(struct sockaddr_in), | 1002 | .sockaddr_len = sizeof(struct sockaddr_in), |
999 | }; | 1003 | }; |
@@ -1040,6 +1044,10 @@ static struct proto dccp_v4_prot = { | |||
1040 | .init = dccp_v4_init_sock, | 1044 | .init = dccp_v4_init_sock, |
1041 | .setsockopt = dccp_setsockopt, | 1045 | .setsockopt = dccp_setsockopt, |
1042 | .getsockopt = dccp_getsockopt, | 1046 | .getsockopt = dccp_getsockopt, |
1047 | #ifdef CONFIG_COMPAT | ||
1048 | .compat_setsockopt = compat_dccp_setsockopt, | ||
1049 | .compat_getsockopt = compat_dccp_getsockopt, | ||
1050 | #endif | ||
1043 | .sendmsg = dccp_sendmsg, | 1051 | .sendmsg = dccp_sendmsg, |
1044 | .recvmsg = dccp_recvmsg, | 1052 | .recvmsg = dccp_recvmsg, |
1045 | .backlog_rcv = dccp_v4_do_rcv, | 1053 | .backlog_rcv = dccp_v4_do_rcv, |
@@ -1079,6 +1087,10 @@ static const struct proto_ops inet_dccp_ops = { | |||
1079 | .shutdown = inet_shutdown, | 1087 | .shutdown = inet_shutdown, |
1080 | .setsockopt = sock_common_setsockopt, | 1088 | .setsockopt = sock_common_setsockopt, |
1081 | .getsockopt = sock_common_getsockopt, | 1089 | .getsockopt = sock_common_getsockopt, |
1090 | #ifdef CONFIG_COMPAT | ||
1091 | .compat_setsockopt = compat_sock_common_setsockopt, | ||
1092 | .compat_getsockopt = compat_sock_common_getsockopt, | ||
1093 | #endif | ||
1082 | .sendmsg = inet_sendmsg, | 1094 | .sendmsg = inet_sendmsg, |
1083 | .recvmsg = sock_common_recvmsg, | 1095 | .recvmsg = sock_common_recvmsg, |
1084 | .mmap = sock_no_mmap, | 1096 | .mmap = sock_no_mmap, |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 7c8233f6d3c2..89106c7d3247 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -1114,6 +1114,10 @@ static struct inet_connection_sock_af_ops dccp_ipv6_af_ops = { | |||
1114 | .net_header_len = sizeof(struct ipv6hdr), | 1114 | .net_header_len = sizeof(struct ipv6hdr), |
1115 | .setsockopt = ipv6_setsockopt, | 1115 | .setsockopt = ipv6_setsockopt, |
1116 | .getsockopt = ipv6_getsockopt, | 1116 | .getsockopt = ipv6_getsockopt, |
1117 | #ifdef CONFIG_COMPAT | ||
1118 | .compat_setsockopt = compat_ipv6_setsockopt, | ||
1119 | .compat_getsockopt = compat_ipv6_getsockopt, | ||
1120 | #endif | ||
1117 | .addr2sockaddr = inet6_csk_addr2sockaddr, | 1121 | .addr2sockaddr = inet6_csk_addr2sockaddr, |
1118 | .sockaddr_len = sizeof(struct sockaddr_in6) | 1122 | .sockaddr_len = sizeof(struct sockaddr_in6) |
1119 | }; | 1123 | }; |
@@ -1130,6 +1134,10 @@ static struct inet_connection_sock_af_ops dccp_ipv6_mapped = { | |||
1130 | .net_header_len = sizeof(struct iphdr), | 1134 | .net_header_len = sizeof(struct iphdr), |
1131 | .setsockopt = ipv6_setsockopt, | 1135 | .setsockopt = ipv6_setsockopt, |
1132 | .getsockopt = ipv6_getsockopt, | 1136 | .getsockopt = ipv6_getsockopt, |
1137 | #ifdef CONFIG_COMPAT | ||
1138 | .compat_setsockopt = compat_ipv6_setsockopt, | ||
1139 | .compat_getsockopt = compat_ipv6_getsockopt, | ||
1140 | #endif | ||
1133 | .addr2sockaddr = inet6_csk_addr2sockaddr, | 1141 | .addr2sockaddr = inet6_csk_addr2sockaddr, |
1134 | .sockaddr_len = sizeof(struct sockaddr_in6) | 1142 | .sockaddr_len = sizeof(struct sockaddr_in6) |
1135 | }; | 1143 | }; |
@@ -1167,6 +1175,10 @@ static struct proto dccp_v6_prot = { | |||
1167 | .init = dccp_v6_init_sock, | 1175 | .init = dccp_v6_init_sock, |
1168 | .setsockopt = dccp_setsockopt, | 1176 | .setsockopt = dccp_setsockopt, |
1169 | .getsockopt = dccp_getsockopt, | 1177 | .getsockopt = dccp_getsockopt, |
1178 | #ifdef CONFIG_COMPAT | ||
1179 | .compat_setsockopt = compat_dccp_setsockopt, | ||
1180 | .compat_getsockopt = compat_dccp_getsockopt, | ||
1181 | #endif | ||
1170 | .sendmsg = dccp_sendmsg, | 1182 | .sendmsg = dccp_sendmsg, |
1171 | .recvmsg = dccp_recvmsg, | 1183 | .recvmsg = dccp_recvmsg, |
1172 | .backlog_rcv = dccp_v6_do_rcv, | 1184 | .backlog_rcv = dccp_v6_do_rcv, |
@@ -1204,6 +1216,10 @@ static struct proto_ops inet6_dccp_ops = { | |||
1204 | .shutdown = inet_shutdown, | 1216 | .shutdown = inet_shutdown, |
1205 | .setsockopt = sock_common_setsockopt, | 1217 | .setsockopt = sock_common_setsockopt, |
1206 | .getsockopt = sock_common_getsockopt, | 1218 | .getsockopt = sock_common_getsockopt, |
1219 | #ifdef CONFIG_COMPAT | ||
1220 | .compat_setsockopt = compat_sock_common_setsockopt, | ||
1221 | .compat_getsockopt = compat_sock_common_getsockopt, | ||
1222 | #endif | ||
1207 | .sendmsg = inet_sendmsg, | 1223 | .sendmsg = inet_sendmsg, |
1208 | .recvmsg = sock_common_recvmsg, | 1224 | .recvmsg = sock_common_recvmsg, |
1209 | .mmap = sock_no_mmap, | 1225 | .mmap = sock_no_mmap, |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index baccaf35ffbd..59b214995f28 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -455,18 +455,13 @@ out_free_val: | |||
455 | goto out; | 455 | goto out; |
456 | } | 456 | } |
457 | 457 | ||
458 | int dccp_setsockopt(struct sock *sk, int level, int optname, | 458 | static int do_dccp_setsockopt(struct sock *sk, int level, int optname, |
459 | char __user *optval, int optlen) | 459 | char __user *optval, int optlen) |
460 | { | 460 | { |
461 | struct dccp_sock *dp; | 461 | struct dccp_sock *dp; |
462 | int err; | 462 | int err; |
463 | int val; | 463 | int val; |
464 | 464 | ||
465 | if (level != SOL_DCCP) | ||
466 | return inet_csk(sk)->icsk_af_ops->setsockopt(sk, level, | ||
467 | optname, optval, | ||
468 | optlen); | ||
469 | |||
470 | if (optlen < sizeof(int)) | 465 | if (optlen < sizeof(int)) |
471 | return -EINVAL; | 466 | return -EINVAL; |
472 | 467 | ||
@@ -512,8 +507,34 @@ int dccp_setsockopt(struct sock *sk, int level, int optname, | |||
512 | return err; | 507 | return err; |
513 | } | 508 | } |
514 | 509 | ||
510 | int dccp_setsockopt(struct sock *sk, int level, int optname, | ||
511 | char __user *optval, int optlen) | ||
512 | { | ||
513 | if (level != SOL_DCCP) | ||
514 | return inet_csk(sk)->icsk_af_ops->setsockopt(sk, level, | ||
515 | optname, optval, | ||
516 | optlen); | ||
517 | return do_dccp_setsockopt(sk, level, optname, optval, optlen); | ||
518 | } | ||
515 | EXPORT_SYMBOL_GPL(dccp_setsockopt); | 519 | EXPORT_SYMBOL_GPL(dccp_setsockopt); |
516 | 520 | ||
521 | #ifdef CONFIG_COMPAT | ||
522 | int compat_dccp_setsockopt(struct sock *sk, int level, int optname, | ||
523 | char __user *optval, int optlen) | ||
524 | { | ||
525 | if (level != SOL_DCCP) { | ||
526 | if (inet_csk(sk)->icsk_af_ops->compat_setsockopt) | ||
527 | return inet_csk(sk)->icsk_af_ops->compat_setsockopt(sk, | ||
528 | level, optname, optval, optlen); | ||
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); | ||
534 | } | ||
535 | EXPORT_SYMBOL_GPL(compat_dccp_setsockopt); | ||
536 | #endif | ||
537 | |||
517 | static int dccp_getsockopt_service(struct sock *sk, int len, | 538 | static int dccp_getsockopt_service(struct sock *sk, int len, |
518 | __be32 __user *optval, | 539 | __be32 __user *optval, |
519 | int __user *optlen) | 540 | int __user *optlen) |
@@ -545,16 +566,12 @@ out: | |||
545 | return err; | 566 | return err; |
546 | } | 567 | } |
547 | 568 | ||
548 | int dccp_getsockopt(struct sock *sk, int level, int optname, | 569 | static int do_dccp_getsockopt(struct sock *sk, int level, int optname, |
549 | char __user *optval, int __user *optlen) | 570 | char __user *optval, int __user *optlen) |
550 | { | 571 | { |
551 | struct dccp_sock *dp; | 572 | struct dccp_sock *dp; |
552 | int val, len; | 573 | int val, len; |
553 | 574 | ||
554 | if (level != SOL_DCCP) | ||
555 | return inet_csk(sk)->icsk_af_ops->getsockopt(sk, level, | ||
556 | optname, optval, | ||
557 | optlen); | ||
558 | if (get_user(len, optlen)) | 575 | if (get_user(len, optlen)) |
559 | return -EFAULT; | 576 | return -EFAULT; |
560 | 577 | ||
@@ -587,8 +604,34 @@ int dccp_getsockopt(struct sock *sk, int level, int optname, | |||
587 | return 0; | 604 | return 0; |
588 | } | 605 | } |
589 | 606 | ||
607 | int dccp_getsockopt(struct sock *sk, int level, int optname, | ||
608 | char __user *optval, int __user *optlen) | ||
609 | { | ||
610 | if (level != SOL_DCCP) | ||
611 | return inet_csk(sk)->icsk_af_ops->getsockopt(sk, level, | ||
612 | optname, optval, | ||
613 | optlen); | ||
614 | return do_dccp_getsockopt(sk, level, optname, optval, optlen); | ||
615 | } | ||
590 | EXPORT_SYMBOL_GPL(dccp_getsockopt); | 616 | EXPORT_SYMBOL_GPL(dccp_getsockopt); |
591 | 617 | ||
618 | #ifdef CONFIG_COMPAT | ||
619 | int compat_dccp_getsockopt(struct sock *sk, int level, int optname, | ||
620 | char __user *optval, int __user *optlen) | ||
621 | { | ||
622 | if (level != SOL_DCCP) { | ||
623 | if (inet_csk(sk)->icsk_af_ops->compat_setsockopt) | ||
624 | return inet_csk(sk)->icsk_af_ops->compat_getsockopt(sk, | ||
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); | ||
631 | } | ||
632 | EXPORT_SYMBOL_GPL(compat_dccp_getsockopt); | ||
633 | #endif | ||
634 | |||
592 | int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, | 635 | int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, |
593 | size_t len) | 636 | size_t len) |
594 | { | 637 | { |