From owner-p4-projects@FreeBSD.ORG Mon Jun 29 09:52:51 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 50A2A106566C; Mon, 29 Jun 2009 09:52:50 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 944F61065678 for ; Mon, 29 Jun 2009 09:52:49 +0000 (UTC) (envelope-from fangwang@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 774AA8FC15 for ; Mon, 29 Jun 2009 09:52:49 +0000 (UTC) (envelope-from fangwang@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n5T9qnqN092686 for ; Mon, 29 Jun 2009 09:52:49 GMT (envelope-from fangwang@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5T9qnaQ092684 for perforce@freebsd.org; Mon, 29 Jun 2009 09:52:49 GMT (envelope-from fangwang@FreeBSD.org) Date: Mon, 29 Jun 2009 09:52:49 GMT Message-Id: <200906290952.n5T9qnaQ092684@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to fangwang@FreeBSD.org using -f From: Fang Wang To: Perforce Change Reviews Cc: Subject: PERFORCE change 165383 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jun 2009 09:52:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=165383 Change 165383 by fangwang@fangwang_utobsd on 2009/06/29 09:52:37 Tmp submit. Affected files ... .. //depot/projects/soc2009/tcputo/src/tools/regression/netinet/tcputo/tcputo.c#3 edit Differences ... ==== //depot/projects/soc2009/tcputo/src/tools/regression/netinet/tcputo/tcputo.c#3 (text+ko) ==== @@ -1,8 +1,37 @@ +/*- + * Copyright (c) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD: src/tools/regression/netinet/tcputo/tcputo.c $ + */ + #include #include #include -#include +//#include +#include "tcp.h" #include @@ -52,7 +81,7 @@ char buf[16*1024]; long port; int user_timeout; - int optval = 4*1024; + int optval; if (argc != 1) usage(); @@ -70,7 +99,10 @@ listen_sock = socket(PF_INET, SOCK_STREAM, 0); if (listen_sock == -1) err(-1, "socket"); - + optval = 150; + /*if (setsockopt(listen_sock, IPPROTO_TCP, TCP_UTO, &optval, sizeof(optval)) == -1) + err(-1, "setsockopt"); +*/ if (bind(listen_sock, (struct sockaddr *)&sin, sizeof(sin)) == -1) err(-1, "bind"); @@ -79,6 +111,7 @@ accept_sock = accept(listen_sock, NULL, NULL); close(listen_sock); + optval = 4*1024; if (setsockopt(accept_sock, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)) == -1) err(-1, "setsockopt"); while(1) { @@ -103,11 +136,10 @@ tcputo_client(int argc, char *argv[]) { struct sockaddr_in sin; - long count, i, port; + long port; char *dummy; char buf[16*1024]; int sock; - int nonblock = 0, md5enable = 0; int user_timeout; int optval = 4*1024; @@ -130,7 +162,10 @@ err(-1, "socket"); if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, &optval, sizeof(optval)) == -1) err(-1, "setsockopt"); - + optval = 150; +/* if (setsockopt(sock, IPPROTO_TCP, TCP_UTO, &optval, sizeof(optval)) == -1) + err(-1, "setsockopt"); +*/ /* No warning in default case on ENOPROTOOPT. */ /* if (setsockopt(sock, IPPROTO_TCP, TCP_MD5SIG, &md5enable, sizeof(md5enable)) != 0) {