Skip to contentSkip to conversation

net: sctp: introduce uapi header for sctp

PATCH In review Daniel Borkmann 3 participants 3 messages Apr 9, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sctp: introduce uapi header for sctp

This patch introduces an UAPI header for the SCTP protocol, so that we can facilitate the maintenance and development of user land applications or libraries, in particular in terms of header synchronization.

To not break compatibility, some fragments from lksctp-tools' netinet/sctp.h have been carefully included, while taking care that neither kernel nor user land breaks, so both compile fine with this change (for lksctp-tools I tested with the old netinet/sctp.h header and with a newly adapted one that includes the uapi sctp header). lksctp-tools smoke test run through successfully as well in both cases.

---
 fs/dlm/lowcomms.c            |   2 +-
 include/linux/sctp.h         |   6 +-
 include/net/sctp/constants.h |   1 -
 include/net/sctp/user.h      | 782 ---------------------------------------
 include/uapi/linux/Kbuild    |   1 +
 include/uapi/linux/sctp.h    | 846 +++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 850 insertions(+), 788 deletions(-)
 delete mode 100644 include/net/sctp/user.h
 create mode 100644 include/uapi/linux/sctp.h
fs/dlm/lowcomms.c +1 -1
index 4f5ad24..d0ccd2f 100644
@@ -52,8 +52,8 @@
 #include <linux/mutex.h>
 #include <linux/sctp.h>
 #include <linux/slab.h>
+#include <linux/sctp.h>
 #include <net/sctp/sctp.h>
-#include <net/sctp/user.h>
 #include <net/ipv6.h>
 
 #include "dlm_internal.h"
include/linux/sctp.h +2 -4
index c11a287..3bfe8d6 100644
@@ -53,7 +53,9 @@
 
 #include <linux/in.h>		/* We need in_addr.  */
 #include <linux/in6.h>		/* We need in6_addr.  */
+#include <linux/skbuff.h>
 
+#include <uapi/linux/sctp.h>
 
 /* Section 3.1.  SCTP Common Header Format */
 typedef struct sctphdr {
@@ -63,14 +65,10 @@ typedef struct sctphdr {
 	__le32 checksum;
 } __packed sctp_sctphdr_t;
 
-#ifdef __KERNEL__
-#include <linux/skbuff.h>
-
 static inline struct sctphdr *sctp_hdr(const struct sk_buff *skb)
 {
 	return (struct sctphdr *)skb_transport_header(skb);
 }
-#endif
 
 /* Section 3.2.  Chunk Field Descriptions. */
 typedef struct sctp_chunkhdr {
include/net/sctp/constants.h +0 -1
index a7dd5c5..ca50e075 100644
@@ -49,7 +49,6 @@
 
 #include <linux/sctp.h>
 #include <linux/ipv6.h> /* For ipv6hdr. */
-#include <net/sctp/user.h>
 #include <net/tcp_states.h>  /* For TCP states used in sctp_sock_state_t */
 
 /* Value used for stream negotiation. */
include/net/sctp/user.h deleted +0 -782

782 lines not on this page · raw message

include/uapi/linux/Kbuild +1 -0
index 5c8a1d2..7df1905 100644
@@ -331,6 +331,7 @@ header-y += rtnetlink.h
 header-y += scc.h
 header-y += sched.h
 header-y += screen_info.h
+header-y += sctp.h
 header-y += sdla.h
 header-y += seccomp.h
 header-y += securebits.h
include/uapi/linux/sctp.h new file +846 -0

846 lines not on this page · raw message

Signature · 1 line
1.7.11.7
maintainer
#1 lore raw

From: Daniel Borkmann <[email protected]>
Date: Tue, 9 Apr 2013 17:54:01 +0200

Quoted 13 lines

This patch introduces an UAPI header for the SCTP protocol, so that we can facilitate the maintenance and development of user land applications or libraries, in particular in terms of header synchronization.

To not break compatibility, some fragments from lksctp-tools' netinet/sctp.h have been carefully included, while taking care that neither kernel nor user land breaks, so both compile fine with this change (for lksctp-tools I tested with the old netinet/sctp.h header and with a newly adapted one that includes the uapi sctp header). lksctp-tools smoke test run through successfully as well in both cases.

Quoted 4 lines

This looks great, applied, thanks Daniel.

Acked-by on v1 1/1
#2 lore raw
In reply to Daniel Borkmann
Quoted 13 lines · Daniel Borkmann

This patch introduces an UAPI header for the SCTP protocol, so that we can facilitate the maintenance and development of user land applications or libraries, in particular in terms of header synchronization.

To not break compatibility, some fragments from lksctp-tools' netinet/sctp.h have been carefully included, while taking care that neither kernel nor user land breaks, so both compile fine with this change (for lksctp-tools I tested with the old netinet/sctp.h header and with a newly adapted one that includes the uapi sctp header). lksctp-tools smoke test run through successfully as well in both cases.

Quoted 4 lines

Yup, Thanks Daniel. Davids already applied it, but FWIW