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_3-2-gddfc1fd


From: Mats Erik Andersson
Subject: [SCM] GNU Inetutils branch, master, updated. inetutils-1_9_3-2-gddfc1fd
Date: Sat, 16 May 2015 23:11:55 +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  ddfc1fda581f61f5154a9dd5827e49584409ee86 (commit)
      from  4858b4e340b83c545aa5f161bb80a1433bee7886 (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=ddfc1fda581f61f5154a9dd5827e49584409ee86


commit ddfc1fda581f61f5154a9dd5827e49584409ee86
Author: Mats Erik Andersson <address@hidden>
Date:   Sun May 17 00:58:17 2015 +0200

    ifconfig: Regression during interface selection.
    
    Correctly implement the default behaviour of printing
    all interfaces in state `UP'.  The regression appeared
    in version 1.9.3 when 32-bit wide flags were implemented.

diff --git a/ChangeLog b/ChangeLog
index 02edeac..b04e0aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2015-05-17  Mats Erik Andersson  <address@hidden>
+
+       ifconfig: Regression during interface selection.
+       Without arguments, ifconfig is expected to print status
+       of all interfaces that are in state `UP'.  The mechanism
+       to detect this state was corrupted when 32-bit flags were
+       implemented.  The issue was reported by Juergen Daubert in
+       http://lists.gnu.org/archive/html/bug-inetutils/2015-05/msg00002.html
+
+       * ifconfig/printif.c (fh_ifdisplay_query): Logically invert
+       every use of N.
+       [SIOCGIFFLAGS] (fh_ifdisplay_query): Calculate UFLAGS after
+       executing `ioctl(SIOCGIFFLAGS)', since only then is the value
+       of `form->ifr->ifr_flags' valid.  This side effect of ioctl()
+       was not taken into account in previously committed code with
+       32-bit flags.
+
 2015-05-13  Guillem Jover  <address@hidden>
 
        ping, ping6: Always use line buffered output.
diff --git a/ifconfig/printif.c b/ifconfig/printif.c
index cc4d7a1..615a630 100644
--- a/ifconfig/printif.c
+++ b/ifconfig/printif.c
@@ -481,22 +481,29 @@ fh_ifdisplay_query (format_data_t form, int argc, char 
*argv[])
   int n;
 
 #ifdef SIOCGIFFLAGS
-  int f;
-  int rev;
-  unsigned int uflags = (unsigned short) form->ifr->ifr_flags;
+  /* Request for all, or for a specified interface?  */
+  n = all_option || ifs_cmdline;
+  if (!n)
+    {
+      /* Otherwise, only interfaces in state `UP' are displayed.  */
+      int rev = 0;
+      int f = if_nameztoflag ("UP", &rev);
+
+      n = f && ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) == 0;
+      if (n) {
+       unsigned int uflags = (unsigned short) form->ifr->ifr_flags;
 
 # ifdef ifr_flagshigh
-  uflags |= (unsigned short) form->ifr->ifr_flagshigh << 16;
+       uflags |= (unsigned short) form->ifr->ifr_flagshigh << 16;
 # endif /* ifr_flagshigh */
 
-  n = !(all_option || ifs_cmdline
-       || ((f = if_nameztoflag ("UP", &rev))
-           && ioctl (form->sfd, SIOCGIFFLAGS, form->ifr) == 0
-           && (f & uflags)));
+       n = n && (f & uflags);
+      };
+    }
 #else
-  n = 0;
+  n = 1;       /* Display all of them.  */
 #endif
-  select_arg (form, argc, argv, n);
+  select_arg (form, argc, argv, !n);
 }
 
 void

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

Summary of changes:
 ChangeLog          |   17 +++++++++++++++++
 ifconfig/printif.c |   27 +++++++++++++++++----------
 2 files changed, 34 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GNU Inetutils 



reply via email to

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