diff options
author | Geir Ola Vaagland <geirola@gmail.com> | 2014-07-12 14:30:37 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-07-16 17:40:03 -0400 |
commit | 0d3a421d284812d07970b4ccee74d4fa38737e4d (patch) | |
tree | c9d97227606c9682671e8d9e7d2ebfc727416c31 /include/net/sctp | |
parent | 63b949382c5f263746b1c177f6ff84de2201ae9d (diff) |
net: sctp: implement rfc6458, 5.3.5. SCTP_RCVINFO cmsg support
This patch implements section 5.3.5. of RFC6458, that is, support
for 'SCTP Receive Information Structure' (SCTP_RCVINFO) which is
placed into ancillary data cmsghdr structure for each recvmsg()
call.
This option can be enabled/disabled via setsockopt(2) on SOL_SCTP
level by setting an int value with 1/0 for SCTP_RECVRCVINFO in user
space applications as per RFC6458, section 8.1.29.
The sctp_rcvinfo structure is defined as per RFC as below ...
struct sctp_rcvinfo {
uint16_t rcv_sid;
uint16_t rcv_ssn;
uint16_t rcv_flags;
<-- 2 bytes hole -->
uint32_t rcv_ppid;
uint32_t rcv_tsn;
uint32_t rcv_cumtsn;
uint32_t rcv_context;
sctp_assoc_t rcv_assoc_id;
};
... and provided under cmsg_level IPPROTO_SCTP, cmsg_type
SCTP_RCVINFO, while cmsg_data[] contains struct sctp_rcvinfo.
An sctp_rcvinfo item always corresponds to the data in msg_iov.
Joint work with Daniel Borkmann.
Signed-off-by: Geir Ola Vaagland <geirola@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sctp')
-rw-r--r-- | include/net/sctp/structs.h | 3 | ||||
-rw-r--r-- | include/net/sctp/ulpevent.h | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 7af9a0f5d8ce..11d5df015370 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -207,7 +207,9 @@ struct sctp_sock { | |||
207 | struct sctp_paddrparams paddrparam; | 207 | struct sctp_paddrparams paddrparam; |
208 | struct sctp_event_subscribe subscribe; | 208 | struct sctp_event_subscribe subscribe; |
209 | struct sctp_assocparams assocparams; | 209 | struct sctp_assocparams assocparams; |
210 | |||
210 | int user_frag; | 211 | int user_frag; |
212 | |||
211 | __u32 autoclose; | 213 | __u32 autoclose; |
212 | __u8 nodelay; | 214 | __u8 nodelay; |
213 | __u8 disable_fragments; | 215 | __u8 disable_fragments; |
@@ -215,6 +217,7 @@ struct sctp_sock { | |||
215 | __u8 frag_interleave; | 217 | __u8 frag_interleave; |
216 | __u32 adaptation_ind; | 218 | __u32 adaptation_ind; |
217 | __u32 pd_point; | 219 | __u32 pd_point; |
220 | __u8 recvrcvinfo; | ||
218 | 221 | ||
219 | atomic_t pd_mode; | 222 | atomic_t pd_mode; |
220 | /* Receive to here while partial delivery is in effect. */ | 223 | /* Receive to here while partial delivery is in effect. */ |
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h index daacb32b55b5..e8095f973e94 100644 --- a/include/net/sctp/ulpevent.h +++ b/include/net/sctp/ulpevent.h | |||
@@ -129,7 +129,10 @@ struct sctp_ulpevent *sctp_ulpevent_make_sender_dry_event( | |||
129 | const struct sctp_association *asoc, gfp_t gfp); | 129 | const struct sctp_association *asoc, gfp_t gfp); |
130 | 130 | ||
131 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, | 131 | void sctp_ulpevent_read_sndrcvinfo(const struct sctp_ulpevent *event, |
132 | struct msghdr *); | 132 | struct msghdr *); |
133 | void sctp_ulpevent_read_rcvinfo(const struct sctp_ulpevent *event, | ||
134 | struct msghdr *); | ||
135 | |||
133 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); | 136 | __u16 sctp_ulpevent_get_notification_type(const struct sctp_ulpevent *event); |
134 | 137 | ||
135 | /* Is this event type enabled? */ | 138 | /* Is this event type enabled? */ |