From owner-svn-src-all@freebsd.org Sat Jan 23 22:51:23 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBF13A8E081; Sat, 23 Jan 2016 22:51:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0539198F; Sat, 23 Jan 2016 22:51:23 +0000 (UTC) (envelope-from ngie@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0NMpMNX087960; Sat, 23 Jan 2016 22:51:22 GMT (envelope-from ngie@FreeBSD.org) Received: (from ngie@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0NMpMg0087959; Sat, 23 Jan 2016 22:51:22 GMT (envelope-from ngie@FreeBSD.org) Message-Id: <201601232251.u0NMpMg0087959@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ngie set sender to ngie@FreeBSD.org using -f From: Garrett Cooper Date: Sat, 23 Jan 2016 22:51:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294647 - head/tools/regression/sockets/zerosend X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Jan 2016 22:51:24 -0000 Author: ngie Date: Sat Jan 23 22:51:22 2016 New Revision: 294647 URL: https://svnweb.freebsd.org/changeset/base/294647 Log: Use different ports in the TCP/UDP testcases with the first set and the second set (increment the original ports by 10) This avoids issues where the first listening socket might not be torn down by the time it makes it to the second set of testcases. The sockets should likely only be setup once, but this keeps in the spirit of the original testcases, so this will be easier to backport to ^/stable/9 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/tools/regression/sockets/zerosend/zerosend.c Directory Properties: head/ (props changed) Modified: head/tools/regression/sockets/zerosend/zerosend.c ============================================================================== --- head/tools/regression/sockets/zerosend/zerosend.c Sat Jan 23 22:49:13 2016 (r294646) +++ head/tools/regression/sockets/zerosend/zerosend.c Sat Jan 23 22:51:22 2016 (r294647) @@ -74,7 +74,7 @@ try_0write(const char *test, int fd) } static void -setup_udp(const char *test, int *fdp) +setup_udp(const char *test, int *fdp, int port1, int port2) { struct sockaddr_in sin; int sock1, sock2; @@ -84,14 +84,14 @@ setup_udp(const char *test, int *fdp) sin.sin_family = AF_INET; sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - sin.sin_port = htons(PORT1); + sin.sin_port = htons(port1); sock1 = socket(PF_INET, SOCK_DGRAM, 0); if (sock1 < 0) err(1, "%s: setup_udp: socket", test); if (bind(sock1, (struct sockaddr *)&sin, sizeof(sin)) < 0) err(1, "%s: setup_udp: bind(%s, %d)", test, inet_ntoa(sin.sin_addr), PORT1); - sin.sin_port = htons(PORT2); + sin.sin_port = htons(port2); if (connect(sock1, (struct sockaddr *)&sin, sizeof(sin)) < 0) err(1, "%s: setup_udp: connect(%s, %d)", test, inet_ntoa(sin.sin_addr), PORT2); @@ -102,7 +102,7 @@ setup_udp(const char *test, int *fdp) if (bind(sock2, (struct sockaddr *)&sin, sizeof(sin)) < 0) err(1, "%s: setup_udp: bind(%s, %d)", test, inet_ntoa(sin.sin_addr), PORT2); - sin.sin_port = htons(PORT1); + sin.sin_port = htons(port1); if (connect(sock2, (struct sockaddr *)&sin, sizeof(sin)) < 0) err(1, "%s: setup_udp: connect(%s, %d)", test, inet_ntoa(sin.sin_addr), PORT1); @@ -112,7 +112,7 @@ setup_udp(const char *test, int *fdp) } static void -setup_tcp(const char *test, int *fdp) +setup_tcp(const char *test, int *fdp, int port) { fd_set writefds, exceptfds; struct sockaddr_in sin; @@ -127,7 +127,7 @@ setup_tcp(const char *test, int *fdp) /* * First set up the listen socket. */ - sin.sin_port = htons(PORT1); + sin.sin_port = htons(port); sock1 = socket(PF_INET, SOCK_STREAM, 0); if (sock1 < 0) err(1, "%s: setup_tcp: socket", test); @@ -246,19 +246,19 @@ main(void) { int fd[2]; - setup_udp("udp_0send", fd); + setup_udp("udp_0send", fd, PORT1, PORT2); try_0send("udp_0send", fd[0]); close_both(fd); - setup_udp("udp_0write", fd); + setup_udp("udp_0write", fd, PORT1 + 10, PORT2 + 10); try_0write("udp_0write", fd[0]); close_both(fd); - setup_tcp("tcp_0send", fd); + setup_tcp("tcp_0send", fd, PORT1); try_0send("tcp_0send", fd[0]); close_both(fd); - setup_tcp("tcp_0write", fd); + setup_tcp("tcp_0write", fd, PORT1 + 10); try_0write("tcp_0write", fd[0]); close_both(fd);