From MAILER-DAEMON Tue Feb 09 16:44:05 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aTG4r-0001p9-Cw
	for mharc-commit-inetutils@gnu.org; Tue, 09 Feb 2016 16:44:05 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:57706)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aTG4o-0001oM-Jy
	for commit-inetutils@gnu.org; Tue, 09 Feb 2016 16:44:03 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aTG4n-0000lb-9N
	for commit-inetutils@gnu.org; Tue, 09 Feb 2016 16:44:02 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:49291)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aTG4n-0000lT-5v
	for commit-inetutils@gnu.org; Tue, 09 Feb 2016 16:44:01 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1aTG4h-0002cf-Fw
	for commit-inetutils@gnu.org; Tue, 09 Feb 2016 21:43:57 +0000
Date: Tue, 09 Feb 2016 21:43:55 +0000
Message-Id: <E1aTG4h-0002cf-Fw@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-21-g5ab869f
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 192a0fc6a0b3d891dec9708be31d0ab49a16738d
X-Git-Newrev: 5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 09 Feb 2016 21:44:03 -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  5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba (commit)
      from  192a0fc6a0b3d891dec9708be31d0ab49a16738d (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=5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba


commit 5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Tue Feb 9 22:42:00 2016 +0100

    Properly disable the generation of ping6.

diff --git a/ChangeLog b/ChangeLog
index 0092933..6b53b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-09  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	* configure.ac (missing ipv6 or icmp6): Disable `ping6' using
+	the macro IU_DISABLE_TARGET.
+
 2016-01-23  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ftp: Allow remote user in command.
diff --git a/configure.ac b/configure.ac
index e1dfcff..2edc6b4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -463,7 +463,7 @@ else
 fi
 
 if test "$ipv6" = "no" || test "$working_ipv6" = "no";then
-  ping6_BUILD=''
+  IU_DISABLE_TARGET([ping6])
 else
   working_icmp6=yes
   AC_CHECK_HEADER(netinet/icmp6.h, , working_icmp6=no,
@@ -552,7 +552,7 @@ else
 
   if test "$working_icmp6" = "no"; then
     AC_MSG_WARN([ICMPv6 support not available, disabling ping6])
-    ping6_BUILD=''
+    IU_DISABLE_TARGET([ping6])
   fi
 fi
 

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

Summary of changes:
 ChangeLog    |    5 +++++
 configure.ac |    4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Feb 12 10:36:20 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aUFlc-0005hI-Fn
	for mharc-commit-inetutils@gnu.org; Fri, 12 Feb 2016 10:36:20 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:54048)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aUFla-0005eX-SC
	for commit-inetutils@gnu.org; Fri, 12 Feb 2016 10:36:19 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aUFlZ-0001dO-Bb
	for commit-inetutils@gnu.org; Fri, 12 Feb 2016 10:36:18 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:55643)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aUFlZ-0001dH-8A
	for commit-inetutils@gnu.org; Fri, 12 Feb 2016 10:36:17 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1aUFkx-00074C-Bm
	for commit-inetutils@gnu.org; Fri, 12 Feb 2016 15:35:40 +0000
Date: Fri, 12 Feb 2016 15:35:39 +0000
Message-Id: <E1aUFkx-00074C-Bm@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-22-g05a2f93
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba
X-Git-Newrev: 05a2f938e3f56ce0136966136410c5f9e20c37a7
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Fri, 12 Feb 2016 15:36:20 -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  05a2f938e3f56ce0136966136410c5f9e20c37a7 (commit)
      from  5ab869ff3fe95ad07b4dd919ba91b64e7c3183ba (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=05a2f938e3f56ce0136966136410c5f9e20c37a7


commit 05a2f938e3f56ce0136966136410c5f9e20c37a7
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Feb 12 14:45:33 2016 +0100

    ping: Implement subprivileged echo method.
    
    The change implements a setuid-less use case of echo pinging
    for use on GNU/Linux systems.  The new mode is the fallback
    when a raw socket mode fails.

diff --git a/ChangeLog b/ChangeLog
index 6b53b0c..3c42992 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2016-02-12  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ping: Implement subprivileged echo method.
+	Add fallback code usable by GNU/Linux to create a datagram
+	socket for sending ICMP ECHOREQUEST.  The change is related
+	to issue #37252.
+
+	* ping/libping.c (useless_ident): New variable.
+	(ping_init): When a raw socket fails, fall back to a datagram
+	socket.  In case of success, increase `useless_ident' since
+	the kernel choses a packet identity, overwriting our choice.
+	(my_echo_reply, ping_recv): Short circuit the tests for packet
+	identity with the value of `useless_identity'.
+
 2016-02-09  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	* configure.ac (missing ipv6 or icmp6): Disable `ping6' using
diff --git a/ping/libping.c b/ping/libping.c
index e85d58b..0d77d41 100644
--- a/ping/libping.c
+++ b/ping/libping.c
@@ -39,6 +39,8 @@
 
 #include "ping.h"
 
+static int useless_ident = 0;	/* Relevant at least for Linux.  */
+
 static size_t _ping_packetsize (PING * p);
 
 size_t
@@ -72,8 +74,28 @@ ping_init (int type, int ident)
   if (fd < 0)
     {
       if (errno == EPERM || errno == EACCES)
-	fprintf (stderr, "ping: Lacking privilege for raw socket.\n");
-      return NULL;
+	{
+	  errno = 0;
+
+	  /* At least Linux can allow subprivileged users to send ICMP
+	   * packets formally encapsulated and built as a datagram socket,
+	   * but then the identity number is set by the kernel itself.
+	   */
+	  fd = socket (AF_INET, SOCK_DGRAM, proto->p_proto);
+	  if (fd < 0)
+	    {
+	      if (errno == EPERM || errno == EACCES || errno == EPROTONOSUPPORT)
+		fprintf (stderr, "ping: Lacking privilege for icmp socket.\n");
+	      else
+		fprintf (stderr, "ping: %s\n", strerror (errno));
+
+	      return NULL;
+	    }
+
+	  useless_ident++;	/* SOCK_DGRAM overrides our set identity.  */
+	}
+      else
+	return NULL;
     }
 
   /* Allocate PING structure and initialize it to default values */
@@ -172,7 +194,7 @@ my_echo_reply (PING * p, icmphdr_t * icmp)
   return (orig_ip->ip_dst.s_addr == p->ping_dest.ping_sockaddr.sin_addr.s_addr
 	  && orig_ip->ip_p == IPPROTO_ICMP
 	  && orig_icmp->icmp_type == ICMP_ECHO
-	  && ntohs (orig_icmp->icmp_id) == p->ping_ident);
+	  && (ntohs (orig_icmp->icmp_id) == p->ping_ident || useless_ident));
 }
 
 int
