Remove duplicate definitions, run through indent

This commit is contained in:
Glenn L McGrath 2002-08-22 19:35:36 +00:00
parent 4534af2763
commit 1ed9dd9d06

View File

@ -15,7 +15,7 @@
* that either displays or sets the characteristics of * that either displays or sets the characteristics of
* one or more of the system's networking interfaces. * one or more of the system's networking interfaces.
* *
* Version: $Id: interface.c,v 1.8 2002/07/03 11:46:36 andersen Exp $ * Version: $Id: interface.c,v 1.9 2002/08/22 19:35:36 bug1 Exp $
* *
* Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Author: Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
* and others. Copyright 1993 MicroWalt Corporation * and others. Copyright 1993 MicroWalt Corporation
@ -159,11 +159,10 @@ struct aftype {
char *flag_file; char *flag_file;
}; };
static struct aftype *aftypes[];
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
static int flag_unx; static int flag_unx;
#ifdef HAVE_AFIPX #ifdef HAVE_AFIPX
static int flag_ipx; static int flag_ipx;
#endif #endif
@ -177,6 +176,7 @@ static int flag_ddp;
static int flag_netrom; static int flag_netrom;
#endif #endif
static int flag_inet; static int flag_inet;
#ifdef HAVE_AFINET6 #ifdef HAVE_AFINET6
static int flag_inet6; static int flag_inet6;
#endif #endif
@ -199,69 +199,53 @@ static struct aftrans_t {
#ifdef HAVE_AFX25 #ifdef HAVE_AFX25
{ {
"ax25", "ax25", &flag_ax25 "ax25", "ax25", &flag_ax25},
},
#endif #endif
{ {
"ip", "inet", &flag_inet "ip", "inet", &flag_inet},
},
#ifdef HAVE_AFINET6 #ifdef HAVE_AFINET6
{ {
"ip6", "inet6", &flag_inet6 "ip6", "inet6", &flag_inet6},
},
#endif #endif
#ifdef HAVE_AFIPX #ifdef HAVE_AFIPX
{ {
"ipx", "ipx", &flag_ipx "ipx", "ipx", &flag_ipx},
},
#endif #endif
#ifdef HAVE_AFATALK #ifdef HAVE_AFATALK
{ {
"appletalk", "ddp", &flag_ddp "appletalk", "ddp", &flag_ddp},
},
#endif #endif
#ifdef HAVE_AFNETROM #ifdef HAVE_AFNETROM
{ {
"netrom", "netrom", &flag_netrom "netrom", "netrom", &flag_netrom},
},
#endif #endif
{ {
"inet", "inet", &flag_inet "inet", "inet", &flag_inet},
},
#ifdef HAVE_AFINET6 #ifdef HAVE_AFINET6
{ {
"inet6", "inet6", &flag_inet6 "inet6", "inet6", &flag_inet6},
},
#endif #endif
#ifdef HAVE_AFATALK #ifdef HAVE_AFATALK
{ {
"ddp", "ddp", &flag_ddp "ddp", "ddp", &flag_ddp},
},
#endif #endif
{ {
"unix", "unix", &flag_unx "unix", "unix", &flag_unx}, {
}, "tcpip", "inet", &flag_inet},
{
"tcpip", "inet", &flag_inet
},
#ifdef HAVE_AFECONET #ifdef HAVE_AFECONET
{ {
"econet", "ec", &flag_econet "econet", "ec", &flag_econet},
},
#endif #endif
#ifdef HAVE_AFX25 #ifdef HAVE_AFX25
{ {
"x25", "x25", &flag_x25 "x25", "x25", &flag_x25},
},
#endif #endif
#ifdef HAVE_AFASH #ifdef HAVE_AFASH
{ {
"ash", "ash", &flag_ash "ash", "ash", &flag_ash},
},
#endif #endif
{ {
0, 0, 0 0, 0, 0}
}
}; };
static char afname[256] = ""; static char afname[256] = "";
@ -287,8 +271,7 @@ static char *UNIX_sprint(struct sockaddr *sap, int numeric)
} }
static struct aftype unix_aftype = static struct aftype unix_aftype = {
{
"unix", "UNIX Domain", AF_UNIX, 0, "unix", "UNIX Domain", AF_UNIX, 0,
UNIX_print, UNIX_sprint, NULL, NULL, UNIX_print, UNIX_sprint, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL,
@ -417,8 +400,7 @@ static int INET_getnetmask(char *adr, struct sockaddr *m, char *name)
} }
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct aftype inet_aftype = static struct aftype inet_aftype = {
{
"inet", "DARPA Internet", AF_INET, sizeof(unsigned long), "inet", "DARPA Internet", AF_INET, sizeof(unsigned long),
NULL /* UNUSED INET_print */ , INET_sprint, NULL /* UNUSED INET_print */ , INET_sprint,
NULL /* UNUSED INET_input */ , NULL /* UNUSED INET_reserror */ , NULL /* UNUSED INET_input */ , NULL /* UNUSED INET_reserror */ ,
@ -456,7 +438,8 @@ static char *INET6_sprint(struct sockaddr *sap, int numeric)
if (sap->sa_family == 0xFFFF || sap->sa_family == 0) if (sap->sa_family == 0xFFFF || sap->sa_family == 0)
return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff)); return safe_strncpy(buff, _("[NONE SET]"), sizeof(buff));
if (INET6_rresolve(buff, sizeof(buff), (struct sockaddr_in6 *) sap, numeric) != 0) if (INET6_rresolve
(buff, sizeof(buff), (struct sockaddr_in6 *) sap, numeric) != 0)
return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff)); return safe_strncpy(buff, _("[UNKNOWN]"), sizeof(buff));
return (buff); return (buff);
} }
@ -487,8 +470,7 @@ static int INET6_input(int type, char *bufp, struct sockaddr *sap)
} }
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct aftype inet6_aftype = static struct aftype inet6_aftype = {
{
"inet6", "IPv6", AF_INET6, sizeof(struct in6_addr), "inet6", "IPv6", AF_INET6, sizeof(struct in6_addr),
NULL /* UNUSED INET6_print */ , INET6_sprint, NULL /* UNUSED INET6_print */ , INET6_sprint,
NULL /* UNUSED INET6_input */ , NULL /* UNUSED INET6_reserror */ , NULL /* UNUSED INET6_input */ , NULL /* UNUSED INET6_reserror */ ,
@ -528,15 +510,13 @@ static char *UNSPEC_sprint(struct sockaddr *sap, int numeric)
return (UNSPEC_print(sap->sa_data)); return (UNSPEC_print(sap->sa_data));
} }
static struct aftype unspec_aftype = static struct aftype unspec_aftype = {
{
"unspec", "UNSPEC", AF_UNSPEC, 0, "unspec", "UNSPEC", AF_UNSPEC, 0,
UNSPEC_print, UNSPEC_sprint, NULL, NULL, UNSPEC_print, UNSPEC_sprint, NULL, NULL,
NULL, NULL,
}; };
static struct aftype *aftypes[] = static struct aftype *aftypes[] = {
{
#if HAVE_AFUNIX #if HAVE_AFUNIX
&unix_aftype, &unix_aftype,
#endif #endif
@ -712,7 +692,8 @@ static struct aftype *get_aftype(const char *name)
afp++; afp++;
} }
if (strchr(name, ',')) if (strchr(name, ','))
fprintf(stderr, _("Please don't supply more than one address family.\n")); fprintf(stderr,
_("Please don't supply more than one address family.\n"));
return (NULL); return (NULL);
} }
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
@ -757,7 +738,8 @@ static int get_socket_for_af(int af)
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
/* type: 0=all, 1=getroute */ /* type: 0=all, 1=getroute */
static void print_aflist(int type) { static void print_aflist(int type)
{
int count = 0; int count = 0;
char *txt; char *txt;
struct aftype **afp; struct aftype **afp;
@ -770,10 +752,14 @@ static void print_aflist(int type) {
afp = aftypes; afp = aftypes;
while (*afp != NULL) { while (*afp != NULL) {
if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) { if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) {
afp++; continue; afp++;
continue;
} }
if ((count % 3) == 0) fprintf(stderr,count?"\n ":" "); if ((count % 3) == 0)
txt = (*afp)->name; if (!txt) txt = ".."; fprintf(stderr, count ? "\n " : " ");
txt = (*afp)->name;
if (!txt)
txt = "..";
fprintf(stderr, "%s (%s) ", txt, _((*afp)->title)); fprintf(stderr, "%s (%s) ", txt, _((*afp)->title));
count++; count++;
afp++; afp++;
@ -875,6 +861,7 @@ static int sockets_open(int family)
for (aft = aftypes; *aft; aft++) { for (aft = aftypes; *aft; aft++) {
struct aftype *af = *aft; struct aftype *af = *aft;
int type = SOCK_DGRAM; int type = SOCK_DGRAM;
if (af->af == AF_UNSPEC) if (af->af == AF_UNSPEC)
continue; continue;
if (family && family != af->af) if (family && family != af->af)
@ -940,6 +927,7 @@ static struct interface *add_interface(char *name)
for (ife = int_last; ife; ife = ife->prev) { for (ife = int_last; ife; ife = ife->prev) {
int n = nstrcmp(ife->name, name); int n = nstrcmp(ife->name, name);
if (n == 0) if (n == 0)
return ife; return ife;
if (n < 0) if (n < 0)
@ -1017,6 +1005,7 @@ static char *get_name(char *name, char *p)
break; break;
if (*p == ':') { /* could be an alias */ if (*p == ':') { /* could be an alias */
char *dot = p, *dotname = name; char *dot = p, *dotname = name;
*name++ = *p++; *name++ = *p++;
while (isdigit(*p)) while (isdigit(*p))
*name++ = *p++; *name++ = *p++;
@ -1049,15 +1038,13 @@ static int get_dev_fields(char *bp, struct interface *ife)
&ife->stats.rx_frame_errors, &ife->stats.rx_frame_errors,
&ife->stats.rx_compressed, &ife->stats.rx_compressed,
&ife->stats.rx_multicast, &ife->stats.rx_multicast,
&ife->stats.tx_bytes, &ife->stats.tx_bytes,
&ife->stats.tx_packets, &ife->stats.tx_packets,
&ife->stats.tx_errors, &ife->stats.tx_errors,
&ife->stats.tx_dropped, &ife->stats.tx_dropped,
&ife->stats.tx_fifo_errors, &ife->stats.tx_fifo_errors,
&ife->stats.collisions, &ife->stats.collisions,
&ife->stats.tx_carrier_errors, &ife->stats.tx_carrier_errors, &ife->stats.tx_compressed);
&ife->stats.tx_compressed);
break; break;
case 2: case 2:
sscanf(bp, "%Lu %Lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu", sscanf(bp, "%Lu %Lu %lu %lu %lu %lu %Lu %Lu %lu %lu %lu %lu %lu",
@ -1067,14 +1054,12 @@ static int get_dev_fields(char *bp, struct interface *ife)
&ife->stats.rx_dropped, &ife->stats.rx_dropped,
&ife->stats.rx_fifo_errors, &ife->stats.rx_fifo_errors,
&ife->stats.rx_frame_errors, &ife->stats.rx_frame_errors,
&ife->stats.tx_bytes, &ife->stats.tx_bytes,
&ife->stats.tx_packets, &ife->stats.tx_packets,
&ife->stats.tx_errors, &ife->stats.tx_errors,
&ife->stats.tx_dropped, &ife->stats.tx_dropped,
&ife->stats.tx_fifo_errors, &ife->stats.tx_fifo_errors,
&ife->stats.collisions, &ife->stats.collisions, &ife->stats.tx_carrier_errors);
&ife->stats.tx_carrier_errors);
ife->stats.rx_multicast = 0; ife->stats.rx_multicast = 0;
break; break;
case 1: case 1:
@ -1084,13 +1069,11 @@ static int get_dev_fields(char *bp, struct interface *ife)
&ife->stats.rx_dropped, &ife->stats.rx_dropped,
&ife->stats.rx_fifo_errors, &ife->stats.rx_fifo_errors,
&ife->stats.rx_frame_errors, &ife->stats.rx_frame_errors,
&ife->stats.tx_packets, &ife->stats.tx_packets,
&ife->stats.tx_errors, &ife->stats.tx_errors,
&ife->stats.tx_dropped, &ife->stats.tx_dropped,
&ife->stats.tx_fifo_errors, &ife->stats.tx_fifo_errors,
&ife->stats.collisions, &ife->stats.collisions, &ife->stats.tx_carrier_errors);
&ife->stats.tx_carrier_errors);
ife->stats.rx_bytes = 0; ife->stats.rx_bytes = 0;
ife->stats.tx_bytes = 0; ife->stats.tx_bytes = 0;
ife->stats.rx_multicast = 0; ife->stats.rx_multicast = 0;
@ -1131,8 +1114,7 @@ static int if_readlist_proc(char *target)
fgets(buf, sizeof buf, fh); fgets(buf, sizeof buf, fh);
#if 0 /* pretty, but can't cope with missing fields */ #if 0 /* pretty, but can't cope with missing fields */
fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, fmt = proc_gen_fmt(_PATH_PROCNET_DEV, 1, fh, "face", "", /* parsed separately */
"face", "", /* parsed separately */
"bytes", "%lu", "bytes", "%lu",
"packets", "%lu", "packets", "%lu",
"errs", "%lu", "errs", "%lu",
@ -1147,9 +1129,7 @@ static int if_readlist_proc(char *target)
"drop", "%lu", "drop", "%lu",
"fifo", "%lu", "fifo", "%lu",
"colls", "%lu", "colls", "%lu",
"carrier", "%lu", "carrier", "%lu", "compressed", "%lu", NULL);
"compressed", "%lu",
NULL);
if (!fmt) if (!fmt)
return -1; return -1;
#else #else
@ -1159,6 +1139,7 @@ static int if_readlist_proc(char *target)
err = 0; err = 0;
while (fgets(buf, sizeof buf, fh)) { while (fgets(buf, sizeof buf, fh)) {
char *s, name[IFNAMSIZ]; char *s, name[IFNAMSIZ];
s = get_name(name, buf); s = get_name(name, buf);
ife = add_interface(name); ife = add_interface(name);
get_dev_fields(s, ife); get_dev_fields(s, ife);
@ -1171,7 +1152,6 @@ static int if_readlist_proc(char *target)
err = -1; err = -1;
proc_read = 0; proc_read = 0;
} }
#if 0 #if 0
free(fmt); free(fmt);
#endif #endif
@ -1182,12 +1162,14 @@ static int if_readlist_proc(char *target)
static int if_readlist(void) static int if_readlist(void)
{ {
int err = if_readlist_proc(NULL); int err = if_readlist_proc(NULL);
if (!err) if (!err)
err = if_readconf(); err = if_readconf();
return err; return err;
} }
static int for_all_interfaces(int (*doit) (struct interface *, void *), void *cookie) static int for_all_interfaces(int (*doit) (struct interface *, void *),
void *cookie)
{ {
struct interface *ife; struct interface *ife;
@ -1195,6 +1177,7 @@ static int for_all_interfaces(int (*doit) (struct interface *, void *), void *co
return -1; return -1;
for (ife = int_list; ife; ife = ife->next) { for (ife = int_list; ife; ife = ife->next) {
int err = doit(ife, cookie); int err = doit(ife, cookie);
if (err) if (err)
return err; return err;
} }
@ -1377,6 +1360,7 @@ static int do_if_fetch(struct interface *ife)
{ {
if (if_fetch(ife) < 0) { if (if_fetch(ife) < 0) {
char *errmsg; char *errmsg;
if (errno == ENODEV) { if (errno == ENODEV) {
/* Give better error message for this case. */ /* Give better error message for this case. */
errmsg = _("Device not found"); errmsg = _("Device not found");
@ -1402,14 +1386,12 @@ struct hwtype {
int suppress_null_addr; int suppress_null_addr;
}; };
static struct hwtype unspec_hwtype = static struct hwtype unspec_hwtype = {
{
"unspec", "UNSPEC", -1, 0, "unspec", "UNSPEC", -1, 0,
UNSPEC_print, NULL, NULL UNSPEC_print, NULL, NULL
}; };
static struct hwtype loop_hwtype = static struct hwtype loop_hwtype = {
{
"loop", "Local Loopback", ARPHRD_LOOPBACK, 0, "loop", "Local Loopback", ARPHRD_LOOPBACK, 0,
NULL, NULL, NULL NULL, NULL, NULL
}; };
@ -1418,8 +1400,6 @@ static struct hwtype loop_hwtype =
#include <net/if_arp.h> #include <net/if_arp.h>
#include <linux/if_ether.h> #include <linux/if_ether.h>
static struct hwtype ether_hwtype;
/* Display an Ethernet address in readable format. */ /* Display an Ethernet address in readable format. */
static char *pr_ether(unsigned char *ptr) static char *pr_ether(unsigned char *ptr)
{ {
@ -1457,7 +1437,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
val = c - 'A' + 10; val = c - 'A' + 10;
else { else {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); fprintf(stderr, _("in_ether(%s): invalid ether address!\n"),
orig);
#endif #endif
errno = EINVAL; errno = EINVAL;
return (-1); return (-1);
@ -1474,7 +1455,8 @@ static int in_ether(char *bufp, struct sockaddr *sap)
val >>= 4; val >>= 4;
else { else {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, _("in_ether(%s): invalid ether address!\n"), orig); fprintf(stderr, _("in_ether(%s): invalid ether address!\n"),
orig);
#endif #endif
errno = EINVAL; errno = EINVAL;
return (-1); return (-1);
@ -1514,8 +1496,7 @@ static int in_ether(char *bufp, struct sockaddr *sap)
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct hwtype ether_hwtype = static struct hwtype ether_hwtype = {
{
"ether", "Ethernet", ARPHRD_ETHER, ETH_ALEN, "ether", "Ethernet", ARPHRD_ETHER, ETH_ALEN,
pr_ether, NULL /* UNUSED in_ether */ , NULL pr_ether, NULL /* UNUSED in_ether */ , NULL
}; };
@ -1537,8 +1518,7 @@ static int do_ppp(int fd)
} }
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct hwtype ppp_hwtype = static struct hwtype ppp_hwtype = {
{
"ppp", "Point-Point Protocol", ARPHRD_PPP, 0, "ppp", "Point-Point Protocol", ARPHRD_PPP, 0,
NULL, NULL, NULL /* UNUSED do_ppp */ , 0 NULL, NULL, NULL /* UNUSED do_ppp */ , 0
}; };
@ -1546,8 +1526,7 @@ static struct hwtype ppp_hwtype =
#endif /* HAVE_PPP */ #endif /* HAVE_PPP */
static struct hwtype *hwtypes[] = static struct hwtype *hwtypes[] = {
{
&loop_hwtype, &loop_hwtype,
@ -1696,8 +1675,7 @@ static void hwinit()
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
#ifdef IFF_PORTSEL #ifdef IFF_PORTSEL
static const char *if_port_text[][4] = static const char *if_port_text[][4] = {
{
/* Keep in step with <linux/netdevice.h> */ /* Keep in step with <linux/netdevice.h> */
{"unknown", NULL, NULL, NULL}, {"unknown", NULL, NULL, NULL},
{"10base2", "bnc", "coax", NULL}, {"10base2", "bnc", "coax", NULL},
@ -1734,6 +1712,7 @@ static int hw_null_address(struct hwtype *hw, void *ap)
{ {
unsigned int i; unsigned int i;
unsigned char *address = (unsigned char *) ap; unsigned char *address = (unsigned char *) ap;
for (i = 0; i < hw->alen; i++) for (i = 0; i < hw->alen; i++)
if (address[i]) if (address[i])
return 0; return 0;
@ -1849,18 +1828,21 @@ static void ife_print(struct interface *ptr)
#define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */ #define IPV6_ADDR_RESERVED 0x2000U /* reserved address space */
if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) { if ((f = fopen(_PATH_PROCNET_IFINET6, "r")) != NULL) {
while (fscanf(f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n", while (fscanf
addr6p[0], addr6p[1], addr6p[2], addr6p[3], (f, "%4s%4s%4s%4s%4s%4s%4s%4s %02x %02x %02x %02x %20s\n",
addr6p[4], addr6p[5], addr6p[6], addr6p[7], addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4],
&if_idx, &plen, &scope, &dad_status, devname) != EOF) { addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope,
&dad_status, devname) != EOF) {
if (!strcmp(devname, ptr->name)) { if (!strcmp(devname, ptr->name)) {
sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[0], addr6p[1], addr6p[2], addr6p[3],
addr6p[4], addr6p[5], addr6p[6], addr6p[7]); addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
inet_pton(AF_INET6, addr6, (struct sockaddr *) &sap.sin6_addr); inet_pton(AF_INET6, addr6,
(struct sockaddr *) &sap.sin6_addr);
sap.sin6_family = AF_INET6; sap.sin6_family = AF_INET6;
printf(_(" inet6 addr: %s/%d"), printf(_(" inet6 addr: %s/%d"),
inet6_aftype.sprint((struct sockaddr *) &sap, 1), plen); inet6_aftype.sprint((struct sockaddr *) &sap, 1),
plen);
printf(_(" Scope:")); printf(_(" Scope:"));
switch (scope & IPV6_ADDR_SCOPE_MASK) { switch (scope & IPV6_ADDR_SCOPE_MASK) {
case 0: case 0:
@ -1913,7 +1895,8 @@ static void ife_print(struct interface *ptr)
ddptype = get_afntype(AF_APPLETALK); ddptype = get_afntype(AF_APPLETALK);
if (ddptype != NULL) { if (ddptype != NULL) {
if (ptr->has_ddp) if (ptr->has_ddp)
printf(_(" EtherTalk Phase 2 addr:%s\n"), ddptype->sprint(&ptr->ddpaddr, 1)); printf(_(" EtherTalk Phase 2 addr:%s\n"),
ddptype->sprint(&ptr->ddpaddr, 1));
} }
#endif #endif
@ -1922,7 +1905,8 @@ static void ife_print(struct interface *ptr)
ectype = get_afntype(AF_ECONET); ectype = get_afntype(AF_ECONET);
if (ectype != NULL) { if (ectype != NULL) {
if (ptr->has_econet) if (ptr->has_econet)
printf(_(" econet addr:%s\n"), ectype->sprint(&ptr->ecaddr, 1)); printf(_(" econet addr:%s\n"),
ectype->sprint(&ptr->ecaddr, 1));
} }
#endif #endif
@ -1961,12 +1945,10 @@ static void ife_print(struct interface *ptr)
printf(_("DYNAMIC ")); printf(_("DYNAMIC "));
#endif #endif
/* DONT FORGET TO ADD THE FLAGS IN ife_print_short */ /* DONT FORGET TO ADD THE FLAGS IN ife_print_short */
printf(_(" MTU:%d Metric:%d"), printf(_(" MTU:%d Metric:%d"), ptr->mtu, ptr->metric ? ptr->metric : 1);
ptr->mtu, ptr->metric ? ptr->metric : 1);
#ifdef SIOCSKEEPALIVE #ifdef SIOCSKEEPALIVE
if (ptr->outfill || ptr->keepalive) if (ptr->outfill || ptr->keepalive)
printf(_(" Outfill:%d Keepalive:%d"), printf(_(" Outfill:%d Keepalive:%d"), ptr->outfill, ptr->keepalive);
ptr->outfill, ptr->keepalive);
#endif #endif
printf("\n"); printf("\n");
@ -1979,14 +1961,17 @@ static void ife_print(struct interface *ptr)
*/ */
printf(" "); printf(" ");
printf(_("RX packets:%Lu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"), printf(_
("RX packets:%Lu errors:%lu dropped:%lu overruns:%lu frame:%lu\n"),
ptr->stats.rx_packets, ptr->stats.rx_errors, ptr->stats.rx_packets, ptr->stats.rx_errors,
ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors, ptr->stats.rx_dropped, ptr->stats.rx_fifo_errors,
ptr->stats.rx_frame_errors); ptr->stats.rx_frame_errors);
if (can_compress) if (can_compress)
printf(_(" compressed:%lu\n"), ptr->stats.rx_compressed); printf(_(" compressed:%lu\n"),
ptr->stats.rx_compressed);
printf(" "); printf(" ");
printf(_("TX packets:%Lu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"), printf(_
("TX packets:%Lu errors:%lu dropped:%lu overruns:%lu carrier:%lu\n"),
ptr->stats.tx_packets, ptr->stats.tx_errors, ptr->stats.tx_packets, ptr->stats.tx_errors,
ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors, ptr->stats.tx_dropped, ptr->stats.tx_fifo_errors,
ptr->stats.tx_carrier_errors); ptr->stats.tx_carrier_errors);
@ -2008,9 +1993,11 @@ static void ife_print(struct interface *ptr)
printf(_("Interrupt:%d "), ptr->map.irq); printf(_("Interrupt:%d "), ptr->map.irq);
if (ptr->map.base_addr >= 0x100) /* Only print devices using it for if (ptr->map.base_addr >= 0x100) /* Only print devices using it for
I/O maps */ I/O maps */
printf(_("Base address:0x%lx "), (unsigned long)ptr->map.base_addr); printf(_("Base address:0x%lx "),
(unsigned long) ptr->map.base_addr);
if (ptr->map.mem_start) { if (ptr->map.mem_start) {
printf(_("Memory:%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) if (ptr->map.dma)
printf(_("DMA chan:%x "), ptr->map.dma); printf(_("DMA chan:%x "), ptr->map.dma);