CVS commit: src/tests/net/icmp

2019-06-11 Thread Andreas Gustafsson
Module Name:src
Committed By:   gson
Date:   Tue Jun 11 08:34:01 UTC 2019

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
In the "got %d/%d" message printed at the end of the pingsize test,
make the latter number show the actual number of ICMP packets the test
attempted to send.  Thus, the two numbers can now be meaningfully
compared, and their difference indicates the number of packets lost.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.23 src/tests/net/icmp/t_ping.c:1.24
--- src/tests/net/icmp/t_ping.c:1.23	Mon Mar 26 09:11:15 2018
+++ src/tests/net/icmp/t_ping.c	Tue Jun 11 08:34:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.24 2019/06/11 08:34:01 gson Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.24 2019/06/11 08:34:01 gson Exp $");
 #endif /* not lint */
 
 #include 
@@ -280,7 +280,7 @@ ATF_TC_BODY(pingsize, tc)
 {
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
-	int succ, i;
+	int sent, succ, i;
 
 	cpid = fork();
 	rump_init();
@@ -299,21 +299,27 @@ ATF_TC_BODY(pingsize, tc)
 
 	netcfg_rump_if(ifname, "1.1.1.20", "255.255.255.0");
 
-	succ = 0;
+	succ = sent = 0;
 
 	/* small sizes */
-	for (i = 0 ; i < IP_MAXPACKET - 6; i++)
+	for (i = 0 ; i < IP_MAXPACKET - 6; i++) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
 	/* medium sizes */
-	for (i = IP_MAXPACKET - 6; i < IP_MAXPACKET - 100; i += 1000)
+	for (i = IP_MAXPACKET - 6; i < IP_MAXPACKET - 100; i += 1000) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
 	/* big sizes */
-	for (i = IP_MAXPACKET - 100; i < IP_MAXPACKET; i += 10)
+	for (i = IP_MAXPACKET - 100; i < IP_MAXPACKET; i += 10) {
+		sent++;
 		succ += doping("1.1.1.10", 1, i);
+	}
 
-	printf("got %d/%d\n", succ, IP_MAXPACKET);
+	printf("got %d/%d\n", succ, sent);
 	kill(cpid, SIGKILL);
 }
 



CVS commit: src/tests/net/icmp

2018-03-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Mar 26 09:11:15 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle errors better.
Fix test for checking we sent all the data we asked to.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.22 src/tests/net/icmp/t_ping.c:1.23
--- src/tests/net/icmp/t_ping.c:1.22	Sat Mar 24 15:51:57 2018
+++ src/tests/net/icmp/t_ping.c	Mon Mar 26 09:11:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.23 2018/03/26 09:11:15 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -334,7 +334,8 @@ ATF_TC_BODY(ping_of_death, tc)
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
 	size_t tot, frag;
-	int s, x, loop, error;
+	int s, x, loop;
+	ssize_t error;
 
 	cpid = fork();
 	rump_init();
@@ -420,11 +421,13 @@ ATF_TC_BODY(ping_of_death, tc)
 
 			error = rump_sys_sendto(s, data, frag, 0,
 			(struct sockaddr *), sizeof(dst));
-			if (error == sizeof(dst))
-continue;
-			if (error == -1 && errno == ENOBUFS)
-continue;
-			atf_tc_fail_errno("sendto failed");
+			if (error == -1) {
+if (errno == ENOBUFS)
+	continue;
+atf_tc_fail_errno("sendto failed");
+			}
+			if ((size_t)error != frag)
+atf_tc_fail("sendto did not write all data");
 		}
 		if (waitpid(-1, , WNOHANG) > 0) {
 			if (WIFEXITED(status) && WEXITSTATUS(status) == 0)



CVS commit: src/tests/net/icmp

2018-03-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Mar 26 09:11:15 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle errors better.
Fix test for checking we sent all the data we asked to.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2018-03-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Mar 24 15:51:57 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Allow a valid sendto  duh


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.21 src/tests/net/icmp/t_ping.c:1.22
--- src/tests/net/icmp/t_ping.c:1.21	Sat Mar 24 00:06:32 2018
+++ src/tests/net/icmp/t_ping.c	Sat Mar 24 15:51:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.22 2018/03/24 15:51:57 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -420,6 +420,8 @@ ATF_TC_BODY(ping_of_death, tc)
 
 			error = rump_sys_sendto(s, data, frag, 0,
 			(struct sockaddr *), sizeof(dst));
+			if (error == sizeof(dst))
+continue;
 			if (error == -1 && errno == ENOBUFS)
 continue;
 			atf_tc_fail_errno("sendto failed");



CVS commit: src/tests/net/icmp

2018-03-24 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat Mar 24 15:51:57 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Allow a valid sendto  duh


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2018-03-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Mar 24 00:06:32 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Fix a printf(3)-like format in ATF ICMP t_ping.c

Use %zd for ssize_t, instead of %d.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2018-03-23 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Mar 24 00:06:32 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Fix a printf(3)-like format in ATF ICMP t_ping.c

Use %zd for ssize_t, instead of %d.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.20 src/tests/net/icmp/t_ping.c:1.21
--- src/tests/net/icmp/t_ping.c:1.20	Fri Mar 23 10:05:45 2018
+++ src/tests/net/icmp/t_ping.c	Sat Mar 24 00:06:32 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.21 2018/03/24 00:06:32 kamil Exp $");
 #endif /* not lint */
 
 #include 
@@ -198,7 +198,7 @@ doping(const char *target, int loops, u_
 		}
 		if (n == -1 && (errno == EAGAIN || errno == ENOBUFS))
 			continue;
-		atf_tc_fail_errno("recv failed (n == %d)", n);
+		atf_tc_fail_errno("recv failed (n == %zd)", n);
 	}
 
 	rump_sys_close(s);



CVS commit: src/tests/net/icmp

2018-03-23 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Mar 23 10:05:45 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Note value received. Harden another sendto for ENOBUFS.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.19 src/tests/net/icmp/t_ping.c:1.20
--- src/tests/net/icmp/t_ping.c:1.19	Thu Mar 22 17:27:34 2018
+++ src/tests/net/icmp/t_ping.c	Fri Mar 23 10:05:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -198,7 +198,7 @@ doping(const char *target, int loops, u_
 		}
 		if (n == -1 && (errno == EAGAIN || errno == ENOBUFS))
 			continue;
-		atf_tc_fail_errno("recv failed");
+		atf_tc_fail_errno("recv failed (n == %d)", n);
 	}
 
 	rump_sys_close(s);
@@ -334,7 +334,7 @@ ATF_TC_BODY(ping_of_death, tc)
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
 	size_t tot, frag;
-	int s, x, loop;
+	int s, x, loop, error;
 
 	cpid = fork();
 	rump_init();
@@ -418,15 +418,18 @@ ATF_TC_BODY(ping_of_death, tc)
 ip->ip_off |= IP_MF;
 			}
 
-			RL(rump_sys_sendto(s, data, frag, 0,
-			(struct sockaddr *), sizeof(dst)));
+			error = rump_sys_sendto(s, data, frag, 0,
+			(struct sockaddr *), sizeof(dst));
+			if (error == -1 && errno == ENOBUFS)
+continue;
+			atf_tc_fail_errno("sendto failed");
 		}
 		if (waitpid(-1, , WNOHANG) > 0) {
 			if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
 break;
 			atf_tc_fail("child did not exit clean");
 		}
-			
+
 		usleep(1);
 	}
 }



CVS commit: src/tests/net/icmp

