1 diff -up net-tools-2.0/man/en_US/netstat.8.interface net-tools-2.0/man/en_US/netstat.8
2 --- net-tools-2.0/man/en_US/netstat.8.interface 2014-11-24 14:52:45.648623478 +0100
3 +++ net-tools-2.0/man/en_US/netstat.8 2014-11-24 14:53:32.294972184 +0100
4 @@ -49,9 +49,9 @@ netstat \- Print network connections, ro
8 -.RB { \-\-interfaces | \-i }
9 +.RB { \-\-interfaces | \-I | \-i }
11 -.RB [ \-\-extend | \-e [ \-\-extend | \-e] ]
12 +.RB [ \-\-extend | \-e ]
13 .RB [ \-\-verbose | \-v ]
14 .RB [ \-\-program | \-p ]
15 .RB [ \-\-numeric | \-n ]
16 @@ -134,8 +134,8 @@ and
17 produce the same output.
19 Display multicast group membership information for IPv4 and IPv6.
20 -.SS "\-\-interfaces, \-i"
21 -Display a table of all network interfaces.
22 +.SS "\-\-interfaces=\fIiface \fR, \fB\-I=\fIiface \fR, \fB\-i"
23 +Display a table of all network interfaces, or the specified \fIiface\fR.
24 .SS "\-\-masquerade, \-M"
25 Display a list of masqueraded connections.
26 .SS "\-\-statistics, \-s"
27 diff -up net-tools-2.0/netstat.c.interface net-tools-2.0/netstat.c
28 --- net-tools-2.0/netstat.c.interface 2014-11-24 14:52:45.644623534 +0100
29 +++ net-tools-2.0/netstat.c 2014-11-24 14:52:45.652623422 +0100
30 @@ -144,6 +144,7 @@ static char *Release = RELEASE, *Signatu
34 +char *flag_int_name = NULL;
38 @@ -2083,6 +2083,7 @@ static int rfcomm_info(void)
40 static int iface_info(void)
42 + struct interface *ife = NULL;
44 if ((skfd = sockets_open(0)) < 0) {
46 @@ -1802,7 +1804,11 @@ static int iface_info(void)
47 printf(_("Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
50 - if (for_all_interfaces(do_if_print, &flag_all) < 0) {
51 + if (flag_int_name) {
52 + ife = lookup_interface(flag_int_name);
53 + do_if_print(ife, &flag_all);
55 + else if (for_all_interfaces(do_if_print, &flag_all) < 0) {
56 perror(_("missing interface information"));
59 @@ -1825,10 +1825,11 @@ static void usage(int rc)
60 FILE *fp = rc ? stderr : stdout;
61 fprintf(fp, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n"));
62 fprintf(fp, _(" netstat [-vWnNcaeol] [<Socket> ...]\n"));
63 - fprintf(fp, _(" netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] }\n\n"));
64 + fprintf(fp, _(" netstat { [-vWeenNac] -I[<Iface>] | -i | [-cnNe] -M | -s [-6tuw] }\n\n"));
66 fprintf(fp, _(" -r, --route display routing table\n"));
67 fprintf(fp, _(" -i, --interfaces display interface table\n"));
68 + fprintf(fp, _(" -I, --interfaces=<Iface> display interface table for <Iface>\n"));
69 fprintf(fp, _(" -g, --groups display multicast group memberships\n"));
70 fprintf(fp, _(" -s, --statistics display networking statistics (like SNMP)\n"));
71 #if HAVE_FW_MASQUERADE
72 @@ -1875,7 +1882,7 @@ int main
75 {"version", 0, 0, 'V'},
76 - {"interfaces", 0, 0, 'i'},
77 + {"interfaces", 2, 0, 'I'},
80 #if HAVE_FW_MASQUERADE
81 @@ -1919,7 +1926,7 @@ int main
82 getroute_init(); /* Set up AF routing support */
85 - while ((i = getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWw2fx64?Z", longopts, &lop)) != EOF)
86 + while ((i = getopt_long(argc, argv, "A:CFMacdeghiI::lnNoprsStuUvVWw2fx64?Z", longopts, &lop)) != EOF)
90 @@ -1960,6 +1967,13 @@ int main
95 + if (optarg && strcmp(optarg, "(null)"))
96 + if (optarg[0] == '=') optarg++;
97 + if (optarg && strcmp(optarg, "(null)"))
98 + flag_int_name = strdup(optarg);