svn commit: r294223 - stable/10/sys/netinet

Michael Tuexen tuexen at FreeBSD.org
Sun Jan 17 14:14:13 UTC 2016


Author: tuexen
Date: Sun Jan 17 14:14:12 2016
New Revision: 294223
URL: https://svnweb.freebsd.org/changeset/base/294223

Log:
  MFC r294057:
  Fix a bug in INIT handling on accepted 1-to-1 style sockets when the
  listener is closed.
  This fix allows the following packetdrill test to pass:
  // Setup a connected, blocking 1-to-1 style socket
  +0.0 socket(..., SOCK_STREAM, IPPROTO_SCTP) = 3
  // Check the handshake with en empty(!) cookie
  +0.0 bind(3, ..., ...) = 0
  +0.0 listen(3, 1) = 0
  +0.0 < sctp: INIT[flgs=0, tag=1, a_rwnd=1500, os=1, is=1, tsn=1]
  +0.0 > sctp: INIT_ACK[flgs=0, tag=2, a_rwnd=..., os=..., is=..., tsn=1, ...]
  +0.0 < sctp: COOKIE_ECHO[flgs=0, len=..., val=...]
  +0.0 > sctp: COOKIE_ACK[flgs=0]
  +0.0 accept(3, ..., ...) = 4
  +0.0 close(3) = 0
  // Inject an INIT chunk and expect an INIT-ACK
  +0.0 < sctp: INIT[flgs=0, tag=3, a_rwnd=1500, os=1, is=1, tsn=1]
  +0.0 > sctp: INIT_ACK[flgs=0, tag=..., a_rwnd=..., os=..., is=..., tsn=..., ...]

Modified:
  stable/10/sys/netinet/sctp_pcb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/netinet/sctp_pcb.c
==============================================================================
--- stable/10/sys/netinet/sctp_pcb.c	Sun Jan 17 14:10:37 2016	(r294222)
+++ stable/10/sys/netinet/sctp_pcb.c	Sun Jan 17 14:14:12 2016	(r294223)
@@ -2269,8 +2269,12 @@ sctp_findassociation_addr(struct mbuf *m
 		}
 	}
 	find_tcp_pool = 0;
-	if ((ch->chunk_type != SCTP_INITIATION) &&
-	    (ch->chunk_type != SCTP_INITIATION_ACK) &&
+	/*
+	 * Don't consider INIT chunks since that breaks 1-to-1 sockets: When
+	 * a server closes the listener, incoming INIT chunks are not
+	 * responsed by an INIT-ACK chunk.
+	 */
+	if ((ch->chunk_type != SCTP_INITIATION_ACK) &&
 	    (ch->chunk_type != SCTP_COOKIE_ACK) &&
 	    (ch->chunk_type != SCTP_COOKIE_ECHO)) {
 		/* Other chunk types go to the tcp pool. */


More information about the svn-src-all mailing list