]> git.pld-linux.org Git - packages/net-tools.git/blame - net-tools-interface.patch
- rediffed
[packages/net-tools.git] / net-tools-interface.patch
CommitLineData
581b2566
MK
1diff -urNp -x '*.orig' net-tools-2.10.org/man/en_US/netstat.8 net-tools-2.10/man/en_US/netstat.8
2--- net-tools-2.10.org/man/en_US/netstat.8 2021-01-07 00:22:35.000000000 +0100
3+++ net-tools-2.10/man/en_US/netstat.8 2023-12-02 23:35:08.827986462 +0100
4@@ -47,9 +47,9 @@ netstat \- Print network connections, ro
5 .RB [ \-\-continuous | \-c ]
03596bd7
AM
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 ]
581b2566 16@@ -128,8 +128,8 @@ and
03596bd7
AM
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"
581b2566
MK
27diff -urNp -x '*.orig' net-tools-2.10.org/netstat.c net-tools-2.10/netstat.c
28--- net-tools-2.10.org/netstat.c 2023-12-02 23:35:08.762985691 +0100
29+++ net-tools-2.10/netstat.c 2023-12-02 23:35:08.827986462 +0100
30@@ -149,6 +149,7 @@ static char *Release = RELEASE, *Signatu
c04cf26f
JB
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;
581b2566 38@@ -2132,6 +2133,7 @@ static int rfcomm_info(void)
03596bd7 39
c04cf26f
JB
40 static int iface_info(void)
41 {
c04cf26f 42+ struct interface *ife = NULL;
c04cf26f
JB
43 if (skfd < 0) {
44 if ((skfd = sockets_open(0)) < 0) {
03596bd7 45 perror("socket");
581b2566
MK
46@@ -2144,7 +2146,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"));
c04cf26f
JB
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 }
581b2566 59@@ -2171,10 +2177,11 @@ static void usage(int rc)
917f10ac
AM
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"));
c04cf26f 65
917f10ac
AM
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
581b2566 72@@ -2217,7 +2224,7 @@ int main
c04cf26f
JB
73 {
74 AFTRANS_OPTS,
75 {"version", 0, 0, 'V'},
76- {"interfaces", 0, 0, 'i'},
03596bd7 77+ {"interfaces", 2, 0, 'I'},
c04cf26f
JB
78 {"help", 0, 0, 'h'},
79 {"route", 0, 0, 'r'},
80 #if HAVE_FW_MASQUERADE
581b2566 81@@ -2261,7 +2268,7 @@ int main
c04cf26f
JB
82 getroute_init(); /* Set up AF routing support */
83
84 afname[0] = '\0';
03596bd7
AM
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)
c04cf26f
JB
87 switch (i) {
88 case -1:
89 break;
581b2566 90@@ -2302,6 +2309,13 @@ int main
03596bd7 91 case 'p':
c04cf26f
JB
92 flag_prg++;
93 break;
03596bd7
AM
94+ case 'I':
95+ if (optarg && strcmp(optarg, "(null)"))
96+ if (optarg[0] == '=') optarg++;
97+ if (optarg && strcmp(optarg, "(null)"))
98+ flag_int_name = strdup(optarg);
99+ flag_int++;
100+ break;
c04cf26f 101 case 'i':
c04cf26f
JB
102 flag_int++;
103 break;
This page took 0.39987 seconds and 4 git commands to generate.