Blame SOURCES/net-tools-interface.patch

612949
diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US/netstat.8
612949
--- net-tools-2.0/man/en_US/netstat.8.interface	2012-10-04 11:31:00.753513633 +0200
612949
+++ net-tools-2.0/man/en_US/netstat.8	2012-10-04 11:31:00.755513607 +0200
612949
@@ -46,9 +46,9 @@ netstat \- Print network connections, ro
612949
 .RB [delay]
612949
 .P
612949
 .B netstat
612949
-.RB { \-\-interfaces | \-i }
612949
+.RB { \-\-interfaces | \-I | \-i }
612949
 .RB [ \-\-all | \-a ]
612949
-.RB [ \-\-extend | \-e  [ \-\-extend | \-e] ]
612949
+.RB [ \-\-extend | \-e  ]
612949
 .RB [ \-\-verbose | \-v ]
612949
 .RB [ \-\-program | \-p ]
612949
 .RB [ \-\-numeric | \-n ]
612949
@@ -129,8 +129,8 @@ and
612949
 produce the same output.
612949
 .SS "\-\-groups , \-g"
612949
 Display multicast group membership information for IPv4 and IPv6.
612949
-.SS "\-\-interfaces, \-i"
612949
-Display a table of all network interfaces.
612949
+.SS "\-\-interfaces=\fIiface \fR, \fB\-I=\fIiface \fR, \fB\-i"
612949
+Display a table of all network interfaces, or the specified \fIiface\fR.
612949
 .SS "\-\-masquerade , \-M"
612949
 Display a list of masqueraded connections.
612949
 .SS "\-\-statistics , \-s"
612949
diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
612949
--- net-tools-2.0/netstat.c.interface	2012-10-04 11:31:00.745513734 +0200
612949
+++ net-tools-2.0/netstat.c	2012-10-04 11:31:00.756513594 +0200
612949
@@ -143,6 +143,7 @@ char *Release = RELEASE, *Version = "net
612949
 #define E_IOCTL -3
612949
 
612949
 int flag_int = 0;
612949
+char *flag_int_name = NULL;
612949
 int flag_rou = 0;
612949
 int flag_mas = 0;
612949
 int flag_sta = 0;
612949
@@ -1786,6 +1787,7 @@ static int rfcomm_info(void)
612949
 static int iface_info(void)
612949
 {
612949
     static int count=0;
612949
+    struct interface *ife = NULL;
612949
 
612949
     if (skfd < 0) {
612949
 	if ((skfd = sockets_open(0)) < 0) {
612949
@@ -1800,7 +1802,11 @@ static int iface_info(void)
612949
 	    printf(_("Iface      MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
612949
     }
612949
 
612949
-    if (for_all_interfaces(do_if_print, &flag_all) < 0) {
612949
+    if (flag_int_name) {
612949
+        ife = lookup_interface(flag_int_name);
612949
+        do_if_print(ife, &flag_all);
612949
+    }
612949
+    else if (for_all_interfaces(do_if_print, &flag_all) < 0) {
612949
 	perror(_("missing interface information"));
612949
 	exit(1);
612949
     }
612949
@@ -1826,9 +1832,10 @@ static void usage(void)
612949
 {
612949
     fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r         netstat {-V|--version|-h|--help}\n"));
612949
     fprintf(stderr, _("       netstat [-vWnNcaeol] [<Socket> ...]\n"));
612949
-    fprintf(stderr, _("       netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n"));
612949
+    fprintf(stderr, _("       netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n"));
612949
 
612949
     fprintf(stderr, _("        -r, --route              display routing table\n"));
612949
+    fprintf(stderr, _("        -I, --interfaces=<Iface> display interface table for <Iface>\n"));
612949
     fprintf(stderr, _("        -i, --interfaces         display interface table\n"));
612949
     fprintf(stderr, _("        -g, --groups             display multicast group memberships\n"));
612949
     fprintf(stderr, _("        -s, --statistics         display networking statistics (like SNMP)\n"));
612949
@@ -1873,7 +1880,7 @@ int main
612949
     {
612949
 	AFTRANS_OPTS,
612949
 	{"version", 0, 0, 'V'},
612949
-	{"interfaces", 0, 0, 'i'},
612949
+	{"interfaces", 2, 0, 'I'},
612949
 	{"help", 0, 0, 'h'},
612949
 	{"route", 0, 0, 'r'},
612949
 #if HAVE_FW_MASQUERADE
612949
@@ -1917,7 +1924,7 @@ int main
612949
     getroute_init();		/* Set up AF routing support */
612949
 
612949
     afname[0] = '\0';
612949
-    while ((i = getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWwx64?Z", longopts, &lop)) != EOF)
612949
+    while ((i = getopt_long(argc, argv, "A:CFMacdeghiI::lnNoprsStuUvVWwx64?Z", longopts, &lop)) != EOF)
612949
 	switch (i) {
612949
 	case -1:
612949
 	    break;
612949
@@ -1958,6 +1965,13 @@ int main
612949
 	case 'p':
612949
 	    flag_prg++;
612949
 	    break;
612949
+	case 'I':
612949
+	    if (optarg && strcmp(optarg, "(null)"))
612949
+		if (optarg[0] == '=') optarg++;
612949
+	    if (optarg && strcmp(optarg, "(null)"))
612949
+		flag_int_name = strdup(optarg);
612949
+	    flag_int++;
612949
+	    break;
612949
 	case 'i':
612949
 	    flag_int++;
612949
 	    break;