2018-03-23 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Fri Mar 23 10:05:45 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Note value received. Harden another sendto for ENOBUFS.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2018-03-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Mar 22 17:27:34 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle ENOBUFS in sendto


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.18 src/tests/net/icmp/t_ping.c:1.19
--- src/tests/net/icmp/t_ping.c:1.18	Thu Mar 22 17:16:05 2018
+++ src/tests/net/icmp/t_ping.c	Thu Mar 22 17:27:34 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -182,8 +182,14 @@ doping(const char *target, int loops, u_
 		icmp->icmp_seq = htons(loop);
 		icmp->icmp_cksum = 0;
 		icmp->icmp_cksum = in_cksum(icmp, pktsize);
-		RL(rump_sys_sendto(s, icmp, pktsize, 0,
-		(struct sockaddr *), sizeof(dst)));
+
+		n = rump_sys_sendto(s, icmp, pktsize, 0,
+		(struct sockaddr *), sizeof(dst));
+		if (n == -1) {
+			if (errno == ENOBUFS)
+continue;
+			atf_tc_fail_errno("sendto failed");
+		}
 
 		RL(rump_sys_fcntl(s, F_SETFL, xnon));
 		while ((n = rump_sys_recvfrom(s, recvbuf, sizeof(recvbuf), 0,



CVS commit: src/tests/net/icmp

2018-03-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Mar 22 17:27:34 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle ENOBUFS in sendto


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2018-03-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Mar 22 17:16:05 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle ENOBUFS in recv


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.17 src/tests/net/icmp/t_ping.c:1.18
--- src/tests/net/icmp/t_ping.c:1.17	Fri Jan 13 21:30:42 2017
+++ src/tests/net/icmp/t_ping.c	Thu Mar 22 17:16:05 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.17 2017/01/13 21:30:42 christos Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $");
 #endif /* not lint */
 
 #include 
@@ -190,7 +190,7 @@ doping(const char *target, int loops, u_
 		(struct sockaddr *), )) > 0) {
 			succ++;
 		}
-		if (n == -1 && errno == EAGAIN)
+		if (n == -1 && (errno == EAGAIN || errno == ENOBUFS))
 			continue;
 		atf_tc_fail_errno("recv failed");
 	}



CVS commit: src/tests/net/icmp

2018-03-22 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Mar 22 17:16:05 UTC 2018

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Handle ENOBUFS in recv


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2016-10-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Oct  2 04:46:07 UTC 2016

Modified Files:
src/tests/net/icmp: t_icmp6_redirect.sh

Log Message:
More adaptation to changed ifconfig output format.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_icmp6_redirect.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_icmp6_redirect.sh
diff -u src/tests/net/icmp/t_icmp6_redirect.sh:1.2 src/tests/net/icmp/t_icmp6_redirect.sh:1.3
--- src/tests/net/icmp/t_icmp6_redirect.sh:1.2	Wed Aug 10 22:17:44 2016
+++ src/tests/net/icmp/t_icmp6_redirect.sh	Sun Oct  2 04:46:07 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_icmp6_redirect.sh,v 1.2 2016/08/10 22:17:44 kre Exp $
+#	$NetBSD: t_icmp6_redirect.sh,v 1.3 2016/10/02 04:46:07 kre Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -50,7 +50,8 @@ get_lladdr()
 {
 
 	export RUMP_SERVER=${1}
-	rump.ifconfig ${2} inet6 | awk "/fe80/ {sub(/%$2/, \"\"); print \$2;}"
+	rump.ifconfig ${2} inet6 |
+	awk "/fe80/ {sub(/%$2/, \"\"); sub(/\\/[0-9]*/, \"\"); print \$2;}"
 	unset RUMP_SERVER
 
 	return 0



CVS commit: src/tests/net/icmp

2016-10-01 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Oct  2 04:46:07 UTC 2016

Modified Files:
src/tests/net/icmp: t_icmp6_redirect.sh

Log Message:
More adaptation to changed ifconfig output format.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_icmp6_redirect.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2016-08-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 10 22:17:44 UTC 2016

Modified Files:
src/tests/net/icmp: t_icmp6_redirect.sh t_icmp_redirect.sh t_ping2.sh

Log Message:
+ -lrumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_icmp6_redirect.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_icmp_redirect.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_icmp6_redirect.sh
diff -u src/tests/net/icmp/t_icmp6_redirect.sh:1.1 src/tests/net/icmp/t_icmp6_redirect.sh:1.2
--- src/tests/net/icmp/t_icmp6_redirect.sh:1.1	Mon Sep 14 05:22:56 2015
+++ src/tests/net/icmp/t_icmp6_redirect.sh	Wed Aug 10 22:17:44 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_icmp6_redirect.sh,v 1.1 2015/09/14 05:22:56 ozaki-r Exp $
+#	$NetBSD: t_icmp6_redirect.sh,v 1.2 2016/08/10 22:17:44 kre Exp $
 #
 # Copyright (c) 2015 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -25,7 +25,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 netserver="rump_server -lrumpnet -lrumpnet_net -lrumpnet_shmif"
-netserver="${netserver} -lrumpnet_netinet -lrumpnet_netinet6"
+netserver="${netserver} -lrumpnet_netinet -lrumpnet_netinet6 -lrumpdev"
 
 SOCK_LOCAL=unix://commsock1
 SOCK_PEER=unix://commsock2

Index: src/tests/net/icmp/t_icmp_redirect.sh
diff -u src/tests/net/icmp/t_icmp_redirect.sh:1.2 src/tests/net/icmp/t_icmp_redirect.sh:1.3
--- src/tests/net/icmp/t_icmp_redirect.sh:1.2	Fri Dec 25 08:22:28 2015
+++ src/tests/net/icmp/t_icmp_redirect.sh	Wed Aug 10 22:17:44 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_icmp_redirect.sh,v 1.2 2015/12/25 08:22:28 ozaki-r Exp $
+#	$NetBSD: t_icmp_redirect.sh,v 1.3 2016/08/10 22:17:44 kre Exp $
 #
 # Copyright (c) 2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,7 +28,7 @@
 # Most codes are derived from tests/net/route/t_flags.sh
 
 netserver=\
-"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif"
+"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev"
 SOCK_LOCAL=unix://commsock1
 SOCK_PEER=unix://commsock2
 SOCK_GW=unix://commsock3

Index: src/tests/net/icmp/t_ping2.sh
diff -u src/tests/net/icmp/t_ping2.sh:1.4 src/tests/net/icmp/t_ping2.sh:1.5
--- src/tests/net/icmp/t_ping2.sh:1.4	Thu Dec 30 16:58:07 2010
+++ src/tests/net/icmp/t_ping2.sh	Wed Aug 10 22:17:44 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ping2.sh,v 1.4 2010/12/30 16:58:07 pooka Exp $
+#	$NetBSD: t_ping2.sh,v 1.5 2016/08/10 22:17:44 kre Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -26,7 +26,7 @@
 #
 
 netserver=\
-"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif"
+"rump_server -lrumpnet -lrumpnet_net -lrumpnet_netinet -lrumpnet_shmif -lrumpdev"
 
 atf_test_case basic cleanup
 basic_head()



CVS commit: src/tests/net/icmp

2016-08-10 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Aug 10 22:17:44 UTC 2016

Modified Files:
src/tests/net/icmp: t_icmp6_redirect.sh t_icmp_redirect.sh t_ping2.sh

Log Message:
+ -lrumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_icmp6_redirect.sh
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_icmp_redirect.sh
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:49:35 UTC 2016

Modified Files:
src/tests/net/icmp: Makefile

Log Message:
And this one also needs librumpvfs


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/icmp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:49:35 UTC 2016

Modified Files:
src/tests/net/icmp: Makefile

Log Message:
And this one also needs librumpvfs


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/icmp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/Makefile
diff -u src/tests/net/icmp/Makefile:1.7 src/tests/net/icmp/Makefile:1.8
--- src/tests/net/icmp/Makefile:1.7	Mon Aug  8 14:46:35 2016
+++ src/tests/net/icmp/Makefile	Mon Aug  8 14:49:35 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.7 2016/08/08 14:46:35 pgoyette Exp $
+# $NetBSD: Makefile,v 1.8 2016/08/08 14:49:35 pgoyette Exp $
 #
 
 .include 
@@ -11,6 +11,6 @@ TESTS_C+=	t_ping
 TESTS_SH=	t_ping2 t_icmp_redirect t_icmp6_redirect
 
 LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
-LDADD+=		-lrump -lrumpuser -lrump -lpthread -lrumpdev
+LDADD+=		-lrump -lrumpuser -lrump -lpthread -lrumpdev -lrumpvfs
 
 .include 



CVS commit: src/tests/net/icmp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:46:35 UTC 2016

Modified Files:
src/tests/net/icmp: Makefile

Log Message:
More need for librumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/icmp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/Makefile
diff -u src/tests/net/icmp/Makefile:1.6 src/tests/net/icmp/Makefile:1.7
--- src/tests/net/icmp/Makefile:1.6	Mon Sep 14 05:22:56 2015
+++ src/tests/net/icmp/Makefile	Mon Aug  8 14:46:35 2016
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.6 2015/09/14 05:22:56 ozaki-r Exp $
+# $NetBSD: Makefile,v 1.7 2016/08/08 14:46:35 pgoyette Exp $
 #
 
 .include 
@@ -11,6 +11,6 @@ TESTS_C+=	t_ping
 TESTS_SH=	t_ping2 t_icmp_redirect t_icmp6_redirect
 
 LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
-LDADD+=		-lrump -lrumpuser -lrump -lpthread
+LDADD+=		-lrump -lrumpuser -lrump -lpthread -lrumpdev
 
 .include 



CVS commit: src/tests/net/icmp

2016-08-08 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Aug  8 14:46:35 UTC 2016

Modified Files:
src/tests/net/icmp: Makefile

Log Message:
More need for librumpdev


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/icmp/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2015-02-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 26 13:03:21 UTC 2015

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
Do not use artificial low timeouts - slow machines might be still paging
in all the rump environment. Bump timeout from 4 seconds to 20 (my shark
needs ~9).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_forward.c
diff -u src/tests/net/icmp/t_forward.c:1.8 src/tests/net/icmp/t_forward.c:1.9
--- src/tests/net/icmp/t_forward.c:1.8	Sun Mar 18 09:46:50 2012
+++ src/tests/net/icmp/t_forward.c	Thu Feb 26 13:03:21 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_forward.c,v 1.8 2012/03/18 09:46:50 jruoho Exp $	*/
+/*	$NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_forward.c,v 1.8 2012/03/18 09:46:50 jruoho Exp $);
+__RCSID($NetBSD: t_forward.c,v 1.9 2015/02/26 13:03:21 martin Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -129,7 +129,7 @@ ATF_TC_HEAD(returndatabytes, tc)
 
 	atf_tc_set_md_var(tc, descr, icmp.returndatabytes with certain 
 	packets can cause kernel panic (PR kern/43548));
-	atf_tc_set_md_var(tc, timeout, 4); /* just in case */
+	atf_tc_set_md_var(tc, timeout, 20); /* just in case */
 }
 
 ATF_TC_BODY(returndatabytes, tc)



CVS commit: src/tests/net/icmp

2015-02-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 26 13:06:10 UTC 2015

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Bump timeout to 20 seconds for slower machines.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.15 src/tests/net/icmp/t_ping.c:1.16
--- src/tests/net/icmp/t_ping.c:1.15	Tue Sep  4 22:31:58 2012
+++ src/tests/net/icmp/t_ping.c	Thu Feb 26 13:06:10 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.16 2015/02/26 13:06:10 martin Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -60,7 +60,7 @@ ATF_TC_HEAD(simpleping, tc)
 {
 
 	atf_tc_set_md_var(tc, descr, check that kernel responds to ping);
-	atf_tc_set_md_var(tc, timeout, 2);
+	atf_tc_set_md_var(tc, timeout, 20);
 }
 
 ATF_TC_BODY(simpleping, tc)
@@ -316,7 +316,7 @@ ATF_TC_HEAD(ping_of_death, tc)
 {
 
 	atf_tc_set_md_var(tc, descr, send a \ping of death\);
-	atf_tc_set_md_var(tc, timeout, 2);
+	atf_tc_set_md_var(tc, timeout, 20);
 }
 
 ATF_TC_BODY(ping_of_death, tc)



CVS commit: src/tests/net/icmp

2015-02-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 26 13:06:10 UTC 2015

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Bump timeout to 20 seconds for slower machines.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2015-02-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Feb 26 13:03:21 UTC 2015

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
Do not use artificial low timeouts - slow machines might be still paging
in all the rump environment. Bump timeout from 4 seconds to 20 (my shark
needs ~9).


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2012-09-04 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Sep  4 22:31:59 UTC 2012

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Replace usleep(50) with a synchronization over a pipe.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.14 src/tests/net/icmp/t_ping.c:1.15
--- src/tests/net/icmp/t_ping.c:1.14	Sun Jun 26 13:15:22 2011
+++ src/tests/net/icmp/t_ping.c	Tue Sep  4 22:31:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.15 2012/09/04 22:31:58 alnsn Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -68,6 +68,10 @@ ATF_TC_BODY(simpleping, tc)
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
 	bool win, win2;
+	char token;
+	int channel[2];
+
+	RL(pipe(channel));
 
 	cpid = fork();
 	rump_init();
@@ -78,13 +82,18 @@ ATF_TC_BODY(simpleping, tc)
 		atf_tc_fail_errno(fork failed);
 	case 0:
 		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		close(channel[0]);
+		ATF_CHECK(write(channel[1], U, 1) == 1);
+		close(channel[1]);
 		pause();
 		break;
 	default:
 		break;
 	}
 