@@ -206,7 +228,7 @@ ping_recv (PING * p)
     case ICMP_ADDRESSREPLY:
       /*    case ICMP_ROUTERADV: */
 
-      if (ntohs (icmp->icmp_id) != p->ping_ident)
+      if (ntohs (icmp->icmp_id) != p->ping_ident && useless_ident == 0)
 	return -1;
 
       if (rc)

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

Summary of changes:
 ChangeLog      |   14 ++++++++++++++
 ping/libping.c |   30 ++++++++++++++++++++++++++----
 2 files changed, 40 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Feb 17 07:27:01 2016
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1aW1C9-0004Vs-Hs
	for mharc-commit-inetutils@gnu.org; Wed, 17 Feb 2016 07:27:01 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:55603)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aW1C6-0004VA-Qq
	for commit-inetutils@gnu.org; Wed, 17 Feb 2016 07:27:00 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aW1C5-0001t5-KM
	for commit-inetutils@gnu.org; Wed, 17 Feb 2016 07:26:58 -0500
Received: from vcs.savannah.gnu.org ([208.118.235.72]:36530)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1aW1C5-0001t1-G5
	for commit-inetutils@gnu.org; Wed, 17 Feb 2016 07:26:57 -0500
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1aW1BX-0007Qr-8E
	for commit-inetutils@gnu.org; Wed, 17 Feb 2016 12:26:30 +0000
Date: Wed, 17 Feb 2016 12:26:23 +0000
Message-Id: <E1aW1BX-0007Qr-8E@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-23-g7267896
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 05a2f938e3f56ce0136966136410c5f9e20c37a7
X-Git-Newrev: 7267896f92e3df2eb935b5b8dd4adde1ee0b4c21
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.72
X-BeenThere: commit-inetutils@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
List-Id: CVS commit notices for the GNU Internet utilities
	<commit-inetutils.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/commit-inetutils>
