summaryrefslogtreecommitdiff
path: root/net/hping/patches
diff options
context:
space:
mode:
authoratatat <atatat@pkgsrc.org>2002-04-04 17:02:30 +0000
committeratatat <atatat@pkgsrc.org>2002-04-04 17:02:30 +0000
commit0fc5d6b01c1b853df6e8fe699b6f270cd4d6c866 (patch)
treefbe13b4313967b393bfb0d7617d154ade2ba22af /net/hping/patches
parent97bd97796e4657412b02aa8f53c7bef0adbd4fc6 (diff)
downloadpkgsrc-0fc5d6b01c1b853df6e8fe699b6f270cd4d6c866.tar.gz
Add a pkg for hping (aka hping2). Sort of an amalgam of ping,
traceroute, and nmap, hping can be used to traceroute through packet filtering routers. Among other things.
Diffstat (limited to 'net/hping/patches')
-rw-r--r--net/hping/patches/patch-aa39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/hping/patches/patch-aa b/net/hping/patches/patch-aa
new file mode 100644
index 00000000000..6bdda51a232
--- /dev/null
+++ b/net/hping/patches/patch-aa
@@ -0,0 +1,39 @@
+$NetBSD: patch-aa,v 1.1.1.1 2002/04/04 17:02:30 atatat Exp $
+
+Do *ALL* the root stuff right up front and then completely lose
+privileges.
+
+--- main.c.orig Mon Aug 13 20:07:33 2001
++++ main.c Fri Mar 29 23:46:01 2002
+@@ -150,6 +150,17 @@
+ char setflags[1024] = {'\0'};
+ int c, hdr_size;
+
++ /* open raw socket */
++ sockraw = open_sockraw();
++ if (sockraw == -1) {
++ printf("[main] can't open raw socket\n");
++ exit(1);
++ }
++ if (getuid() && setuid(getuid()) == -1) {
++ printf("[main] can't drop privs\n");
++ exit(1);
++ }
++
+ if ( parse_options(argc, argv) == -1 )
+ {
+ printf("hping2: missing host argument\n"
+@@ -187,13 +199,6 @@
+ {
+ printf("using %s, addr: %s, MTU: %d\n",
+ ifname, ifstraddr, h_if_mtu);
+- }
+-
+- /* open raw socket */
+- sockraw = open_sockraw();
+- if (sockraw == -1) {
+- printf("[main] can't open raw socket\n");
+- exit(1);
+ }
+
+ /* set SO_BROADCAST option */