-	usleep(50);
+	close(channel[1]);
+	ATF_CHECK(read(channel[0], token, 1) == 1  token == 'U');
+	close(channel[0]);
 
 	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
 



CVS commit: src/tests/net/icmp

2012-09-04 Thread Alexander Nasonov
Module Name:src
Committed By:   alnsn
Date:   Tue Sep  4 22:31:59 UTC 2012

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Replace usleep(50) with a synchronization over a pipe.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 13:15:22 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
fix fallout from including signal.h from rump_syscallargs.h


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.13 src/tests/net/icmp/t_ping.c:1.14
--- src/tests/net/icmp/t_ping.c:1.13	Wed Jan  5 09:43:40 2011
+++ src/tests/net/icmp/t_ping.c	Sun Jun 26 09:15:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.13 2011/01/05 14:43:40 martin Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.13 2011/01/05 14:43:40 martin Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.14 2011/06/26 13:15:22 christos Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -44,6 +44,7 @@
 #include stdlib.h
 #include string.h
 #include unistd.h
+#include signal.h
 
 #include netinet/in.h
 #include netinet/ip_var.h



CVS commit: src/tests/net/icmp

2011-06-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jun 26 13:15:22 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
fix fallout from including signal.h from rump_syscallargs.h


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2011-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  5 14:08:12 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Fix alignment of sndbuf (sparc64 got a SIGBUS in this test)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.11 src/tests/net/icmp/t_ping.c:1.12
--- src/tests/net/icmp/t_ping.c:1.11	Sun Nov  7 17:51:21 2010
+++ src/tests/net/icmp/t_ping.c	Wed Jan  5 14:08:12 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.11 2010/11/07 17:51:21 jmmv Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.12 2011/01/05 14:08:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.11 2010/11/07 17:51:21 jmmv Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.12 2011/01/05 14:08:12 martin Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -129,7 +129,10 @@
 static int
 doping(const char *target, int loops, u_int pktsize)
 {
-	char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
+	union {
+		char buf[IP_MAXPACKET - sizeof(struct ip)];
+		struct icmp i;	/* ensure proper alignment */
+	} sndbuf;
 	char recvbuf[IP_MAXPACKET];
 	struct sockaddr_in dst, pingee;
 	struct icmp *icmp;
@@ -147,7 +150,7 @@
 	dst.sin_family = AF_INET;
 	dst.sin_addr.s_addr = inet_addr(target);
 
-	icmp = (struct icmp *)sndbuf;
+	icmp = (struct icmp *)sndbuf;
 	memset(icmp, 0, sizeof(*icmp));
 	icmp-icmp_type = ICMP_ECHO;
 	icmp-icmp_id = htons(37);



CVS commit: src/tests/net/icmp

2011-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  5 14:43:40 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Use raw buffer size (not aligned value) to limit packet size


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.12 src/tests/net/icmp/t_ping.c:1.13
--- src/tests/net/icmp/t_ping.c:1.12	Wed Jan  5 14:08:12 2011
+++ src/tests/net/icmp/t_ping.c	Wed Jan  5 14:43:40 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.12 2011/01/05 14:08:12 martin Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.13 2011/01/05 14:43:40 martin Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.12 2011/01/05 14:08:12 martin Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.13 2011/01/05 14:43:40 martin Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -157,8 +157,8 @@
 
 	if (pktsize  sizeof(*icmp))
 		pktsize = sizeof(*icmp);
-	if (pktsize  sizeof(sndbuf))
-		pktsize = sizeof(sndbuf);
+	if (pktsize  sizeof(sndbuf.buf))
+		pktsize = sizeof(sndbuf.buf);
 
 	RL(rump_sys_setsockopt(s, SOL_SOCKET, SO_SNDBUF,
 	pktsize, sizeof(pktsize)));



CVS commit: src/tests/net/icmp

2011-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  5 14:08:12 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Fix alignment of sndbuf (sparc64 got a SIGBUS in this test)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2011-01-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Jan  5 14:43:40 UTC 2011

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Use raw buffer size (not aligned value) to limit packet size


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-12-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Dec 18 08:35:54 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping2.sh

Log Message:
atf-check = atf_check


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping2.sh
diff -u src/tests/net/icmp/t_ping2.sh:1.2 src/tests/net/icmp/t_ping2.sh:1.3
--- src/tests/net/icmp/t_ping2.sh:1.2	Tue Dec 14 19:08:22 2010
+++ src/tests/net/icmp/t_ping2.sh	Sat Dec 18 08:35:53 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ping2.sh,v 1.2 2010/12/14 19:08:22 pooka Exp $
+#	$NetBSD: t_ping2.sh,v 1.3 2010/12/18 08:35:53 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -38,26 +38,26 @@
 	sock=${1}
 	addr=${2}
 
-	atf-check -s exit:0 \
+	atf_check -s exit:0 \
 	env RUMP_SERVER=${sock} rump.ifconfig shmif0 create
-	atf-check -s exit:0 \
+	atf_check -s exit:0 \
 	env RUMP_SERVER=${sock} rump.ifconfig shmif0 linkstr bus
-	atf-check -s exit:0 \
+	atf_check -s exit:0 \
 	env RUMP_SERVER=${sock} rump.ifconfig shmif0 inet ${addr}
 }
 
 basic_body()
 {
 
-	atf-check -s exit:0 rump_allserver unix://commsock1
-	atf-check -s exit:0 rump_allserver unix://commsock2
+	atf_check -s exit:0 rump_allserver unix://commsock1
+	atf_check -s exit:0 rump_allserver unix://commsock2
 
 	docfg unix://commsock1 1.2.3.4
 	docfg unix://commsock2 1.2.3.5
 
-	atf-check -s exit:0 -o ignore \
+	atf_check -s exit:0 -o ignore \
 	env RUMP_SERVER=unix://commsock1 rump.ping -n -c 1 1.2.3.5
-	atf-check -s exit:0 -o ignore \
+	atf_check -s exit:0 -o ignore \
 	env RUMP_SERVER=unix://commsock2 rump.ping -n -c 1 1.2.3.5
 }
 



