From MAILER-DAEMON Fri Jul 17 18:08:48 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZGDoG-0006an-12
	for mharc-commit-inetutils@gnu.org; Fri, 17 Jul 2015 18:08:48 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:34859)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGDoD-0006Yt-7a
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 18:08:46 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGDoB-00089P-O6
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 18:08:45 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:33737)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGDoB-00089K-L6
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 18:08:43 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZGDoA-0000eR-P6
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 22:08:42 +0000
Date: Fri, 17 Jul 2015 22:08:42 +0000
Message-Id: <E1ZGDoA-0000eR-P6@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-1-g3de647c
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a95c081ab2edc53f51797780fcfc3737a9a60ac4
X-Git-Newrev: 3de647c8548f30f882c6ad5088df9acdc8cda300
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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, 17 Jul 2015 22:08:46 -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  3de647c8548f30f882c6ad5088df9acdc8cda300 (commit)
      from  a95c081ab2edc53f51797780fcfc3737a9a60ac4 (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=3de647c8548f30f882c6ad5088df9acdc8cda300


commit 3de647c8548f30f882c6ad5088df9acdc8cda300
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Fri Jul 17 23:02:37 2015 +0200

    ifconfig: Sporadically appearing regression.
    
    Device flags are sometimes calculated before their
    query using SIOCGIFFLAGS.  First observed on GNU/Hurd.

diff --git a/ChangeLog b/ChangeLog
index ea184b0..7f799da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-07-17  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Sporadically appearing regression.
+	Device flags are sometimes calculated before their
+	query using SIOCGIFFLAGS.  First observed on GNU/Hurd.
+
+	* ifconfig/printif.c (fh_brdaddr_query, fh_dstaddr_query):
+	Execute ioctl(SIOCGIFFLAGS) before calculating UFLAGS.
+
 2015-05-27  Alfred M. Szmidt  <ams@gnu.org>
 
 	* Makefile.am (ACLOCAL_AMFLAGS): New variable.
diff --git a/ifconfig/printif.c b/ifconfig/printif.c
index 615a630..a269a50 100644
--- a/ifconfig/printif.c
+++ b/ifconfig/printif.c
@@ -719,24 +719,32 @@ fh_brdaddr_query (format_data_t form, int argc, char *argv[])
 # ifdef SIOCGIFFLAGS
   int f;
   int rev;
-  unsigned int uflags = (unsigned short) form->ifr->ifr_flags;
+  unsigned int uflags;
 
-# ifdef ifr_flagshigh
+  f = if_nameztoflag ("BROADCAST", &rev);
+
+  if (f == 0 || (ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) < 0))
+    {
+      select_arg (form, argc, argv, 1);
+      return;
+    }
+
+  uflags = (unsigned short) form->ifr->ifr_flags;
+#  ifdef ifr_flagshigh
   uflags |= (unsigned short) form->ifr->ifr_flagshigh << 16;
-# endif /* ifr_flagshigh */
+#  endif /* ifr_flagshigh */
 
-  if (0 == (f = if_nameztoflag ("BROADCAST", &rev))
-      || (ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) < 0)
-      || ((f & uflags) == 0))
+  if ((f & uflags) == 0)
     {
       select_arg (form, argc, argv, 1);
       return;
     }
-# endif
+# endif /* SIOCGIFFLAGS */
+
   if (ioctl (form->sfd, SIOCGIFBRDADDR, form->ifr) >= 0)
     select_arg (form, argc, argv, 0);
   else
-#endif
+#endif /* SIOCGIFBRDADDR */
     select_arg (form, argc, argv, 1);
 }
 
@@ -763,24 +771,32 @@ fh_dstaddr_query (format_data_t form, int argc, char *argv[])
 # ifdef SIOCGIFFLAGS
   int f;
   int rev;
-  unsigned int uflags = (unsigned short) form->ifr->ifr_flags;
+  unsigned int uflags;
+
+  f = if_nameztoflag ("POINTOPOINT", &rev);
 
+  if (f == 0 || (ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) < 0))
+    {
+      select_arg (form, argc, argv, 1);
+      return;
+    }
+
+  uflags = (unsigned short) form->ifr->ifr_flags;
 #  ifdef ifr_flagshigh
   uflags |= (unsigned short) form->ifr->ifr_flagshigh << 16;
 #  endif /* ifr_flagshigh */
 
-  if (0 == (f = if_nameztoflag ("POINTOPOINT", &rev))
-      || (ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) < 0)
-      || ((f & uflags) == 0))
+  if ((f & uflags) == 0)
     {
       select_arg (form, argc, argv, 1);
       return;
     }
-# endif
+# endif /* SIOCGIFFLAGS */
+
   if (ioctl (form->sfd, SIOCGIFDSTADDR, form->ifr) >= 0)
     select_arg (form, argc, argv, 0);
   else
-#endif
+#endif /* SIOCGIFDSTADDR */
     select_arg (form, argc, argv, 1);
 }
 

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

Summary of changes:
 ChangeLog          |    9 +++++++++
 ifconfig/printif.c |   44 ++++++++++++++++++++++++++++++--------------
 2 files changed, 39 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Fri Jul 17 19:18:17 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZGEtV-0004ku-OL
	for mharc-commit-inetutils@gnu.org; Fri, 17 Jul 2015 19:18:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:46293)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGEtS-0004ju-Mb
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 19:18:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGEtQ-00072L-CL
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 19:18:14 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:34549)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGEtQ-00072H-8A
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 19:18:12 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZGEtP-0005M6-7t
	for commit-inetutils@gnu.org; Fri, 17 Jul 2015 23:18:11 +0000
