]> git.pld-linux.org Git - packages/net-tools.git/blob - net-tools-interface.patch
- rediffed
[packages/net-tools.git] / net-tools-interface.patch
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 @@ -2083,6 +2083,7 @@ static int rfcomm_info(void)
39  
40  static int iface_info(void)
41  {
42 +    struct interface *ife = NULL;
43      if (skfd < 0) {
44         if ((skfd = sockets_open(0)) < 0) {
45             perror("socket");
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 @@ -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"));
65  
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
73      {
74         AFTRANS_OPTS,
75         {"version", 0, 0, 'V'},
76 -       {"interfaces", 0, 0, 'i'},
77 +       {"interfaces", 2, 0, 'I'},
78         {"help", 0, 0, 'h'},
79         {"route", 0, 0, 'r'},
80  #if HAVE_FW_MASQUERADE
81 @@ -1919,7 +1926,7 @@ int main
82      getroute_init();           /* Set up AF routing support */
83  
84      afname[0] = '\0';
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)
87         switch (i) {
88         case -1:
89             break;
90 @@ -1960,6 +1967,13 @@ int main
91         case 'p':
92             flag_prg++;
93             break;
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;
101         case 'i':
102             flag_int++;
103             break;
This page took 0.209917 seconds and 3 git commands to generate.