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-212-gdbf10


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_1-212-gdbf10eb
Date: Wed, 21 Nov 2012 20:55:22 +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  dbf10eb3d0fc58d109931d00cc46caedc46ab909 (commit)
       via  3430b8bd5544dc978228f844112d4944750bb563 (commit)
      from  3182dccb1a168c3eac728a0035caaca20f614bdd (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=dbf10eb3d0fc58d109931d00cc46caedc46ab909


commit dbf10eb3d0fc58d109931d00cc46caedc46ab909
Author: Mats Erik Andersson <address@hidden>
Date:   Wed Nov 21 20:57:40 2012 +0100

    ifconfig: Address changing on BSD.

diff --git a/ChangeLog b/ChangeLog
index 862670d..733b0aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-11-21  Mats Erik Andersson  <address@hidden>
+
+       ifconfig: Make address changes possible on BSD.
+
+       * ifconfig/changeif.c (SET_SIN_LEN): New macro.
+       (SIOCSIF): Add SET_SIN_LEN, which is needed by
+       every BSD system.
+
+       * ifconfig/options.c (formats) <unix format>:
+       Add `dstaddr?' stanza for tunnel interfaces.
+
 2012-11-18  Mats Erik Andersson  <address@hidden>
 
        * ifconfig/ifconfig.c (main): New independent code
diff --git a/ifconfig/changeif.c b/ifconfig/changeif.c
index 1f1f6a8..fbe7fe8 100644
--- a/ifconfig/changeif.c
+++ b/ifconfig/changeif.c
@@ -34,6 +34,13 @@
 #include <netdb.h>
 #include "ifconfig.h"
 
+/* Necessary for BSD systems.  */
+#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
+# define SET_SIN_LEN   sin->sin_len = sizeof (struct sockaddr_in);
+#else /* !HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */
+# define SET_SIN_LEN
+#endif
+
 #define SIOCSIF(type, addr)                                            \
   int err = 0;                                                         \
   struct sockaddr_in *sin = (struct sockaddr_in *) &ifr->ifr_addr;     \
@@ -45,6 +52,7 @@
       error (0, 0, "`%s' is not a valid address", addr);               \
       return -1;                                                       \
     }                                                                  \
+  SET_SIN_LEN                                                          \
   err = ioctl (sfd, SIOCSIF##type, ifr);                               \
   if (err < 0)                                                         \
     {                                                                  \
@@ -137,7 +145,8 @@ set_netmask (int sfd, struct ifreq *ifr, char *netmask)
   return -1;
 #else
 
-  SIOCSIF (NETMASK, netmask) if (verbose)
+  SIOCSIF (NETMASK, netmask)
+  if (verbose)
     printf ("Set interface netmask of `%s' to %s.\n",
            ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
@@ -152,7 +161,8 @@ set_dstaddr (int sfd, struct ifreq *ifr, char *dstaddr)
          "don't know how to set an interface peer address on this system");
   return -1;
 #else
-  SIOCSIF (DSTADDR, dstaddr) if (verbose)
+  SIOCSIF (DSTADDR, dstaddr)
+  if (verbose)
     printf ("Set interface peer address of `%s' to %s.\n",
            ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
@@ -167,7 +177,8 @@ set_brdaddr (int sfd, struct ifreq *ifr, char *brdaddr)
          "don't know how to set an interface broadcast address on this 
system");
   return -1;
 #else
-  SIOCSIF (BRDADDR, brdaddr) if (verbose)
+  SIOCSIF (BRDADDR, brdaddr)
+  if (verbose)
     printf ("Set interface broadcast address of `%s' to %s.\n",
            ifr->ifr_name, inet_ntoa (sin->sin_addr));
   return 0;
diff --git a/ifconfig/options.c b/ifconfig/options.c
index abba812..364a55d 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -146,6 +146,7 @@ struct format formats[] = {
    "${metric?}{ metric ${metric}}"
    "${mtu?}{ mtu ${mtu}}${\\n}"
    "${addr?}{${\\t}inet ${addr}"
+   "${dstaddr?}{ --> ${dstaddr}}"
    " netmask ${netmask}{0}{%#02x}${netmask}{1}{%02x}"
    "${netmask}{2}{%02x}${netmask}{3}{%02x}"
    "${brdaddr?}{ broadcast ${brdaddr}}${\\n}}"

http://git.savannah.gnu.org/cgit/inetutils.git/commit/?id=3430b8bd5544dc978228f844112d4944750bb563


commit 3430b8bd5544dc978228f844112d4944750bb563
Author: Mats Erik Andersson <address@hidden>
Date:   Sun Nov 18 22:51:56 2012 +0100

    ifconfig: Interface listing mode.

diff --git a/ChangeLog b/ChangeLog
index 431e924..862670d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2012-11-18  Mats Erik Andersson  <address@hidden>
+
+       * ifconfig/ifconfig.c (main): New independent code
+       to be executed when `list_mode' is true.
+       * ifconfig/options.c (list_mode): New variable.
+       (argp_options): New option `-l/--list'.
+       (parse_opt) <'l'>: New case.
+       * ifconfig/options.h (list_mode): New variable.
+
 2012-11-17  Mats Erik Andersson  <address@hidden>
 
        * ifconfig/system/Makefile.am (noinst_HEADERS):
diff --git a/ifconfig/ifconfig.c b/ifconfig/ifconfig.c
index b767628..9cef95f 100644
--- a/ifconfig/ifconfig.c
+++ b/ifconfig/ifconfig.c
@@ -65,11 +65,28 @@ main (int argc, char *argv[])
 
   for (ifp = ifs; ifp < ifs + nifs; ifp++)
     {
+      if (list_mode)
+       {
+         /* Protect against mistakes in use of `-i'.  */
+         if (!if_nametoindex (ifp->name))
+           continue;
+
+         /* Use ERR as a marker of previous output.
+          * It will never mix with a call to configure_if().  */
+         if (err++)
+           putchar (' ');
+         printf ("%s", ifp->name);
+         continue;
+       }
+
       err = configure_if (sfd, ifp);
       if (err)
        break;
     }
 
+  if (list_mode && err)
+    putchar ('\n');
+
   close (sfd);
   return err;
 }
diff --git a/ifconfig/options.c b/ifconfig/options.c
index f4a07cb..abba812 100644
--- a/ifconfig/options.c
+++ b/ifconfig/options.c
@@ -39,6 +39,9 @@
 #include <net/if.h>
 #include "ifconfig.h"
 
+/* List available interfaces.  */
+int list_mode;
+
 /* Be verbose about actions.  */
 int verbose;
 
@@ -228,6 +231,8 @@ static struct argp_option argp_options[] = {
     "shut the interface down" },
   { "flags", 'F', "FLAG[,FLAG...]", 0,
     "set interface flags" },
+  { "list", 'l', NULL, 0,
+    "list available or selected interfaces" },
   { "short", 's', NULL, 0,
     "short output format" },
   { NULL }
@@ -495,6 +500,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       parse_opt_set_default_format ("netstat");
       break;
 
+    case 'l':
+      list_mode++;
+      break;
+
     case 'v':
       verbose++;
       break;
diff --git a/ifconfig/options.h b/ifconfig/options.h
index 822100b..bc2060d 100644
--- a/ifconfig/options.h
+++ b/ifconfig/options.h
@@ -69,6 +69,9 @@ extern int ifs_cmdline;
 extern struct ifconfig *ifs;
 extern int nifs;
 
+/* List available interfaces.  */
+extern int list_mode;
+
 /* Be verbose about what we do.  */
 extern int verbose;
 

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

Summary of changes:
 ChangeLog           |   20 ++++++++++++++++++++
 ifconfig/changeif.c |   17 ++++++++++++++---
 ifconfig/ifconfig.c |   17 +++++++++++++++++
 ifconfig/options.c  |   10 ++++++++++
 ifconfig/options.h  |    3 +++
 5 files changed, 64 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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