Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Nov 2010 22:16:38 +0000 (UTC)
From:      Michael Tuexen <tuexen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r215410 - head/sys/netinet
Message-ID:  <201011162216.oAGMGcUv069022@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tuexen
Date: Tue Nov 16 22:16:38 2010
New Revision: 215410
URL: http://svn.freebsd.org/changeset/base/215410

Log:
  Add an SCTP socket option to retrieve the number of timeouts
  of an association.
  
  MFC after: 3 days.

Modified:
  head/sys/netinet/sctp.h
  head/sys/netinet/sctp_uio.h
  head/sys/netinet/sctp_usrreq.c

Modified: head/sys/netinet/sctp.h
==============================================================================
--- head/sys/netinet/sctp.h	Tue Nov 16 20:39:52 2010	(r215409)
+++ head/sys/netinet/sctp.h	Tue Nov 16 22:16:38 2010	(r215410)
@@ -123,6 +123,7 @@ struct sctp_paramhdr {
 #define SCTP_LOCAL_AUTH_CHUNKS 		0x00000103
 #define SCTP_GET_ASSOC_NUMBER           0x00000104	/* ro */
 #define SCTP_GET_ASSOC_ID_LIST          0x00000105	/* ro */
+#define SCTP_TIMEOUTS                   0x00000106
 
 /*
  * user socket options: BSD implementation specific

Modified: head/sys/netinet/sctp_uio.h
==============================================================================
--- head/sys/netinet/sctp_uio.h	Tue Nov 16 20:39:52 2010	(r215409)
+++ head/sys/netinet/sctp_uio.h	Tue Nov 16 22:16:38 2010	(r215410)
@@ -563,6 +563,17 @@ struct sctp_sack_info {
 	uint32_t sack_freq;
 };
 
+struct sctp_timeouts {
+	sctp_assoc_t stimo_assoc_id;
+	uint32_t stimo_init;
+	uint32_t stimo_data;
+	uint32_t stimo_sack;
+	uint32_t stimo_shutdown;
+	uint32_t stimo_heartbeat;
+	uint32_t stimo_cookie;
+	uint32_t stimo_shutdownack;
+};
+
 struct sctp_cwnd_args {
 	struct sctp_nets *net;	/* network to *//* FIXME: LP64 issue */
 	uint32_t cwnd_new_value;/* cwnd in k */

Modified: head/sys/netinet/sctp_usrreq.c
==============================================================================
--- head/sys/netinet/sctp_usrreq.c	Tue Nov 16 20:39:52 2010	(r215409)
+++ head/sys/netinet/sctp_usrreq.c	Tue Nov 16 22:16:38 2010	(r215410)
@@ -2441,6 +2441,29 @@ flags_out:
 			*optsize = sizeof(*srto);
 		}
 		break;
+	case SCTP_TIMEOUTS:
+		{
+			struct sctp_timeouts *stimo;
+
+			SCTP_CHECK_AND_CAST(stimo, optval, struct sctp_timeouts, *optsize);
+			SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
+
+			if (stcb) {
+				stimo->stimo_init = stcb->asoc.timoinit;
+				stimo->stimo_data = stcb->asoc.timodata;
+				stimo->stimo_sack = stcb->asoc.timosack;
+				stimo->stimo_shutdown = stcb->asoc.timoshutdown;
+				stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
+				stimo->stimo_cookie = stcb->asoc.timocookie;
+				stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
+				SCTP_TCB_UNLOCK(stcb);
+			} else {
+				SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
+				error = EINVAL;
+			}
+			*optsize = sizeof(*stimo);
+		}
+		break;
 	case SCTP_ASSOCINFO:
 		{
 			struct sctp_assocparams *sasoc;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011162216.oAGMGcUv069022>