Date: Fri, 17 Jul 2015 23:18:11 +0000
Message-Id: <E1ZGEtP-0005M6-7t@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-2-g9a90d9b
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3de647c8548f30f882c6ad5088df9acdc8cda300
X-Git-Newrev: 9a90d9b9119906df23cb2db1503cb0f099942dd9
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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, 17 Jul 2015 23:18:17 -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  9a90d9b9119906df23cb2db1503cb0f099942dd9 (commit)
      from  3de647c8548f30f882c6ad5088df9acdc8cda300 (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=9a90d9b9119906df23cb2db1503cb0f099942dd9


commit 9a90d9b9119906df23cb2db1503cb0f099942dd9
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Jul 18 01:12:41 2015 +0200

    ifconfig: Improve the support for GNU/Hurd.
    
    Use system specific code instead of generic code.
    This provides abilities similar to other systems.

diff --git a/ChangeLog b/ChangeLog
index 7f799da..18a584b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2015-07-18  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Improve the support for GNU/Hurd.
+	Add system specific abilities, including parsing of command
+	line and hardware addresses.
+
+	* ifconfig/system.h [__GNU__]: Include "system/hurd.h".
+	* ifconfig/system.c [__GNU__]: Include "system/hurd.c".
+	* ifconfig/system/Makefile.am (noinst_HEADERS): Add the
+	files `hurd.h' and `hurd.c'.
+	* ifconfig/system/hurd.h, ifconfig/system/hurd.c: New files.
+
+	* ifconfig/system/generic.c: Include <unused-parameter.h>.
+	(system_parse_opt, system_parse_opt_rest, system_configure):
+	Apply _GL_UNUSED_PARAMETER to all arguments, as these functions
+	are placeholders and no-ops.
+
 2015-07-17  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Sporadically appearing regression.
diff --git a/ifconfig/system.c b/ifconfig/system.c
index 30677e4..e108dc2 100644
--- a/ifconfig/system.c
+++ b/ifconfig/system.c
@@ -25,10 +25,12 @@
 # include "system/solaris.c"
 #elif defined __QNX__
 # include "system/qnx.c"
-# elif defined __DragonFly__ || defined __FreeBSD__ || \
-       defined __FreeBSD_kernel__ || \
-       defined __NetBSD__ || defined __OpenBSD__
-#  include "system/bsd.c"
+#elif defined __DragonFly__ || defined __FreeBSD__ || \
+      defined __FreeBSD_kernel__ || \
+      defined __NetBSD__ || defined __OpenBSD__
+# include "system/bsd.c"
+#elif defined __GNU__
+# include "system/hurd.c"
 #else
 # include "system/generic.c"
 #endif
diff --git a/ifconfig/system.h b/ifconfig/system.h
index 8521ad9..66878d3 100644
--- a/ifconfig/system.h
+++ b/ifconfig/system.h
@@ -97,6 +97,8 @@ extern struct if_nameindex* (*system_if_nameindex) (void);
        defined __FreeBSD_kernel__ || \
        defined __NetBSD__ || defined __OpenBSD__
 #  include "system/bsd.h"
+# elif defined __GNU__
+#  include "system/hurd.h"
 # else
 #  include "system/generic.h"
 # endif
diff --git a/ifconfig/system/Makefile.am b/ifconfig/system/Makefile.am
index 954c677..62a9f1c 100644
--- a/ifconfig/system/Makefile.am
+++ b/ifconfig/system/Makefile.am
@@ -26,8 +26,10 @@ noinst_HEADERS = \
 	linux.h \
 	solaris.h \
 	qnx.h \
+	hurd.h \
 	bsd.c \
 	generic.c \
 	linux.c \
 	solaris.c \
-	qnx.c
+	qnx.c \
+	hurd.c
diff --git a/ifconfig/system/generic.c b/ifconfig/system/generic.c
index 9a2bda5..20a78bd 100644
--- a/ifconfig/system/generic.c
+++ b/ifconfig/system/generic.c
@@ -22,6 +22,8 @@
 #include <config.h>
 
 #include "../ifconfig.h"
+
+#include <unused-parameter.h>
 
 
 /* Output format stuff.  */
@@ -36,19 +38,25 @@ const char *system_help;
 struct argp_child system_argp_child;
 
 int
-system_parse_opt (struct ifconfig **ifp, char option, char *optarg)
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
 
 int
-system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+system_parse_opt_rest (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		       int argc _GL_UNUSED_PARAMETER,
+		       char *argv[] _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
 
 int
-system_configure (int sfd, struct ifreq *ifr, struct system_ifconfig *ifs)
+system_configure (int sfd _GL_UNUSED_PARAMETER,
+		  struct ifreq *ifr _GL_UNUSED_PARAMETER,
+		  struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
 {
   return 0;
 }
diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
new file mode 100644
index 0000000..3bd1977
--- /dev/null
+++ b/ifconfig/system/hurd.c
@@ -0,0 +1,292 @@
+/* hurd.c -- Code for ifconfig specific to GNU/Hurd.
+  Copyright (C) 2015 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Mostly written by Marcus Brinkmann.
+   Adaptions to GNU/Hurd by Mats Erik Andersson.  */
+
+#include <config.h>
+
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <net/if_arp.h>
+#include "../ifconfig.h"
+
+#include <unused-parameter.h>
+
+
+/* Output format stuff.  */
+
+const char *system_default_format = "gnu";
+
+
+/* Argument parsing stuff.  */
+
+const char *system_help = "NAME [ADDR]\
+ [broadcast BRDADDR] [netmask MASK]\
+ [mtu N] [up|down] [FLAGS]";
+
+struct argp_child system_argp_child;
+
+int
+system_parse_opt (struct ifconfig **ifp _GL_UNUSED_PARAMETER,
+		  char option _GL_UNUSED_PARAMETER,
+		  char *optarg _GL_UNUSED_PARAMETER)
+{
+  return 0;
+}
+
+int
+system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
+{
+  int i = 0, mask, rev;
+  enum {
+    EXPECT_NOTHING,
+    EXPECT_AF,
+    EXPECT_BROADCAST,
+    EXPECT_NETMASK,
+    EXPECT_METRIC,
+    EXPECT_MTU
+  } expect = EXPECT_AF;
+
+  *ifp = parse_opt_new_ifs (argv[0]);
+
+  while (++i < argc)
+    {
+      switch (expect)
+	{
+	case EXPECT_BROADCAST:
+	  parse_opt_set_brdaddr (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_NETMASK:
+	  parse_opt_set_netmask (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_MTU:
+	  parse_opt_set_mtu (*ifp, argv[i]);
+	  break;
+
+	/* XXX: 2015-07-18, GNU/Hurd does not yet support
+		ioctl(SIOCSIFMETRIC), but we let the code
+		handle this standard ability anyway!
+	 */
+	case EXPECT_METRIC:
+	  parse_opt_set_metric (*ifp, argv[i]);
+	  break;
+
+	case EXPECT_AF:
+	  expect = EXPECT_NOTHING;
+	  if (!strcmp (argv[i], "inet"))
+	    continue;
+	  else if (!strcmp (argv[i], "inet6"))
+	    {
+	      error (0, 0, "%s is not a supported address family", argv[i]);
+	      return 0;
+	    }
+	  break;
+
+	case EXPECT_NOTHING:
+	  break;
+	}
+
+      if (expect != EXPECT_NOTHING)
+	expect = EXPECT_NOTHING;
+      else if (!strcmp (argv[i], "broadcast"))
+	expect = EXPECT_BROADCAST;
+      else if (!strcmp (argv[i], "netmask"))
+	expect = EXPECT_NETMASK;
+      else if (!strcmp (argv[i], "metric"))
+	expect = EXPECT_METRIC;
+      else if (!strcmp (argv[i], "mtu"))
+	expect = EXPECT_MTU;
+      else if (!strcmp (argv[i], "up"))
+	parse_opt_set_flag (*ifp, IFF_UP | IFF_RUNNING, 0);
+      else if (!strcmp (argv[i], "down"))
+	parse_opt_set_flag (*ifp, IFF_UP, 1);
+      else if (((mask = if_nameztoflag (argv[i], &rev))
+		& ~IU_IFF_CANTCHANGE) != 0)
+	parse_opt_set_flag (*ifp, mask, rev);
+      else
+	{
+	  if (!((*ifp)->valid & IF_VALID_ADDR))
+	    parse_opt_set_address (*ifp, argv[i]);
+	  else if (!((*ifp)->valid & IF_VALID_DSTADDR))
+	    parse_opt_set_dstaddr (*ifp, argv[i]);
+	}
+    }
+
+  switch (expect)
+    {
+    case EXPECT_BROADCAST:
+      error (0, 0, "option `broadcast' requires an argument");
+      break;
+
+    case EXPECT_NETMASK:
+      error (0, 0, "option `netmask' requires an argument");
+      break;
+
+    case EXPECT_METRIC:
+      error (0, 0, "option `metric' requires an argument");
+      break;
+
+    case EXPECT_MTU:
+      error (0, 0, "option `mtu' requires an argument");
+      break;
+
+    case EXPECT_AF:
+    case EXPECT_NOTHING:
+      return 1;
+    }
+
+  return 0;
+}
+
+int
+system_configure (int sfd _GL_UNUSED_PARAMETER,
+		  struct ifreq *ifr _GL_UNUSED_PARAMETER,
+		  struct system_ifconfig *ifs _GL_UNUSED_PARAMETER)
+{
+  return 0;
+}
+
+struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
+
+static void
+print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
+		    unsigned char *data)
+{
+  *column += printf ("%02X:%02X:%02X:%02X:%02X:%02X",
+		     data[0], data[1], data[2], data[3], data[4], data[5]);
+  had_output = 1;
+}
+
+struct arphrd_symbol
+{
+  const char *name;
+  const char *title;
+  int value;
+  void (*print_hwaddr) (format_data_t form, unsigned char *data);
+} arphrd_symbols[] =
+  {
+#ifdef ARPHRD_ETHER		/* Ethernet 10/100Mbps.  */
+    { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
+#endif
+#ifdef ARPHRD_LOOPBACK		/* Loopback device.  */
+    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
+#endif
+    /* XXX: The image debian-hurd-20150424 returns the value 4
+	    instead of expected ARPHRD_LOOPBACK.  This has been
+	    discussed in the list debian-hurd, where I was asked
+	    to resist the temptation of a work around!
+     */
+    { NULL, NULL, 0, NULL}
+  };
+
+struct arphrd_symbol *
+arphrd_findvalue (int value)
+{
+  struct arphrd_symbol *arp = arphrd_symbols;
+  while (arp->name != NULL)
+    {
+      if (arp->value == value)
+	break;
+      arp++;
+    }
+  if (arp->name)
+    return arp;
+  else
+    return NULL;
+}
+
+void
+system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFHWADDR
+  struct arphrd_symbol *arp;
+
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    select_arg (form, argc, argv, 1);
+
+  arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+  select_arg (form, argc, argv, (arp && arp->print_hwaddr) ? 0 : 1);
+#else
+  select_arg (form, argc, argv, 1);
+#endif
+}
+
+void
+system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFHWADDR failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    {
+      struct arphrd_symbol *arp;
+
+      arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+      if (arp && arp->print_hwaddr)
+	arp->print_hwaddr (form,
+			   (unsigned char *) form->ifr->ifr_hwaddr.sa_data);
+      else
+	put_string (form, "(hwaddr unknown)");
+    }
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
+
+void
+system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) >= 0)
+    select_arg (form, argc, argv, 0);
+  else
+#endif
+    select_arg (form, argc, argv, 1);
+}
+
+void
+system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
+		  char *argv[] _GL_UNUSED_PARAMETER)
+{
+#ifdef SIOCGIFHWADDR
+  if (ioctl (form->sfd, SIOCGIFHWADDR, form->ifr) < 0)
+    error (EXIT_FAILURE, errno,
+	   "SIOCGIFHWADDR failed for interface `%s'",
+	   form->ifr->ifr_name);
+  else
+    {
+      struct arphrd_symbol *arp;
+
+      arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
+      if (arp)
+	put_string (form, arp->title);
+      else
+	put_string (form, "(hwtype unknown)");
+    }
+#else
+  *column += printf ("(not available)");
+  had_output = 1;
+#endif
+}
diff --git a/ifconfig/system/hurd.h b/ifconfig/system/hurd.h
new file mode 100644
index 0000000..bab1456
--- /dev/null
+++ b/ifconfig/system/hurd.h
@@ -0,0 +1,50 @@
+/*
+  Copyright (C) 2015 Free Software Foundation, Inc.
+
+  This file is part of GNU Inetutils.
+
+  GNU Inetutils is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or (at
+  your option) any later version.
+
+  GNU Inetutils is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program.  If not, see `http://www.gnu.org/licenses/'. */
+
+/* Written by Mats Erik Andersson.  */
+
+#ifndef IFCONFIG_SYSTEM_HURD_H
+# define IFCONFIG_SYSTEM_HURD_H
+
+# include "../printif.h"
+# include "../options.h"
+
+
+/* Option support.  */
+
+struct system_ifconfig
+{
+  int valid;
+};
+
+
+/* Output format support.  */
+
+# define SYSTEM_FORMAT_HANDLER \
+  { "hurd", fh_nothing}, \
+  { "hwaddr?", system_fh_hwaddr_query}, \
+  { "hwaddr", system_fh_hwaddr}, \
+  { "hwtype?", system_fh_hwtype_query}, \
+  { "hwtype", system_fh_hwtype},
+
+void system_fh_hwaddr_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwaddr (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype_query (format_data_t form, int argc, char *argv[]);
+void system_fh_hwtype (format_data_t form, int argc, char *argv[]);
+
+#endif /* !IFCONFIG_SYSTEM_HURD_H */

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

Summary of changes:
 ChangeLog                             |   17 ++
 ifconfig/system.c                     |   10 +-
 ifconfig/system.h                     |    2 +
 ifconfig/system/Makefile.am           |    4 +-
 ifconfig/system/generic.c             |   14 ++-
 ifconfig/system/hurd.c                |  292 +++++++++++++++++++++++++++++++++
 ifconfig/system/{solaris.h => hurd.h} |   34 ++--
 7 files changed, 347 insertions(+), 26 deletions(-)
 create mode 100644 ifconfig/system/hurd.c
 copy ifconfig/system/{solaris.h => hurd.h} (57%)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Jul 18 06:10:59 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZGP59-0000mW-27
	for mharc-commit-inetutils@gnu.org; Sat, 18 Jul 2015 06:10:59 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:48157)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGP56-0000ll-4O
	for commit-inetutils@gnu.org; Sat, 18 Jul 2015 06:10:57 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGP54-0007lh-SC
	for commit-inetutils@gnu.org; Sat, 18 Jul 2015 06:10:56 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:40789)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZGP54-0007lV-Or
	for commit-inetutils@gnu.org; Sat, 18 Jul 2015 06:10:54 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZGP54-0003OH-3G
	for commit-inetutils@gnu.org; Sat, 18 Jul 2015 10:10:54 +0000
