]>
Commit | Line | Data |
---|---|---|
44f64d91 SS |
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 | |
5 | .RB [delay] | |
6 | .P | |
7 | .B netstat | |
8 | -.RB { \-\-interfaces | \-i } | |
9 | +.RB { \-\-interfaces | \-I | \-i } | |
10 | .RB [ \-\-all | \-a ] | |
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. | |
18 | .SS "\-\-groups, \-g" | |
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 | |
31 | #define E_IOCTL -3 | |
32 | ||
33 | int flag_int = 0; | |
34 | +char *flag_int_name = NULL; | |
35 | int flag_rou = 0; | |
36 | int flag_mas = 0; | |
37 | int flag_sta = 0; | |
38 | @@ -1788,6 +1789,7 @@ static int rfcomm_info(void) | |
39 | static int iface_info(void) | |
40 | { | |
41 | static int count=0; | |
42 | + struct interface *ife = NULL; | |
43 | ||
44 | if (skfd < 0) { | |
45 | 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")); | |
48 | } | |
49 | ||
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); | |
54 | + } | |
55 | + else if (for_all_interfaces(do_if_print, &flag_all) < 0) { | |
56 | perror(_("missing interface information")); | |
57 | exit(1); | |
58 | } | |
59 | @@ -1828,9 +1834,10 @@ static void usage(void) | |
60 | { | |
61 | fprintf(stderr, _("usage: netstat [-vWeenNcCF] [<Af>] -r netstat {-V|--version|-h|--help}\n")); | |
62 | fprintf(stderr, _(" netstat [-vWnNcaeol] [<Socket> ...]\n")); | |
63 | - fprintf(stderr, _(" netstat { [-vWeenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n")); | |
64 | + fprintf(stderr, _(" netstat { [-vWeenNac] -I[<Iface>] | [-veenNac] -i | [-cnNe] -M | -s [-6tuw] } [delay]\n\n")); | |
65 | ||
66 | fprintf(stderr, _(" -r, --route display routing table\n")); | |
67 | + fprintf(stderr, _(" -I, --interfaces=<Iface> display interface table for <Iface>\n")); | |
68 | fprintf(stderr, _(" -i, --interfaces display interface table\n")); | |
69 | fprintf(stderr, _(" -g, --groups display multicast group memberships\n")); | |
70 | fprintf(stderr, _(" -s, --statistics display networking statistics (like SNMP)\n")); | |
71 | @@ -1875,7 +1882,7 @@ int main | |
72 | { | |
73 | AFTRANS_OPTS, | |
74 | {"version", 0, 0, 'V'}, | |
75 | - {"interfaces", 0, 0, 'i'}, | |
76 | + {"interfaces", 2, 0, 'I'}, | |
77 | {"help", 0, 0, 'h'}, | |
78 | {"route", 0, 0, 'r'}, | |
79 | #if HAVE_FW_MASQUERADE | |
80 | @@ -1919,7 +1926,7 @@ int main | |
81 | getroute_init(); /* Set up AF routing support */ | |
82 | ||
83 | afname[0] = '\0'; | |
84 | - while ((i = getopt_long(argc, argv, "A:CFMacdeghilnNoprsStuUvVWw2fx64?Z", longopts, &lop)) != EOF) | |
85 | + while ((i = getopt_long(argc, argv, "A:CFMacdeghiI::lnNoprsStuUvVWw2fx64?Z", longopts, &lop)) != EOF) | |
86 | switch (i) { | |
87 | case -1: | |
88 | break; | |
89 | @@ -1960,6 +1967,13 @@ int main | |
90 | case 'p': | |
91 | flag_prg++; | |
92 | break; | |
93 | + case 'I': | |
94 | + if (optarg && strcmp(optarg, "(null)")) | |
95 | + if (optarg[0] == '=') optarg++; | |
96 | + if (optarg && strcmp(optarg, "(null)")) | |
97 | + flag_int_name = strdup(optarg); | |
98 | + flag_int++; | |
99 | + break; | |
100 | case 'i': | |
101 | flag_int++; | |
102 | break; |