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