Date: Sat, 18 Jul 2015 10:10:54 +0000
Message-Id: <E1ZGP54-0003OH-3G@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-3-g993e7a9
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 9a90d9b9119906df23cb2db1503cb0f099942dd9
X-Git-Newrev: 993e7a9703821acc81a2a3dfe7cadd4d35197597
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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: Sat, 18 Jul 2015 10:10:57 -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  993e7a9703821acc81a2a3dfe7cadd4d35197597 (commit)
      from  9a90d9b9119906df23cb2db1503cb0f099942dd9 (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=993e7a9703821acc81a2a3dfe7cadd4d35197597


commit 993e7a9703821acc81a2a3dfe7cadd4d35197597
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Jul 18 10:51:28 2015 +0200

    rcp: Integer overflow with large files.
    
    An insufficiently sized variable cannot handle
    file sizes in excess of 2GB.

diff --git a/ChangeLog b/ChangeLog
index 18a584b..822b6d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2015-07-18  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	rcp: Integer overflow.
+	During transmission of large files, size exceeding 2GB,
+	a long integer variable overflows.  Issue reported and
+	identified by Wenlin Kang in
+	http://lists.gnu.org/archive/html/bug-inetutils/2015-07/msg00004.html
+
+	* src/rcp.c (sink): Change SIZE to have type `off_t'.
+
+2015-07-18  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig: Improve the support for GNU/Hurd.
 	Add system specific abilities, including parsing of command
 	line and hardware addresses.
diff --git a/src/rcp.c b/src/rcp.c
index 21f55b6..bafa35f 100644
--- a/src/rcp.c
+++ b/src/rcp.c
@@ -876,9 +876,9 @@ sink (int argc, char *argv[])
   enum
   { YES, NO, DISPLAYED } wrerr;
   BUF *bp;
-  off_t i, j;
+  off_t i, j, size;
   int amt, count, exists, first, mask, mode, ofd, omode;
-  int setimes, size, targisdir, wrerrno;
+  int setimes, targisdir, wrerrno;
   char ch, *cp, *np, *targ, *vect[1], buf[BUFSIZ];
   const char *why;
 

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

Summary of changes:
 ChangeLog |   10 ++++++++++
 src/rcp.c |    4 ++--
 2 files changed, 12 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Mon Jul 20 17:34:29 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZHIhh-0004iM-To
	for mharc-commit-inetutils@gnu.org; Mon, 20 Jul 2015 17:34:29 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:47263)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHIhf-0004hy-8e
	for commit-inetutils@gnu.org; Mon, 20 Jul 2015 17:34:28 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHIhd-0002WG-Da
	for commit-inetutils@gnu.org; Mon, 20 Jul 2015 17:34:27 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:48447)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHIhd-0002W5-AI
	for commit-inetutils@gnu.org; Mon, 20 Jul 2015 17:34:25 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZHIhc-0003Wn-Hc
	for commit-inetutils@gnu.org; Mon, 20 Jul 2015 21:34:24 +0000
Date: Mon, 20 Jul 2015 21:34:24 +0000
Message-Id: <E1ZHIhc-0003Wn-Hc@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-4-g3b164f1
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 993e7a9703821acc81a2a3dfe7cadd4d35197597
X-Git-Newrev: 3b164f18445460fbea124b77c87b02acc07cdfea
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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: Mon, 20 Jul 2015 21:34:29 -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  3b164f18445460fbea124b77c87b02acc07cdfea (commit)
      from  993e7a9703821acc81a2a3dfe7cadd4d35197597 (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=3b164f18445460fbea124b77c87b02acc07cdfea


commit 3b164f18445460fbea124b77c87b02acc07cdfea
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Mon Jul 20 23:28:19 2015 +0200

    ifconfig: More info on tunnel interfaces.
    
    All formats display point-to-point destination.
    Display tunnel endpoints on BSD systems.

diff --git a/ChangeLog b/ChangeLog
index 822b6d2..c0780be 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2015-07-20  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: More info on tunnel interfaces.
+
+	* ifconfig/options.c (formats) <net-tools format>: Add
+	destination address for point-to-point interfaces.  It is
+	present in some other formats.
+	<unix format>: Display tunnel addresses for p-t-p interfaces.
+	<osf format>: Add destination address for p-t-p interfaces
+	and hardware type and hardware address for any device.
+
+	* ifconfig/system/bsd.c (system_fh_brdaddr_query): Check
+	that IFF_BROADCAST is set and access the relevant member
+	`fp->ifa_broadaddr'.
+	(system_fh_brdaddr): Check for set IFF_BROADCAST.
+	(system_fh_tunnel_query, system_fh_tundst, system_fh_tunsrc):
+	New functions.
+	* ifconfig/system/bsd.h (SYSTEM_FORMAT_HANDLER): Add the
+	keys `tunnel?', `tundst', and `tunsrc'.
+	(system_fh_tunnel_query, system_fh_tundst, system_fh_tunsrc):
+	New prototypes.
+
 2015-07-18  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	rcp: Integer overflow.
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 3356f0e..2f20e75 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -102,6 +102,7 @@ struct format formats[] = {
    "${name}${exists?}{hwtype?}{${hwtype?}{${tab}{10}Link encap:${hwtype}}"
    "${hwaddr?}{  HWaddr ${hwaddr}}}${\\n}"
    "${addr?}{${tab}{10}inet addr:${addr}"
+   "${dstaddr?}{  P-t-P:${dstaddr}}"
    "${brdaddr?}{  Bcast:${brdaddr}}"
    "${netmask?}{  Mask:${netmask}}"
    "${newline}}"
@@ -164,6 +165,8 @@ struct format formats[] = {
    "${exists?}{hwtype?}{"
      "${hwtype?}{${\\t}${hwtype}${exists?}{hwaddr?}{"
        "${hwaddr?}{ ${hwaddr}}}${\\n}}}"
+   "${exists?}{tunnel?}{"
+     "${tunnel?}{${\\t}tunnel inet ${tunsrc} --> ${tundst}${\\n}}}"
    "${addr?}{${\\t}inet ${addr}"
    "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
@@ -180,9 +183,13 @@ struct format formats[] = {
    "${ifdisplay?}{"
    "${name}: flags=${flags}{number}{%x}<${flags}{string}{,}>${\\n}"
    "${addr?}{${\\t}inet ${addr}"
+   "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%02x}${netmask}{1}{%02x}"
    "${netmask}{2}{%02x}${netmask}{3}{%02x}"
    "${brdaddr?}{ broadcast ${brdaddr}}" "${mtu?}{ ipmtu ${mtu}}${\\n}}"
+   "${exists?}{hwtype?}{"
+     "${hwtype?}{${\\t}${hwtype}${exists?}{hwaddr?}{"
+       "${hwaddr?}{ ${hwaddr}}}${\\n}}}"
    "}"
   },
   {"check",
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index 4746124..910a75e 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -217,7 +217,7 @@ system_fh_brdaddr_query (format_data_t form, int argc, char *argv[])
 	      strcmp (fp->ifa_name, form->ifr->ifr_name))
 	    continue;
 
-	  if (fp->ifa_netmask)
+	  if ((fp->ifa_flags & IFF_BROADCAST) && fp->ifa_broadaddr)
 	    missing = 0;
 	  break;
 	}
@@ -242,7 +242,7 @@ system_fh_brdaddr (format_data_t form, int argc, char *argv[])
 	      strcmp (fp->ifa_name, form->ifr->ifr_name))
 	    continue;
 
-	  if (fp->ifa_broadaddr)
+	  if ((fp->ifa_flags & IFF_BROADCAST) && fp->ifa_broadaddr)
 	    {
 	      missing = 0;
 	      put_addr (form, argc, argv, fp->ifa_broadaddr);
@@ -588,3 +588,36 @@ system_fh_status (format_data_t form, int argc, char *argv[])
 #endif /* SIOCGIFMEDIA */
     put_string (form, "(not known)");
 }
+
+void
+system_fh_tunnel_query (format_data_t form, int argc, char *argv[])
+{
+#if defined SIOCGIFPSRCADDR && defined SIOCGIFPDSTADDR
+  if (ioctl (form->sfd, SIOCGIFPSRCADDR, form->ifr) >= 0)
+    select_arg (form, argc, argv, 0);
+  else
+#endif /* SIOCGIFPSRCADDR && SIOCGIFPDSTADDR */
+  select_arg (form, argc, argv, 1);
+}
+
+void
+system_fh_tundst (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFPDSTADDR
+  if (ioctl (form->sfd, SIOCGIFPDSTADDR, form->ifr) >= 0)
+    put_addr (form, argc, argv, &form->ifr->ifr_addr);
+  else
+    put_string (form, "(no phydst)");
+#endif /* SIOCGIFPDSTADDR */
+}
+
+void
+system_fh_tunsrc (format_data_t form, int argc, char *argv[])
+{
+#ifdef SIOCGIFPSRCADDR
+  if (ioctl (form->sfd, SIOCGIFPSRCADDR, form->ifr) >= 0)
+    put_addr (form, argc, argv, &form->ifr->ifr_addr);
+  else
+    put_string (form, "(no physrc)");
+#endif /* SIOCGIFPSRCADDR */
+}
diff --git a/ifconfig/system/bsd.h b/ifconfig/system/bsd.h
index 0b802a6..918c1f2 100644
--- a/ifconfig/system/bsd.h
+++ b/ifconfig/system/bsd.h
@@ -71,7 +71,10 @@ struct system_ifconfig
   {"netmask?", system_fh_netmask_query}, \
   {"netmask", system_fh_netmask},	\
   {"status?", system_fh_status_query}, \
-  {"status", system_fh_status},
+  {"status", system_fh_status}, \
+  {"tunnel?", system_fh_tunnel_query}, \
+  {"tundst", system_fh_tundst}, \
+  {"tunsrc", system_fh_tunsrc},
 
 void system_fh_brdaddr_query (format_data_t form, int argc, char *argv[]);
 void system_fh_brdaddr (format_data_t form, int argc, char *argv[]);
@@ -85,5 +88,8 @@ void system_fh_netmask_query (format_data_t form, int argc, char *argv[]);
 void system_fh_netmask (format_data_t form, int argc, char *argv[]);
 void system_fh_status_query (format_data_t form, int argc, char *argv[]);
 void system_fh_status (format_data_t form, int argc, char *argv[]);
+void system_fh_tunnel_query (format_data_t form, int argc, char *argv[]);
+void system_fh_tundst (format_data_t form, int argc, char *argv[]);
+void system_fh_tunsrc (format_data_t form, int argc, char *argv[]);
 
 #endif /* IFCONFIG_SYSTEM_BSD_H */

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

Summary of changes:
 ChangeLog             |   22 ++++++++++++++++++++++
 ifconfig/options.c    |    7 +++++++
 ifconfig/system/bsd.c |   37 +++++++++++++++++++++++++++++++++++--
 ifconfig/system/bsd.h |    8 +++++++-
 4 files changed, 71 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Tue Jul 21 17:06:42 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZHekM-0007mK-Td
	for mharc-commit-inetutils@gnu.org; Tue, 21 Jul 2015 17:06:42 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42026)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHekJ-0007i0-Hd
	for commit-inetutils@gnu.org; Tue, 21 Jul 2015 17:06:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHekH-0008AB-OS
	for commit-inetutils@gnu.org; Tue, 21 Jul 2015 17:06:39 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:34703)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZHekH-00089z-Es
	for commit-inetutils@gnu.org; Tue, 21 Jul 2015 17:06:37 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZHekG-0004aO-Pa
	for commit-inetutils@gnu.org; Tue, 21 Jul 2015 21:06:37 +0000
