net: sctp: implement rfc6458, 5.3.4. SCTP_SNDINFO cmsg support
Subsystems (2)
PATCH v2 2/6 net: sctp: implement rfc6458, 5.3.4. SCTP_SNDINFO cmsg support
From: Geir Ola Vaagland <[email protected]>
This patch implements section 5.3.4. of RFC6458, that is, support for 'SCTP Send Information Structure' (SCTP_SNDINFO) which can be placed into ancillary data cmsghdr structure for sendmsg() calls.
The sctp_sndinfo structure is defined as per RFC as below ...
struct sctp_sndinfo {
uint16_t snd_sid;
uint16_t snd_flags;
uint32_t snd_ppid;
uint32_t snd_context;
sctp_assoc_t snd_assoc_id;
};... and supplied under cmsg_level IPPROTO_SCTP, cmsg_type SCTP_SNDINFO, while cmsg_data[] contains struct sctp_sndinfo. An sctp_sndinfo item always corresponds to the data in msg_iov.
Joint work with Daniel Borkmann.
Signed-off-by Geir Ola Vaagland <[email protected]>
Signed-off-by Daniel Borkmann <[email protected]>
--- include/net/sctp/structs.h | 3 +- include/uapi/linux/sctp.h | 22 +++++++++++-- net/sctp/socket.c | 77 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 79 insertions(+), 23 deletions(-)
include/net/sctp/structs.h +2 -1
@@ -1919,7 +1919,8 @@ struct sctp_chunk *sctp_get_ecne_prepend(struct sctp_association *asoc);/* A convenience structure to parse out SCTP specific CMSGs. */ typedef struct sctp_cmsgs {struct sctp_initmsg *init; -struct sctp_sndrcvinfo *info; +struct sctp_sndrcvinfo *srinfo; +struct sctp_sndinfo *sinfo; }sctp_cmsgs_t ;/* Structure for tracking memory objects */
include/uapi/linux/sctp.h +20 -2
@@ -154,6 +154,22 @@ struct sctp_sndrcvinfo {sctp_assoc_t sinfo_assoc_id; }; +/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO) +* +* This cmsghdr structure specifies SCTP options for sendmsg(). +* +* cmsg_level cmsg_type cmsg_data[] +* ------------ ------------ ------------------- +* IPPROTO_SCTP SCTP_SNDINFO struct sctp_sndinfo +*/ +struct sctp_sndinfo { +__u16 snd_sid; +__u16 snd_flags; +__u32 snd_ppid; +__u32 snd_context; +sctp_assoc_t snd_assoc_id; +}; +/* * sinfo_flags: 16 bits (unsigned integer) *
@@ -177,10 +193,12 @@ typedef union {/* These are cmsg_types. */ typedef enum sctp_cmsg_type { -SCTP_INIT ,/* 5.2.1 SCTP Initiation Structure */ +SCTP_INIT ,/* 5.2.1 SCTP Initiation Structure */ #define SCTP_INIT SCTP_INIT - SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ + SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */#define SCTP_SNDRCV SCTP_SNDRCV + SCTP_SNDINFO, /* 5.3.4 SCTP Send Information Structure */ +#define SCTP_SNDINFO SCTP_SNDINFO }sctp_cmsg_t ;/*
net/sctp/socket.c +57 -17
145 lines not on this page · raw message
Signature · 1 line
1.7.11.7