List-Post: <mailto:commit-inetutils@gnu.org>
List-Help: <mailto:commit-inetutils-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/commit-inetutils>,
	<mailto:commit-inetutils-request@gnu.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Feb 2016 12:27:00 -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  7267896f92e3df2eb935b5b8dd4adde1ee0b4c21 (commit)
      from  05a2f938e3f56ce0136966136410c5f9e20c37a7 (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=7267896f92e3df2eb935b5b8dd4adde1ee0b4c21


commit 7267896f92e3df2eb935b5b8dd4adde1ee0b4c21
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Tue Feb 16 23:29:25 2016 +0100

    traceroute: Subprivileged use case.
    
    A fallback for ICMP tracing relevant to GNU/Linux is implemented,
    allowing a rudimentary but suid-less use case.

diff --git a/ChangeLog b/ChangeLog
index 3c42992..b85e63d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2016-02-16  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	traceroute: Subprivileged use case.
+	A fallback for ICMP tracing relevant to GNU/Linux is implemented,
+	allowing a rudimentary but suid-less use case.  The ability to
+	identify intermediary hosts is missing, due to the crippled
+	capability of receiving ICMP packets other than ICMP_ECHOREPLY.
+
+	* src/traceroute.c (struct trace): New member `no_ident'.
+	(trace_init): Initiate `t->no_ident'.
+	<type TRACE_ICMP or TRACE_UDP>: In case a raw socket for an ICMP
+	protocol fails, fall back to a datagram socket.
+	(trace_read) <type TRACE_ICMP>: Short circuit `ic->icmp_id != pid'
+	with the conditional `t->no_ident == 0'.
+	(trace_write) <type TRACE_ICMP>: New variable I.  Initialize HDR
+	to its full extent.  If `t->no_ident' is non-zero, insert our
+	intended target as payload of HDR for trace identification.
+
 2016-02-12  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ping: Implement subprivileged echo method.
diff --git a/src/traceroute.c b/src/traceroute.c
index dac45e7..301507d 100644
--- a/src/traceroute.c
+++ b/src/traceroute.c
@@ -75,6 +75,7 @@ typedef struct trace
 {
   int icmpfd, udpfd;
   enum trace_type type;
+  int no_ident;
   struct sockaddr_in to, from;
   int ttl;
   struct timeval tsent;
@@ -476,6 +477,7 @@ trace_init (trace_t * t, const struct sockaddr_in to,
   t->type = type;
   t->to = to;
   t->ttl = opt_ttl;
+  t->no_ident = 0;
 
   if (t->type == TRACE_UDP)
     {
@@ -494,6 +496,21 @@ trace_init (trace_t * t, const struct sockaddr_in to,
       if (protocol)
 	{
 	  t->icmpfd = socket (PF_INET, SOCK_RAW, protocol->p_proto);
+	  if (t->icmpfd < 0 && (errno == EPERM || errno == EACCES))
+	    {
+	      /* A subprivileged user on GNU/Linux might be allowed
+	       * to create ICMP packets from a datagram socket.
+	       * Such packets are always severely crippled.
+	       */
+	      errno = 0;
+	      t->icmpfd = socket (PF_INET, SOCK_DGRAM, protocol->p_proto);
+	      t->no_ident++;
+
+	      /* Recover error message for non-Linux systems.  */
+	      if (errno == EPROTONOSUPPORT)
+		errno = EPERM;
+	    }
+
 	  if (t->icmpfd < 0)
 	    error (EXIT_FAILURE, errno, "socket");
 
@@ -609,7 +626,7 @@ trace_read (trace_t * t, int * type, int * code)
 
       if (ic->icmp_type == ICMP_ECHOREPLY
 	  && (ntohs (ic->icmp_seq) != seqno
-	      || ntohs (ic->icmp_id) != pid))
+	      || (ntohs (ic->icmp_id) != pid && t->no_ident == 0)))
 	return -1;
 
       if (ic->icmp_type == ICMP_TIME_EXCEEDED
@@ -685,6 +702,17 @@ trace_write (trace_t * t)
     case TRACE_ICMP:
       {
 	icmphdr_t hdr;
+	int i;
+
+	/* Deposit deterministic values throughout the header!  */
+	for (i = 0; i < sizeof (hdr); ++i)
+	  *((char *) &hdr + i) = i;
+
+	/* The subprivileged use case of ICMP sent over datagram
+	 * sockets needs extra help with identification of target.
+	 */
+	if (t->no_ident)
+	  *((int *) &hdr + 12 / sizeof(int)) = dest.sin_addr.s_addr;
 
 	/* The sequence number is updated to a valid value!  */
 	if (icmp_echo_encode ((unsigned char *) &hdr, sizeof (hdr),

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

Summary of changes:
 ChangeLog        |   18 ++++++++++++++++++
 src/traceroute.c |   30 +++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


