Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 272255 Details for
Bug 366159
net-analyzer/hping: Patch to make hping's traceroute mode increment TTL after N retries
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add an hping option to increment the TTL after a certain number of tries in traceroute mode.
hping-3_pre20051105-tr-try-per-ttl.patch (text/plain), 4.63 KB, created by
Hank Leininger
on 2011-05-06 02:04:54 UTC
(
hide
)
Description:
Add an hping option to increment the TTL after a certain number of tries in traceroute mode.
Filename:
MIME Type:
Creator:
Hank Leininger
Created:
2011-05-06 02:04:54 UTC
Size:
4.63 KB
patch
obsolete
>diff -urNP hping3-20051105.orig//binding.c hping3-20051105/binding.c >--- hping3-20051105.orig//binding.c 2003-08-31 20:15:22.000000000 -0400 >+++ hping3-20051105/binding.c 2010-09-01 13:19:41.000000000 -0400 >@@ -46,7 +46,7 @@ > } else > (*p)++; > >- printf("\b\b\b\b\b\b\b\b\b"); >+ printf("\r"); > printf("%d: ", *p); > fflush(stdout); > >diff -urNP hping3-20051105.orig//globals.h hping3-20051105/globals.h >--- hping3-20051105.orig//globals.h 2004-06-18 05:53:11.000000000 -0400 >+++ hping3-20051105/globals.h 2010-09-01 11:00:17.000000000 -0400 >@@ -110,6 +110,8 @@ > opt_force_icmp, > icmp_ip_protocol, > icmp_cksum, >+ ttl_count, >+ sent_pkt_this_ttl, > raw_ip_protocol; > > extern unsigned char lsr[255], >diff -urNP hping3-20051105.orig//hping2.h hping3-20051105/hping2.h >--- hping3-20051105.orig//hping2.h 2004-06-04 03:22:38.000000000 -0400 >+++ hping3-20051105/hping2.h 2010-09-01 11:00:17.000000000 -0400 >@@ -126,6 +126,7 @@ > #define DEFAULT_ICMP_IP_PROTOCOL 6 /* TCP */ > #define DEFAULT_RAW_IP_PROTOCOL 6 /* TCP */ > #define DEFAULT_TRACEROUTE_TTL 1 >+#define DEFAULT_TTL_COUNT -1 /* default packets-per-ttl count: -1 means forever */ > > #define BIND_NONE 0 /* no bind */ > #define BIND_DPORT 1 /* bind destination port */ >diff -urNP hping3-20051105.orig//main.c hping3-20051105/main.c >--- hping3-20051105.orig//main.c 2004-06-18 05:53:11.000000000 -0400 >+++ hping3-20051105/main.c 2010-09-01 13:19:54.000000000 -0400 >@@ -61,6 +61,7 @@ > sent_pkt = 0, > recv_pkt = 0, > out_of_sequence_pkt = 0, >+ sent_pkt_this_ttl = 0, > sending_wait = DEFAULT_SENDINGWAIT, /* see DEFAULT_SENDINGWAIT */ > opt_rawipmode = FALSE, > opt_icmpmode = FALSE, >@@ -129,6 +130,7 @@ > icmp_ip_dstport = DEFAULT_DPORT, > opt_force_icmp = FALSE, > icmp_cksum = DEFAULT_ICMP_CKSUM, >+ ttl_count = DEFAULT_TTL_COUNT, > raw_ip_protocol = DEFAULT_RAW_IP_PROTOCOL; > > char >diff -urNP hping3-20051105.orig//parseoptions.c hping3-20051105/parseoptions.c >--- hping3-20051105.orig//parseoptions.c 2004-06-18 05:53:11.000000000 -0400 >+++ hping3-20051105/parseoptions.c 2010-09-01 11:08:45.000000000 -0400 >@@ -35,7 +35,7 @@ > OPT_RAND_DEST, OPT_RAND_SOURCE, OPT_LSRR, OPT_SSRR, OPT_ROUTE_HELP, > OPT_ICMP_IPSRC, OPT_ICMP_IPDST, OPT_ICMP_SRCPORT, OPT_ICMP_DSTPORT, > OPT_ICMP_GW, OPT_FORCE_ICMP, OPT_APD_SEND, OPT_SCAN, OPT_FASTER, >- OPT_BEEP, OPT_FLOOD }; >+ OPT_BEEP, OPT_FLOOD, OPT_TTL_COUNT }; > > static struct ago_optlist hping_optlist[] = { > { 'c', "count", OPT_COUNT, AGO_NEEDARG }, >@@ -124,6 +124,7 @@ > { '\0', "force-icmp", OPT_FORCE_ICMP, AGO_NOARG }, > { '\0', "beep", OPT_BEEP, AGO_NOARG }, > { '\0', "flood", OPT_FLOOD, AGO_NOARG }, >+ { '\0', "tr-try-per-ttl", OPT_TTL_COUNT, AGO_NEEDARG }, > AGO_LIST_TERM > }; > >@@ -552,6 +553,9 @@ > case OPT_FLOOD: > opt_flood = TRUE; > break; >+ case OPT_TTL_COUNT: >+ ttl_count = strtol(ago_optarg, NULL, 0); >+ break; > } > } > >@@ -628,6 +632,10 @@ > "when the --rand-dest option is enabled\n"); > exit(1); > } >+ else if (ttl_count <= 0 && ttl_count != -1) { >+ printf("Option error: ttl_count must > 0\n"); >+ exit(1); >+ } > > /* dependences */ > if (opt_safe == TRUE) >diff -urNP hping3-20051105.orig//send.c hping3-20051105/send.c >--- hping3-20051105.orig//send.c 2003-08-31 13:23:53.000000000 -0400 >+++ hping3-20051105/send.c 2010-09-01 13:20:16.000000000 -0400 >@@ -79,8 +79,14 @@ > else send_tcp(); > > sent_pkt++; >+ sent_pkt_this_ttl++; > Signal(SIGALRM, send_packet); > >+ if (ttl_count != -1 && ttl_count <= sent_pkt_this_ttl && ctrlzbind == BIND_TTL) { >+ sent_pkt_this_ttl = 0; >+ kill(getpid(), SIGTSTP); >+ } >+ > if (count != -1 && count == sent_pkt) { /* count reached? */ > Signal(SIGALRM, print_statistics); > alarm(COUNTREACHED_TIMEOUT); >diff -urNP hping3-20051105.orig//usage.c hping3-20051105/usage.c >--- hping3-20051105.orig//usage.c 2004-06-18 05:53:11.000000000 -0400 >+++ hping3-20051105/usage.c 2010-09-01 11:00:17.000000000 -0400 >@@ -100,6 +100,7 @@ > " --tr-stop Exit when receive the first not ICMP in traceroute mode\n" > " --tr-keep-ttl Keep the source TTL fixed, useful to monitor just one hop\n" > " --tr-no-rtt Don't calculate/show RTT information in traceroute mode\n" >+" --tr-try-per-ttl Max tries at a given TTL value before auto-incrementing\n" > "ARS packet description (new, unstable)\n" > " --apd-send Send the packet described with APD (see docs/APD.txt)\n" > ); >diff -urNP hping3-20051105.orig//waitpacket.c hping3-20051105/waitpacket.c >--- hping3-20051105.orig//waitpacket.c 2004-06-18 05:53:11.000000000 -0400 >+++ hping3-20051105/waitpacket.c 2010-09-01 13:20:28.000000000 -0400 >@@ -124,7 +124,10 @@ > } > > if (match) >+ { > recv_pkt++; >+ sent_pkt_this_ttl = 0; >+ } > > /* Dump the packet in hex */ > if (opt_hexdump && match && !opt_quiet)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 366159
:
272253
| 272255