Commit 92da362c authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'sctp-rfc7829'

Xin Long says:

====================
sctp: update from rfc7829

SCTP-PF was implemented based on a Internet-Draft in 2012:

  https://tools.ietf.org/html/draft-nishida-tsvwg-sctp-failover-05



It's been updated quite a few by rfc7829 in 2016.

This patchset adds the following features:

  1. add SCTP_ADDR_POTENTIALLY_FAILED notification
  2. add pf_expose per netns/sock/asoc
  3. add SCTP_EXPOSE_POTENTIALLY_FAILED_STATE sockopt
  4. add ps_retrans per netns/sock/asoc/transport
     (Primary Path Switchover)
  5. add spt_pathcpthld for SCTP_PEER_ADDR_THLDS sockopt

v1->v2:
  - See Patch 2/5 and Patch 5/5.
v2->v3:
  - See Patch 1/5, 2/5 and 3/5.
v3->v4:
  - See Patch 1/5, 2/5, 3/5 and 4/5.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a0c76345 d467ac0a
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -2091,6 +2091,28 @@ pf_enable - INTEGER

	Default: 1

pf_expose - INTEGER
	Unset or enable/disable pf (pf is short for potentially failed) state
	exposure.  Applications can control the exposure of the PF path state
	in the SCTP_PEER_ADDR_CHANGE event and the SCTP_GET_PEER_ADDR_INFO
	sockopt.   When it's unset, no SCTP_PEER_ADDR_CHANGE event with
	SCTP_ADDR_PF state will be sent and a SCTP_PF-state transport info
	can be got via SCTP_GET_PEER_ADDR_INFO sockopt;  When it's enabled,
	a SCTP_PEER_ADDR_CHANGE event will be sent for a transport becoming
	SCTP_PF state and a SCTP_PF-state transport info can be got via
	SCTP_GET_PEER_ADDR_INFO sockopt;  When it's diabled, no
	SCTP_PEER_ADDR_CHANGE event will be sent and it returns -EACCES when
	trying to get a SCTP_PF-state transport info via SCTP_GET_PEER_ADDR_INFO
	sockopt.

	0: Unset pf state exposure, Compatible with old applications.

	1: Disable pf state exposure.

	2: Enable pf state exposure.

	Default: 0

addip_noauth_enable - BOOLEAN
	Dynamic Address Reconfiguration (ADD-IP) requires the use of
	authentication to protect the operations of adding or removing new
@@ -2173,6 +2195,18 @@ pf_retrans - INTEGER

	Default: 0

ps_retrans - INTEGER
	Primary.Switchover.Max.Retrans (PSMR), it's a tunable parameter coming
	from section-5 "Primary Path Switchover" in rfc7829.  The primary path
	will be changed to another active path when the path error counter on
	the old primary path exceeds PSMR, so that "the SCTP sender is allowed
	to continue data transmission on a new working path even when the old
	primary destination address becomes active again".   Note this feature
	is disabled by initializing 'ps_retrans' per netns as 0xffff by default,
	and its value can't be less than 'pf_retrans' when changing by sysctl.

	Default: 0xffff

rto_initial - INTEGER
	The initial round trip timeout value in milliseconds that will be used
	in calculating round trip times.  This is the initial time interval
