display all IFF_ flags for netstat -i (print_short and print_long has equal
authorBernd Eckenfels <net-tools@lina.inka.de>
Tue, 19 Dec 2000 01:28:34 +0000 (01:28 +0000)
committerBernd Eckenfels <net-tools@lina.inka.de>
Tue, 19 Dec 2000 01:28:34 +0000 (01:28 +0000)
count of printed flags now)

lib/interface.c
netstat.c

index 1322557..172b208 100644 (file)
@@ -7,7 +7,7 @@
    8/2000  Andi Kleen make the list operations a bit more efficient.
    People are crazy enough to use thousands of aliases now.
 
-   $Id: interface.c,v 1.11 2000/12/19 01:01:41 ecki Exp $
+   $Id: interface.c,v 1.12 2000/12/19 01:28:34 ecki Exp $
  */
 
 #include "config.h"
@@ -580,10 +580,10 @@ int do_if_print(struct interface *ife, void *cookie)
 void ife_print_short(struct interface *ptr)
 {
     printf("%-5.5s ", ptr->name);
-    printf("%5d %3d ", ptr->mtu, ptr->metric);
+    printf("%5d %3d", ptr->mtu, ptr->metric);
     /* If needed, display the interface statistics. */
     if (ptr->statistics_valid) {
-       printf("%8lu %6lu %6lu %6lu ",
+       printf("%8lu %6lu %6lu %6lu",
               ptr->stats.rx_packets, ptr->stats.rx_errors,
               ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors);
        printf("%8lu %6lu %6lu %6lu ",
@@ -592,6 +592,7 @@ void ife_print_short(struct interface *ptr)
     } else {
        printf("%-56s", _("     - no statistics available -"));
     }
+    /* DONT FORGET TO ADD THE FLAGS IN ife_print_long, too */
     if (ptr->flags == 0)
        printf(_("[NO FLAGS]"));
     if (ptr->flags & IFF_ALLMULTI)
@@ -602,18 +603,29 @@ void ife_print_short(struct interface *ptr)
        printf("D");
     if (ptr->flags & IFF_LOOPBACK)
        printf("L");
-    if (ptr->flags & IFF_PROMISC)
+    if (ptr->flags & IFF_MULTICAST)
        printf("M");
+#ifdef HAVE_DYNAMIC
+    if (ptr->flags & IFF_DYNAMIC)
+       printf("d");
+#endif
+    if (ptr->flags & IFF_PROMISC)
+       printf("P");
     if (ptr->flags & IFF_NOTRAILERS)
        printf("N");
     if (ptr->flags & IFF_NOARP)
        printf("O");
     if (ptr->flags & IFF_POINTOPOINT)
        printf("P");
+    if (ptr->flags & IFF_SLAVE)
+       printf("s");
+    if (ptr->flags & IFF_MASTER)
+       printf("m");
     if (ptr->flags & IFF_RUNNING)
        printf("R");
     if (ptr->flags & IFF_UP)
        printf("U");
+    /* DONT FORGET TO ADD THE FLAGS IN ife_print_long, too */
     printf("\n");
 }
 
@@ -768,6 +780,7 @@ void ife_print_long(struct interface *ptr)
 #endif
 
     printf("          ");
+    /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
     if (ptr->flags == 0)
        printf(_("[NO FLAGS] "));
     if (ptr->flags & IFF_UP)
@@ -800,7 +813,7 @@ void ife_print_long(struct interface *ptr)
     if (ptr->flags & IFF_DYNAMIC)
        printf(_("DYNAMIC "));
 #endif
-
+    /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */
     printf(_(" MTU:%d  Metric:%d"),
           ptr->mtu, ptr->metric ? ptr->metric : 1);
 #ifdef SIOCSKEEPALIVE
index 2a1d909..bc1ac1c 100644 (file)
--- a/netstat.c
+++ b/netstat.c
@@ -6,7 +6,7 @@
  *              NET-3 Networking Distribution for the LINUX operating
  *              system.
  *
- * Version:     $Id: netstat.c,v 1.39 2000/10/08 01:00:43 ecki Exp $
+ * Version:     $Id: netstat.c,v 1.40 2000/12/19 01:28:34 ecki Exp $
  *
  * Authors:     Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
  *              Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
@@ -1444,7 +1444,7 @@ static int iface_info(void)
     }
     if (flag_exp < 2) {
        ife_short = 1;
-       printf(_("Iface   MTU Met    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
+       printf(_("Iface   MTU Met   RX-OK RX-ERR RX-DRP RX-OVR   TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
     }
 
     if (for_all_interfaces(do_if_print, &flag_all) < 0) {