Resolves: 1557470 - netstat -i cut's interface names

Resolves: 1566084 - netstat -agn only shows 10 character interface name for IPv4 addressing
This commit is contained in:
Michal Ruprich 2018-04-25 12:02:21 +02:00
parent df717ce0a7
commit b38ebe5824
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,59 @@
diff --git a/netstat.c b/netstat.c
index c084dfb..cfcfb78 100644
--- a/netstat.c
+++ b/netstat.c
@@ -743,6 +743,7 @@ static void igmp_do_one(int lnr, const char *line,const char *prot)
static int igmp6_flag = 0;
static char device[16];
int num, idx, refcnt;
+ char* offset;
if (lnr == 0) {
/* IPV6 ONLY */
@@ -794,17 +795,21 @@ static void igmp_do_one(int lnr, const char *line,const char *prot)
#if HAVE_AFINET
if (line[0] != '\t') {
if (idx_flag) {
- if ((num = sscanf( line, "%d\t%10c", &idx, device)) < 2) {
+ if ((num = sscanf( line, "%d\t%15c", &idx, device)) < 2) {
fprintf(stderr, _("warning, got bogus igmp line %d.\n"), lnr);
return;
}
} else {
- if ( (num = sscanf( line, "%10c", device )) < 1 ) {
+ if ( (num = sscanf( line, "%15c", device )) < 1 ) {
fprintf(stderr, _("warning, got bogus igmp line %d.\n"), lnr);
return;
}
}
- device[10] = '\0';
+
+ offset = strrchr(device, ':');
+ if(offset)
+ *offset = 0;
+
return;
} else if ( line[0] == '\t' ) {
if ( (num = sscanf(line, "\t%8[0-9A-Fa-f] %d", mcast_addr, &refcnt)) < 2 ) {
@@ -2037,7 +2037,7 @@ static int iface_info(void)
if (flag_exp < 2) {
ife_short = 1;
if(!(count % 8))
- printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
+ printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
}
if (flag_int_name) {
diff --git a/lib/interface.c b/lib/interface.c
index 3bd999f..97f3db5 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -655,7 +655,7 @@ int do_if_print(struct interface *ife, void *cookie)
void ife_print_short(struct interface *ptr)
{
- printf("%-8.8s ", ptr->name);
+ printf("%-15.15s ", ptr->name);
printf("%5d ", ptr->mtu);
/* If needed, display the interface statistics. */
if (ptr->statistics_valid) {

View File

@ -3,7 +3,7 @@
Summary: Basic networking tools
Name: net-tools
Version: 2.0
Release: 0.49.%{checkout}%{?dist}
Release: 0.50.%{checkout}%{?dist}
License: GPLv2+
Group: System Environment/Base
URL: http://sourceforge.net/projects/net-tools/
@ -35,6 +35,7 @@ Patch20: ether-wake-interfaces.patch
# use all interfaces instead of default (#1003875)
Patch21: net-tools-ifconfig-EiB.patch
Patch22: net-tools-timer-man.patch
Patch23: net-tools-interface-name-len.patch
BuildRequires: bluez-libs-devel
BuildRequires: gettext, libselinux
@ -65,6 +66,7 @@ cp %SOURCE8 ./man/en_US
%patch20 -p1 -b .interfaces
%patch21 -p1 -b .ifconfig-EiB
%patch22 -p1 -b .timer-man
%patch23 -p1 -b .interface-name-len
touch ./config.h
@ -137,6 +139,10 @@ install -D -p -m 644 %{SOURCE9} %{buildroot}%{_unitdir}/arp-ethers.service
%attr(0644,root,root) %{_unitdir}/arp-ethers.service
%changelog
* Wed Apr 25 2018 Michal Ruprich <mruprich@redhat.com> - 2.0-0.50.20160912git
- Resolves: 1557470 - netstat -i cut's interface names
- Resolves: 1566084 - netstat -agn only shows 10 character interface name for IPv4 addressing
* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 2.0-0.49.20160912git
- Escape macros in %%changelog