CVS commit: src/tests/net/icmp

2010-12-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sat Dec 18 08:35:54 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping2.sh

Log Message:
atf-check = atf_check


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-12-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Dec 14 19:08:23 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping2.sh

Log Message:
use ping -n, since technically we don't have dns


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping2.sh
diff -u src/tests/net/icmp/t_ping2.sh:1.1 src/tests/net/icmp/t_ping2.sh:1.2
--- src/tests/net/icmp/t_ping2.sh:1.1	Tue Dec 14 11:03:17 2010
+++ src/tests/net/icmp/t_ping2.sh	Tue Dec 14 19:08:22 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ping2.sh,v 1.1 2010/12/14 11:03:17 pooka Exp $
+#	$NetBSD: t_ping2.sh,v 1.2 2010/12/14 19:08:22 pooka Exp $
 #
 # Copyright (c) 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -56,9 +56,9 @@
 	docfg unix://commsock2 1.2.3.5
 
 	atf-check -s exit:0 -o ignore \
-	env RUMP_SERVER=unix://commsock1 rump.ping -c 1 1.2.3.5
+	env RUMP_SERVER=unix://commsock1 rump.ping -n -c 1 1.2.3.5
 	atf-check -s exit:0 -o ignore \
-	env RUMP_SERVER=unix://commsock2 rump.ping -c 1 1.2.3.5
+	env RUMP_SERVER=unix://commsock2 rump.ping -n -c 1 1.2.3.5
 }
 
 basic_cleanup()



CVS commit: src/tests/net/icmp

2010-12-14 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Dec 14 19:08:23 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping2.sh

Log Message:
use ping -n, since technically we don't have dns


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_ping2.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-11-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  3 21:44:46 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
make that u_int, because it is passed as a socket option.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.9 src/tests/net/icmp/t_ping.c:1.10
--- src/tests/net/icmp/t_ping.c:1.9	Wed Nov  3 12:10:24 2010
+++ src/tests/net/icmp/t_ping.c	Wed Nov  3 17:44:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.9 2010/11/03 16:10:24 christos Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.10 2010/11/03 21:44:46 christos Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.9 2010/11/03 16:10:24 christos Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.10 2010/11/03 21:44:46 christos Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -129,7 +129,7 @@
 }
 
 static int
-doping(const char *target, int loops, size_t pktsize)
+doping(const char *target, int loops, u_int pktsize)
 {
 	char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
 	char recvbuf[IP_MAXPACKET];



CVS commit: src/tests/net/icmp

2010-11-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Nov  3 21:44:46 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
make that u_int, because it is passed as a socket option.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 26 17:24:15 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
setsockopt() wants int instead of size_t.  Should fix this on LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.7 src/tests/net/icmp/t_ping.c:1.8
--- src/tests/net/icmp/t_ping.c:1.7	Mon Aug 23 10:49:27 2010
+++ src/tests/net/icmp/t_ping.c	Thu Aug 26 17:24:14 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.7 2010/08/23 10:49:27 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.8 2010/08/26 17:24:14 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.7 2010/08/23 10:49:27 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.8 2010/08/26 17:24:14 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -129,7 +129,7 @@
 }
 
 static int
-doping(const char *target, int loops, size_t pktsize)
+doping(const char *target, int loops, int pktsize)
 {
 	char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
 	char recvbuf[IP_MAXPACKET];



CVS commit: src/tests/net/icmp

2010-08-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Aug 26 17:24:15 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
setsockopt() wants int instead of size_t.  Should fix this on LP64.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 23 10:49:28 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a delay between startup of pinger and pingee here too.

XXX: there's apparently some race condition which appears to trigger
if a broadcast arp arrives around the same time as the arpwhohas
is sent.  This causes original packet to never be sent by the
arpwhohas requestor.  If this rings a bell to someone, please let
me know.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.6 src/tests/net/icmp/t_ping.c:1.7
--- src/tests/net/icmp/t_ping.c:1.6	Wed Aug 18 21:23:48 2010
+++ src/tests/net/icmp/t_ping.c	Mon Aug 23 10:49:27 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.7 2010/08/23 10:49:27 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.7 2010/08/23 10:49:27 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -84,6 +84,8 @@
 		break;
 	}
 
