PERFORCE change 165383 for review
Fang Wang
fangwang at FreeBSD.org
Mon Jun 29 09:52:52 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=165383
Change 165383 by fangwang at 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 <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
-#include <netinet/tcp.h>
+//#include <netinet/tcp.h>
+#include "tcp.h"
#include <arpa/inet.h>
@@ -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) {
More information about the p4-projects
mailing list