+14 −0
Original line number Diff line number Diff line
@@ -89,6 +89,12 @@ struct netns_sctp {
	 */
	int pf_retrans;

	/* Primary.Switchover.Max.Retrans sysctl value
	 * taken from:
	 * https://tools.ietf.org/html/rfc7829
	 */
	int ps_retrans;

	/*
	 * Disable Potentially-Failed feature, the feature is enabled by default
	 * pf_enable	-  0  : disable pf
@@ -96,6 +102,14 @@ struct netns_sctp {
	 */
	int pf_enable;

	/*
	 * Disable Potentially-Failed state exposure, ignored by default
	 * pf_expose	-  0  : compatible with old applications (by default)
	 *		-  1  : disable pf state exposure
	 *		-  2  : enable  pf state exposure
	 */
	int pf_expose;

	/*
	 * Policy for preforming sctp/socket accounting
	 * 0   - do socket level accounting, all assocs share sk_sndbuf
+12 −0
Original line number Diff line number Diff line
@@ -286,6 +286,18 @@ enum { SCTP_MAX_GABS = 16 };
				 * functions simpler to write.
				 */

/* These are the values for pf exposure, UNUSED is to keep compatible with old
 * applications by default.
 */
enum {
	SCTP_PF_EXPOSE_UNSET,
	SCTP_PF_EXPOSE_DISABLE,
	SCTP_PF_EXPOSE_ENABLE,
};
#define SCTP_PF_EXPOSE_MAX	SCTP_PF_EXPOSE_ENABLE

#define SCTP_PS_RETRANS_MAX	0xffff

/* These return values describe the success or failure of a number of
 * routines which form the lower interface to SCTP_outqueue.
 */
+10 −3
Original line number Diff line number Diff line
@@ -184,7 +184,8 @@ struct sctp_sock {
	__u32 flowlabel;
	__u8  dscp;

	int pf_retrans;
	__u16 pf_retrans;
	__u16 ps_retrans;

	/* The initial Path MTU to use for new associations. */
	__u32 pathmtu;
@@ -215,6 +216,7 @@ struct sctp_sock {
	__u32 adaptation_ind;
	__u32 pd_point;
	__u16	nodelay:1,
		pf_expose:2,
		reuse:1,
		disable_fragments:1,
		v4mapped:1,
@@ -896,7 +898,9 @@ struct sctp_transport {
	 * and will be initialized from the assocs value.  This can be changed
	 * using the SCTP_PEER_ADDR_THLDS socket option
	 */
	int pf_retrans;
	__u16 pf_retrans;
	/* Used for primary path switchover. */
	__u16 ps_retrans;
	/* PMTU	      : The current known path MTU.  */
	__u32 pathmtu;

@@ -1772,7 +1776,9 @@ struct sctp_association {
	 * and will be initialized from the assocs value.  This can be
	 * changed using the SCTP_PEER_ADDR_THLDS socket option
	 */
	int pf_retrans;
	__u16 pf_retrans;
	/* Used for primary path switchover. */
	__u16 ps_retrans;

	/* Maximum number of times the endpoint will retransmit INIT  */
	__u16 max_init_attempts;
@@ -2053,6 +2059,7 @@ struct sctp_association {

	__u8 need_ecne:1,	/* Need to send an ECNE Chunk? */
	     temp:1,		/* Is it a temporary association? */
	     pf_expose:2,       /* Expose pf state? */
	     force_delay:1;

	__u8 strreset_enable;
+15 −0
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ typedef __s32 sctp_assoc_t;
#define SCTP_DEFAULT_SNDINFO	34
#define SCTP_AUTH_DEACTIVATE_KEY	35
#define SCTP_REUSE_PORT		36
#define SCTP_PEER_ADDR_THLDS_V2	37

/* Internal Socket Options. Some of the sctp library functions are
 * implemented using these socket options.
@@ -137,6 +138,8 @@ typedef __s32 sctp_assoc_t;
#define SCTP_ASCONF_SUPPORTED	128
#define SCTP_AUTH_SUPPORTED	129
#define SCTP_ECN_SUPPORTED	130
#define SCTP_EXPOSE_POTENTIALLY_FAILED_STATE	131
#define SCTP_EXPOSE_PF_STATE	SCTP_EXPOSE_POTENTIALLY_FAILED_STATE

/* PR-SCTP policies */
#define SCTP_PR_SCTP_NONE	0x0000
@@ -410,6 +413,8 @@ enum sctp_spc_state {
	SCTP_ADDR_ADDED,
	SCTP_ADDR_MADE_PRIM,
	SCTP_ADDR_CONFIRMED,
	SCTP_ADDR_POTENTIALLY_FAILED,
#define SCTP_ADDR_PF	SCTP_ADDR_POTENTIALLY_FAILED
};


@@ -933,6 +938,7 @@ struct sctp_paddrinfo {
enum sctp_spinfo_state {
	SCTP_INACTIVE,
	SCTP_PF,
#define	SCTP_POTENTIALLY_FAILED		SCTP_PF
	SCTP_ACTIVE,
	SCTP_UNCONFIRMED,
	SCTP_UNKNOWN = 0xffff  /* Value used for transport state unknown */
@@ -1082,6 +1088,15 @@ struct sctp_paddrthlds {
	__u16 spt_pathpfthld;
};

/* Use a new structure with spt_pathcpthld for back compatibility */
struct sctp_paddrthlds_v2 {
	sctp_assoc_t spt_assoc_id;
	struct sockaddr_storage spt_address;
	__u16 spt_pathmaxrxt;
	__u16 spt_pathpfthld;
	__u16 spt_pathcpthld;
};

/*
 * Socket Option for Getting the Association/Stream-Specific PR-SCTP Status
 */
Loading