jpopelka / rpms / net-tools

Forked from rpms/net-tools 4 years ago
Clone

Blame SOURCES/net-tools-interface-name-len.patch

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