Date: Tue, 21 Jul 2015 21:06:36 +0000
Message-Id: <E1ZHekG-0004aO-Pa@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-5-gbbd3a55
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 3b164f18445460fbea124b77c87b02acc07cdfea
X-Git-Newrev: bbd3a55c8aad2c2800206c77bf8bd794b3c8d957
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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, 21 Jul 2015 21:06:41 -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  bbd3a55c8aad2c2800206c77bf8bd794b3c8d957 (commit)
      from  3b164f18445460fbea124b77c87b02acc07cdfea (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=bbd3a55c8aad2c2800206c77bf8bd794b3c8d957


commit bbd3a55c8aad2c2800206c77bf8bd794b3c8d957
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Tue Jul 21 23:04:46 2015 +0200

    ifconfig: Implement hardware list for BSD systems.
    
    Let formats `gnu' and `osf' report tunnel endpoints.

diff --git a/ChangeLog b/ChangeLog
index c0780be..5715580 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2015-07-21  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Implement a hardware list for BSD systems.
+	Patterned on the hardware recognition already in use
+	by GNU/Linux, use a similar mechanism for all of BSD.
+
+	* ifconfig/system/bsd.c (print_hwaddr_ether): New function.
+	(ift_symbols): New variable.
+	(ift_findvalue): New function.
+	(system_fh_hwaddr_query, system_fh_hwaddr)
+	(system_fh_hwtype_query, system_fh_hwtype): Adjust mechanisms
+	to use the table `ift_symbols' via ift_findvalue().
+
+
+	ifconfig: Report tunnels in two more formats.
+
+	* ifconfig/options.c (formats) <gnu-one-entry format>:
+	Add two entries for the endpoints of tunnels.
+	<osf format>: Add a line to display tunnels.
+
+
+	ifconfig: Add a missing interface flag.
+
+	* ifconfig/flags.c [IFF_CANTCONFIG] (if_flags): Add the
+	extended interface flag `CANTCONFIG'.
+
 2015-07-20  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: More info on tunnel interfaces.
diff --git a/ifconfig/flags.c b/ifconfig/flags.c
index ee4f6e0..003e535 100644
--- a/ifconfig/flags.c
+++ b/ifconfig/flags.c
@@ -218,6 +218,9 @@ struct if_flag
 #ifdef IFF_SNAP			/* Ethernet driver outputs SNAP header.  */
     {"SNAP", IFF_SNAP, 0},
 #endif
+#ifdef IFF_CANTCONFIG
+    {"CANTCONFIG", IFF_CANTCONFIG, 0},
+#endif
 #ifdef IFF_MONITOR
     {"MONITOR", IFF_MONITOR, 0},
 #endif
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 2f20e75..9478f31 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -84,6 +84,10 @@ struct format formats[] = {
    "${netmask?}{  netmask ${tab}{16}${netmask}${\\n}}"
    "${brdaddr?}{  broadcast ${tab}{16}${brdaddr}${\\n}}"
    "${dstaddr?}{  peer address ${tab}{16}${dstaddr}${\\n}}"
+   "${exists?}{tunnel?}{"
+     "${tunnel?}{  tunnel src ${tab}{16}${tunsrc}${\\n}}}"
+   "${exists?}{tunnel?}{"
+     "${tunnel?}{  tunnel dst ${tab}{16}${tundst}${\\n}}}"
    "${flags?}{  flags ${tab}{16}${flags}${\\n}}"
    "${mtu?}{  mtu ${tab}{16}${mtu}${\\n}}"
    "${metric?}{  metric ${tab}{16}${metric}${\\n}}"
@@ -182,6 +186,8 @@ struct format formats[] = {
    "${format}{check-existence}"
    "${ifdisplay?}{"
    "${name}: flags=${flags}{number}{%x}<${flags}{string}{,}>${\\n}"
+   "${exists?}{tunnel?}{"
+     "${tunnel?}{${\\t}inet tunnel src ${tunsrc} tunnel dst ${tundst}${\\n}}}"
    "${addr?}{${\\t}inet ${addr}"
    "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%02x}${netmask}{1}{%02x}"
diff --git a/ifconfig/system/bsd.c b/ifconfig/system/bsd.c
index 910a75e..1db525b 100644
--- a/ifconfig/system/bsd.c
+++ b/ifconfig/system/bsd.c
@@ -200,6 +200,73 @@ struct ifmediareq ifm;
 
 struct if_nameindex* (*system_if_nameindex) (void) = if_nameindex;
 
+static void
+print_hwaddr_ether (format_data_t form, unsigned char *data)
+{
+  put_string (form, ether_ntoa ((struct ether_addr *) data));
+  had_output = 1;
+}
+
+struct ift_symbol
+{
+  const char *name;
+  const char *title;
+  int value;
+  void (*print_hwaddr) (format_data_t form, unsigned char *data);
+} ift_symbols[] =
+  {
+#ifdef IFT_ETHER		/* Ethernet CSMA/CD */
+# ifdef ETHERNAME
+    { "ETHER", ETHERNAME, IFT_ETHER, print_hwaddr_ether},
+# else
+    { "ETHER", "ether", IFT_ETHER, print_hwaddr_ether},
+# endif /* !ETHERNAME */
+#endif /* IFT_ETHER */
+#ifdef IFT_GIF			/* Generic tunnel (gif) */
+    { "IPGIF", "IPIP tunnel", IFT_GIF, NULL},
+#endif
+#ifdef IFT_FAITH		/* IPv6-to-IPv4 TCP relay capture */
+    { "FAITH", "TCP relay capture", IFT_FAITH, NULL},
+#endif
+#ifdef IFT_LOOP			/* Local loopback */
+    { "LOOPBACK", "Local loopback", IFT_LOOP, NULL},
+#endif
+#ifdef IFT_PFLOG		/* Packet filter logging */
+    { "PFLOG", "Packet filter logger", IFT_PFLOG, NULL},
+#endif
+#ifdef IFT_PFSYNC		/* Packet filter state synching */
+    { "PFSYNC", "Packet filter state synching", IFT_PFSYNC, NULL},
+#endif
+#ifdef IFT_PPP			/* Point-to-Point serial protocol */
+    { "PPP", "Point-to-Point over serial", IFT_PPP, NULL},
+#endif
+#ifdef IFT_SLIP			/* IP over generic TTY */
+    { "SLIP", "Serial line IP", IFT_SLIP, NULL},
+#endif
+#ifdef IFT_TUNNEL		/* Encapsulation (gre) */
+    { "IPGRE", "GRE over IP", IFT_TUNNEL, NULL},
+#endif
+    { NULL, NULL, 0, NULL}
+  };
+
+static struct ift_symbol *
+ift_findvalue (int value)
+{
+  struct ift_symbol *ift = ift_symbols;
+
+  while (ift->name != NULL)
+    {
+      if (ift->value == value)
+	break;
+      ift++;
+    }
+
+  if (ift->name)
+    return ift;
+  else
+    return NULL;
+}
+
 void
 system_fh_brdaddr_query (format_data_t form, int argc, char *argv[])
 {
@@ -274,11 +341,16 @@ system_fh_hwaddr_query (format_data_t form, int argc, char *argv[])
 	    continue;
 
 	  dl = (struct sockaddr_dl *) fp->ifa_addr;
-	  if (dl && (dl->sdl_len > 0) &&
-	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
-	    missing = 0;
+	  if (dl && (dl->sdl_len > 0))
+	    {
+	      struct ift_symbol *ift = ift_findvalue (dl->sdl_type);
+
+	      if (ift && ift->print_hwaddr)
+		missing = 0;
+	    }
 	  break;
 	}
+
       select_arg (form, argc, argv, missing);
     }
 }
@@ -304,11 +376,16 @@ system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
 	    continue;
 
 	  dl = (struct sockaddr_dl *) fp->ifa_addr;
-	  if (dl && (dl->sdl_len > 0) &&
-	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
+	  if (dl && (dl->sdl_len > 0))
 	    {
-	      missing = 0;
-	      put_string (form, ether_ntoa ((struct ether_addr *) LLADDR (dl)));
+	      struct ift_symbol *ift = ift_findvalue (dl->sdl_type);
+
+	      if (ift && ift->print_hwaddr)
+		{
+		  missing = 0;
+		  ift->print_hwaddr (form,
+				     (unsigned char *) LLADDR (dl));
+		}
 	    }
 	  break;
 	}
@@ -320,19 +397,44 @@ system_fh_hwaddr (format_data_t form, int argc _GL_UNUSED_PARAMETER,
 void
 system_fh_hwtype_query (format_data_t form, int argc, char *argv[])
 {
-  system_fh_hwaddr_query (form, argc, argv);
+  int missing = 1;
+
+  ESTABLISH_IFADDRS
+  if (ifp)
+    {
+      struct ifaddrs *fp;
+      struct sockaddr_dl *dl = NULL;
+
+      for (fp = ifp; fp; fp = fp->ifa_next)
+	{
+	  if (fp->ifa_addr->sa_family != AF_LINK ||
+	      strcmp (fp->ifa_name, form->ifr->ifr_name))
+	    continue;
+
+	  dl = (struct sockaddr_dl *) fp->ifa_addr;
+	  if (dl && (dl->sdl_len > 0))
+	    {
+	      struct ift_symbol *ift = ift_findvalue (dl->sdl_type);
+
+	      if (ift && ift->title)
+		missing = 0;
+	    }
+	  break;
+	}
+    }
+
+  select_arg (form, argc, argv, missing);
 }
 
 void
 system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
 		  char *argv[] _GL_UNUSED_PARAMETER)
 {
+  int found = 0;
+
   ESTABLISH_IFADDRS
-  if (!ifp)
-    put_string (form, "(hwtype unknown)");
-  else
+  if (ifp)
     {
-      int found = 0;
       struct ifaddrs *fp;
       struct sockaddr_dl *dl = NULL;
 
@@ -343,17 +445,22 @@ system_fh_hwtype (format_data_t form, int argc _GL_UNUSED_PARAMETER,
 	    continue;
 
 	  dl = (struct sockaddr_dl *) fp->ifa_addr;
-	  if (dl && (dl->sdl_len > 0) &&
-	      dl->sdl_type == IFT_ETHER)	/* XXX: More cases?  */
+	  if (dl && (dl->sdl_len > 0))
 	    {
-	      found = 1;
-	      put_string (form, ETHERNAME);
+	      struct ift_symbol *ift = ift_findvalue (dl->sdl_type);
+
+	      if (ift && ift->title)
+		{
+		  found = 1;
+		  put_string (form, ift->title);
+		}
 	    }
 	  break;
 	}
-      if (!found)
-	put_string (form, "(unknown hwtype)");
     }
+
+  if (!found)
+    put_string (form, "(unknown hwtype)");
 }
 
 /* Lookup structures provided by the system, each decoding

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

Summary of changes:
 ChangeLog             |   26 +++++++++
 ifconfig/flags.c      |    3 +
 ifconfig/options.c    |    6 ++
 ifconfig/system/bsd.c |  143 ++++++++++++++++++++++++++++++++++++++++++------
 4 files changed, 160 insertions(+), 18 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Jul 25 17:25:33 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZJ6wn-0006YW-5T
	for mharc-commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:25:33 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37892)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ6wk-0006YK-FC
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:25:32 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ6wi-0000PI-LL
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:25:30 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37690)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ6wi-0000PC-Ig
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:25:28 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ6wh-0007uT-FM
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 21:25:27 +0000
Date: Sat, 25 Jul 2015 21:25:27 +0000
Message-Id: <E1ZJ6wh-0007uT-FM@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-6-g9d4bff6
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: bbd3a55c8aad2c2800206c77bf8bd794b3c8d957
X-Git-Newrev: 9d4bff64fd11773297ed05a5e6dd7eab6e780535
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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: Sat, 25 Jul 2015 21:25:32 -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  9d4bff64fd11773297ed05a5e6dd7eab6e780535 (commit)
      from  bbd3a55c8aad2c2800206c77bf8bd794b3c8d957 (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=9d4bff64fd11773297ed05a5e6dd7eab6e780535


commit 9d4bff64fd11773297ed05a5e6dd7eab6e780535
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Jul 25 23:01:10 2015 +0200

    ifconfig: Support changing of hardware address.
    
    Implemented for GNU/Linux as first step.

diff --git a/ChangeLog b/ChangeLog
index 5715580..839ecb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2015-07-25  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: Support changing of hardware address.
+	Implement the setting of link level addresses
+	for systems running GNU/Linux.
+
+	* ifconfig/changeif.c [HAVE_NETINET_ETHER_H]: Include
+	header <netinet/ether.h>.
+	(set_hwaddr): New function.
+	(configure_if): Call set_hwaddr() whenever `ifp->valid'
+	contains IF_VALID_HWADDR.
+	* ifconfig/options.c (ifconfig_initializer): Add a further
+	NULL at the end.
+	(parse_opt_set_hwaddr): New function built by the generic
+	macro PARSE_OPT_SET_ADDR.
+	* ifconfig/options.h (struct ifconfig): Define IF_VALID_HWADDR
+	and add a new member `hwaddr'.
+	(parse_opt_set_hwaddr): New prototype.
+
+	* ifconfig/system/linux.c (system_help): Add parsed option
+	`ether|hwaddr|lladdr MACADDR'.
+	(system_parse_opt_rest): New enum value EXPECT_HWADDR.  Insert
+	this into the parser, triggering on all the keywords `ether',
+	`hwaddr', and `lladdr' for best portability.
+
 2015-07-21  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Implement a hardware list for BSD systems.
diff --git a/ifconfig/changeif.c b/ifconfig/changeif.c
index 99fc03b..dfcae9f 100644
--- a/ifconfig/changeif.c
+++ b/ifconfig/changeif.c
@@ -30,6 +30,9 @@
 #include <sys/ioctl.h>
 #include <net/if.h>
 #include <netinet/in.h>
+#ifdef HAVE_NETINET_ETHER_H
+# include <netinet/ether.h>
+#endif
 #include <arpa/inet.h>
 #include <netdb.h>
 #include "ifconfig.h"
@@ -186,6 +189,58 @@ set_brdaddr (int sfd, struct ifreq *ifr, char *brdaddr)
 }
 
 int
+set_hwaddr (int sfd, struct ifreq *ifr, char *hwaddr)
+{
+#ifndef SIOCSIFHWADDR
+  error (0, 0,
+         "don't know how to set a hardware address on this system");
+  return -1;
+#else
+# ifndef ifr_hwaddr
+#  ifdef ifr_enaddr
+#   define ifr_hwaddr ifr_enaddr
+#  endif /* ifr_en_addr */
+# endif /* ifr_hwaddr */
+  int err;
+  struct ether_addr *ether;
+  struct sockaddr *sa = (struct sockaddr *) &ifr->ifr_hwaddr;
+
+  ether = ether_aton (hwaddr);
+  if (!ether)
+    {
+      struct ether_addr addr;
+
+      err = ether_hostton (hwaddr, &addr);
+      if (err)
+	{
+	  error (0, 0, "`%s' is not a valid hardware address", hwaddr);
+	  return -1;
+	}
+
+	ether = &addr;
+    }
+
+  /* Reading the present hardware address is a simple
+   * way of initializing the structure!
+   */
+  (void) ioctl (sfd, SIOCGIFHWADDR, ifr);
+
+  memcpy (&sa->sa_data, ether, sizeof (*ether));
+  err = ioctl (sfd, SIOCSIFHWADDR, ifr);
+  if (err < 0)
+    {
+      error (0, errno, "%s failed", "SIOCSIFHWADDR");
+      return -1;
+    }
+
+  if (verbose)
+    printf ("Set interface hardware address of `%s' to %s.\n",
+	    ifr->ifr_name, ether_ntoa (ether));
+  return 0;
+#endif /* SIOCSIFHWADDR */
+}
+
+int
 set_mtu (int sfd, struct ifreq *ifr, int mtu)
 {
 #ifndef SIOCSIFMTU
@@ -282,6 +337,8 @@ configure_if (int sfd, struct ifconfig *ifp)
     err = set_dstaddr (sfd, &ifr, ifp->dstaddr);
   if (!err && ifp->valid & IF_VALID_BRDADDR)
     err = set_brdaddr (sfd, &ifr, ifp->brdaddr);
+  if (!err && ifp->valid & IF_VALID_HWADDR)
+    err = set_hwaddr (sfd, &ifr, ifp->hwaddr);
   if (!err && ifp->valid & IF_VALID_MTU)
     err = set_mtu (sfd, &ifr, ifp->mtu);
   if (!err && ifp->valid & IF_VALID_METRIC)
diff --git a/ifconfig/options.c b/ifconfig/options.c
index 9478f31..3032062 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -61,7 +61,7 @@ int nifs;
 static struct ifconfig ifconfig_initializer = {
   NULL,				/* name */
   0,				/* valid */
-  NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0
+  NULL, NULL, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL
 };
 
 struct format formats[] = {
@@ -338,6 +338,7 @@ PARSE_OPT_SET_ADDR (address, address, ADDR)
 PARSE_OPT_SET_ADDR (netmask, netmask, NETMASK)
 PARSE_OPT_SET_ADDR (dstaddr, destination / peer address, DSTADDR)
 PARSE_OPT_SET_ADDR (brdaddr, broadcast address, BRDADDR)
+PARSE_OPT_SET_ADDR (hwaddr, hardware address, HWADDR)
 
 #define PARSE_OPT_SET_INT(field, fname, fvalid) \
 void								\
diff --git a/ifconfig/options.h b/ifconfig/options.h
index a4b932d..1052838 100644
--- a/ifconfig/options.h
+++ b/ifconfig/options.h
@@ -52,6 +52,8 @@ struct ifconfig
   int metric;
   int setflags;
   int clrflags;
+# define IF_VALID_HWADDR	0x200
+  char *hwaddr;
 };
 
 struct format
@@ -84,6 +86,7 @@ void parse_opt_set_address (struct ifconfig *ifp, char *addr);
 void parse_opt_set_brdaddr (struct ifconfig *ifp, char *addr);
 void parse_opt_set_dstaddr (struct ifconfig *ifp, char *addr);
 void parse_opt_set_netmask (struct ifconfig *ifp, char *addr);
+void parse_opt_set_hwaddr (struct ifconfig *ifp, char *addr);
 void parse_opt_set_mtu (struct ifconfig *ifp, char *addr);
 void parse_opt_set_metric (struct ifconfig *ifp, char *addr);
 void parse_opt_set_default_format (const char *format);
diff --git a/ifconfig/system/linux.c b/ifconfig/system/linux.c
index ef27d65..cad3544 100644
--- a/ifconfig/system/linux.c
+++ b/ifconfig/system/linux.c
@@ -675,6 +675,7 @@ system_fh_txqlen (format_data_t form, int argc, char *argv[])
 const char *system_help = "\
  NAME [ADDR] [broadcast BRDADDR]\
  [pointopoint|dstaddr DSTADDR] [netmask MASK]\
+ [ether|hwaddr|lladdr MACADDR]\
  [metric N] [mtu N] [txqueuelen N] [up|down] [FLAGS]";
 
 void
@@ -768,6 +769,7 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
     EXPECT_BROADCAST,
     EXPECT_DSTADDR,
     EXPECT_NETMASK,
+    EXPECT_HWADDR,
     EXPECT_MTU,
     EXPECT_METRIC,
     EXPECT_TXQLEN,
@@ -792,6 +794,10 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
 	  parse_opt_set_netmask (*ifp, argv[i]);
 	  break;
 
+	case EXPECT_HWADDR:
+	  parse_opt_set_hwaddr (*ifp, argv[i]);
+	  break;
+
 	case EXPECT_MTU:
 	  parse_opt_set_mtu (*ifp, argv[i]);
 	  break;
@@ -828,6 +834,10 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
 	expect = EXPECT_DSTADDR;
       else if (!strcmp (argv[i], "netmask"))
 	expect = EXPECT_NETMASK;
+      else if (!strcmp (argv[i], "ether")
+	       || !strcmp(argv[i], "hwaddr")
+	       || !strcmp(argv[i], "lladdr"))
+	expect = EXPECT_HWADDR;
       else if (!strcmp (argv[i], "metric"))
 	expect = EXPECT_METRIC;
       else if (!strcmp (argv[i], "mtu"))
@@ -859,6 +869,10 @@ system_parse_opt_rest (struct ifconfig **ifp, int argc, char *argv[])
       error (0, 0, "option `netmask' requires an argument");
       break;
 
+    case EXPECT_HWADDR:
+      error (0, 0, "option `hwaddr' requires an argument");
+      break;
+
     case EXPECT_METRIC:
       error (0, 0, "option `metric' requires an argument");
       break;

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

Summary of changes:
 ChangeLog               |   25 ++++++++++++++++++++
 ifconfig/changeif.c     |   57 +++++++++++++++++++++++++++++++++++++++++++++++
 ifconfig/options.c      |    3 +-
 ifconfig/options.h      |    3 ++
 ifconfig/system/linux.c |   14 +++++++++++
 5 files changed, 101 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Sat Jul 25 17:41:55 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZJ7Cd-0000go-Hg
	for mharc-commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:41:55 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42969)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ7Ca-0000ge-Fa
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:41:53 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ7CZ-0008G5-80
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:41:52 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:37900)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ7CZ-0008G1-4h
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 17:41:51 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZJ7CY-0002pn-AF
	for commit-inetutils@gnu.org; Sat, 25 Jul 2015 21:41:50 +0000
