Module Name: src
Committed By: pooka
Date: Fri Jan 29 12:34:17 UTC 2010
Modified Files:
src/sys/rump/net/rumptest: rumptest_net.c
Log Message:
* add comment explaining why we randomize the last source ip octet
* fix bug in randomization (well, at least with the current configuration ..)
To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/rump/net/rumptest/rumptest_net.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/rump/net/rumptest/rumptest_net.c
diff -u src/sys/rump/net/rumptest/rumptest_net.c:1.18 src/sys/rump/net/rumptest/rumptest_net.c:1.19
--- src/sys/rump/net/rumptest/rumptest_net.c:1.18 Wed Jan 27 13:30:45 2010
+++ src/sys/rump/net/rumptest/rumptest_net.c Fri Jan 29 12:34:17 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: rumptest_net.c,v 1.18 2010/01/27 13:30:45 martti Exp $ */
+/* $NetBSD: rumptest_net.c,v 1.19 2010/01/29 12:34:17 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@@ -114,9 +114,14 @@
if (s == -1)
err(1, "configuration socket");
+ /*
+ * Randomize last octet of source address. This ~prevents
+ * source/dest 4-tuple re-use if this program is run a few
+ * times consecutively.
+ */
srandom(time(NULL));
myaddr = inet_addr(MYADDR);
- myaddr = htonl(ntohl(myaddr) + (random() % 126 + 1));
+ myaddr = htonl(ntohl(myaddr) + (random() % 126 + 2));
/* fill out struct ifaliasreq */
memset(&ia, 0, sizeof(ia));