aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/proto.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/dccp/proto.c')
-rw-r--r--net/dccp/proto.c67
1 files changed, 55 insertions, 12 deletions
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
458int dccp_setsockopt(struct sock *sk, int level, int optname, 458static 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
510int 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}
515EXPORT_SYMBOL_GPL(dccp_setsockopt); 519EXPORT_SYMBOL_GPL(dccp_setsockopt);
516 520
521#ifdef CONFIG_COMPAT
522int 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}
535EXPORT_SYMBOL_GPL(compat_dccp_setsockopt);
536#endif
537
517static int dccp_getsockopt_service(struct sock *sk, int len, 538static 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
548int dccp_getsockopt(struct sock *sk, int level, int optname, 569static 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
607int 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}
590EXPORT_SYMBOL_GPL(dccp_getsockopt); 616EXPORT_SYMBOL_GPL(dccp_getsockopt);
591 617
618#ifdef CONFIG_COMPAT
619int 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}
632EXPORT_SYMBOL_GPL(compat_dccp_getsockopt);
633#endif
634
592int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, 635int dccp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
593 size_t len) 636 size_t len)
594{ 637{