diff options
-rw-r--r-- | networking/libiproute/ip_parse_common_args.c | 77 | ||||
-rw-r--r-- | networking/libiproute/ipaddress.c | 10 |
2 files changed, 82 insertions, 5 deletions
diff --git a/networking/libiproute/ip_parse_common_args.c b/networking/libiproute/ip_parse_common_args.c index d693c54fa..eccd7e670 100644 --- a/networking/libiproute/ip_parse_common_args.c +++ b/networking/libiproute/ip_parse_common_args.c | |||
@@ -14,6 +14,83 @@ | |||
14 | #include "ip_common.h" /* #include "libbb.h" is inside */ | 14 | #include "ip_common.h" /* #include "libbb.h" is inside */ |
15 | #include "utils.h" | 15 | #include "utils.h" |
16 | 16 | ||
17 | /* iproute2-5.17.0: | ||
18 | -V, -Version | ||
19 | Print the version of the ip utility and exit. | ||
20 | -h, -human, -human-readable | ||
21 | output statistics with human readable values followed by suffix. | ||
22 | -b, -batch FILENAME | ||
23 | Read commands from provided file or standard input and invoke them. | ||
24 | First failure will cause termination of ip. | ||
25 | -force Don't terminate ip on errors in batch mode. If there were any errors | ||
26 | during execution of the commands, the application return code will be | ||
27 | non zero. | ||
28 | -s, -stats, -statistics | ||
29 | Output more information. If the option appears twice or more, | ||
30 | the amount of information increases. As a rule, the information | ||
31 | is statistics or some time values. | ||
32 | -d, -details | ||
33 | Output more detailed information. | ||
34 | -l, -loops COUNT | ||
35 | Specify maximum number of loops the 'ip address flush' logic will | ||
36 | attempt before giving up. The default is 10. Zero (0) means loop | ||
37 | until all addresses are removed. | ||
38 | -f, -family FAMILY | ||
39 | Specifies the protocol family to use. The protocol family identifier | ||
40 | can be one of inet, inet6, bridge, mpls or link. If this option is | ||
41 | not present, the protocol family is guessed from other arguments. | ||
42 | If the rest of the command line does not give enough information | ||
43 | to guess the family, ip falls back to the default one, usually inet | ||
44 | or any. link is a special family identifier meaning that | ||
45 | no networking protocol is involved. | ||
46 | -4 shortcut for -family inet. | ||
47 | -6 shortcut for -family inet6. | ||
48 | -B shortcut for -family bridge. | ||
49 | -M shortcut for -family mpls. | ||
50 | -0 shortcut for -family link. | ||
51 | -o, -oneline | ||
52 | output each record on a single line, replacing line feeds with the '\' | ||
53 | character. This is convenient when you want to count records with wc(1) | ||
54 | or to grep(1) the output. | ||
55 | -r, -resolve | ||
56 | use the system's name resolver to print DNS names instead of addresses. | ||
57 | -n, -netns NETNS | ||
58 | switches ip to the specified network namespace NETNS. Actually it just | ||
59 | simplifies executing of: | ||
60 | ip netns exec NETNS ip [ OPTIONS ] OBJECT { COMMAND | help } | ||
61 | to | ||
62 | ip -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help } | ||
63 | -N, -Numeric | ||
64 | Print the number of protocol, scope, dsfield, etc directly instead of | ||
65 | converting it to human readable name. | ||
66 | -a, -all | ||
67 | executes specified command over all objects, it depends if command | ||
68 | supports this option. | ||
69 | -c[color][={always|auto|never} | ||
70 | Configure color output. If parameter is omitted or always, color output | ||
71 | is enabled regardless of stdout state. If parameter is auto, stdout is | ||
72 | checked to be a terminal before enabling color output. If parameter is | ||
73 | never, color output is disabled. If specified multiple times, the last | ||
74 | one takes precedence. This flag is ignored if -json is also given. | ||
75 | Used color palette can be influenced by COLORFGBG environment variable. | ||
76 | -t, -timestamp | ||
77 | display current time when using monitor option. | ||
78 | -ts, -tshort | ||
79 | Like -timestamp, but use shorter format. | ||
80 | -rc, -rcvbuf SIZE | ||
81 | Set the netlink socket receive buffer size, defaults to 1MB. | ||
82 | -iec print human readable rates in IEC units (e.g. 1Ki = 1024). | ||
83 | -br, -brief | ||
84 | Print only basic information in a tabular format for better readability. | ||
85 | This option is currently only supported by ip addr show , ip link show | ||
86 | & ip neigh show commands. | ||
87 | -j, -json | ||
88 | Output results in JavaScript Object Notation (JSON). | ||
89 | -p, -pretty | ||
90 | The default JSON format is compact and more efficient to parse but hard | ||
91 | for most users to read. This flag adds indentation for readability. | ||
92 | */ | ||
93 | |||
17 | family_t preferred_family = AF_UNSPEC; | 94 | family_t preferred_family = AF_UNSPEC; |
18 | smallint oneline; | 95 | smallint oneline; |
19 | char _SL_; | 96 | char _SL_; |
diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index ecc3848ff..c8d77422c 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c | |||
@@ -44,7 +44,7 @@ struct filter_t { | |||
44 | int ifindex; | 44 | int ifindex; |
45 | family_t family; | 45 | family_t family; |
46 | smallint showqueue; | 46 | smallint showqueue; |
47 | smallint oneline; | 47 | /*smallint oneline; - redundant, global "oneline" flag is enough */ |
48 | smallint up; | 48 | smallint up; |
49 | /* Misnomer. Does not mean "flushed something" */ | 49 | /* Misnomer. Does not mean "flushed something" */ |
50 | /* More like "flush commands were constructed by print_addrinfo()" */ | 50 | /* More like "flush commands were constructed by print_addrinfo()" */ |
@@ -297,7 +297,7 @@ static int FAST_FUNC print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM, | |||
297 | if (n->nlmsg_type == RTM_DELADDR) | 297 | if (n->nlmsg_type == RTM_DELADDR) |
298 | printf("Deleted "); | 298 | printf("Deleted "); |
299 | 299 | ||
300 | if (G_filter.oneline) | 300 | if (/*G_filter.*/ oneline) |
301 | printf("%u: %s", ifa->ifa_index, ll_index_to_name(ifa->ifa_index)); | 301 | printf("%u: %s", ifa->ifa_index, ll_index_to_name(ifa->ifa_index)); |
302 | if (ifa->ifa_family == AF_INET) | 302 | if (ifa->ifa_family == AF_INET) |
303 | printf(" inet "); | 303 | printf(" inet "); |
@@ -427,10 +427,10 @@ static int FAST_FUNC store_nlmsg(const struct sockaddr_nl *who, struct nlmsghdr | |||
427 | return 0; | 427 | return 0; |
428 | } | 428 | } |
429 | 429 | ||
430 | static void ipaddr_reset_filter(int _oneline) | 430 | static void ipaddr_reset_filter(void /*int _oneline*/) |
431 | { | 431 | { |
432 | memset(&G_filter, 0, sizeof(G_filter)); | 432 | memset(&G_filter, 0, sizeof(G_filter)); |
433 | G_filter.oneline = _oneline; | 433 | /*G_filter.oneline = _oneline;*/ |
434 | } | 434 | } |
435 | 435 | ||
436 | /* Return value becomes exitcode. It's okay to not return at all */ | 436 | /* Return value becomes exitcode. It's okay to not return at all */ |
@@ -444,7 +444,7 @@ int FAST_FUNC ipaddr_list_or_flush(char **argv, int flush) | |||
444 | struct rtnl_handle rth; | 444 | struct rtnl_handle rth; |
445 | char *filter_dev = NULL; | 445 | char *filter_dev = NULL; |
446 | 446 | ||
447 | ipaddr_reset_filter(oneline); | 447 | ipaddr_reset_filter(/*oneline*/); |
448 | G_filter.showqueue = 1; | 448 | G_filter.showqueue = 1; |
449 | 449 | ||
450 | if (G_filter.family == AF_UNSPEC) | 450 | if (G_filter.family == AF_UNSPEC) |