Date: Sat, 25 Jul 2015 21:41:50 +0000
Message-Id: <E1ZJ7CY-0002pn-AF@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-7-ga7be57c
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 9d4bff64fd11773297ed05a5e6dd7eab6e780535
X-Git-Newrev: a7be57c41320dab107f0368d7af17fed91b682f8
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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: Sat, 25 Jul 2015 21:41:54 -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  a7be57c41320dab107f0368d7af17fed91b682f8 (commit)
      from  9d4bff64fd11773297ed05a5e6dd7eab6e780535 (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=a7be57c41320dab107f0368d7af17fed91b682f8


commit a7be57c41320dab107f0368d7af17fed91b682f8
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Sat Jul 25 23:39:26 2015 +0200

    ifconfig: Symbolic name as peer address.

diff --git a/ChangeLog b/ChangeLog
index 839ecb0..d1f4c47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2015-07-25  Mats Erik Andersson  <gnu@gisladisker.se>
 
+	ifconfig: Symbolic name as peer address.
+
+	* ifconfig/changeif.c (set_dstaddr): Adapt code block used
+	by set_address(), thereby first using either getaddrinfo()
+	or gethostbyname() to resolve a possibly symbolic peer
+	destination, then setting the established address.
+
+2015-07-25  Mats Erik Andersson  <gnu@gisladisker.se>
+
 	ifconfig: Support changing of hardware address.
 	Implement the setting of link level addresses
 	for systems running GNU/Linux.
diff --git a/ifconfig/changeif.c b/ifconfig/changeif.c
index dfcae9f..a040587 100644
--- a/ifconfig/changeif.c
+++ b/ifconfig/changeif.c
@@ -163,13 +163,65 @@ set_dstaddr (int sfd, struct ifreq *ifr, char *dstaddr)
   error (0, 0,
          "don't know how to set an interface peer address on this system");
   return -1;
-#else
-  SIOCSIF (DSTADDR, dstaddr)
+#else /* !SIOCSIFDSTADDR */
+# if HAVE_DECL_GETADDRINFO
+  int rc;
+  char addr[INET_ADDRSTRLEN];
+  struct addrinfo hints, *ai, *res;
+
+  memset (&hints, 0, sizeof (hints));
+  hints.ai_family = AF_INET;
+
+  rc = getaddrinfo (dstaddr, NULL, &hints, &res);
+  if (rc)
+    {
+      error (0, 0, "cannot resolve `%s': %s", dstaddr, gai_strerror (rc));
+      return -1;
+    }
+  for (ai = res; ai; ai = ai->ai_next)
+    if (ai->ai_family == AF_INET)
+      break;
+
+  if (ai == NULL)
+    {
+      error (0, 0, "`%s' refers to an unknown address type", dstaddr);
+      freeaddrinfo (res);
+      return -1;
+    }
+
+  rc = getnameinfo (ai->ai_addr, ai->ai_addrlen,
+		    addr, sizeof (addr), NULL, 0,
+		    NI_NUMERICHOST);
+  freeaddrinfo (res);
+  if (rc)
+    {
+      error (0, 0, "cannot resolve `%s': %s", dstaddr, gai_strerror (rc));
+      return -1;
+    }
+# else /* !HAVE_DECL_GETADDRINFO */
+  char *addr;
+  struct hostent *host = gethostbyname (dstaddr);
+
+  if (!host)
+    {
+      error (0, 0, "cannot resolve `%s': %s", dstaddr, hstrerror (h_errno));
+      return -1;
+    }
+  if (host->h_addrtype != AF_INET)
+    {
+      error (0, 0, "`%s' refers to an unknown address type", dstaddr);
+      return -1;
+    }
+
+  addr = inet_ntoa (*((struct in_addr *) host->h_addr));
+# endif /* !HAVE_DECL_GETADDRINFO */
+
+  SIOCSIF (DSTADDR, addr)
   if (verbose)
     printf ("Set interface peer address of `%s' to %s.\n",
 	    ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
-#endif
+#endif /* SIOCSIFDSTADDR */
 }
 
 int

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

Summary of changes:
 ChangeLog           |    9 ++++++++
 ifconfig/changeif.c |   58 ++++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 64 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


From MAILER-DAEMON Wed Jul 29 19:11:32 2015
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1ZKaVY-0005OO-Jq
	for mharc-commit-inetutils@gnu.org; Wed, 29 Jul 2015 19:11:32 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:39186)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZKaVV-0005No-Dz
	for commit-inetutils@gnu.org; Wed, 29 Jul 2015 19:11:30 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZKaVT-00080m-M8
	for commit-inetutils@gnu.org; Wed, 29 Jul 2015 19:11:29 -0400
