Login
Log in using an SSO provider:
Fedora Account System
Red Hat Associate
Red Hat Customer
Login using a Red Hat Bugzilla account
Forgot Password
Create an Account
Red Hat Bugzilla – Attachment 72072 Details for
Bug 64862
RHEL 2.1/IPF/QU3: -c option to netstat(1) repeatedly prints headings (not I/F stats)
Home
New
Search
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh90 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
[?]
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
patch that fixes this bug
net-tools-1.60-continuous.patch (text/plain), 4.63 KB, created by
Scott Edlund
on 2002-08-21 20:30:45 UTC
(
hide
)
Description:
patch that fixes this bug
Filename:
MIME Type:
Creator:
Scott Edlund
Created:
2002-08-21 20:30:45 UTC
Size:
4.63 KB
patch
obsolete
>--- net-tools-1.60/lib/interface.c.bak Sat Feb 10 14:31:15 2001 >+++ net-tools-1.60/lib/interface.c Wed Aug 21 16:00:17 2002 >@@ -146,6 +146,7 @@ > int_list = ife->next; > free(ife); > } >+ int_last = NULL; > return 0; > } > >@@ -309,7 +310,7 @@ > if (proc_read) > return 0; > if (!target) >- proc_read = 1; >+;// proc_read = 1; > > fh = fopen(_PATH_PROCNET_DEV, "r"); > if (!fh) { >@@ -891,3 +892,22 @@ > else > ife_print_long(i); > } >+ >+int get_iface_count(void) { >+ int num_iface = 0; >+ struct interface* ife = int_list; >+ >+ for (; ife != NULL; ife=ife->next) { >+ num_iface++; >+ } >+ return num_iface; >+} >+ >+char* get_iface_name(int index) { >+ struct interface* ife = int_list; >+ >+ while ((index-- > 0) && (ife->next != NULL)) { >+ ife = ife->next; >+ } >+ return ife->name; >+} > >--- net-tools-1.60/include/interface.h.bak Sat Feb 10 14:24:25 2001 >+++ net-tools-1.60/include/interface.h Wed Aug 21 15:57:56 2002 >@@ -76,6 +76,8 @@ > extern int ife_short; > > extern const char *if_port_text[][4]; >+extern int get_iface_count(void); >+char *get_iface_name(int index); > > /* Defines for poor glibc2.0 users, the feature check is done at runtime */ > #if !defined(SIOCSIFTXQLEN) > >--- net-tools-1.60/netstat.c.bak Wed Aug 21 16:23:57 2002 >+++ net-tools-1.60/netstat.c Wed Aug 21 16:22:12 2002 >@@ -58,6 +58,7 @@ > * > *990420 {1.38} Tuan Hoang removed a useless assignment from igmp_do_one() > *20010404 {1.39} Arnaldo Carvalho de Melo - use setlocale >+ *20020821 Dave Melson / Scott Edlund - fixed -ic option > * > * This program is free software; you can redistribute it > * and/or modify it under the terms of the GNU General >@@ -152,6 +153,20 @@ > > FILE *procinfo; > >+struct iface_cache { >+ char iface_name[16+1]; >+ int rxok; >+ int rxerr; >+ int rxdrp; >+ int rxovr; >+ int txok; >+ int txerr; >+ int txdrp; >+ int txovr; >+}; >+ >+static struct iface_cache* mycache; >+ > #define INFO_GUTS1(file,name,proc) \ > procinfo = fopen((file), "r"); \ > if (procinfo == NULL) { \ >@@ -1438,6 +1453,77 @@ > } > #endif > >+int do_if_cache_print(struct interface *ife, void *cookie) >+{ >+ int *opt_a = (int *) cookie; >+ int res; >+ int num_iface = get_iface_count(); >+ int i; >+ >+ struct iface_cache* cur_iface_cache = NULL; >+ >+ res = do_if_fetch(ife); >+ >+ if (mycache == NULL) { >+ mycache = malloc(num_iface * sizeof(struct iface_cache)); >+ if (mycache == NULL) { exit(-1); } >+ memset(mycache, '\0', num_iface * sizeof(struct iface_cache)); >+ for (i=0; i < num_iface; i++) { >+ strncpy(mycache[i].iface_name, get_iface_name(i), 16); >+ } >+ } >+ >+ for (i=0; i < num_iface; i++) { >+ if (strcmp(ife->name, mycache[i].iface_name) == 0) { >+ cur_iface_cache = &mycache[i]; >+ break; >+ } >+ } >+ >+ if (cur_iface_cache != NULL) { >+ int swap; >+ >+ swap = ife->stats.rx_packets; >+ ife->stats.rx_packets -= cur_iface_cache->rxok; >+ cur_iface_cache->rxok = swap; >+ >+ swap = ife->stats.rx_errors; >+ ife->stats.rx_errors -= cur_iface_cache->rxerr; >+ cur_iface_cache->rxerr = swap; >+ >+ swap = ife->stats.rx_dropped; >+ ife->stats.rx_dropped -= cur_iface_cache->rxdrp; >+ cur_iface_cache->rxdrp = swap; >+ >+ swap = ife->stats.rx_fifo_errors; >+ ife->stats.rx_fifo_errors -= cur_iface_cache->rxovr; >+ cur_iface_cache->rxovr = swap; >+ >+ swap = ife->stats.tx_packets; >+ ife->stats.tx_packets -= cur_iface_cache->txok; >+ cur_iface_cache->txok = swap; >+ >+ swap = ife->stats.tx_errors; >+ ife->stats.tx_errors -= cur_iface_cache->txerr; >+ cur_iface_cache->txerr = swap; >+ >+ swap = ife->stats.tx_dropped; >+ ife->stats.tx_dropped -= cur_iface_cache->txdrp; >+ cur_iface_cache->txdrp = swap; >+ >+ swap = ife->stats.tx_fifo_errors; >+ ife->stats.tx_fifo_errors -= cur_iface_cache->txovr; >+ cur_iface_cache->txovr = swap; >+ } >+ >+ if (res >= 0) { >+ if ((ife->flags & IFF_UP) || *opt_a) { >+ ife_print(ife); >+ } >+ } >+ return res; >+} >+ > static int iface_info(void) > { > if (skfd < 0) { >@@ -1452,7 +1538,7 @@ > 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) { >+ if (for_all_interfaces(do_if_cache_print, &flag_all) < 0) { > perror(_("missing interface information")); > exit(1); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 64862
: 72072