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-236-g3853b


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-236-g3853b33
Date: Thu, 17 Jan 2013 01:21:26 +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  3853b33cf34fcf0773a861947bfd9b7b7731815f (commit)
      from  ab029ce23a3cfa9f2051cb07fa7c16228c5d3775 (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=3853b33cf34fcf0773a861947bfd9b7b7731815f


commit 3853b33cf34fcf0773a861947bfd9b7b7731815f
Author: Mats Erik Andersson <address@hidden>
Date:   Thu Jan 17 01:51:12 2013 +0100

    ping6: Verbose packet info.

diff --git a/ChangeLog b/ChangeLog
index a9a190b..6afd5d9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-01-17  Mats Erik Andersson  <address@hidden>
+
+       * ping/ping6.c: Include <arpa/inet.h>.
+       (print_ip_data): New function.
+       (print_icmp_error): In verbose mode, let print_ip_data()
+       display information on returned packet.
+
+       * ping/ping_echo.c (print_icmp): Use bitwise-and in test.
+
 2013-01-16  Mats Erik Andersson  <address@hidden>
 
        * ping/ping_echo.c (print_ip_header): Empirically test
diff --git a/NEWS b/NEWS
index e5a9fea..f7b703c 100644
--- a/NEWS
+++ b/NEWS
@@ -66,7 +66,8 @@ Can be built with PAM support.  New option `-l/--logging'.
 
 * rlogind
 
-Support for IPv6.  New switches `-4/--ipv4', `-6/--ipv6',
+Support for IPv6.  Buildable with libwrap support for use in
+stand-alone daemon mode.  New switches `-4/--ipv4', `-6/--ipv6',
 and `-S/--server-principal'.
 
 * rshd
diff --git a/ping/ping6.c b/ping/ping6.c
index ff3f4b7..77b4f03 100644
--- a/ping/ping6.c
+++ b/ping/ping6.c
@@ -31,6 +31,7 @@
 #include <netinet/in.h>
 #include <netinet/ip6.h>
 #include <netinet/icmp6.h>
+#include <arpa/inet.h>
 
 #include <netdb.h>
 #include <unistd.h>
@@ -662,6 +663,58 @@ print_param_prob (struct icmp6_hdr *icmp6)
   printf ("Unknown code %d\n", icmp6->icmp6_code);
 }
 
+void
+print_ip_data (struct icmp6_hdr *icmp6)
+{
+  size_t j;
+  struct ip6_hdr *ip = (struct ip6_hdr *) ((char *) icmp6 + sizeof (*icmp6));
+  char src[INET6_ADDRSTRLEN], dst[INET6_ADDRSTRLEN];
+
+  (void) inet_ntop (AF_INET6, &ip->ip6_dst, dst, sizeof (dst));
+  (void) inet_ntop (AF_INET6, &ip->ip6_src, src, sizeof (src));
+
+  printf ("IP Header Dump:\n ");
+  for (j = 0; j < sizeof (*ip) - sizeof (ip->ip6_src) - sizeof (ip->ip6_dst); 
++j)
+    printf ("%02x%s", *((unsigned char *) ip + j),
+           (j % 2) ? " " : "");        /* Group bytes two by two.  */
+  printf ("(src) (dst)\n");
+
+  printf ("Vr TC Flow Plen Nxt Hop Src\t\t  Dst\n");
+  printf (" %1x %02x %04x %4hu %3hhu %3hhu %s %s\n",
+         ntohl (ip->ip6_flow) >> 28,
+         (ntohl (ip->ip6_flow) & 0x0fffffff) >> 20,
+         ntohl (ip->ip6_flow) & 0x0fffff,
+         ntohs (ip->ip6_plen), ip->ip6_nxt, ip->ip6_hlim,
+         src, dst);
+
+  switch (ip->ip6_nxt)
+    {
+    case IPPROTO_ICMPV6:
+      {
+       struct icmp6_hdr *hdr =
+         (struct icmp6_hdr *) ((unsigned char *) ip + sizeof (*ip));
+
+       printf ("ICMP: type %hhu, code %hhu, size %hu",
+               hdr->icmp6_type, hdr->icmp6_code, ntohs (ip->ip6_plen));
+       switch (hdr->icmp6_type)
+         {
+         case ICMP6_ECHO_REQUEST:
+         case ICMP6_ECHO_REPLY:
+           printf (", id 0x%04x, seq 0x%04x",
+                   ntohs (hdr->icmp6_id), ntohs (hdr->icmp6_seq));
+           break;
+         default:
+           break;
+         }
+      }
+      break;
+    default:
+      break;
+    }
+
+  printf ("\n");
+};
+
 static struct icmp_diag
 {
   int type;
@@ -688,6 +741,9 @@ print_icmp_error (struct sockaddr_in6 *from, struct 
icmp6_hdr *icmp6, int len)
       if (p->type == icmp6->icmp6_type)
        {
          p->func (icmp6);
+         if (options & OPT_VERBOSE)
+           print_ip_data (icmp6);
+
          return;
        }
     }
diff --git a/ping/ping_echo.c b/ping/ping_echo.c
index 70c5b1d..634e178 100644
--- a/ping/ping_echo.c
+++ b/ping/ping_echo.c
@@ -373,7 +373,7 @@ static void
 print_icmp (icmphdr_t * icmp, void *data)
 {
   print_icmp_code (icmp->icmp_type, icmp->icmp_code, data);
-  if (options && OPT_VERBOSE)
+  if (options & OPT_VERBOSE)
     print_ip_data (icmp, NULL);
 }
 

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

Summary of changes:
 ChangeLog        |    9 ++++++++
 NEWS             |    3 +-
 ping/ping6.c     |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 ping/ping_echo.c |    2 +-
 4 files changed, 68 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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