* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-04-09 13:58 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-04-09 13:58 UTC (permalink / raw
To: gentoo-commits
commit: 1dd95c51357839aa86259dd4d9372b7a4e946264
Author: Bernd Eckenfels <net-tools <AT> lina <DOT> inka <DOT> de>
AuthorDate: Thu Jan 27 00:43:13 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Thu Jan 27 00:43:13 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=1dd95c51
corrected indention
---
lib/net-support.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/net-support.h b/lib/net-support.h
index 2820619..b79f11b 100644
--- a/lib/net-support.h
+++ b/lib/net-support.h
@@ -140,7 +140,7 @@ extern char afname[];
#define AFTRANS_OPTS \
{"ax25", 0, 0, 1}, \
- {"x25", 0, 0, 1}, \
+ {"x25", 0, 0, 1}, \
{"ip", 0, 0, 1}, \
{"ipx", 0, 0, 1}, \
{"appletalk", 0, 0, 1}, \
@@ -148,7 +148,7 @@ extern char afname[];
{"inet", 0, 0, 1}, \
{"inet6", 0, 0, 1}, \
{"ddp", 0, 0, 1}, \
- {"rose", 0, 0, 1}, \
+ {"rose", 0, 0, 1}, \
{"unix", 0, 0, 1}, \
{"tcpip", 0, 0, 1}
#define AFTRANS_CNT 12
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-04-09 13:58 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-04-09 13:58 UTC (permalink / raw
To: gentoo-commits
commit: 8b2bedef6cf6bf6639d309fee7f22019acefcafa
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 19 07:07:09 2008 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Apr 9 13:57:46 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=8b2bedef
revert 621a2f376334f8097604b9fee5783e0f1141e66d for ifconfig output format to avoid breaking scripts
this isn't a complete revert, just the display portions
---
lib/interface.c | 262 +++++++++++++++++++++++++-----------------------------
1 files changed, 121 insertions(+), 141 deletions(-)
diff --git a/lib/interface.c b/lib/interface.c
index 0e5e454..ead6a8d 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -691,70 +691,32 @@ void ife_print_long(struct interface *ptr)
if (hw == NULL)
hw = get_hwntype(-1);
- sprintf(flags, "flags=%d<", ptr->flags);
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
- if (ptr->flags == 0)
- strcat(flags,">");
- if (ptr->flags & IFF_UP)
- strcat(flags,_("UP,"));
- if (ptr->flags & IFF_BROADCAST)
- strcat(flags,_("BROADCAST,"));
- if (ptr->flags & IFF_DEBUG)
- strcat(flags,_("DEBUG,"));
- if (ptr->flags & IFF_LOOPBACK)
- strcat(flags,_("LOOPBACK,"));
- if (ptr->flags & IFF_POINTOPOINT)
- strcat(flags,_("POINTOPOINT,"));
- if (ptr->flags & IFF_NOTRAILERS)
- strcat(flags,_("NOTRAILERS,"));
- if (ptr->flags & IFF_RUNNING)
- strcat(flags,_("RUNNING,"));
- if (ptr->flags & IFF_NOARP)
- strcat(flags,_("NOARP,"));
- if (ptr->flags & IFF_PROMISC)
- strcat(flags,_("PROMISC,"));
- if (ptr->flags & IFF_ALLMULTI)
- strcat(flags,_("ALLMULTI,"));
- if (ptr->flags & IFF_SLAVE)
- strcat(flags,_("SLAVE,"));
- if (ptr->flags & IFF_MASTER)
- strcat(flags,_("MASTER,"));
- if (ptr->flags & IFF_MULTICAST)
- strcat(flags,_("MULTICAST,"));
-#ifdef HAVE_DYNAMIC
- if (ptr->flags & IFF_DYNAMIC)
- strcat(flags,_("DYNAMIC,"));
-#endif
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
-
-
- printf(_("%s: %s mtu %d metric %d"),
- ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1);
-#ifdef SIOCSKEEPALIVE
- if (ptr->outfill || ptr->keepalive)
- printf(_(" outfill %d keepalive %d"),
- ptr->outfill, ptr->keepalive);
+ printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title);
+ /* For some hardware types (eg Ash, ATM) we don't print the
+ hardware address if it's null. */
+ if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
+ hw->suppress_null_addr)))
+ printf(_("HWaddr %s "), hw->print(ptr->hwaddr));
+#ifdef IFF_PORTSEL
+ if (ptr->flags & IFF_PORTSEL) {
+ printf(_("Media:%s"), if_port_text[ptr->map.port][0]);
+ if (ptr->flags & IFF_AUTOMEDIA)
+ printf(_("(auto)"));
+ }
#endif
printf("\n");
-
-
#if HAVE_AFINET
if (ptr->has_ip) {
- printf(_(" %s %s"), ap->name,
+ printf(_(" %s addr:%s "), ap->name,
ap->sprint(&ptr->addr, 1));
- printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1));
- if (ptr->flags & IFF_BROADCAST) {
- printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1));
- }
if (ptr->flags & IFF_POINTOPOINT) {
- printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1));
+ printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1));
}
- printf("\n");
+ if (ptr->flags & IFF_BROADCAST) {
+ printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1));
+ }
+ printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1));
}
#endif
@@ -771,30 +733,29 @@ void ife_print_long(struct interface *ptr)
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &sap);
- printf(_(" %s %s prefixlen %d"),
- inet6_aftype.name,
- inet6_aftype.sprint((struct sockaddr *) &sap, 1),
- plen);
- printf(_(" scopeid 0x%x"), scope);
-
- flags[0] = '<'; flags[1] = 0;
- if (scope & IPV6_ADDR_COMPATv4) {
- strcat(flags, _("compat,"));
- scope -= IPV6_ADDR_COMPATv4;
+ printf(_(" inet6 addr: %s/%d"),
+ inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen);
+ printf(_(" Scope:"));
+ switch (scope) {
+ case 0:
+ printf(_("Global"));
+ break;
+ case IPV6_ADDR_LINKLOCAL:
+ printf(_("Link"));
+ break;
+ case IPV6_ADDR_SITELOCAL:
+ printf(_("Site"));
+ break;
+ case IPV6_ADDR_COMPATv4:
+ printf(_("Compat"));
+ break;
+ case IPV6_ADDR_LOOPBACK:
+ printf(_("Host"));
+ break;
+ default:
+ printf(_("Unknown"));
}
- if (scope == 0)
- strcat(flags, _("global,"));
- if (scope & IPV6_ADDR_LINKLOCAL)
- strcat(flags, _("link,"));
- if (scope & IPV6_ADDR_SITELOCAL)
- strcat(flags, _("site,"));
- if (scope & IPV6_ADDR_LOOPBACK)
- strcat(flags, _("host,"));
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
- printf("%s\n", flags);
+ printf("\n");
}
}
fclose(f);
@@ -807,17 +768,17 @@ void ife_print_long(struct interface *ptr)
if (ipxtype != NULL) {
if (ptr->has_ipx_bb)
- printf(_(" %s Ethernet-II %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1));
+ printf(_(" IPX/Ethernet II addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_bb, 1));
if (ptr->has_ipx_sn)
- printf(_(" %s Ethernet-SNAP %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1));
+ printf(_(" IPX/Ethernet SNAP addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_sn, 1));
if (ptr->has_ipx_e2)
- printf(_(" %s Ethernet802.2 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1));
+ printf(_(" IPX/Ethernet 802.2 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e2, 1));
if (ptr->has_ipx_e3)
- printf(_(" %s Ethernet802.3 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1));
+ printf(_(" IPX/Ethernet 802.3 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e3, 1));
}
#endif
@@ -826,7 +787,7 @@ void ife_print_long(struct interface *ptr)
ddptype = get_afntype(AF_APPLETALK);
if (ddptype != NULL) {
if (ptr->has_ddp)
- printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1));
+ printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1));
}
#endif
@@ -835,30 +796,53 @@ void ife_print_long(struct interface *ptr)
ectype = get_afntype(AF_ECONET);
if (ectype != NULL) {
if (ptr->has_econet)
- printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1));
+ printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1));
}
#endif
- /* For some hardware types (eg Ash, ATM) we don't print the
- hardware address if it's null. */
- if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
- hw->suppress_null_addr)))
- printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr));
- else
- printf(_(" %s"), hw->name);
- if (ptr->tx_queue_len != -1)
- printf(_(" txqueuelen %d"), ptr->tx_queue_len);
- printf(" (%s)\n", hw->title);
-
-#ifdef IFF_PORTSEL
- if (ptr->flags & IFF_PORTSEL) {
- printf(_(" media %s"), if_port_text[ptr->map.port][0]);
- if (ptr->flags & IFF_AUTOMEDIA)
- printf(_("autoselect"));
- printf("\n");
- }
+ printf(" ");
+ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
+ if (ptr->flags == 0)
+ printf(_("[NO FLAGS] "));
+ if (ptr->flags & IFF_UP)
+ printf(_("UP "));
+ if (ptr->flags & IFF_BROADCAST)
+ printf(_("BROADCAST "));
+ if (ptr->flags & IFF_DEBUG)
+ printf(_("DEBUG "));
+ if (ptr->flags & IFF_LOOPBACK)
+ printf(_("LOOPBACK "));
+ if (ptr->flags & IFF_POINTOPOINT)
+ printf(_("POINTOPOINT "));
+ if (ptr->flags & IFF_NOTRAILERS)
+ printf(_("NOTRAILERS "));
+ if (ptr->flags & IFF_RUNNING)
+ printf(_("RUNNING "));
+ if (ptr->flags & IFF_NOARP)
+ printf(_("NOARP "));
+ if (ptr->flags & IFF_PROMISC)
+ printf(_("PROMISC "));
+ if (ptr->flags & IFF_ALLMULTI)
+ printf(_("ALLMULTI "));
+ if (ptr->flags & IFF_SLAVE)
+ printf(_("SLAVE "));
+ if (ptr->flags & IFF_MASTER)
+ printf(_("MASTER "));
+ if (ptr->flags & IFF_MULTICAST)
+ printf(_("MULTICAST "));
+#ifdef HAVE_DYNAMIC
+ 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
+ if (ptr->outfill || ptr->keepalive)
+ printf(_(" Outfill:%d Keepalive:%d"),
+ ptr->outfill, ptr->keepalive);
+#endif
+ printf("\n");
/* If needed, display the interface statistics. */
@@ -867,6 +851,15 @@ void ife_print_long(struct interface *ptr)
* not for the aliases, although strictly speaking they're shared
* by all addresses.
*/
+ printf(" ");
+
+ printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
+ ptr->stats.rx_packets, ptr->stats.rx_errors,
+ ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
+ ptr->stats.rx_frame_errors);
+ if (can_compress)
+ printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed);
+
rx = ptr->stats.rx_bytes;
short_rx = rx * 10;
if (rx > 1125899906842624ull) {
@@ -904,50 +897,37 @@ void ife_print_long(struct interface *ptr)
Text = "KiB";
}
- printf(" ");
- printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.rx_packets,
- rx, (unsigned long)(short_rx / 10),
- (unsigned long)(short_rx % 10), Rext);
- if (can_compress) {
- printf(" ");
- printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed);
- }
- printf(" ");
- printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"),
- ptr->stats.rx_errors, ptr->stats.rx_dropped,
- ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors);
-
-
- printf(" ");
- printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.tx_packets,
- tx, (unsigned long)(short_tx / 10),
- (unsigned long)(short_tx % 10), Text);
- if (can_compress) {
- printf(" ");
- printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed);
- }
- printf(" ");
- printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"),
- ptr->stats.tx_errors,
+ printf(" ");
+ printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
+ ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
- ptr->stats.tx_carrier_errors, ptr->stats.collisions);
+ ptr->stats.tx_carrier_errors);
+ printf(_(" collisions:%lu "), ptr->stats.collisions);
+ if (can_compress)
+ printf(_("compressed:%lu "), ptr->stats.tx_compressed);
+ if (ptr->tx_queue_len != -1)
+ printf(_("txqueuelen:%d "), ptr->tx_queue_len);
+ printf("\n ");
+ printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"),
+ rx, (unsigned long)(short_rx / 10),
+ (unsigned long)(short_rx % 10), Rext,
+ tx, (unsigned long)(short_tx / 10),
+ (unsigned long)(short_tx % 10), Text);
}
if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma ||
ptr->map.base_addr >= 0x100)) {
- printf(" device ");
+ printf(" ");
if (ptr->map.irq)
- printf(_("interrupt %d "), ptr->map.irq);
+ printf(_("Interrupt:%d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */
- printf(_("base 0x%x "), ptr->map.base_addr);
+ printf(_("Base address:0x%x "), ptr->map.base_addr);
if (ptr->map.mem_start) {
- printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
+ printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
}
if (ptr->map.dma)
- printf(_(" dma 0x%x"), ptr->map.dma);
+ printf(_("DMA chan:%x "), ptr->map.dma);
printf("\n");
}
printf("\n");
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-08-20 4:57 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-08-20 4:57 UTC (permalink / raw
To: gentoo-commits
commit: 995cd238633f0b80f251df5cc9b87aacb0494c8c
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 19 07:07:09 2008 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Sat Aug 20 04:57:30 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=995cd238
revert 621a2f376334f8097604b9fee5783e0f1141e66d for ifconfig output format to avoid breaking scripts
this isn't a complete revert, just the display portions
---
lib/interface.c | 262 +++++++++++++++++++++++++-----------------------------
1 files changed, 121 insertions(+), 141 deletions(-)
diff --git a/lib/interface.c b/lib/interface.c
index 0e5e454..ead6a8d 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -691,70 +691,32 @@ void ife_print_long(struct interface *ptr)
if (hw == NULL)
hw = get_hwntype(-1);
- sprintf(flags, "flags=%d<", ptr->flags);
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
- if (ptr->flags == 0)
- strcat(flags,">");
- if (ptr->flags & IFF_UP)
- strcat(flags,_("UP,"));
- if (ptr->flags & IFF_BROADCAST)
- strcat(flags,_("BROADCAST,"));
- if (ptr->flags & IFF_DEBUG)
- strcat(flags,_("DEBUG,"));
- if (ptr->flags & IFF_LOOPBACK)
- strcat(flags,_("LOOPBACK,"));
- if (ptr->flags & IFF_POINTOPOINT)
- strcat(flags,_("POINTOPOINT,"));
- if (ptr->flags & IFF_NOTRAILERS)
- strcat(flags,_("NOTRAILERS,"));
- if (ptr->flags & IFF_RUNNING)
- strcat(flags,_("RUNNING,"));
- if (ptr->flags & IFF_NOARP)
- strcat(flags,_("NOARP,"));
- if (ptr->flags & IFF_PROMISC)
- strcat(flags,_("PROMISC,"));
- if (ptr->flags & IFF_ALLMULTI)
- strcat(flags,_("ALLMULTI,"));
- if (ptr->flags & IFF_SLAVE)
- strcat(flags,_("SLAVE,"));
- if (ptr->flags & IFF_MASTER)
- strcat(flags,_("MASTER,"));
- if (ptr->flags & IFF_MULTICAST)
- strcat(flags,_("MULTICAST,"));
-#ifdef HAVE_DYNAMIC
- if (ptr->flags & IFF_DYNAMIC)
- strcat(flags,_("DYNAMIC,"));
-#endif
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
-
-
- printf(_("%s: %s mtu %d metric %d"),
- ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1);
-#ifdef SIOCSKEEPALIVE
- if (ptr->outfill || ptr->keepalive)
- printf(_(" outfill %d keepalive %d"),
- ptr->outfill, ptr->keepalive);
+ printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title);
+ /* For some hardware types (eg Ash, ATM) we don't print the
+ hardware address if it's null. */
+ if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
+ hw->suppress_null_addr)))
+ printf(_("HWaddr %s "), hw->print(ptr->hwaddr));
+#ifdef IFF_PORTSEL
+ if (ptr->flags & IFF_PORTSEL) {
+ printf(_("Media:%s"), if_port_text[ptr->map.port][0]);
+ if (ptr->flags & IFF_AUTOMEDIA)
+ printf(_("(auto)"));
+ }
#endif
printf("\n");
-
-
#if HAVE_AFINET
if (ptr->has_ip) {
- printf(_(" %s %s"), ap->name,
+ printf(_(" %s addr:%s "), ap->name,
ap->sprint(&ptr->addr, 1));
- printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1));
- if (ptr->flags & IFF_BROADCAST) {
- printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1));
- }
if (ptr->flags & IFF_POINTOPOINT) {
- printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1));
+ printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1));
}
- printf("\n");
+ if (ptr->flags & IFF_BROADCAST) {
+ printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1));
+ }
+ printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1));
}
#endif
@@ -771,30 +733,29 @@ void ife_print_long(struct interface *ptr)
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &sap);
- printf(_(" %s %s prefixlen %d"),
- inet6_aftype.name,
- inet6_aftype.sprint((struct sockaddr *) &sap, 1),
- plen);
- printf(_(" scopeid 0x%x"), scope);
-
- flags[0] = '<'; flags[1] = 0;
- if (scope & IPV6_ADDR_COMPATv4) {
- strcat(flags, _("compat,"));
- scope -= IPV6_ADDR_COMPATv4;
+ printf(_(" inet6 addr: %s/%d"),
+ inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen);
+ printf(_(" Scope:"));
+ switch (scope) {
+ case 0:
+ printf(_("Global"));
+ break;
+ case IPV6_ADDR_LINKLOCAL:
+ printf(_("Link"));
+ break;
+ case IPV6_ADDR_SITELOCAL:
+ printf(_("Site"));
+ break;
+ case IPV6_ADDR_COMPATv4:
+ printf(_("Compat"));
+ break;
+ case IPV6_ADDR_LOOPBACK:
+ printf(_("Host"));
+ break;
+ default:
+ printf(_("Unknown"));
}
- if (scope == 0)
- strcat(flags, _("global,"));
- if (scope & IPV6_ADDR_LINKLOCAL)
- strcat(flags, _("link,"));
- if (scope & IPV6_ADDR_SITELOCAL)
- strcat(flags, _("site,"));
- if (scope & IPV6_ADDR_LOOPBACK)
- strcat(flags, _("host,"));
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
- printf("%s\n", flags);
+ printf("\n");
}
}
fclose(f);
@@ -807,17 +768,17 @@ void ife_print_long(struct interface *ptr)
if (ipxtype != NULL) {
if (ptr->has_ipx_bb)
- printf(_(" %s Ethernet-II %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1));
+ printf(_(" IPX/Ethernet II addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_bb, 1));
if (ptr->has_ipx_sn)
- printf(_(" %s Ethernet-SNAP %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1));
+ printf(_(" IPX/Ethernet SNAP addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_sn, 1));
if (ptr->has_ipx_e2)
- printf(_(" %s Ethernet802.2 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1));
+ printf(_(" IPX/Ethernet 802.2 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e2, 1));
if (ptr->has_ipx_e3)
- printf(_(" %s Ethernet802.3 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1));
+ printf(_(" IPX/Ethernet 802.3 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e3, 1));
}
#endif
@@ -826,7 +787,7 @@ void ife_print_long(struct interface *ptr)
ddptype = get_afntype(AF_APPLETALK);
if (ddptype != NULL) {
if (ptr->has_ddp)
- printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1));
+ printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1));
}
#endif
@@ -835,30 +796,53 @@ void ife_print_long(struct interface *ptr)
ectype = get_afntype(AF_ECONET);
if (ectype != NULL) {
if (ptr->has_econet)
- printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1));
+ printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1));
}
#endif
- /* For some hardware types (eg Ash, ATM) we don't print the
- hardware address if it's null. */
- if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
- hw->suppress_null_addr)))
- printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr));
- else
- printf(_(" %s"), hw->name);
- if (ptr->tx_queue_len != -1)
- printf(_(" txqueuelen %d"), ptr->tx_queue_len);
- printf(" (%s)\n", hw->title);
-
-#ifdef IFF_PORTSEL
- if (ptr->flags & IFF_PORTSEL) {
- printf(_(" media %s"), if_port_text[ptr->map.port][0]);
- if (ptr->flags & IFF_AUTOMEDIA)
- printf(_("autoselect"));
- printf("\n");
- }
+ printf(" ");
+ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
+ if (ptr->flags == 0)
+ printf(_("[NO FLAGS] "));
+ if (ptr->flags & IFF_UP)
+ printf(_("UP "));
+ if (ptr->flags & IFF_BROADCAST)
+ printf(_("BROADCAST "));
+ if (ptr->flags & IFF_DEBUG)
+ printf(_("DEBUG "));
+ if (ptr->flags & IFF_LOOPBACK)
+ printf(_("LOOPBACK "));
+ if (ptr->flags & IFF_POINTOPOINT)
+ printf(_("POINTOPOINT "));
+ if (ptr->flags & IFF_NOTRAILERS)
+ printf(_("NOTRAILERS "));
+ if (ptr->flags & IFF_RUNNING)
+ printf(_("RUNNING "));
+ if (ptr->flags & IFF_NOARP)
+ printf(_("NOARP "));
+ if (ptr->flags & IFF_PROMISC)
+ printf(_("PROMISC "));
+ if (ptr->flags & IFF_ALLMULTI)
+ printf(_("ALLMULTI "));
+ if (ptr->flags & IFF_SLAVE)
+ printf(_("SLAVE "));
+ if (ptr->flags & IFF_MASTER)
+ printf(_("MASTER "));
+ if (ptr->flags & IFF_MULTICAST)
+ printf(_("MULTICAST "));
+#ifdef HAVE_DYNAMIC
+ 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
+ if (ptr->outfill || ptr->keepalive)
+ printf(_(" Outfill:%d Keepalive:%d"),
+ ptr->outfill, ptr->keepalive);
+#endif
+ printf("\n");
/* If needed, display the interface statistics. */
@@ -867,6 +851,15 @@ void ife_print_long(struct interface *ptr)
* not for the aliases, although strictly speaking they're shared
* by all addresses.
*/
+ printf(" ");
+
+ printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
+ ptr->stats.rx_packets, ptr->stats.rx_errors,
+ ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
+ ptr->stats.rx_frame_errors);
+ if (can_compress)
+ printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed);
+
rx = ptr->stats.rx_bytes;
short_rx = rx * 10;
if (rx > 1125899906842624ull) {
@@ -904,50 +897,37 @@ void ife_print_long(struct interface *ptr)
Text = "KiB";
}
- printf(" ");
- printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.rx_packets,
- rx, (unsigned long)(short_rx / 10),
- (unsigned long)(short_rx % 10), Rext);
- if (can_compress) {
- printf(" ");
- printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed);
- }
- printf(" ");
- printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"),
- ptr->stats.rx_errors, ptr->stats.rx_dropped,
- ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors);
-
-
- printf(" ");
- printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.tx_packets,
- tx, (unsigned long)(short_tx / 10),
- (unsigned long)(short_tx % 10), Text);
- if (can_compress) {
- printf(" ");
- printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed);
- }
- printf(" ");
- printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"),
- ptr->stats.tx_errors,
+ printf(" ");
+ printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
+ ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
- ptr->stats.tx_carrier_errors, ptr->stats.collisions);
+ ptr->stats.tx_carrier_errors);
+ printf(_(" collisions:%lu "), ptr->stats.collisions);
+ if (can_compress)
+ printf(_("compressed:%lu "), ptr->stats.tx_compressed);
+ if (ptr->tx_queue_len != -1)
+ printf(_("txqueuelen:%d "), ptr->tx_queue_len);
+ printf("\n ");
+ printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"),
+ rx, (unsigned long)(short_rx / 10),
+ (unsigned long)(short_rx % 10), Rext,
+ tx, (unsigned long)(short_tx / 10),
+ (unsigned long)(short_tx % 10), Text);
}
if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma ||
ptr->map.base_addr >= 0x100)) {
- printf(" device ");
+ printf(" ");
if (ptr->map.irq)
- printf(_("interrupt %d "), ptr->map.irq);
+ printf(_("Interrupt:%d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */
- printf(_("base 0x%x "), ptr->map.base_addr);
+ printf(_("Base address:0x%x "), ptr->map.base_addr);
if (ptr->map.mem_start) {
- printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
+ printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
}
if (ptr->map.dma)
- printf(_(" dma 0x%x"), ptr->map.dma);
+ printf(_("DMA chan:%x "), ptr->map.dma);
printf("\n");
}
printf("\n");
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:master commit in: lib/
2011-11-21 1:38 [gentoo-commits] proj/net-tools:gentoo commit in: lib/ Mike Frysinger
@ 2011-11-21 1:35 ` Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:35 UTC (permalink / raw
To: gentoo-commits
commit: 243cd05e7ac857f64648639e970a8c0d28dc0f2e
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:25:56 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:46:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=243cd05e
pull in stdlib.h for malloc() prototype
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/proc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/proc.c b/lib/proc.c
index 9cd4eeb..5c709ed 100644
--- a/lib/proc.c
+++ b/lib/proc.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-11-21 1:38 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 2b4f34b987dbb7a2003219162bab0d61305c95d7
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:07:40 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:11:05 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=2b4f34b9
get_sname: constify args/return when possible
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/inet.c | 2 +-
lib/net-support.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/inet.c b/lib/inet.c
index c0f7efa..8080364 100644
--- a/lib/inet.c
+++ b/lib/inet.c
@@ -416,7 +416,7 @@ static int read_services(void)
}
-char *get_sname(int socknumber, char *proto, int numeric)
+const char *get_sname(int socknumber, const char *proto, int numeric)
{
static char buffer[64], init = 0;
struct service *item;
diff --git a/lib/net-support.h b/lib/net-support.h
index b79f11b..dae15ac 100644
--- a/lib/net-support.h
+++ b/lib/net-support.h
@@ -124,7 +124,7 @@ extern int ROSE_rinput(int action, int flags, char **argv);
extern int aftrans_opt(const char *arg);
extern void aftrans_def(char *tool, char *argv0, char *dflt);
-extern char *get_sname(int socknumber, char *proto, int numeric);
+extern const char *get_sname(int socknumber, const char *proto, int numeric);
extern int flag_unx;
extern int flag_ipx;
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
2011-11-21 1:35 [gentoo-commits] proj/net-tools:master " Mike Frysinger
@ 2011-11-21 1:38 ` Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 6a9347cb91535eb35306eff731d94384c9b7025e
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:08:15 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:11:22 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=6a9347cb
get_sname: unify numeric handling
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/inet.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/inet.c b/lib/inet.c
index 8080364..073c8a3 100644
--- a/lib/inet.c
+++ b/lib/inet.c
@@ -423,10 +423,9 @@ const char *get_sname(int socknumber, const char *proto, int numeric)
if (socknumber == 0)
return ("*");
- if (numeric) {
- sprintf(buffer, "%d", ntohs(socknumber));
- return (buffer);
- }
+ if (numeric)
+ goto do_ntohs;
+
if (!init) {
(void) read_services();
init = 1;
@@ -443,8 +442,11 @@ const char *get_sname(int socknumber, const char *proto, int numeric)
sprintf(buffer, "%s", item->name);
}
- if (!buffer[0])
+
+ if (!buffer[0]) {
+ do_ntohs:
sprintf(buffer, "%d", ntohs(socknumber));
+ }
return (buffer);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-11-21 1:38 Mike Frysinger
2011-11-21 1:35 ` [gentoo-commits] proj/net-tools:master " Mike Frysinger
0 siblings, 1 reply; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 243cd05e7ac857f64648639e970a8c0d28dc0f2e
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:25:56 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:46:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=243cd05e
pull in stdlib.h for malloc() prototype
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/proc.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/proc.c b/lib/proc.c
index 9cd4eeb..5c709ed 100644
--- a/lib/proc.c
+++ b/lib/proc.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
+#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-11-21 1:38 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 46cd57a736c30bafd41406781e7b1c6532e6a97d
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:27:14 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:46:38 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=46cd57a7
fix up unused variable warnings
Some of these are unused, so drop them. Others are only used in debug
code, so refactor those so things are always compiled.
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/arcnet.c | 32 ++++++++++++++------------------
lib/ax25.c | 27 +++++++++++++++------------
lib/ether.c | 32 ++++++++++++++------------------
lib/eui64.c | 37 +++++++++++++++++--------------------
lib/fddi.c | 32 ++++++++++++++------------------
lib/hippi.c | 32 ++++++++++++++------------------
lib/ib.c | 10 +++++++---
lib/inet6_gr.c | 8 +++-----
lib/ipx.c | 2 --
lib/netrom.c | 27 +++++++++++++++------------
lib/rose.c | 11 -----------
lib/tr.c | 32 ++++++++++++++------------------
12 files changed, 127 insertions(+), 155 deletions(-)
diff --git a/lib/arcnet.c b/lib/arcnet.c
index 35a2b9a..10b59e5 100644
--- a/lib/arcnet.c
+++ b/lib/arcnet.c
@@ -43,6 +43,11 @@ static const char *pr_arcnet(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an ARCnet address and convert to binary. */
static int in_arcnet(char *bufp, struct sockaddr *sap)
@@ -66,9 +71,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -81,9 +85,8 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_arcnet(%s): invalid arcnet address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -92,28 +95,21 @@ static int in_arcnet(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == ETH_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == ETH_ALEN)
fprintf(stderr, _("in_arcnet(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == ETH_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_arcnet(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_arcnet(%s): %s\n", orig, pr_arcnet(sap->sa_data));
return (0);
}
diff --git a/lib/ax25.c b/lib/ax25.c
index 209e479..afc035b 100644
--- a/lib/ax25.c
+++ b/lib/ax25.c
@@ -76,6 +76,11 @@ static const char *
return (AX25_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int AX25_input(int type, char *bufp, struct sockaddr *sap)
{
@@ -95,9 +100,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
c = toupper(c);
if (!(isupper(c) || isdigit(c))) {
safe_strncpy(AX25_errmsg, _("Invalid callsign"), sizeof(AX25_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
errno = EINVAL;
return (-1);
}
@@ -108,9 +112,8 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
/* Callsign too long? */
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) {
strcpy(AX25_errmsg, _("Callsign too long"));
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "ax25_input(%s): %s !\n", AX25_errmsg, orig);
errno = E2BIG;
return (-1);
}
@@ -128,12 +131,12 @@ static int AX25_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "ax25_input(%s): ", orig);
- for (i = 0; i < sizeof(ax25_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
+ if (_DEBUG) {
+ fprintf(stderr, "ax25_input(%s): ", orig);
+ for (i = 0; i < sizeof(ax25_address); i++)
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
+ fprintf(stderr, "\n");
+ }
return (0);
}
diff --git a/lib/ether.c b/lib/ether.c
index ddd1598..9bf8a55 100644
--- a/lib/ether.c
+++ b/lib/ether.c
@@ -46,6 +46,11 @@ static const char *pr_ether(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an Ethernet address and convert to binary. */
static int in_ether(char *bufp, struct sockaddr *sap)
@@ -70,9 +75,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -87,9 +91,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
else if (c == ':' || c == 0)
val >>= 4;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -100,28 +103,21 @@ static int in_ether(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == ETH_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == ETH_ALEN)
fprintf(stderr, _("in_ether(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == ETH_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == ETH_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_ether(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_ether(%s): %s\n", orig, pr_ether(sap->sa_data));
return (0);
}
diff --git a/lib/eui64.c b/lib/eui64.c
index 6ab7d26..32822a3 100644
--- a/lib/eui64.c
+++ b/lib/eui64.c
@@ -60,6 +60,12 @@ static const char *pr_eui64(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
+
/* Start the PPP encapsulation on the file descriptor. */
static int in_eui64( char *bufp, struct sockaddr *sap )
{
@@ -84,10 +90,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
- orig );
-#endif
+ if (_DEBUG)
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
+ orig );
errno = EINVAL;
return (-1);
}
@@ -103,10 +108,9 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
else if (c == ':' || c == 0)
val >>= 4;
else {
-#ifdef DEBUG
- fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
- orig );
-#endif
+ if (_DEBUG)
+ fprintf( stderr, _("in_eui64(%s): invalid eui64 address!\n"),
+ orig );
errno = EINVAL;
return (-1);
}
@@ -119,28 +123,21 @@ static int in_eui64( char *bufp, struct sockaddr *sap )
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == EUI64_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == EUI64_ALEN)
fprintf(stderr, _("in_eui64(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == EUI64_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == EUI64_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_eui64(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_eui64(%s): %s\n", orig, pr_eui64(sap->sa_data));
return (0);
}
diff --git a/lib/fddi.c b/lib/fddi.c
index 75adddd..750cc2d 100644
--- a/lib/fddi.c
+++ b/lib/fddi.c
@@ -57,6 +57,11 @@ static const char *pr_fddi(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an FDDI address and convert to binary. */
static int in_fddi(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -95,9 +99,8 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_fddi(%s): invalid fddi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -106,28 +109,21 @@ static int in_fddi(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == FDDI_K_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == FDDI_K_ALEN)
fprintf(stderr, _("in_fddi(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == FDDI_K_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == FDDI_K_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_fddi(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_fddi(%s): %s\n", orig, pr_fddi(sap->sa_data));
return (0);
}
diff --git a/lib/hippi.c b/lib/hippi.c
index bd73ea1..ae6e31b 100644
--- a/lib/hippi.c
+++ b/lib/hippi.c
@@ -57,6 +57,11 @@ static const char *pr_hippi(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an HIPPI address and convert to binary. */
static int in_hippi(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -95,9 +99,8 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_hippi(%s): invalid hippi address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -106,27 +109,20 @@ static int in_hippi(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == HIPPI_ALEN) {
-#ifdef DEBUG
- fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig)
-#endif
- ; /* nothing */
- }
+ if (_DEBUG && i == HIPPI_ALEN)
+ fprintf(stderr, _("in_hippi(%s): trailing : ignored!\n"), orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == HIPPI_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == HIPPI_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_hippi(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_hippi(%s): %s\n", orig, pr_hippi(sap->sa_data));
return (0);
}
diff --git a/lib/ib.c b/lib/ib.c
index e05bd3e..98f3446 100644
--- a/lib/ib.c
+++ b/lib/ib.c
@@ -56,6 +56,11 @@ static const char *pr_ib(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
/* Input an Infiniband address and convert to binary. */
static int in_ib(char *bufp, struct sockaddr *sap)
@@ -80,9 +85,8 @@ static int in_ib(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_ib(%s): invalid infiniband address!\n"), orig);
errno = EINVAL;
return (-1);
}
diff --git a/lib/inet6_gr.c b/lib/inet6_gr.c
index 7f1bc20..2b055f6 100644
--- a/lib/inet6_gr.c
+++ b/lib/inet6_gr.c
@@ -92,10 +92,8 @@ int rprint_fib6(int ext, int numeric)
naddr6p[0], naddr6p[1], naddr6p[2], naddr6p[3],
naddr6p[4], naddr6p[5], naddr6p[6], naddr6p[7],
&metric, &refcnt, &use, &iflags, iface);
-#if 0
- if (num < 23)
+ if (0 && num < 23)
continue;
-#endif
if (iflags & RTF_CACHE) {
if (!(numeric & RTF_CACHE))
continue;
@@ -163,7 +161,7 @@ int rprint_cache6(int ext, int numeric)
char buff[4096], iface[16], flags[16];
char addr6[128], haddr[20], statestr[20];
struct sockaddr_in6 saddr6;
- int type, num, refcnt, prefix_len, location, state, gc;
+ int type, refcnt, prefix_len, location, state, gc;
long tstamp, expire, ndflags, reachable, stale, delete;
FILE *fp = fopen(_PATH_PROCNET_NDISC, "r");
char addr6p[8][5], haddrp[6][3];
@@ -184,7 +182,7 @@ int rprint_cache6(int ext, int numeric)
while (fgets(buff, 1023, fp)) {
- num = sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n",
+ sscanf(buff, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %08lx %08lx %08lx %04x %04x %04lx %8s %2s%2s%2s%2s%2s%2s\n",
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7],
&location, &prefix_len, &type, &state, &expire, &tstamp, &reachable, &gc, &refcnt,
diff --git a/lib/ipx.c b/lib/ipx.c
index 1359f5f..f90c96c 100644
--- a/lib/ipx.c
+++ b/lib/ipx.c
@@ -87,12 +87,10 @@ static int IPX_getsock(char *bufp, struct sockaddr *sap)
{
char *sp = bufp, *bp;
unsigned int i;
- unsigned char val;
struct sockaddr_ipx *sipx = (struct sockaddr_ipx *) sap;
sipx->sipx_port = 0;
- val = 0;
bp = (char *) sipx->sipx_node;
for (i = 0; i < sizeof(sipx->sipx_node); i++) {
*sp = toupper(*sp);
diff --git a/lib/netrom.c b/lib/netrom.c
index f3033c7..254bd61 100644
--- a/lib/netrom.c
+++ b/lib/netrom.c
@@ -79,6 +79,11 @@ static const char *NETROM_sprint(struct sockaddr *sap, int numeric)
return (NETROM_print(((struct sockaddr_ax25 *) sap)->sax25_call.ax25_call));
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
{
@@ -98,9 +103,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
c = toupper(c);
if (!(isupper(c) || isdigit(c))) {
safe_strncpy(netrom_errmsg, _("Invalid callsign"), sizeof(netrom_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
errno = EINVAL;
return (-1);
}
@@ -111,9 +115,8 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
/* Callsign too long? */
if ((i == 6) && (*bufp != '-') && (*bufp != '\0')) {
safe_strncpy(netrom_errmsg, _("Callsign too long"), sizeof(netrom_errmsg));
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "netrom_input(%s): %s !\n", netrom_errmsg, orig);
errno = E2BIG;
return (-1);
}
@@ -131,12 +134,12 @@ static int NETROM_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "netrom_input(%s): ", orig);
- for (i = 0; i < sizeof(ax25_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
+ if (_DEBUG) {
+ fprintf(stderr, "netrom_input(%s): ", orig);
+ for (i = 0; i < sizeof(ax25_address); i++)
+ fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
+ fprintf(stderr, "\n");
+ }
return (0);
}
diff --git a/lib/rose.c b/lib/rose.c
index 52d025a..c02e741 100644
--- a/lib/rose.c
+++ b/lib/rose.c
@@ -73,7 +73,6 @@ static const char *
return (ROSE_print(((struct sockaddr_rose *) sap)->srose_addr.rose_addr));
}
-
static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
{
char *ptr;
@@ -85,9 +84,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
/* Node address the correct length ? */
if (strlen(bufp) != 10) {
strcpy(ROSE_errmsg, _("Node address must be ten digits"));
-#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): %s !\n", ROSE_errmsg, orig);
-#endif
errno = EINVAL;
return (-1);
}
@@ -98,13 +94,6 @@ static int ROSE_input(int type, char *bufp, struct sockaddr *sap)
}
/* All done. */
-#ifdef DEBUG
- fprintf(stderr, "rose_input(%s): ", orig);
- for (i = 0; i < sizeof(rose_address); i++)
- fprintf(stderr, "%02X ", sap->sa_data[i] & 0377);
- fprintf(stderr, "\n");
-#endif
-
return (0);
}
diff --git a/lib/tr.c b/lib/tr.c
index 961cdb1..a0413f4 100644
--- a/lib/tr.c
+++ b/lib/tr.c
@@ -50,6 +50,11 @@ static const char *pr_tr(const char *ptr)
return (buff);
}
+#ifdef DEBUG
+#define _DEBUG 1
+#else
+#define _DEBUG 0
+#endif
static int in_tr(char *bufp, struct sockaddr *sap)
{
@@ -82,9 +87,8 @@ static int in_tr(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val = c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -97,9 +101,8 @@ static int in_tr(char *bufp, struct sockaddr *sap)
else if (c >= 'A' && c <= 'F')
val |= c - 'A' + 10;
else {
-#ifdef DEBUG
- fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
-#endif
+ if (_DEBUG)
+ fprintf(stderr, _("in_tr(%s): invalid token ring address!\n"), orig);
errno = EINVAL;
return (-1);
}
@@ -108,28 +111,21 @@ static int in_tr(char *bufp, struct sockaddr *sap)
/* We might get a semicolon here - not required. */
if (*bufp == ':') {
- if (i == TR_ALEN) {
-#ifdef DEBUG
+ if (_DEBUG && i == TR_ALEN)
fprintf(stderr, _("in_tr(%s): trailing : ignored!\n"),
- orig)
-#endif
- ; /* nothing */
- }
+ orig);
bufp++;
}
}
/* That's it. Any trailing junk? */
- if ((i == TR_ALEN) && (*bufp != '\0')) {
-#ifdef DEBUG
+ if (_DEBUG && (i == TR_ALEN) && (*bufp != '\0')) {
fprintf(stderr, _("in_tr(%s): trailing junk!\n"), orig);
errno = EINVAL;
return (-1);
-#endif
}
-#ifdef DEBUG
- fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data));
-#endif
+ if (_DEBUG)
+ fprintf(stderr, "in_tr(%s): %s\n", orig, pr_tr(sap->sa_data));
return (0);
}
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
2011-11-21 1:35 [gentoo-commits] proj/net-tools:master " Mike Frysinger
@ 2011-11-21 1:38 ` Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 7ae4aa5619cc7e7067ea6ee24a4d49fa5b4a72fd
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 21 00:08:37 2011 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 00:11:56 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=7ae4aa56
get_sname: avoid buffer overflows if proto name is too long
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
---
lib/inet.c | 21 +++++++++++----------
1 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/lib/inet.c b/lib/inet.c
index 073c8a3..60e55df 100644
--- a/lib/inet.c
+++ b/lib/inet.c
@@ -431,16 +431,17 @@ const char *get_sname(int socknumber, const char *proto, int numeric)
init = 1;
}
buffer[0] = '\0';
- if (!strcmp(proto, "tcp")) {
- if ((item = searchlist(tcp_name, socknumber)) != NULL)
- sprintf(buffer, "%s", item->name);
- } else if (!strcmp(proto, "udp")) {
- if ((item = searchlist(udp_name, socknumber)) != NULL)
- sprintf(buffer, "%s", item->name);
- } else if (!strcmp(proto, "raw")) {
- if ((item = searchlist(raw_name, socknumber)) != NULL)
- sprintf(buffer, "%s", item->name);
-
+ if (!strcmp(proto, "tcp"))
+ item = searchlist(tcp_name, socknumber);
+ else if (!strcmp(proto, "udp"))
+ item = searchlist(udp_name, socknumber);
+ else if (!strcmp(proto, "raw"))
+ item = searchlist(raw_name, socknumber);
+ else
+ item = NULL;
+ if (item) {
+ strncpy(buffer, item->name, sizeof(buffer));
+ buffer[sizeof(buffer) - 1] = '\0';
}
if (!buffer[0]) {
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [gentoo-commits] proj/net-tools:gentoo commit in: lib/
@ 2011-11-21 1:38 Mike Frysinger
0 siblings, 0 replies; 10+ messages in thread
From: Mike Frysinger @ 2011-11-21 1:38 UTC (permalink / raw
To: gentoo-commits
commit: 1735e2c711c1838757eb8732c6eccf11b38854ef
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 19 07:07:09 2008 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Nov 21 01:38:29 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/net-tools.git;a=commit;h=1735e2c7
revert 621a2f376334f8097604b9fee5783e0f1141e66d for ifconfig output format to avoid breaking scripts
this isn't a complete revert, just the display portions
---
lib/interface.c | 262 +++++++++++++++++++++++++-----------------------------
1 files changed, 121 insertions(+), 141 deletions(-)
diff --git a/lib/interface.c b/lib/interface.c
index 0e5e454..ead6a8d 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -691,70 +691,32 @@ void ife_print_long(struct interface *ptr)
if (hw == NULL)
hw = get_hwntype(-1);
- sprintf(flags, "flags=%d<", ptr->flags);
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
- if (ptr->flags == 0)
- strcat(flags,">");
- if (ptr->flags & IFF_UP)
- strcat(flags,_("UP,"));
- if (ptr->flags & IFF_BROADCAST)
- strcat(flags,_("BROADCAST,"));
- if (ptr->flags & IFF_DEBUG)
- strcat(flags,_("DEBUG,"));
- if (ptr->flags & IFF_LOOPBACK)
- strcat(flags,_("LOOPBACK,"));
- if (ptr->flags & IFF_POINTOPOINT)
- strcat(flags,_("POINTOPOINT,"));
- if (ptr->flags & IFF_NOTRAILERS)
- strcat(flags,_("NOTRAILERS,"));
- if (ptr->flags & IFF_RUNNING)
- strcat(flags,_("RUNNING,"));
- if (ptr->flags & IFF_NOARP)
- strcat(flags,_("NOARP,"));
- if (ptr->flags & IFF_PROMISC)
- strcat(flags,_("PROMISC,"));
- if (ptr->flags & IFF_ALLMULTI)
- strcat(flags,_("ALLMULTI,"));
- if (ptr->flags & IFF_SLAVE)
- strcat(flags,_("SLAVE,"));
- if (ptr->flags & IFF_MASTER)
- strcat(flags,_("MASTER,"));
- if (ptr->flags & IFF_MULTICAST)
- strcat(flags,_("MULTICAST,"));
-#ifdef HAVE_DYNAMIC
- if (ptr->flags & IFF_DYNAMIC)
- strcat(flags,_("DYNAMIC,"));
-#endif
- /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
-
-
- printf(_("%s: %s mtu %d metric %d"),
- ptr->name, flags, ptr->mtu, ptr->metric ? ptr->metric : 1);
-#ifdef SIOCSKEEPALIVE
- if (ptr->outfill || ptr->keepalive)
- printf(_(" outfill %d keepalive %d"),
- ptr->outfill, ptr->keepalive);
+ printf(_("%-9.9s Link encap:%s "), ptr->name, hw->title);
+ /* For some hardware types (eg Ash, ATM) we don't print the
+ hardware address if it's null. */
+ if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
+ hw->suppress_null_addr)))
+ printf(_("HWaddr %s "), hw->print(ptr->hwaddr));
+#ifdef IFF_PORTSEL
+ if (ptr->flags & IFF_PORTSEL) {
+ printf(_("Media:%s"), if_port_text[ptr->map.port][0]);
+ if (ptr->flags & IFF_AUTOMEDIA)
+ printf(_("(auto)"));
+ }
#endif
printf("\n");
-
-
#if HAVE_AFINET
if (ptr->has_ip) {
- printf(_(" %s %s"), ap->name,
+ printf(_(" %s addr:%s "), ap->name,
ap->sprint(&ptr->addr, 1));
- printf(_(" netmask %s"), ap->sprint(&ptr->netmask, 1));
- if (ptr->flags & IFF_BROADCAST) {
- printf(_(" broadcast %s"), ap->sprint(&ptr->broadaddr, 1));
- }
if (ptr->flags & IFF_POINTOPOINT) {
- printf(_(" destination %s"), ap->sprint(&ptr->dstaddr, 1));
+ printf(_(" P-t-P:%s "), ap->sprint(&ptr->dstaddr, 1));
}
- printf("\n");
+ if (ptr->flags & IFF_BROADCAST) {
+ printf(_(" Bcast:%s "), ap->sprint(&ptr->broadaddr, 1));
+ }
+ printf(_(" Mask:%s\n"), ap->sprint(&ptr->netmask, 1));
}
#endif
@@ -771,30 +733,29 @@ void ife_print_long(struct interface *ptr)
addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet6_aftype.input(1, addr6, (struct sockaddr *) &sap);
- printf(_(" %s %s prefixlen %d"),
- inet6_aftype.name,
- inet6_aftype.sprint((struct sockaddr *) &sap, 1),
- plen);
- printf(_(" scopeid 0x%x"), scope);
-
- flags[0] = '<'; flags[1] = 0;
- if (scope & IPV6_ADDR_COMPATv4) {
- strcat(flags, _("compat,"));
- scope -= IPV6_ADDR_COMPATv4;
+ printf(_(" inet6 addr: %s/%d"),
+ inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen);
+ printf(_(" Scope:"));
+ switch (scope) {
+ case 0:
+ printf(_("Global"));
+ break;
+ case IPV6_ADDR_LINKLOCAL:
+ printf(_("Link"));
+ break;
+ case IPV6_ADDR_SITELOCAL:
+ printf(_("Site"));
+ break;
+ case IPV6_ADDR_COMPATv4:
+ printf(_("Compat"));
+ break;
+ case IPV6_ADDR_LOOPBACK:
+ printf(_("Host"));
+ break;
+ default:
+ printf(_("Unknown"));
}
- if (scope == 0)
- strcat(flags, _("global,"));
- if (scope & IPV6_ADDR_LINKLOCAL)
- strcat(flags, _("link,"));
- if (scope & IPV6_ADDR_SITELOCAL)
- strcat(flags, _("site,"));
- if (scope & IPV6_ADDR_LOOPBACK)
- strcat(flags, _("host,"));
- if (flags[strlen(flags)-1] == ',')
- flags[strlen(flags)-1] = '>';
- else
- flags[strlen(flags)-1] = 0;
- printf("%s\n", flags);
+ printf("\n");
}
}
fclose(f);
@@ -807,17 +768,17 @@ void ife_print_long(struct interface *ptr)
if (ipxtype != NULL) {
if (ptr->has_ipx_bb)
- printf(_(" %s Ethernet-II %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_bb, 1));
+ printf(_(" IPX/Ethernet II addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_bb, 1));
if (ptr->has_ipx_sn)
- printf(_(" %s Ethernet-SNAP %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_sn, 1));
+ printf(_(" IPX/Ethernet SNAP addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_sn, 1));
if (ptr->has_ipx_e2)
- printf(_(" %s Ethernet802.2 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e2, 1));
+ printf(_(" IPX/Ethernet 802.2 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e2, 1));
if (ptr->has_ipx_e3)
- printf(_(" %s Ethernet802.3 %s\n"),
- ipxtype->name, ipxtype->sprint(&ptr->ipxaddr_e3, 1));
+ printf(_(" IPX/Ethernet 802.3 addr:%s\n"),
+ ipxtype->sprint(&ptr->ipxaddr_e3, 1));
}
#endif
@@ -826,7 +787,7 @@ void ife_print_long(struct interface *ptr)
ddptype = get_afntype(AF_APPLETALK);
if (ddptype != NULL) {
if (ptr->has_ddp)
- printf(_(" %s %s\n"), ddptype->name, ddptype->sprint(&ptr->ddpaddr, 1));
+ printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1));
}
#endif
@@ -835,30 +796,53 @@ void ife_print_long(struct interface *ptr)
ectype = get_afntype(AF_ECONET);
if (ectype != NULL) {
if (ptr->has_econet)
- printf(_(" %s %s\n"), ectype->name, ectype->sprint(&ptr->ecaddr, 1));
+ printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1));
}
#endif
- /* For some hardware types (eg Ash, ATM) we don't print the
- hardware address if it's null. */
- if (hw->print != NULL && (! (hw_null_address(hw, ptr->hwaddr) &&
- hw->suppress_null_addr)))
- printf(_(" %s %s"), hw->name, hw->print(ptr->hwaddr));
- else
- printf(_(" %s"), hw->name);
- if (ptr->tx_queue_len != -1)
- printf(_(" txqueuelen %d"), ptr->tx_queue_len);
- printf(" (%s)\n", hw->title);
-
-#ifdef IFF_PORTSEL
- if (ptr->flags & IFF_PORTSEL) {
- printf(_(" media %s"), if_port_text[ptr->map.port][0]);
- if (ptr->flags & IFF_AUTOMEDIA)
- printf(_("autoselect"));
- printf("\n");
- }
+ printf(" ");
+ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short, too */
+ if (ptr->flags == 0)
+ printf(_("[NO FLAGS] "));
+ if (ptr->flags & IFF_UP)
+ printf(_("UP "));
+ if (ptr->flags & IFF_BROADCAST)
+ printf(_("BROADCAST "));
+ if (ptr->flags & IFF_DEBUG)
+ printf(_("DEBUG "));
+ if (ptr->flags & IFF_LOOPBACK)
+ printf(_("LOOPBACK "));
+ if (ptr->flags & IFF_POINTOPOINT)
+ printf(_("POINTOPOINT "));
+ if (ptr->flags & IFF_NOTRAILERS)
+ printf(_("NOTRAILERS "));
+ if (ptr->flags & IFF_RUNNING)
+ printf(_("RUNNING "));
+ if (ptr->flags & IFF_NOARP)
+ printf(_("NOARP "));
+ if (ptr->flags & IFF_PROMISC)
+ printf(_("PROMISC "));
+ if (ptr->flags & IFF_ALLMULTI)
+ printf(_("ALLMULTI "));
+ if (ptr->flags & IFF_SLAVE)
+ printf(_("SLAVE "));
+ if (ptr->flags & IFF_MASTER)
+ printf(_("MASTER "));
+ if (ptr->flags & IFF_MULTICAST)
+ printf(_("MULTICAST "));
+#ifdef HAVE_DYNAMIC
+ 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
+ if (ptr->outfill || ptr->keepalive)
+ printf(_(" Outfill:%d Keepalive:%d"),
+ ptr->outfill, ptr->keepalive);
+#endif
+ printf("\n");
/* If needed, display the interface statistics. */
@@ -867,6 +851,15 @@ void ife_print_long(struct interface *ptr)
* not for the aliases, although strictly speaking they're shared
* by all addresses.
*/
+ printf(" ");
+
+ printf(_("RX packets:%llu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
+ ptr->stats.rx_packets, ptr->stats.rx_errors,
+ ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
+ ptr->stats.rx_frame_errors);
+ if (can_compress)
+ printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed);
+
rx = ptr->stats.rx_bytes;
short_rx = rx * 10;
if (rx > 1125899906842624ull) {
@@ -904,50 +897,37 @@ void ife_print_long(struct interface *ptr)
Text = "KiB";
}
- printf(" ");
- printf(_("RX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.rx_packets,
- rx, (unsigned long)(short_rx / 10),
- (unsigned long)(short_rx % 10), Rext);
- if (can_compress) {
- printf(" ");
- printf(_("RX compressed:%lu\n"), ptr->stats.rx_compressed);
- }
- printf(" ");
- printf(_("RX errors %lu dropped %lu overruns %lu frame %lu\n"),
- ptr->stats.rx_errors, ptr->stats.rx_dropped,
- ptr->stats.rx_fifo_errors, ptr->stats.rx_frame_errors);
-
-
- printf(" ");
- printf(_("TX packets %llu bytes %llu (%lu.%lu %s)\n"),
- ptr->stats.tx_packets,
- tx, (unsigned long)(short_tx / 10),
- (unsigned long)(short_tx % 10), Text);
- if (can_compress) {
- printf(" ");
- printf(_("TX compressed %lu\n"), ptr->stats.tx_compressed);
- }
- printf(" ");
- printf(_("TX errors %lu dropped %lu overruns %lu carrier %lu collisions %lu\n"),
- ptr->stats.tx_errors,
+ printf(" ");
+ printf(_("TX packets:%llu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
+ ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
- ptr->stats.tx_carrier_errors, ptr->stats.collisions);
+ ptr->stats.tx_carrier_errors);
+ printf(_(" collisions:%lu "), ptr->stats.collisions);
+ if (can_compress)
+ printf(_("compressed:%lu "), ptr->stats.tx_compressed);
+ if (ptr->tx_queue_len != -1)
+ printf(_("txqueuelen:%d "), ptr->tx_queue_len);
+ printf("\n ");
+ printf(_("RX bytes:%llu (%lu.%lu %s) TX bytes:%llu (%lu.%lu %s)\n"),
+ rx, (unsigned long)(short_rx / 10),
+ (unsigned long)(short_rx % 10), Rext,
+ tx, (unsigned long)(short_tx / 10),
+ (unsigned long)(short_tx % 10), Text);
}
if ((ptr->map.irq || ptr->map.mem_start || ptr->map.dma ||
ptr->map.base_addr >= 0x100)) {
- printf(" device ");
+ printf(" ");
if (ptr->map.irq)
- printf(_("interrupt %d "), ptr->map.irq);
+ printf(_("Interrupt:%d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */
- printf(_("base 0x%x "), ptr->map.base_addr);
+ printf(_("Base address:0x%x "), ptr->map.base_addr);
if (ptr->map.mem_start) {
- printf(_("memory 0x%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
+ printf(_("Memory:%lx-%lx "), ptr->map.mem_start, ptr->map.mem_end);
}
if (ptr->map.dma)
- printf(_(" dma 0x%x"), ptr->map.dma);
+ printf(_("DMA chan:%x "), ptr->map.dma);
printf("\n");
}
printf("\n");
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2011-11-21 1:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 1:38 [gentoo-commits] proj/net-tools:gentoo commit in: lib/ Mike Frysinger
2011-11-21 1:35 ` [gentoo-commits] proj/net-tools:master " Mike Frysinger
-- strict thread matches above, loose matches on Subject: below --
2011-11-21 1:38 [gentoo-commits] proj/net-tools:gentoo " Mike Frysinger
2011-11-21 1:38 Mike Frysinger
2011-11-21 1:38 Mike Frysinger
2011-11-21 1:35 [gentoo-commits] proj/net-tools:master " Mike Frysinger
2011-11-21 1:38 ` [gentoo-commits] proj/net-tools:gentoo " Mike Frysinger
2011-11-21 1:35 [gentoo-commits] proj/net-tools:master " Mike Frysinger
2011-11-21 1:38 ` [gentoo-commits] proj/net-tools:gentoo " Mike Frysinger
2011-08-20 4:57 Mike Frysinger
2011-04-09 13:58 Mike Frysinger
2011-04-09 13:58 Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox