Package: hping3
Version: 3.a2.ds2-2
Severity: normal
Tags: patch

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages hping3 depends on:
ii  libc6                         2.7-10     GNU C Library: Shared libraries
ii  libpcap0.8                    0.9.8-3    system interface for user-level pa
ii  tcl8.4                        8.4.19-2   Tcl (the Tool Command Language) v8

hping3 recommends no packages.

-- no debconf information
diff -Nru hping3-3.a2.ds2/docs/hping2.8 hping3-3.a2.ds2x/docs/hping2.8
--- hping3-3.a2.ds2/docs/hping2.8       2005-03-12 11:13:11.000000000 +0100
+++ hping3-3.a2.ds2x/docs/hping2.8      2008-05-25 13:48:21.000000000 +0200
@@ -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)
diff -Nru hping3-3.a2.ds2/docs/hping3.8 hping3-3.a2.ds2x/docs/hping3.8
--- hping3-3.a2.ds2/docs/hping3.8       2005-03-12 11:13:11.000000000 +0100
+++ hping3-3.a2.ds2x/docs/hping3.8      2008-05-25 13:48:34.000000000 +0200
@@ -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
diff -Nru hping3-3.a2.ds2/hping2.h hping3-3.a2.ds2x/hping2.h
--- hping3-3.a2.ds2/hping2.h    2005-03-12 11:13:11.000000000 +0100
+++ hping3-3.a2.ds2x/hping2.h   2008-05-25 12:48:23.000000000 +0200
@@ -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 */
diff -Nru hping3-3.a2.ds2/parseoptions.c hping3-3.a2.ds2x/parseoptions.c
--- hping3-3.a2.ds2/parseoptions.c      2005-03-12 11:13:11.000000000 +0100
+++ hping3-3.a2.ds2x/parseoptions.c     2008-05-25 13:16:11.000000000 +0200
@@ -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);
diff -Nru hping3-3.a2.ds2/sendicmp.c hping3-3.a2.ds2x/sendicmp.c
--- hping3-3.a2.ds2/sendicmp.c  2005-03-12 11:13:11.000000000 +0100
+++ hping3-3.a2.ds2x/sendicmp.c 2008-05-25 13:24:49.000000000 +0200
@@ -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 */

Reply via email to