commit-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-229-gfb9dc


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-229-gfb9dcf4
Date: Thu, 27 Dec 2012 19:02:18 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Inetutils ".

The branch, master has been updated
       via  fb9dcf487b3cac5bf6d32923241193bb967a9cb4 (commit)
      from  160598f05ba99a6abc4852314679548c209f5831 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=fb9dcf487b3cac5bf6d32923241193bb967a9cb4


commit fb9dcf487b3cac5bf6d32923241193bb967a9cb4
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Dec 27 17:35:29 2012 +0100

    traceroute: Common behaviour.

diff --git a/ChangeLog b/ChangeLog
index 9e5a1cb..9131746 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,22 @@
+2012-12-27  Mats Erik Andersson  <address@hidden>
+
+       traceroute: Conform to standard application set-up.
+
+       * src/traceroute.c (opt_type): Default to TRACE_UDP.
+       (opt_port): Set to TRACE_UDP_PORT.
+       (opt_ttl, opt_wait): New variables.
+       (argp_options): New options `-f/--first-hop', `-I/--icmp',
+       and `-w/--wait'.
+       (parse_opt) <`p', `t'> : Use strtol() for better sanitation.
+       <`f', `I', `w'>: New cases.
+       (main): Free RHOST after use.
+       [HAVE_IDN]: Free `hostname'.
+       (do_try): Set timer from `opt_wait'.
+       (trace_init): Set `t->ttl' from `opt_ttl'.
+
+       * doc/inetutils.texi <traceroute invocation>: Update
+       with new options.  Add a section on diagnostics.
+
 2012-12-19  Mats Erik Andersson  <address@hidden>
 
        Detect a writable directory for better coverage.
diff --git a/doc/inetutils.texi b/doc/inetutils.texi
index 47573fa..663744a 100644
--- a/doc/inetutils.texi
+++ b/doc/inetutils.texi
@@ -879,12 +879,29 @@ traceroute address@hidden@dots{}] @var{host}
 @anchor{traceroute options}
 
 @table @option
address@hidden -f @var{num}
address@hidden address@hidden
address@hidden -f
address@hidden --first-hop
+Set the initial hop distance to @var{num}, instead of the default 1.
+This immediately allows probing packets to sense routing
+properties closer to the target host, skipping routers close
+to the local host.  Quicker analysis of problems known to lie
+at some routing distance is the outcome.
+
address@hidden -I
address@hidden --icmp
address@hidden -I
address@hidden --icmp
+Use ICMP ECHO datagrams for probing the remote host.
+
 @item -M @var{method}
 @itemx address@hidden
 @opindex -M
 @opindex --type
 Use @var{method} as carrier packets for traceroute operations.
-Supported choices are @samp{icmp} and @samp{udp}.
+Supported choices are @samp{icmp} and @samp{udp}, where @samp{udp}
+is the default type.
 
 @item -p @var{port}
 @itemx address@hidden
@@ -909,6 +926,60 @@ Attempt to resolve all addresses as hostnames.
 @opindex --tos
 Set type-of-service, TOS field, to @var{num} on
 transmitted packets.
+
address@hidden -w @var{num}
address@hidden address@hidden
address@hidden -w
address@hidden --wait
+Set timeout in seconds, within which a returning response
+packet is accepted as such.
+Default waiting time is three seconds.
address@hidden table
+
address@hidden Diagnostic tokens
address@hidden printing}
+
+During execution, @command{traceroute} sends three datagrams
+for each value for the TTL field, printing a diagnostic line
+of output for these.  The TTL field is then steadily increased
+until the intended host responds, or some intermediary gateway
+returns a datagram to the effect that the target cannot be
+reached due to one reason or another.
+
+Each line of output displays a sequence number, followed by
+diagnostic annotation.  Any responding host has its address
+printed without repetition, together with a measured timing.
+In case there is no response within a time period of three seconds,
+an asterisque @samp{*} is printed.
+
+When an intermediate router responds with an exceptional state,
+the time elapsed since emitting the original datagram is printed,
+followed by an additional short hand hint of the reason:
+
address@hidden @samp
address@hidden !F
+Fragmentation needed by gateway.
+
address@hidden !H
+Host not reachable from gateway.
+
address@hidden !N
+Network not reachable from gateway.
+
address@hidden !P
+Protocol not usable at host, or within network.
+
address@hidden !S
+Source routing failed at gateway.
+
address@hidden !T
+Host or network not reachable for stated type of service, TOS.
+
address@hidden !U
+Isolated host, not reachable.
+
address@hidden !X
+Forbidden by remote administration.
 @end table
 
 @node whois invocation
diff --git a/src/traceroute.c b/src/traceroute.c
index 8819336..d6f75f0 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -106,12 +106,14 @@ struct sockaddr_in dest;
  */
 const char unreach_sign[NR_ICMP_UNREACH + 2] = "NHPPFS**U**TTXXX";
 