+	usleep(50);
+
 	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
 
 	/*



CVS commit: src/tests/net/icmp

2010-08-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug 23 10:49:28 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a delay between startup of pinger and pingee here too.

XXX: there's apparently some race condition which appears to trigger
if a broadcast arp arrives around the same time as the arpwhohas
is sent.  This causes original packet to never be sent by the
arpwhohas requestor.  If this rings a bell to someone, please let
me know.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 16:39:22 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a two-way floodping test and a test which sends icmp echos with
various sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.2 src/tests/net/icmp/t_ping.c:1.3
--- src/tests/net/icmp/t_ping.c:1.2	Tue Aug 17 15:51:11 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 16:39:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.3 2010/08/18 16:39:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.3 2010/08/18 16:39:22 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -101,20 +101,92 @@
 	atf_tc_set_md_var(tc, use.fs, true);
 }
 
-#define PERLOOP 100
-#define LOOPS 100
-ATF_TC_BODY(floodping, tc)
+/* why the hell isn't this available in userspace??? */
+static uint16_t
+in_cksum(void *data, size_t len)
 {
-	char buf[8192];
-	char ifname[IFNAMSIZ];
-	pid_t cpid;
-	int loop, i, succ;
+	uint16_t *buf = data;
+	unsigned sum;
+
+	for (sum = 0; len  1; len -= 2)
+		sum += *buf++;
+	if (len)
+		sum += *(uint8_t *)buf;
+
+	sum = (sum  16) + (sum  0x);
+	sum += (sum  16);
+
+	return ~sum;
+}
+
+static int
+doping(const char *target, int loops, size_t pktsize)
+{
+	char sndbuf[IP_MAXPACKET - sizeof(struct ip)];
+	char recvbuf[IP_MAXPACKET];
 	struct sockaddr_in dst, pingee;
-	struct icmp icmp;
+	struct icmp *icmp;
 	socklen_t slen;
 	ssize_t n;
+	int loop, i, succ;
 	int x, xnon, s;
 
+	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
+	RL(x = rump_sys_fcntl(s, F_GETFL, 0));
+	xnon = x | O_NONBLOCK;
+
+	memset(dst, 0, sizeof(dst));
+	dst.sin_len = sizeof(dst);
+	dst.sin_family = AF_INET;
+	dst.sin_addr.s_addr = inet_addr(target);
+
+	icmp = (struct icmp *)sndbuf;
+	memset(icmp, 0, sizeof(*icmp));
+	icmp-icmp_type = ICMP_ECHO;
+	icmp-icmp_id = htons(37);
+
+	if (pktsize  sizeof(*icmp))
+		pktsize = sizeof(*icmp);
+	if (pktsize  sizeof(sndbuf))
+		pktsize = sizeof(sndbuf);
+
+	RL(rump_sys_setsockopt(s, SOL_SOCKET, SO_SNDBUF,
+	pktsize, sizeof(pktsize)));
+	RL(rump_sys_setsockopt(s, SOL_SOCKET, SO_RCVBUF,
+	pktsize, sizeof(pktsize)));
+
+	slen = sizeof(pingee);
+	succ = 0;
+	for (loop = 0; loop  loops; loop++) {
+		RL(rump_sys_fcntl(s, F_SETFL, x));
+		icmp-icmp_seq = htons(loop);
+		icmp-icmp_cksum = 0;
+		icmp-icmp_cksum = in_cksum(icmp, pktsize);
+		RL(rump_sys_sendto(s, icmp, pktsize, 0,
+		(struct sockaddr *)dst, sizeof(dst)));
+
+		RL(rump_sys_fcntl(s, F_SETFL, xnon));
+		while ((n = rump_sys_recvfrom(s, recvbuf, sizeof(recvbuf), 0,
+		(struct sockaddr *)pingee, slen))  0) {
+			succ++;
+		}
+		if (n == -1  errno == EAGAIN)
+			continue;
+		atf_tc_fail_errno(recv failed);
+	}
+
+	rump_sys_close(s);
+	return succ;
+}
+
+#define LOOPS 1
+
+ATF_TC_BODY(floodping, tc)
+{
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int succ;
+
 	cpid = fork();
 	rump_init();
 	netcfg_rump_makeshmif(thank-you-driver-for-getting-me-here, ifname);
@@ -132,40 +204,92 @@
 
 	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
 
-	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
-	RL(x = rump_sys_fcntl(s, F_GETFL, 0));
-	xnon = x | O_NONBLOCK;
+	succ = doping(1.1.1.10, LOOPS, 56);
+	printf(got %d/%d\n, succ, LOOPS);
 
-	memset(dst, 0, sizeof(dst));
-	dst.sin_len = sizeof(dst);
-	dst.sin_family = AF_INET;
-	dst.sin_addr.s_addr = inet_addr(1.1.1.10);
+	kill(cpid, SIGKILL);
+}
 
-	memset(icmp, 0, sizeof(icmp));
-	icmp.icmp_type = ICMP_ECHO;
-	icmp.icmp_id = htons(37);
-	icmp.icmp_cksum = htons(0xf7da);
+ATF_TC(floodping2);
+ATF_TC_HEAD(floodping2, tc)
+{
 
-	slen = sizeof(pingee);
-	succ = 0;
-	for (loop = 0; loop  LOOPS; loop++) {
-		RL(rump_sys_fcntl(s, F_SETFL, x));
-		for (i = 0; i  PERLOOP; i++) {
-			RL(rump_sys_sendto(s, icmp, sizeof(icmp), 0,
-			(struct sockaddr *)dst, sizeof(dst)));
-		}
-		RL(rump_sys_fcntl(s, F_SETFL, xnon));
-		while ((n = rump_sys_recvfrom(s, buf, sizeof(buf), 0,
-		(struct sockaddr *)pingee, slen))  0) {
-			succ++;
-		}
-		if (n == -1  errno == EAGAIN)
-			continue;
-		atf_tc_fail_errno(recv failed);
+	atf_tc_set_md_var(tc, descr, two hosts floodpinging each other);
+	atf_tc_set_md_var(tc, use.fs, true);
+}
+
+ATF_TC_BODY(floodping2, tc)
+{
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int succ;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(floodping2, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		succ = doping(1.1.1.20, LOOPS, 

CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:22:34 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a test for the ping of death.  Declare the test a success
when the receiver increases the ip toolong stat counter.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.4 src/tests/net/icmp/t_ping.c:1.5
--- src/tests/net/icmp/t_ping.c:1.4	Wed Aug 18 17:49:03 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 21:22:34 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.4 2010/08/18 17:49:03 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,20 +29,27 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.4 2010/08/18 17:49:03 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
 #include sys/resource.h
+#include sys/sysctl.h
+#include sys/wait.h
 
 #include atf-c.h
+#include assert.h
 #include fcntl.h
 #include stdio.h
 #include stdlib.h
 #include string.h
 #include unistd.h
 
+#include netinet/in.h
+#include netinet/ip_var.h
+
 #include rump/rump.h
+#include rump/rump_syscalls.h
 
 #include ../../h_macros.h
 #include ../config/netconfig.c
@@ -293,6 +300,120 @@
 	kill(cpid, SIGKILL);
 }
 
+ATF_TC(ping_of_death);
+ATF_TC_HEAD(ping_of_death, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, send a \ping of death\);
+	atf_tc_set_md_var(tc, use.fs, true);
+}
+
+ATF_TC_BODY(ping_of_death, tc)
+{
+	char data[1500];
+	struct sockaddr_in dst;
+	struct ip *ip;
+	struct icmp *icmp;
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	size_t tot, frag;
+	int s, x, loop;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(jippikaiee, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		/* wait until we receive a too long IP packet */
+		for (loop = 0;; loop++) {
+			uint64_t ipstat[IP_NSTATS];
+			size_t arglen;
+			int mib[4];
+
+			if (loop == 1)
+netcfg_rump_if(ifname,
+1.1.1.10, 255.255.255.0);
+
+			mib[0] = CTL_NET;
+			mib[1] = PF_INET;
+			mib[2] = IPPROTO_IP;
+			mib[3] = IPCTL_STATS;
+
+			arglen = sizeof(ipstat);
+			RL(rump_sys___sysctl(mib, 4, ipstat, arglen,
+			NULL, 0));
+			if (loop == 0  ipstat[IP_STAT_TOOLONG] != 0)
+_exit(1);
+			if (ipstat[IP_STAT_TOOLONG])
+break;
+			usleep(1);
+		}
+
+		_exit(0);
+		break;
+	default:
+		break;
+	}
+
+	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
+
+	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, 0));
+	x = 1;
+	RL(rump_sys_setsockopt(s, IPPROTO_IP, IP_HDRINCL, x, sizeof(x)));
+
+	memset(dst, 0, sizeof(dst));
+	dst.sin_len = sizeof(dst);
+	dst.sin_family = AF_INET;
+	dst.sin_addr.s_addr = inet_addr(1.1.1.10);
+
+	/* construct packet */
+	memset(data, 0, sizeof(data));
+	ip = (struct ip *)data;
+	ip-ip_v = 4;
+	ip-ip_hl = sizeof(*ip)  2;
+	ip-ip_p = IPPROTO_ICMP;
+	ip-ip_ttl = IPDEFTTL;
+	ip-ip_dst = dst.sin_addr;
+	ip-ip_id = 1234;
+
+	icmp = (struct icmp *)(ip + 1);
+	icmp-icmp_type = ICMP_ECHO;
+	icmp-icmp_cksum = in_cksum(icmp, sizeof(*icmp));
+
+	for (;;) {
+		int status;
+
+		/* resolve arp before sending raw stuff */
+		netcfg_rump_pingtest(1.1.1.10, 1);
+
+		for (tot = 0;
+		tot  65538 - sizeof(*ip);
+		tot += (frag - sizeof(*ip))) {
+			frag = MIN(65538 - tot, sizeof(data));
+			ip-ip_off = tot  3;
+			assert(ip-ip_off  3 == tot);
+			ip-ip_len = frag;
+
+			if (frag == sizeof(data)) {
+ip-ip_off |= IP_MF;
+			}
+
+			RL(rump_sys_sendto(s, data, frag, 0,
+			(struct sockaddr *)dst, sizeof(dst)));
+		}
+		if (waitpid(-1, status, WNOHANG)  0) {
+			if (WIFEXITED(status)  WEXITSTATUS(status) == 0)
+break;
+			atf_tc_fail(child did not exit clean);
+		}
+			
+		usleep(1);
+	}
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -300,6 +421,7 @@
 	ATF_TP_ADD_TC(tp, floodping);
 	ATF_TP_ADD_TC(tp, floodping2);
 	ATF_TP_ADD_TC(tp, pingsize);
+	ATF_TP_ADD_TC(tp, ping_of_death);
 
 	return atf_no_error();
 }



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:23:49 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
.. put a timeout here just in case the receive does not increase
the counter.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.5 src/tests/net/icmp/t_ping.c:1.6
--- src/tests/net/icmp/t_ping.c:1.5	Wed Aug 18 21:22:34 2010
+++ src/tests/net/icmp/t_ping.c	Wed Aug 18 21:23:48 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.5 2010/08/18 21:22:34 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.6 2010/08/18 21:23:48 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -306,6 +306,7 @@
 
 	atf_tc_set_md_var(tc, descr, send a \ping of death\);
 	atf_tc_set_md_var(tc, use.fs, true);
