From: Geir Ola Vaagland <geirola@gmail.com> To: netdev@vger.kernel.org Cc: linux-sctp@vger.kernel.org, Vlad Yasevich <vyasevich@gmail.com> Subject: [PATCH net-next 1/6] Support for SCTP_RECVRCVINFO socket option Date: Tue, 17 Jun 2014 13:57:48 +0200 [thread overview] Message-ID: <1403006273-27859-2-git-send-email-geirola@gmail.com> (raw) In-Reply-To: <1403006273-27859-1-git-send-email-geirola@gmail.com> CC: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: Geir Ola Vaagland <geirola@gmail.com> --- include/net/sctp/structs.h | 1 + include/uapi/linux/sctp.h | 2 ++ net/sctp/socket.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0a248b3..75c598a 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -216,6 +216,7 @@ struct sctp_sock { __u8 frag_interleave; __u32 adaptation_ind; __u32 pd_point; + __u8 recvrcvinfo; atomic_t pd_mode; /* Receive to here while partial delivery is in effect. */ diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h index ca451e9..a7db3b3 100644 --- a/include/uapi/linux/sctp.h +++ b/include/uapi/linux/sctp.h @@ -97,6 +97,8 @@ typedef __s32 sctp_assoc_t; #define SCTP_AUTO_ASCONF 30 #define SCTP_PEER_ADDR_THLDS 31 +#define SCTP_RECVRCVINFO 32 + /* Internal Socket Options. Some of the sctp library functions are * implemented using these socket options. */ diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 146b35d..1f3281b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3566,6 +3566,24 @@ static int sctp_setsockopt_paddr_thresholds(struct sock *sk, return 0; } +static int sctp_setsockopt_recvrcvinfo(struct sock *sk, + char __user *optval, + unsigned int optlen){ + + int val; + + if(optlen < sizeof(int)) + return -EINVAL; + + if(get_user(val, (int __user*)optval)){ + return -EFAULT; + } + sctp_sk(sk)->recvrcvinfo = (val == 0) ? 0 : 1; + return 0; +} + + + /* API 6.2 setsockopt(), getsockopt() * * Applications use setsockopt() and getsockopt() to set or retrieve @@ -3717,6 +3735,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, case SCTP_PEER_ADDR_THLDS: retval = sctp_setsockopt_paddr_thresholds(sk, optval, optlen); break; + case SCTP_RECVRCVINFO: + retval = sctp_setsockopt_recvrcvinfo(sk, optval, optlen); + break; default: retval = -ENOPROTOOPT; break; @@ -3963,6 +3984,9 @@ static int sctp_init_sock(struct sock *sk) /* Enable Nagle algorithm by default. */ sp->nodelay = 0; + /* No SCTP_RECVRCVINFO by default. */ + sp->recvrcvinfo = 0; + /* Enable by default. */ sp->v4mapped = 1; @@ -5734,6 +5758,27 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len, return 0; } +static int sctp_getsockopt_recvrcvinfo(struct sock *sk, + int len, + char __user *optval, + int __user *optlen){ + + int val; + + if (len < sizeof(int)) + return -EINVAL; + + len = sizeof(int); + val = (sctp_sk(sk)->recvrcvinfo == 1); + if (put_user(len, optlen)) + return -EFAULT; + if (copy_to_user(optval, &val, len)) + return -EFAULT; + return 0; +} + + + static int sctp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { @@ -5877,6 +5922,9 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, case SCTP_GET_ASSOC_STATS: retval = sctp_getsockopt_assoc_stats(sk, len, optval, optlen); break; + case SCTP_RECVRCVINFO: + retval = sctp_getsockopt_recvrcvinfo(sk, len, optval, optlen); + break; default: retval = -ENOPROTOOPT; break;
WARNING: multiple messages have this Message-ID (diff)
From: Geir Ola Vaagland <geirola@gmail.com> To: netdev@vger.kernel.org Cc: linux-sctp@vger.kernel.org, Vlad Yasevich <vyasevich@gmail.com> Subject: [PATCH net-next 1/6] Support for SCTP_RECVRCVINFO socket option Date: Tue, 17 Jun 2014 11:57:48 +0000 [thread overview] Message-ID: <1403006273-27859-2-git-send-email-geirola@gmail.com> (raw) In-Reply-To: <1403006273-27859-1-git-send-email-geirola@gmail.com> CC: Vlad Yasevich <vyasevich@gmail.com> Signed-off-by: Geir Ola Vaagland <geirola@gmail.com> --- include/net/sctp/structs.h | 1 + include/uapi/linux/sctp.h | 2 ++ net/sctp/socket.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 0a248b3..75c598a 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -216,6 +216,7 @@ struct sctp_sock { __u8 frag_interleave; __u32 adaptation_ind; __u32 pd_point; + __u8 recvrcvinfo; atomic_t pd_mode; /* Receive to here while partial delivery is in effect. */ diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h index ca451e9..a7db3b3 100644 --- a/include/uapi/linux/sctp.h +++ b/include/uapi/linux/sctp.h @@ -97,6 +97,8 @@ typedef __s32 sctp_assoc_t; #define SCTP_AUTO_ASCONF 30 #define SCTP_PEER_ADDR_THLDS 31 +#define SCTP_RECVRCVINFO 32 + /* Internal Socket Options. Some of the sctp library functions are * implemented using these socket options. */ diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 146b35d..1f3281b 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c @@ -3566,6 +3566,24 @@ static int sctp_setsockopt_paddr_thresholds(struct sock *sk, return 0; } +static int sctp_setsockopt_recvrcvinfo(struct sock *sk, + char __user *optval, + unsigned int optlen){ + + int val; + + if(optlen < sizeof(int)) + return -EINVAL; + + if(get_user(val, (int __user*)optval)){ + return -EFAULT; + } + sctp_sk(sk)->recvrcvinfo = (val = 0) ? 0 : 1; + return 0; +} + + + /* API 6.2 setsockopt(), getsockopt() * * Applications use setsockopt() and getsockopt() to set or retrieve @@ -3717,6 +3735,9 @@ static int sctp_setsockopt(struct sock *sk, int level, int optname, case SCTP_PEER_ADDR_THLDS: retval = sctp_setsockopt_paddr_thresholds(sk, optval, optlen); break; + case SCTP_RECVRCVINFO: + retval = sctp_setsockopt_recvrcvinfo(sk, optval, optlen); + break; default: retval = -ENOPROTOOPT; break; @@ -3963,6 +3984,9 @@ static int sctp_init_sock(struct sock *sk) /* Enable Nagle algorithm by default. */ sp->nodelay = 0; + /* No SCTP_RECVRCVINFO by default. */ + sp->recvrcvinfo = 0; + /* Enable by default. */ sp->v4mapped = 1; @@ -5734,6 +5758,27 @@ static int sctp_getsockopt_assoc_stats(struct sock *sk, int len, return 0; } +static int sctp_getsockopt_recvrcvinfo(struct sock *sk, + int len, + char __user *optval, + int __user *optlen){ + + int val; + + if (len < sizeof(int)) + return -EINVAL; + + len = sizeof(int); + val = (sctp_sk(sk)->recvrcvinfo = 1); + if (put_user(len, optlen)) + return -EFAULT; + if (copy_to_user(optval, &val, len)) + return -EFAULT; + return 0; +} + + + static int sctp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { @@ -5877,6 +5922,9 @@ static int sctp_getsockopt(struct sock *sk, int level, int optname, case SCTP_GET_ASSOC_STATS: retval = sctp_getsockopt_assoc_stats(sk, len, optval, optlen); break; + case SCTP_RECVRCVINFO: + retval = sctp_getsockopt_recvrcvinfo(sk, len, optval, optlen); + break; default: retval = -ENOPROTOOPT; break;
next prev parent reply other threads:[~2014-06-17 11:58 UTC|newest] Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-06-17 11:57 [PATCH net-next 0/6] A step closer to RFC 6458 compliancy Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland [this message] 2014-06-17 11:57 ` [PATCH net-next 1/6] Support for SCTP_RECVRCVINFO socket option Geir Ola Vaagland 2014-06-17 12:35 ` David Laight 2014-06-17 12:35 ` David Laight 2014-06-17 13:57 ` Vlad Yasevich 2014-06-17 13:57 ` Vlad Yasevich 2014-06-17 11:57 ` [PATCH net-next 2/6] Support for SCTP_RCVINFO ancillary data Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 12:36 ` David Laight 2014-06-17 14:07 ` Vlad Yasevich 2014-06-17 14:07 ` Vlad Yasevich 2014-06-17 11:57 ` [PATCH net-next 3/6] Support for SCTP_SNDINFO " Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 12:38 ` David Laight 2014-06-17 14:29 ` Vlad Yasevich 2014-06-17 14:29 ` Vlad Yasevich 2014-06-17 14:42 ` David Laight 2014-06-17 11:57 ` [PATCH net-next 4/6] Support for SCTP_NXTINFO socket option Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 11:57 ` [PATCH net-next 5/6] Support for receiving SCTP_NXTINFO ancillary data Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 11:57 ` [PATCH net-next 6/6] Support for SCTP_DEFAULT_SNDINFO socket option Geir Ola Vaagland 2014-06-17 11:57 ` Geir Ola Vaagland 2014-06-17 12:32 ` [PATCH net-next 0/6] A step closer to RFC 6458 compliancy David Laight 2014-06-17 13:40 ` Vlad Yasevich 2014-06-17 13:40 ` Vlad Yasevich 2014-06-17 15:01 Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-17 15:01 ` [PATCH net-next 1/6] Support for SCTP_RECVRCVINFO socket option Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-18 23:30 ` David Miller 2014-06-18 23:30 ` David Miller 2014-06-17 15:01 ` [PATCH net-next 2/6] Support for SCTP_RCVINFO ancillary data Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-18 23:30 ` David Miller 2014-06-18 23:30 ` David Miller 2014-06-17 15:01 ` [PATCH net-next 3/6] Support for SCTP_SNDINFO " Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-17 15:01 ` [PATCH net-next 4/6] Support for SCTP_NXTINFO socket option Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-17 15:01 ` [PATCH net-next 5/6] Support for receiving SCTP_NXTINFO ancillary data Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-17 15:01 ` [PATCH net-next 6/6] Support for SCTP_DEFAULT_SNDINFO socket option Geir Ola Vaagland 2014-06-17 15:01 ` Geir Ola Vaagland 2014-06-18 23:33 ` David Miller 2014-06-18 23:33 ` David Miller 2014-06-17 15:14 ` [PATCH net-next 0/6] A step closer to RFC 6458 compliancy David Laight 2014-06-17 15:36 ` David Laight 2014-06-17 18:42 ` Vlad Yasevich 2014-06-17 18:42 ` Vlad Yasevich 2014-06-18 8:42 ` David Laight 2014-06-18 12:43 ` Michael Tuexen 2014-06-18 12:43 ` Michael Tuexen 2014-06-18 13:16 ` David Laight 2014-06-18 13:24 ` Michael Tuexen 2014-06-18 13:24 ` Michael Tuexen 2014-06-18 13:25 ` Vlad Yasevich 2014-06-18 13:25 ` Vlad Yasevich 2014-06-18 13:29 ` Michael Tuexen 2014-06-18 13:29 ` Michael Tuexen 2014-06-18 13:53 ` David Laight
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1403006273-27859-2-git-send-email-geirola@gmail.com \ --to=geirola@gmail.com \ --cc=linux-sctp@vger.kernel.org \ --cc=netdev@vger.kernel.org \ --cc=vyasevich@gmail.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.