Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/rump/net/rumptest * add comment explaining why we random...
details: https://anonhg.NetBSD.org/src/rev/4fa794e35276
branches: trunk
changeset: 751244:4fa794e35276
user: pooka <pooka%NetBSD.org@localhost>
date: Fri Jan 29 12:34:17 2010 +0000
description:
* add comment explaining why we randomize the last source ip octet
* fix bug in randomization (well, at least with the current configuration ..)
diffstat:
sys/rump/net/rumptest/rumptest_net.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r 52095ca4808c -r 4fa794e35276 sys/rump/net/rumptest/rumptest_net.c
--- a/sys/rump/net/rumptest/rumptest_net.c Fri Jan 29 12:22:00 2010 +0000
+++ b/sys/rump/net/rumptest/rumptest_net.c Fri Jan 29 12:34:17 2010 +0000
@@ -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));
Home |
Main Index |
Thread Index |
Old Index