+	atf_tc_set_md_var(tc, timeout, 2);
 }
 
 ATF_TC_BODY(ping_of_death, tc)



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 16:39:22 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a two-way floodping test and a test which sends icmp echos with
various sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 17:49:03 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
send pings in ascending order


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:22:34 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
Add a test for the ping of death.  Declare the test a success
when the receiver increases the ip toolong stat counter.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Aug 18 21:23:49 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
.. put a timeout here just in case the receive does not increase
the counter.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Aug 17 15:51:11 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
add a test which floodpings another host


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_ping.c
diff -u src/tests/net/icmp/t_ping.c:1.1 src/tests/net/icmp/t_ping.c:1.2
--- src/tests/net/icmp/t_ping.c:1.1	Mon Aug  9 15:08:43 2010
+++ src/tests/net/icmp/t_ping.c	Tue Aug 17 15:51:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ping.c,v 1.1 2010/08/09 15:08:43 pooka Exp $	*/
+/*	$NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,12 +29,14 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_ping.c,v 1.1 2010/08/09 15:08:43 pooka Exp $);
+__RCSID($NetBSD: t_ping.c,v 1.2 2010/08/17 15:51:11 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
+#include sys/resource.h
 
 #include atf-c.h
+#include fcntl.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -58,7 +60,6 @@
 {
 	char ifname[IFNAMSIZ];
 	pid_t cpid;
-	int status;
 	bool win, win2;
 
 	cpid = fork();
@@ -92,10 +93,87 @@
 		atf_tc_fail(non-existent host responded);
 }
 
+ATF_TC(floodping);
+ATF_TC_HEAD(floodping, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, see how kernel responds to floodping);
+	atf_tc_set_md_var(tc, use.fs, true);
+}
+
+#define PERLOOP 100
+#define LOOPS 100
+ATF_TC_BODY(floodping, tc)
+{
+	char buf[8192];
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int loop, i, succ;
+	struct sockaddr_in dst, pingee;
+	struct icmp icmp;
+	socklen_t slen;
+	ssize_t n;
+	int x, xnon, s;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(thank-you-driver-for-getting-me-here, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		pause();
+		break;
+	default:
+		break;
+	}
+
+	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
+
+	RL(s = rump_sys_socket(PF_INET, SOCK_RAW, IPPROTO_ICMP));
+	RL(x = rump_sys_fcntl(s, F_GETFL, 0));
+	xnon = x | O_NONBLOCK;
+
+	memset(dst, 0, sizeof(dst));
+	dst.sin_len = sizeof(dst);
+	dst.sin_family = AF_INET;
+	dst.sin_addr.s_addr = inet_addr(1.1.1.10);
+
+	memset(icmp, 0, sizeof(icmp));
+	icmp.icmp_type = ICMP_ECHO;
+	icmp.icmp_id = htons(37);
+	icmp.icmp_cksum = htons(0xf7da);
+
+	slen = sizeof(pingee);
+	succ = 0;
+	for (loop = 0; loop  LOOPS; loop++) {
+		RL(rump_sys_fcntl(s, F_SETFL, x));
+		for (i = 0; i  PERLOOP; i++) {
+			RL(rump_sys_sendto(s, icmp, sizeof(icmp), 0,
+			(struct sockaddr *)dst, sizeof(dst)));
+		}
+		RL(rump_sys_fcntl(s, F_SETFL, xnon));
+		while ((n = rump_sys_recvfrom(s, buf, sizeof(buf), 0,
+		(struct sockaddr *)pingee, slen))  0) {
+			succ++;
+		}
+		if (n == -1  errno == EAGAIN)
+			continue;
+		atf_tc_fail_errno(recv failed);
+	}
+
+	printf(got %d/%d\n, succ, LOOPS * PERLOOP);
+
+	kill(cpid, SIGKILL);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
 	ATF_TP_ADD_TC(tp, simpleping);
+	ATF_TP_ADD_TC(tp, floodping);
 
 	return atf_no_error();
 }



CVS commit: src/tests/net/icmp

2010-08-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Aug 17 15:51:11 UTC 2010

Modified Files:
src/tests/net/icmp: t_ping.c

Log Message:
add a test which floodpings another host


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-08-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  9 15:08:43 UTC 2010

Modified Files:
src/tests/net/icmp: Makefile
Added Files:
src/tests/net/icmp: t_ping.c

Log Message:
test that kernel reponds to ping


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/Makefile
diff -u src/tests/net/icmp/Makefile:1.1 src/tests/net/icmp/Makefile:1.2
--- src/tests/net/icmp/Makefile:1.1	Sun Jul  4 19:30:59 2010
+++ src/tests/net/icmp/Makefile	Mon Aug  9 15:08:43 2010
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 2010/07/04 19:30:59 pooka Exp $
+# $NetBSD: Makefile,v 1.2 2010/08/09 15:08:43 pooka Exp $
 #
 
 .include bsd.own.mk
@@ -6,6 +6,7 @@
 TESTSDIR=	${TESTSBASE}/net/icmp
 
 TESTS_C=	t_forward
+TESTS_C+=	t_ping
 
 LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
 LDADD+=		-lrump -lrumpuser -lpthread

Added files:

Index: src/tests/net/icmp/t_ping.c
diff -u /dev/null src/tests/net/icmp/t_ping.c:1.1
--- /dev/null	Mon Aug  9 15:08:43 2010
+++ src/tests/net/icmp/t_ping.c	Mon Aug  9 15:08:43 2010
@@ -0,0 +1,101 @@
+/*	$NetBSD: t_ping.c,v 1.1 2010/08/09 15:08:43 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__RCSID($NetBSD: t_ping.c,v 1.1 2010/08/09 15:08:43 pooka Exp $);
+#endif /* not lint */
+
+#include sys/types.h
+
+#include atf-c.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include rump/rump.h
+
+#include ../../h_macros.h
+#include ../config/netconfig.c
+
+ATF_TC(simpleping);
+ATF_TC_HEAD(simpleping, tc)
+{
+
+	atf_tc_set_md_var(tc, descr, check that kernel responds to ping);
+	atf_tc_set_md_var(tc, use.fs, true);
+	atf_tc_set_md_var(tc, timeout, 2);
+}
+
+ATF_TC_BODY(simpleping, tc)
+{
+	char ifname[IFNAMSIZ];
+	pid_t cpid;
+	int status;
+	bool win, win2;
+
+	cpid = fork();
+	rump_init();
+	netcfg_rump_makeshmif(but-can-i-buy-your-ether-bus, ifname);
+
+	switch (cpid) {
+	case -1:
+		atf_tc_fail_errno(fork failed);
+	case 0:
+		netcfg_rump_if(ifname, 1.1.1.10, 255.255.255.0);
+		pause();
+		break;
+	default:
+		break;
+	}
+
+	netcfg_rump_if(ifname, 1.1.1.20, 255.255.255.0);
+
+	/*
+	 * The beauty of shmif is that we don't have races here.
+	 */
+	win = netcfg_rump_pingtest(1.1.1.10, 500);
+	win2 = netcfg_rump_pingtest(1.1.1.30, 500);
+
+	kill(cpid, SIGKILL);
+
+	if (!win)
+		atf_tc_fail(ping failed);
+	if (win2)
+		atf_tc_fail(non-existent host responded);
+}
+
+ATF_TP_ADD_TCS(tp)
+{
+
+	ATF_TP_ADD_TC(tp, simpleping);
+
+	return atf_no_error();
+}



