diff options
author | Marco Bonetti <sid77@slackware.it> | 2010-05-13 00:36:41 +0200 |
---|---|---|
committer | Robby Workman <rworkman@slackbuilds.org> | 2010-05-13 00:36:41 +0200 |
commit | 091531ddf4f532a5a7263f2982945e4141be7df7 (patch) | |
tree | c5745ad30d0b95d1202750fdfc3b9a50b5c5036b /network/hping3/patches/ip_id_field.diff | |
parent | e007a532993f218458af923574634886a1fac1ee (diff) | |
download | slackbuilds-091531ddf4f532a5a7263f2982945e4141be7df7.tar.gz |
network/hping3: Updated for version 20051105
Diffstat (limited to 'network/hping3/patches/ip_id_field.diff')
-rw-r--r-- | network/hping3/patches/ip_id_field.diff | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/network/hping3/patches/ip_id_field.diff b/network/hping3/patches/ip_id_field.diff new file mode 100644 index 0000000000..bcd2029fe8 --- /dev/null +++ b/network/hping3/patches/ip_id_field.diff @@ -0,0 +1,64 @@ +--- a/docs/hping2.8 ++++ b/docs/hping2.8 +@@ -343,7 +343,7 @@ + .I -N --id + Set ip->id field. Default id is random but if fragmentation is turned on + and id isn't specified it will be +-.BR "getpid() & 0xFF" , ++.BR "getpid() & 0xFFFF" , + to implement a better solution is in TODO list. + .TP + .I -H --ipproto +@@ -714,4 +714,4 @@ + a solaris problem, as stated in the tcpdump-workers mailing list, + so the libpcap can't do nothing to handle it properly. + .SH SEE ALSO +-ping(8), traceroute(8), ifconfig(8), nmap(1) +\ No newline at end of file ++ping(8), traceroute(8), ifconfig(8), nmap(1) +--- a/docs/hping3.8 ++++ b/docs/hping3.8 +@@ -352,7 +352,7 @@ + .I -N --id + Set ip->id field. Default id is random but if fragmentation is turned on + and id isn't specified it will be +-.BR "getpid() & 0xFF" , ++.BR "getpid() & 0xFFFF" , + to implement a better solution is in TODO list. + .TP + .I -H --ipproto +--- a/hping2.h ++++ b/hping2.h +@@ -121,7 +121,7 @@ + #define DEFAULT_ICMP_IP_IHL (IPHDR_SIZE >> 2) + #define DEFAULT_ICMP_IP_TOS 0 + #define DEFAULT_ICMP_IP_TOT_LEN 0 /* computed by send_icmp_*() */ +-#define DEFAULT_ICMP_IP_ID 0 /* rand */ ++#define DEFAULT_ICMP_IP_ID -1 /* rand */ + #define DEFAULT_ICMP_CKSUM -1 /* -1 means compute the cksum */ + #define DEFAULT_ICMP_IP_PROTOCOL 6 /* TCP */ + #define DEFAULT_RAW_IP_PROTOCOL 6 /* TCP */ +--- a/parseoptions.c ++++ b/parseoptions.c +@@ -463,6 +463,10 @@ + break; + case OPT_ICMP_IPID: + icmp_ip_id = strtol(ago_optarg, NULL, 0); ++ if (icmp_ip_id < 0 || icmp_ip_id > 0xffff) { ++ fprintf(stderr, "Bad ICMP IP ID, resetting to random.\n"); ++ icmp_ip_id = DEFAULT_ICMP_IP_ID; ++ } + break; + case OPT_ICMP_IPPROTO: + icmp_ip_protocol = strtol(ago_optarg, NULL, 0); +--- a/sendicmp.c ++++ b/sendicmp.c +@@ -83,7 +83,7 @@ + icmp->type = opt_icmptype; /* echo replay or echo request */ + icmp->code = opt_icmpcode; /* should be indifferent */ + icmp->checksum = 0; +- icmp->un.echo.id = getpid() & 0xffff; ++ icmp->un.echo.id = icmp_ip_id == DEFAULT_ICMP_IP_ID ? getpid() & 0xffff : icmp_ip_id; + icmp->un.echo.sequence = _icmp_seq; + + /* data */ |