pkgsrc/net/hping/patches/patch-aa
salo d898109ed6 Update to hping2, release candidate 3
Changes:
- don't install hping suid root by default, add "hping-suid" option.
- add bunch on patches from Pavel Kankovsky <peak at argo.troja.mff.cuni.cz>
  namely: add --flood and --tcp-mss options (self-explanatory), some checksum
  and interface binding fixes and warning fixes

2.0.0rc3:
=======
FIX: Fix for interface guessing with aliases on BSD
     Thanks <michel.gravey(@)orange.fr> and <cognet(@)freebsd.org>
FIX: fixed cksum.c. Bad outgoing packet checksum with some packet.
     Thanks to Brett Eldridge <beldridg@pobox.com>.
ADD: scan mode (--scan)
ADD: A rc4-based PRNG to use with --rand-source and --rand-dest
FIX: Fix -I option for BSD/Apple
ADD: Add support for BSDI and MacOSX (thanks
     Dennis Opacki <dopacki@adotout.com> and Jan-Hinrich Fessel
     <Jan-Hinrich.Fessel@T-Mobile.de>)
ADD: A few useful ICMP options
ADD: Add support for :
     WLAN (Fabian Melzow <biop0b@web.de>)
     ATM (Debian bug #193436, thanks to Domenico Andreoli)
     Token Ring (jim.r.halfpenny@britishairways.com)
ADD: MacOSX patches (Hans-Joachim Knobloch <knobloch@secorvo.de>)
FIX: --rand-source patches from Quentin Garnier <hping@quatriemek.com>
     . ensure randomness
     . do not stop on errors when using a E or D class address (BSD only?)
2006-03-30 13:51:28 +00:00

76 lines
1.6 KiB
Text

$NetBSD: patch-aa,v 1.3 2006/03/30 13:51:29 salo Exp $
--- main.c.orig 2003-08-08 01:55:55.000000000 +0200
+++ main.c 2005-11-05 21:45:04.000000000 +0100
@@ -47,7 +47,8 @@
signlen,
lsr_length = 0,
ssr_length = 0,
- tcp_ack;
+ tcp_ack,
+ tcp_mss;
unsigned short int
@@ -65,6 +66,7 @@
recv_pkt = 0,
out_of_sequence_pkt = 0,
sending_wait = DEFAULT_SENDINGWAIT, /* see DEFAULT_SENDINGWAIT */
+ opt_flood = FALSE,
opt_rawipmode = FALSE,
opt_icmpmode = FALSE,
opt_udpmode = FALSE,
@@ -98,6 +100,7 @@
opt_tcpexitcode = FALSE,
opt_badcksum = FALSE,
opt_tr_keep_ttl = FALSE,
+ opt_tcp_mss = FALSE,
opt_tcp_timestamp = FALSE,
opt_tr_stop = FALSE,
opt_tr_no_rtt = FALSE,
@@ -179,6 +182,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"
"Try `hping2 --help' for more information.\n");
@@ -219,13 +233,6 @@
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 */
socket_broadcast(sockraw);
/* set SO_IPHDRINCL option */
@@ -355,6 +362,13 @@
}
}
+ /* flood mode */
+ if (opt_flood) {
+ printf("Flooding...\n");
+ for (;;)
+ send_packet(0 /* dummy */);
+ }
+
/* start packet sending */
kill(getpid(), SIGALRM);