CVS commit: src/tests/net/icmp

2010-08-09 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Aug  9 15:08:43 UTC 2010

Modified Files:
src/tests/net/icmp: Makefile
Added Files:
src/tests/net/icmp: t_ping.c

Log Message:
test that kernel reponds to ping


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/net/icmp/t_ping.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 14:10:32 UTC 2010

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
Remove stuff handled by common code now.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_forward.c
diff -u src/tests/net/icmp/t_forward.c:1.4 src/tests/net/icmp/t_forward.c:1.5
--- src/tests/net/icmp/t_forward.c:1.4	Mon Jul 26 14:07:04 2010
+++ src/tests/net/icmp/t_forward.c	Mon Jul 26 14:10:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_forward.c,v 1.4 2010/07/26 14:07:04 pooka Exp $	*/
+/*	$NetBSD: t_forward.c,v 1.5 2010/07/26 14:10:31 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_forward.c,v 1.4 2010/07/26 14:07:04 pooka Exp $);
+__RCSID($NetBSD: t_forward.c,v 1.5 2010/07/26 14:10:31 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -60,110 +60,6 @@
 #include ../../h_macros.h
 #include ../config/netconfig.c
 
-static void
-configure_interface(const char *busname, const char *addr, const char *mask,
-	const char *bcast)
-{
-	char ifname[32];
-	struct ifaliasreq ia;
-	struct sockaddr_in *sin;
-	int s, rv, ifnum;
-
-	if ((s = rump_pub_shmif_create(busname, ifnum)) != 0) {
-		atf_tc_fail(rump_pub_shmif_create(%d), s);
-	}
-
-	if ((s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0))  0) {
-		atf_tc_fail_errno(if config socket);
-	}
-	sprintf(ifname, shmif%d, ifnum);
-
-	/* Address */
-	memset(ia, 0, sizeof(ia));
-	strcpy(ia.ifra_name, ifname);
-	sin = (struct sockaddr_in *)ia.ifra_addr;
-	sin-sin_family = AF_INET;
-	sin-sin_len = sizeof(struct sockaddr_in);
-	sin-sin_addr.s_addr = inet_addr(addr);
-
-	/* Netmask */
-	sin = (struct sockaddr_in *)ia.ifra_mask;
-	sin-sin_family = AF_INET;
-	sin-sin_len = sizeof(struct sockaddr_in);
-	sin-sin_addr.s_addr = inet_addr(mask);
-
-	/* Broadcast address */
-	sin = (struct sockaddr_in *)ia.ifra_broadaddr;
-	sin-sin_family = AF_INET;
-	sin-sin_len = sizeof(struct sockaddr_in);
-	sin-sin_addr.s_addr = inet_addr(bcast);
-
-	rv = rump_sys_ioctl(s, SIOCAIFADDR, ia);
-	if (rv) {
-		atf_tc_fail_errno(SIOCAIFADDR);
-	}
-	rump_sys_close(s);
-}
-
-static void
-configure_routing(const char *dst, const char *mask, const char *gw)
-{
-	size_t len;
-	struct {
-		struct rt_msghdr m_rtm;
-		uint8_t m_space[512];
-	} m_rtmsg;
-#define rtm m_rtmsg.m_rtm
-	uint8_t *bp = m_rtmsg.m_space;
-	struct sockaddr_in sinstore;
-	int s, rv;
-
-	s = rump_sys_socket(PF_ROUTE, SOCK_RAW, 0);
-	if (s == -1) {
-		atf_tc_fail_errno(routing socket);
-	}
-
-	memset(m_rtmsg, 0, sizeof(m_rtmsg));
-	rtm.rtm_type = RTM_ADD;
-	rtm.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC;
-	rtm.rtm_version = RTM_VERSION;
-	rtm.rtm_seq = 2;
-	rtm.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
-
-	/* dst */
-	memset(sinstore, 0, sizeof(sinstore));
-	sinstore.sin_family = AF_INET;
-	sinstore.sin_len = sizeof(sinstore);
-	sinstore.sin_addr.s_addr = inet_addr(dst);
-	memcpy(bp, sinstore, sizeof(sinstore));
-	bp += sizeof(sinstore);
-
-	/* gw */
-	memset(sinstore, 0, sizeof(sinstore));
-	sinstore.sin_family = AF_INET;
-	sinstore.sin_len = sizeof(sinstore);
-	sinstore.sin_addr.s_addr = inet_addr(gw);
-	memcpy(bp, sinstore, sizeof(sinstore));
-	bp += sizeof(sinstore);
-
-	/* netmask */
-	memset(sinstore, 0, sizeof(sinstore));
-	sinstore.sin_family = AF_INET;
-	sinstore.sin_len = sizeof(sinstore);
-	sinstore.sin_addr.s_addr = inet_addr(mask);
-	memcpy(bp, sinstore, sizeof(sinstore));
-	bp += sizeof(sinstore);
-
-	len = bp - (uint8_t *)m_rtmsg;
-	rtm.rtm_msglen = len;
-
-	rv = rump_sys_write(s, m_rtmsg, len);
-	if (rv != (int)len) {
-		atf_tc_fail_errno(write routing message);
-	}
-	rump_sys_close(s);
-}
-
 /*
  * Since our maxttl is in our private namespace, we don't need raw packet
  * construction like traceroute(8) -- we can just use the global maxttl.
@@ -209,6 +105,7 @@
 {
 	int mib[4] = { CTL_NET, PF_INET, IPPROTO_ICMP,
 		ICMPCTL_RETURNDATABYTES };
+	char ifname[IFNAMSIZ];
 	int nv;
 
 	/* set returndatabytes to 200 */
@@ -216,7 +113,8 @@
 	if (rump_sys___sysctl(mib, 4, NULL, NULL, nv, sizeof(nv)) == -1)
 		atf_tc_fail_errno(sysctl returndatabytes);
 