Received: from vcs.savannah.gnu.org ([140.186.70.72]:41064)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <gnu@gisladisker.se>) id 1ZKaVT-00080X-JP
	for commit-inetutils@gnu.org; Wed, 29 Jul 2015 19:11:27 -0400
Received: from meand by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <gnu@gisladisker.se>) id 1ZKaVS-00017n-O1
	for commit-inetutils@gnu.org; Wed, 29 Jul 2015 23:11:26 +0000
Date: Wed, 29 Jul 2015 23:11:26 +0000
Message-Id: <E1ZKaVS-00017n-O1@vcs.savannah.gnu.org>
To: commit-inetutils@gnu.org
Subject: [SCM] GNU Inetutils  branch, master,
	updated. inetutils-1_9_4-8-g25b4f34
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: a7be57c41320dab107f0368d7af17fed91b682f8
X-Git-Newrev: 25b4f3449c040c79ae459cd9a3d0e6984eaa272c
From: Mats Erik Andersson <gnu@gisladisker.se>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.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, 29 Jul 2015 23:11:30 -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  25b4f3449c040c79ae459cd9a3d0e6984eaa272c (commit)
      from  a7be57c41320dab107f0368d7af17fed91b682f8 (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=25b4f3449c040c79ae459cd9a3d0e6984eaa272c


commit 25b4f3449c040c79ae459cd9a3d0e6984eaa272c
Author: Mats Erik Andersson <gnu@gisladisker.se>
Date:   Thu Jul 30 01:06:42 2015 +0200

    ifconfig: Hardware detection in GNU/Hurd.
    
    A work-around needed to distinguish hardware type.

diff --git a/ChangeLog b/ChangeLog
index d1f4c47..f35be24 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-30  Mats Erik Andersson  <gnu@gisladisker.se>
+
+	ifconfig: A work-around specific to GNU/Hurd.
+	This system uses a mixture of BSD definitions
+	and GNU/Linux interfaces.  In particular, some
+	care is needed to check interface hardware type.
+
+	* ifconfig/system/hurd.c (_ARP_MASK): New macro.
+	(arphrd_symbols): Apply _ARP_MASK to each member `value'.
+
 2015-07-25  Mats Erik Andersson  <gnu@gisladisker.se>
 
 	ifconfig: Symbolic name as peer address.
diff --git a/ifconfig/system/hurd.c b/ifconfig/system/hurd.c
index 3bd1977..b6261a0 100644
--- a/ifconfig/system/hurd.c
+++ b/ifconfig/system/hurd.c
@@ -175,6 +175,16 @@ print_hwaddr_ether (format_data_t form _GL_UNUSED_PARAMETER,
   had_output = 1;
 }
 
+/* GNU/Hurd and Mach are using a mixture of BSD definitions
+ * and GNU/Linux interface headers, which in this situation
+ * means that sa_family_t is an unsigned char, from BSD, while
+ * all ARPHRD_* come from GNU/Linux and are thus 16 bits wide.
+ * We must account for this.  The following bitmask will
+ * adapt to any future change!
+ */
+
+#define _ARP_MASK ((sizeof (sa_family_t) == 1) ? 0xff : 0xffff)
+
 struct arphrd_symbol
 {
   const char *name;
@@ -184,16 +194,11 @@ struct arphrd_symbol
 } arphrd_symbols[] =
   {
 #ifdef ARPHRD_ETHER		/* Ethernet 10/100Mbps.  */
-    { "ETHER", "Ethernet", ARPHRD_ETHER, print_hwaddr_ether},
+    { "ETHER", "Ethernet", ARPHRD_ETHER & _ARP_MASK, print_hwaddr_ether},
 #endif
 #ifdef ARPHRD_LOOPBACK		/* Loopback device.  */
-    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK, NULL},
+    { "LOOPBACK", "Local Loopback", ARPHRD_LOOPBACK & _ARP_MASK, NULL},
 #endif
-    /* XXX: The image debian-hurd-20150424 returns the value 4
-	    instead of expected ARPHRD_LOOPBACK.  This has been
-	    discussed in the list debian-hurd, where I was asked
-	    to resist the temptation of a work around!
-     */
     { NULL, NULL, 0, NULL}
   };
 

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

Summary of changes:
 ChangeLog              |   10 ++++++++++
 ifconfig/system/hurd.c |   19 ++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 