-static enum trace_type opt_type = TRACE_ICMP;
-int opt_port = 33434;
+static enum trace_type opt_type = TRACE_UDP;
+int opt_port = TRACE_UDP_PORT;
 int opt_max_hops = 64;
 static int opt_max_tries = 3;
 int opt_resolve_hostnames = 0;
 int opt_tos = -1;      /* Triggers with non-negative values.  */
+int opt_ttl = TRACE_TTL;
+int opt_wait = TIME_INTERVAL;
 
 const char args_doc[] = "HOST";
 const char doc[] = "Print the route packets trace to network host.";
@@ -127,6 +129,9 @@ enum {
 
 static struct argp_option argp_options[] = {
 #define GRP 0
+  {"first-hop", 'f', "NUM", 0, "set initial hop distance, i.e., time-to-live",
+   GRP+1},
+  {"icmp", 'I', NULL, 0, "use ICMP ECHO as probe", GRP+1},
   {"port", 'p', "PORT", 0, "use destination PORT port (default: 33434)",
    GRP+1},
   {"resolve-hostnames", OPT_RESOLVE, NULL, 0, "resolve hostnames", GRP+1},
@@ -134,7 +139,9 @@ static struct argp_option argp_options[] = {
   {"tries", 'q', "NUM", 0, "send NUM probe packets per hop (default: 3)",
    GRP+1},
   {"type", 'M', "METHOD", 0, "use METHOD (`icmp' or `udp') for traceroute "
-   "operations", GRP+1},
+   "operations, defaulting to `udp'", GRP+1},
+  {"wait", 'w', "NUM", 0, "wait NUM seconds for response (default: 3)",
+   GRP+1},
 #undef GRP
   {NULL, 0, NULL, 0, NULL, 0}
 };
@@ -147,9 +154,19 @@ parse_opt (int key, char *arg, struct argp_state *state)
 
   switch (key)
     {
+    case 'f':
+      opt_ttl = strtol (arg, &p, 0);
+      if (*p || opt_ttl <= 0 || opt_ttl > 255)
+        error (EXIT_FAILURE, 0, "impossible distance `%s'", arg);
+      break;
+
+    case 'I':
+      opt_type = TRACE_ICMP;
+      break;
+
     case 'p':
-      opt_port = strtoul (arg, &p, 0);
-      if (*p || opt_port == 0 || opt_port > 65536)
+      opt_port = strtol (arg, &p, 0);
+      if (*p || opt_port <= 0 || opt_port > 65536)
         error (EXIT_FAILURE, 0, "invalid port number `%s'", arg);
       break;
 
@@ -162,7 +179,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
       break;
 
     case 't':
-      opt_tos = strtoul (arg, &p, 0);
+      opt_tos = strtol (arg, &p, 0);
       if (*p || opt_tos < 0 || opt_tos > 255)
        error (EXIT_FAILURE, 0, "invalid TOS value `%s'", arg);
       break;
@@ -176,6 +193,12 @@ parse_opt (int key, char *arg, struct argp_state *state)
         argp_error (state, "invalid method");
       break;
 
+    case 'w':
+      opt_wait = strtol (arg, &p, 0);
+      if (*p || opt_wait < 0 || opt_wait > 60)
+       error (EXIT_FAILURE, 0, "ridiculous waiting time `%s'", arg);
+      break;
+
     case OPT_RESOLVE:
       opt_resolve_hostnames = 1;
       break;
@@ -236,6 +259,8 @@ main (int argc, char **argv)
 
 #ifdef HAVE_IDN
   rc = idna_to_ascii_lz (hostname, &rhost, 0);
+  free (hostname);
+
   if (rc)
     error (EXIT_FAILURE, 0, "unknown host");
 #else /* !HAVE_IDN */
@@ -243,6 +268,8 @@ main (int argc, char **argv)
 #endif
 
   rc = getaddrinfo (rhost, NULL, &hints, &res);
+  free (rhost);
+
   if (rc)
     error (EXIT_FAILURE, 0, "unknown host");
 
@@ -297,7 +324,7 @@ do_try (trace_t * trace, const int hop,
       FD_SET (fd, &readset);
 
       memset (&time, 0, sizeof (time));                /* 64-bit issue.  */
-      time.tv_sec = TIME_INTERVAL;
+      time.tv_sec = opt_wait;
       time.tv_usec = 0;
 
       if (!readonly)
@@ -401,7 +428,7 @@ trace_init (trace_t * t, const struct sockaddr_in to,
 
   t->type = type;
   t->to = to;
-  t->ttl = TRACE_TTL;
+  t->ttl = opt_ttl;
 
   if (t->type == TRACE_UDP)
     {

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog          |   19 +++++++++++++
 doc/inetutils.texi |   73 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/traceroute.c   |   43 +++++++++++++++++++++++++-----
 3 files changed, 126 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]