-	configure_interface(bus1, 1.0.0.2, 255.255.255.0, 1.0.0.255);
+	netcfg_rump_makeshmif(bus1, ifname);
+	netcfg_rump_if(ifname, 1.0.0.2, 255.255.255.0);
 
 	/*
 	 * Wait for parent to send us the data and for us to have



CVS commit: src/tests/net/icmp

2010-07-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jul 26 14:10:32 UTC 2010

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
Remove stuff handled by common code now.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/net/icmp

2010-07-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jul 18 12:43:22 UTC 2010

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
fix routine name in error message


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/icmp/t_forward.c
diff -u src/tests/net/icmp/t_forward.c:1.1 src/tests/net/icmp/t_forward.c:1.2
--- src/tests/net/icmp/t_forward.c:1.1	Sun Jul  4 19:30:59 2010
+++ src/tests/net/icmp/t_forward.c	Sun Jul 18 12:43:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_forward.c,v 1.1 2010/07/04 19:30:59 pooka Exp $	*/
+/*	$NetBSD: t_forward.c,v 1.2 2010/07/18 12:43:22 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: t_forward.c,v 1.1 2010/07/04 19:30:59 pooka Exp $);
+__RCSID($NetBSD: t_forward.c,v 1.2 2010/07/18 12:43:22 pooka Exp $);
 #endif /* not lint */
 
 #include sys/types.h
@@ -69,7 +69,7 @@
 	int s, rv, ifnum;
 
 	if ((s = rump_pub_shmif_create(busname, ifnum)) != 0) {
-		atf_tc_fail(rump_pub_virtif_create(%d), s);
+		atf_tc_fail(rump_pub_shmif_create(%d), s);
 	}
 
 	if ((s = rump_sys_socket(PF_INET, SOCK_DGRAM, 0))  0) {



CVS commit: src/tests/net/icmp

2010-07-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jul 18 12:43:22 UTC 2010

Modified Files:
src/tests/net/icmp: t_forward.c

Log Message:
fix routine name in error message


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/tests/net/icmp

2010-07-04 Thread Antti Kantee
On Sun Jul 04 2010 at 23:08:03 +0200, Thomas Klausner wrote:
 I don't understand exactly how you're doing this, but I admire what
 you can do with it now :)

I'm happy to give a more detailed explanation on how it works, but I need
one or two questions to determine the place where I should start from.
I'm planning a short article on the unique advantages of rump in kernel
testing (four advantages by my counts so far), and some questions now
might even help me write that one about what people want to read instead
of what I guess they'd want to read.


CVS commit: src/tests/net/icmp

2010-07-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jul  4 19:30:59 UTC 2010

Added Files:
src/tests/net/icmp: Atffile Makefile t_forward.c

Log Message:
Add test case for PR kern/43548

Due to the nature of the feature under test, this one is a little
different, so let me explain how it works.

The test program forks and bootstraps a rump kernel in both processes.
It then configures shared memory interfaces in both.  shmif is nice
in that it uses a mmaped file as the bus and does not require root
privileges for communication between two (or more) processes.  The
child process then proceeds to increase icmp.returndatabytes as
indicated by the PR, while the parent process sets the global TTL
of the rump kernel to 1 (note: both values only affect the respective
rump kernels, not each other or more importantly the host kernel).
The parent then sends the bad packet which is supposed to be routed
by the child.  If ip_icmp.c was too old, *boom* + fail; otherwise
nothing bad happens and the test exists with success after one
second.

Eventually this test can be extended into a framework for automated
testing of any networking code which requires (arbitrarily complex)
routing setups.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/net/icmp/Atffile src/tests/net/icmp/Makefile \
src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/tests/net/icmp/Atffile
diff -u /dev/null src/tests/net/icmp/Atffile:1.1
--- /dev/null	Sun Jul  4 19:30:59 2010
+++ src/tests/net/icmp/Atffile	Sun Jul  4 19:30:59 2010
@@ -0,0 +1,6 @@
+Content-Type: application/X-atf-atffile; version=1
+X-NetBSD-Id: $NetBSD: Atffile,v 1.1 2010/07/04 19:30:59 pooka Exp $
+
+prop: test-suite = NetBSD
+
+tp-glob: *
Index: src/tests/net/icmp/Makefile
diff -u /dev/null src/tests/net/icmp/Makefile:1.1
--- /dev/null	Sun Jul  4 19:30:59 2010
+++ src/tests/net/icmp/Makefile	Sun Jul  4 19:30:59 2010
@@ -0,0 +1,13 @@
+# $NetBSD: Makefile,v 1.1 2010/07/04 19:30:59 pooka Exp $
+#
+
+.include bsd.own.mk
+
+TESTSDIR=	${TESTSBASE}/net/icmp
+
+TESTS_C=	t_forward
+
+LDADD+=		-lrumpnet_shmif -lrumpnet_netinet -lrumpnet_net -lrumpnet
+LDADD+=		-lrump -lrumpuser -lpthread
+
+.include bsd.test.mk
Index: src/tests/net/icmp/t_forward.c
diff -u /dev/null src/tests/net/icmp/t_forward.c:1.1
--- /dev/null	Sun Jul  4 19:30:59 2010
+++ src/tests/net/icmp/t_forward.c	Sun Jul  4 19:30:59 2010
@@ -0,0 +1,271 @@
+/*	$NetBSD: t_forward.c,v 1.1 2010/07/04 19:30:59 pooka Exp $	*/
+
+/*-
+ * Copyright (c) 2010 The NetBSD Foundation, Inc.
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
+ */
+
+#include sys/cdefs.h
+#ifndef lint
+__RCSID($NetBSD: t_forward.c,v 1.1 2010/07/04 19:30:59 pooka Exp $);
+#endif /* not lint */
+
+#include sys/types.h
+#include sys/socket.h
+#include sys/time.h
+#include sys/sysctl.h
+#include sys/wait.h
+
+#include arpa/inet.h
+
+#include netinet/in.h
+#include netinet/in_systm.h
+#include netinet/ip.h
+#include netinet/ip_icmp.h
+#include netinet/icmp_var.h
+#include net/route.h
+
+#include rump/rump.h
+#include rump/rump_syscalls.h
+
+#include atf-c.h
+#include errno.h
+#include stdio.h
+#include stdlib.h
+#include string.h
+#include unistd.h
+
+#include ../../h_macros.h
+
+static void
+configure_interface(const char *busname, const char *addr, const char *mask,
+	const char *bcast)
+{
+	char ifname[32];
+	struct ifaliasreq ia;
+	struct sockaddr_in *sin;
+	int s, rv, ifnum;
+
+	if ((s = rump_pub_shmif_create(busname, ifnum)) != 0) {
+		atf_tc_fail(rump_pub_virtif_create(%d), s);
+	}
+
+	if ((s = rump_sys_socket(PF_INET, 

CVS commit: src/tests/net/icmp

2010-07-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Jul  4 19:30:59 UTC 2010

Added Files:
src/tests/net/icmp: Atffile Makefile t_forward.c

Log Message:
Add test case for PR kern/43548

Due to the nature of the feature under test, this one is a little
different, so let me explain how it works.

The test program forks and bootstraps a rump kernel in both processes.
It then configures shared memory interfaces in both.  shmif is nice
in that it uses a mmaped file as the bus and does not require root
privileges for communication between two (or more) processes.  The
child process then proceeds to increase icmp.returndatabytes as
indicated by the PR, while the parent process sets the global TTL
of the rump kernel to 1 (note: both values only affect the respective
rump kernels, not each other or more importantly the host kernel).
The parent then sends the bad packet which is supposed to be routed
by the child.  If ip_icmp.c was too old, *boom* + fail; otherwise
nothing bad happens and the test exists with success after one
second.

Eventually this test can be extended into a framework for automated
testing of any networking code which requires (arbitrarily complex)
routing setups.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/tests/net/icmp/Atffile src/tests/net/icmp/Makefile \
src/tests/net/icmp/t_forward.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.