From 84d30afd8af596d775be5a91d891755f3071cfe5 Mon Sep 17 00:00:00 2001 From: David Ahern Date: Wed, 23 Sep 2015 16:44:56 -0600 Subject: [PATCH 01/13] ip: Add type and master filters to brief output The brief format does not honer the master and type filters: $ ip link show master vrf-mgmt 7: dummy0: mtu 1500 qdisc noop master vrf-mgmt state DOWN mode DEFAULT group default qlen 1000 link/ether 66:39:cc:2b:e9:bd brd ff:ff:ff:ff:ff:ff $ ip -br link show master vrf-mgmt lo UNKNOWN 00:00:00:00:00:00 eth0 UP 08:00:27:de:14:c8 eth1 UP 08:00:27:87:02:f1 eth2 UP 08:00:27:61:1e:fd vrf-blue UNKNOWN a6:3f:09:34:7e:74 vrf-red DOWN fe:a2:2d:e1:bc:ac dummy0 DOWN 66:39:cc:2b:e9:bd dummy1 DOWN 4a:4f:13:91:64:b1 dummy2 DOWN b2:4f:b6:cd:bd:a6 dummy3 DOWN 1e:06:3d:40:b8:c2 vrf-mgmt DOWN ce:b2:74:41:21:df With this patch the expected output is shown: $ ip -br link show master vrf-mgmt dummy0 DOWN 66:39:cc:2b:e9:bd Signed-off-by: David Ahern --- ip/ipaddress.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 2aa5fbfb..e5398472 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -637,6 +637,25 @@ int print_linkinfo_brief(const struct sockaddr_nl *who, return -1; } + if (tb[IFLA_MASTER]) { + int master = *(int*)RTA_DATA(tb[IFLA_MASTER]); + if (filter.master > 0 && master != filter.master) + return -1; + } + else if (filter.master > 0) + return -1; + + if (filter.kind) { + if (tb[IFLA_LINKINFO]) { + char *kind = parse_link_kind(tb[IFLA_LINKINFO]); + + if (strcmp(kind, filter.kind)) + return -1; + } else { + return -1; + } + } + if (n->nlmsg_type == RTM_DELLINK) fprintf(fp, "Deleted "); From 32a6fbe56316f8e1309dcccd77045d7ddf8e654e Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Wed, 23 Sep 2015 16:40:04 -0700 Subject: [PATCH 02/13] tc : add timestamps to tc monitor Support -timestamp and -tshort options for tc monitor like ip monitor. # tc -tshort monitor [2015-09-23T16:39:11.260555] qdisc fq 8003: dev eth0 root refcnt 2 limit 10000p flow_limit 100p buckets 1024 quantum 3028 initial_quantum 15140 refill_delay 40.0ms Signed-off-by: Eric Dumazet --- tc/tc.c | 6 ++++++ tc/tc_monitor.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/tc/tc.c b/tc/tc.c index 46ff3714..17078676 100644 --- a/tc/tc.c +++ b/tc/tc.c @@ -36,6 +36,7 @@ int show_details = 0; int show_raw = 0; int show_pretty = 0; int show_graph = 0; +int timestamp; int batch_mode = 0; int resolve_hosts = 0; @@ -311,6 +312,11 @@ int main(int argc, char **argv) matches(argv[1], "-conf") == 0) { NEXT_ARG(); conf_file = argv[1]; + } else if (matches(argv[1], "-timestamp") == 0) { + timestamp++; + } else if (matches(argv[1], "-tshort") == 0) { + ++timestamp; + ++timestamp_short; } else { fprintf(stderr, "Option \"%s\" is unknown, try \"tc -help\".\n", argv[1]); return -1; diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c index cae36161..097068e9 100644 --- a/tc/tc_monitor.c +++ b/tc/tc_monitor.c @@ -30,7 +30,7 @@ static void usage(void) __attribute__((noreturn)); static void usage(void) { - fprintf(stderr, "Usage: tc monitor\n"); + fprintf(stderr, "Usage: tc [-timestamp [-tshort] monitor\n"); exit(-1); } @@ -41,6 +41,9 @@ static int accept_tcmsg(const struct sockaddr_nl *who, { FILE *fp = (FILE*)arg; + if (timestamp) + print_timestamp(fp); + if (n->nlmsg_type == RTM_NEWTFILTER || n->nlmsg_type == RTM_DELTFILTER) { print_filter(who, n, arg); return 0; From 484b3f922cfd5a38a73de5981e471f99ecfe3e8b Mon Sep 17 00:00:00 2001 From: Florian Westphal Date: Thu, 24 Sep 2015 02:10:28 +0200 Subject: [PATCH 03/13] man: tc: add man page for fq pacer Partially based on kernel Kconfig help text, code comments and git commit messages from Eric Dumazet. Joint work with Phil Sutter. Signed-off-by: Phil Sutter Signed-off-by: Florian Westphal --- man/man8/Makefile | 1 + man/man8/tc-fq.8 | 92 +++++++++++++++++++++++++++++++++++++++++++++++ man/man8/tc.8 | 1 + 3 files changed, 94 insertions(+) create mode 100644 man/man8/tc-fq.8 diff --git a/man/man8/Makefile b/man/man8/Makefile index c97d816c..9ffdaee3 100644 --- a/man/man8/Makefile +++ b/man/man8/Makefile @@ -2,6 +2,7 @@ TARGETS = ip-address.8 ip-link.8 ip-route.8 MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 rtpr.8 ss.8 \ tc.8 tc-bfifo.8 tc-bpf.8 tc-cbq.8 tc-cbq-details.8 tc-choke.8 tc-codel.8 \ + tc-fq.8 \ tc-drr.8 tc-ematch.8 tc-fq_codel.8 tc-hfsc.8 tc-htb.8 tc-pie.8 \ tc-mqprio.8 tc-netem.8 tc-pfifo.8 tc-pfifo_fast.8 tc-prio.8 tc-red.8 \ tc-sfb.8 tc-sfq.8 tc-stab.8 tc-tbf.8 \ diff --git a/man/man8/tc-fq.8 b/man/man8/tc-fq.8 new file mode 100644 index 00000000..993beb61 --- /dev/null +++ b/man/man8/tc-fq.8 @@ -0,0 +1,92 @@ +.TH FQ 8 "10 Sept 2015" "iproute2" "Linux" +.SH NAME +Fair Queuing (FQ) \- Traffic Pacing +.SH SYNOPSIS +.B tc qdisc ... fq +[ +.B limit +PACKETS ] [ +.B flow_limit +PACKETS ] [ +.B quantum +BYTES ] [ +.B initial_quantum +BYTES ] [ +.B maxrate +RATE ] [ +.B buckets +NUMBER ] [ +.B pacing +| +.B nopacing +] + +.SH DESCRIPTION +FQ (Fair Queue) is a classless packet scheduler meant to be mostly +used for locally generated traffic. It is designed to achieve per flow pacing. +FQ does flow separation, and is able to respect pacing requirements set by TCP stack. +All packets belonging to a socket are considered as a 'flow'. +For non local packets (router workload), packet rxhash is used as fallback. + +An application can specify a maximum pacing rate using the +.B SO_MAX_PACING_RATE +setsockopt call. This packet scheduler adds delay between packets to +respect rate limitation set by TCP stack. + +Dequeueing happens in a round-robin fashion. +A special FIFO queue is reserved for high priority packets ( +.B TC_PRIO_CONTROL +priority), such packets are always dequeued first. + +FQ is non-work-conserving. + +TCP pacing is good for flows having idle times, as the congestion +window permits TCP stack to queue a possibly large number of packets. +This removes the 'slow start after idle' choice, badly hitting +large BDP flows and applications delivering chunks of data such as video streams. + +.SH PARAMETERS +.SS limit +Hard limit on the real queue size. When this limit is reached, new packets +are dropped. If the value is lowered, packets are dropped so that the new limit is +met. Default is 10000 packets. +.SS flow_limit +Hard limit on the maximum number of packets queued per flow. +Default value is 100. +.SS quantum +The credit per dequeue RR round, i.e. the amount of bytes a flow is allowed to +dequeue at once. A larger value means a longer time period before the next flow +will be served. +Default is 2 * interface MTU bytes. +.SS initial_quantum +The initial sending rate credit, i.e. the amount of bytes a new flow is allowed +to dequeue initially. +This is specifically meant to allow using IW10 without added delay. +Default is 10 * interface MTU, i.e. 15140 for 'standard' ethernet. +.SS maxrate +Maximum sending rate of a flow. Default is unlimited. +Application specific setting via +.B SO_MAX_PACING_RATE +is ignored only if it is larger than this value. +.SS buckets +The size of the hash table used for flow lookups. Each bucket is assigned a +red-black tree for efficient collision sorting. +Default: 1024. +.SS [no]pacing +Enable or disable flow pacing. Default is enabled. +.SH EXAMPLES +#tc qdisc add dev eth0 root fq +.br +#tc -s -d qdisc +.br +qdisc fq 8003: dev eth0 root refcnt 2 limit 10000p flow_limit 100p buckets 1024 quantum 3028 initial_quantum 15140 + Sent 503727981 bytes 1146972 pkt (dropped 0, overlimits 0 requeues 54452) + backlog 0b 0p requeues 54452 + 1289 flows (1289 inactive, 0 throttled) + 0 gc, 31 highprio, 27411 throttled +.br +.SH SEE ALSO +.BR tc (8), +.BR socket (7) +.SH AUTHORS +FQ was written by Eric Dumazet. diff --git a/man/man8/tc.8 b/man/man8/tc.8 index 96878408..87350113 100644 --- a/man/man8/tc.8 +++ b/man/man8/tc.8 @@ -662,6 +662,7 @@ was written by Alexey N. Kuznetsov and added in Linux 2.2. .BR tc-codel (8), .BR tc-drr (8), .BR tc-ematch (8), +.BR tc-fq (8), .BR tc-fq_codel (8), .BR tc-hfsc (7), .BR tc-hfsc (8), From a8e35427fb14a2275221a1c920b640d9794f9e69 Mon Sep 17 00:00:00 2001 From: Dan Webster Date: Thu, 24 Sep 2015 09:36:53 +0200 Subject: [PATCH 04/13] ss: fix file-based filtering segfault Commit 1527a17 introduced a change where the second of two ssfilter_parse() calls in ss.c was moved outside of a conditional block (ss.c: ~3575). This commit enabled the parsing of services, such as 'sport = :ssh', but inadvertently broke the '-F' file-based filtering: --- misc/ss.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/misc/ss.c b/misc/ss.c index 9efc3c85..7c3dfa3e 100644 --- a/misc/ss.c +++ b/misc/ss.c @@ -3782,12 +3782,6 @@ int main(int argc, char *argv[]) exit(0); } - /* Now parse filter... */ - if (argc == 0 && filter_fp) { - if (ssfilter_parse(¤t_filter.f, 0, NULL, filter_fp)) - usage(); - } - while (argc > 0) { if (strcmp(*argv, "state") == 0) { NEXT_ARG(); From 8d5bd8c302952c24b803b30093c880393935bf87 Mon Sep 17 00:00:00 2001 From: Eric Dumazet Date: Thu, 24 Sep 2015 04:43:26 -0700 Subject: [PATCH 05/13] tc: fq: allow setting and retrieving orphan_mask linux-3.19 fq packet scheduler got a new attribute, controlling number of 'flows' holding packets not attached to a socket (forwarding usage) kernel commit is 06eb395fa9856b5a87cf7d80baee2a0ed3cdb9d7 ("pkt_sched: fq: better control of DDOS traffic") This patch adds corresponding code to tc command. tc qd replace dev eth0 root fq orphan_mask 511 Signed-off-by: Eric Dumazet --- tc/q_fq.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tc/q_fq.c b/tc/q_fq.c index 7ad38014..97b46a52 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -1,7 +1,7 @@ /* * Fair Queue * - * Copyright (C) 2013 Eric Dumazet + * Copyright (C) 2013-2015 Eric Dumazet * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -55,6 +55,7 @@ static void explain(void) fprintf(stderr, " [ quantum BYTES ] [ initial_quantum BYTES ]\n"); fprintf(stderr, " [ maxrate RATE ] [ buckets NUMBER ]\n"); fprintf(stderr, " [ [no]pacing ] [ refill_delay TIME ]\n"); + fprintf(stderr, " [ orphan_mask MASK]\n"); } static unsigned int ilog2(unsigned int val) @@ -80,6 +81,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, unsigned int maxrate; unsigned int defrate; unsigned int refill_delay; + unsigned int orphan_mask; bool set_plimit = false; bool set_flow_plimit = false; bool set_quantum = false; @@ -87,6 +89,7 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, bool set_maxrate = false; bool set_defrate = false; bool set_refill_delay = false; + bool set_orphan_mask = false; int pacing = -1; struct rtattr *tail; @@ -139,6 +142,13 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, return -1; } set_initial_quantum = true; + } else if (strcmp(*argv, "orphan_mask") == 0) { + NEXT_ARG(); + if (get_unsigned(&orphan_mask, *argv, 0)) { + fprintf(stderr, "Illegal \"initial_quantum\"\n"); + return -1; + } + set_orphan_mask = true; } else if (strcmp(*argv, "refill_delay") == 0) { NEXT_ARG(); if (get_time(&refill_delay, *argv)) { @@ -192,6 +202,9 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, if (set_refill_delay) addattr_l(n, 1024, TCA_FQ_FLOW_REFILL_DELAY, &refill_delay, sizeof(refill_delay)); + if (set_orphan_mask) + addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK, + &orphan_mask, sizeof(refill_delay)); tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; return 0; } @@ -204,6 +217,7 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) int pacing; unsigned int rate, quantum; unsigned int refill_delay; + unsigned int orphan_mask; SPRINT_BUF(b1); if (opt == NULL) @@ -226,6 +240,11 @@ static int fq_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt) buckets_log = rta_getattr_u32(tb[TCA_FQ_BUCKETS_LOG]); fprintf(f, "buckets %u ", 1U << buckets_log); } + if (tb[TCA_FQ_ORPHAN_MASK] && + RTA_PAYLOAD(tb[TCA_FQ_ORPHAN_MASK]) >= sizeof(__u32)) { + orphan_mask = rta_getattr_u32(tb[TCA_FQ_ORPHAN_MASK]); + fprintf(f, "orphan_mask %u ", orphan_mask); + } if (tb[TCA_FQ_RATE_ENABLE] && RTA_PAYLOAD(tb[TCA_FQ_RATE_ENABLE]) >= sizeof(int)) { pacing = rta_getattr_u32(tb[TCA_FQ_RATE_ENABLE]); From 8fe9839857d73b770b8aa4e2d9753c6a2c20ad6d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 25 Sep 2015 12:40:00 -0700 Subject: [PATCH 06/13] fq: fix whitespace --- tc/q_fq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tc/q_fq.c b/tc/q_fq.c index 97b46a52..2a370b36 100644 --- a/tc/q_fq.c +++ b/tc/q_fq.c @@ -201,10 +201,10 @@ static int fq_parse_opt(struct qdisc_util *qu, int argc, char **argv, &defrate, sizeof(defrate)); if (set_refill_delay) addattr_l(n, 1024, TCA_FQ_FLOW_REFILL_DELAY, - &refill_delay, sizeof(refill_delay)); + &refill_delay, sizeof(refill_delay)); if (set_orphan_mask) addattr_l(n, 1024, TCA_FQ_ORPHAN_MASK, - &orphan_mask, sizeof(refill_delay)); + &orphan_mask, sizeof(refill_delay)); tail->rta_len = (void *) NLMSG_TAIL(n) - (void *) tail; return 0; } From dcd8d142d2540f29230420972c574dbeac0bf1e9 Mon Sep 17 00:00:00 2001 From: Richard Alpe Date: Fri, 2 Oct 2015 10:15:21 +0200 Subject: [PATCH 07/13] tipc: add man pages This patch adds man pages for the TIPC tool. There is one main page and one page for each top level sub-command. These pages mainly aims to help a user of the tipc tool. In addition to this they describe a bit about what TIPC is and some of its features as a protocol. Signed-off-by: Richard Alpe Reviewed-by: Erik Hugne Reviewed-by: Jon Maloy --- man/man8/tipc-bearer.8 | 230 ++++++++++++++++++++++++++++++++++++++ man/man8/tipc-link.8 | 225 +++++++++++++++++++++++++++++++++++++ man/man8/tipc-media.8 | 86 ++++++++++++++ man/man8/tipc-nametable.8 | 99 ++++++++++++++++ man/man8/tipc-node.8 | 71 ++++++++++++ man/man8/tipc-socket.8 | 59 ++++++++++ man/man8/tipc.8 | 99 ++++++++++++++++ 7 files changed, 869 insertions(+) create mode 100644 man/man8/tipc-bearer.8 create mode 100644 man/man8/tipc-link.8 create mode 100644 man/man8/tipc-media.8 create mode 100644 man/man8/tipc-nametable.8 create mode 100644 man/man8/tipc-node.8 create mode 100644 man/man8/tipc-socket.8 create mode 100644 man/man8/tipc.8 diff --git a/man/man8/tipc-bearer.8 b/man/man8/tipc-bearer.8 new file mode 100644 index 00000000..f59c39d2 --- /dev/null +++ b/man/man8/tipc-bearer.8 @@ -0,0 +1,230 @@ +.TH TIPC-BEARER 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-bearer \- show or modify TIPC bearers + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 +.B tipc bearer enable +.RB "[ " domain +.IR DOMAIN " ]" +.RB "[ " priority +.IR PRIORITY " ]" +.BR media +.br +.RB "{ { " eth " | " ib " } " device +.IR "DEVICE" " }" +.RB "|" +.br +.RB "{ " udp +.B name +.IR NAME +.B localip +.IR LOCALIP +.RB "[ " localport +.IR LOCALPORT " ]" +.RB "[ " remoteip +.IR REMOTEIP " ]" +.RB "[ " remoteport +.IR REMOTEPORT " ] }" +.br + +.ti -8 +.B tipc bearer disable media +.br +.RB "{ { " eth " | " ib " } " device +.IR DEVICE +.RB "|" +.br +.RB "{ " udp +.B name +.IR NAME +.B localip +.IR LOCALIP " } }" +.br + +.ti -8 +.B tipc bearer set +.RB "{ " "priority " +.IR PRIORITY +.RB "| " tolerance +.IR TOLERANCE +.RB "| " window +.IR WINDOW +.RB "} " media +.br +.RB "{ { " eth " | " ib " } " device +.IR "DEVICE" " }" +.RB "|" +.br +.RB "{ " udp +.B name +.IR NAME +.B localip +.IR LOCALIP " } }" +.br + +.ti -8 +.B tipc bearer get +.RB "{ " "priority" " | " tolerance " | " window " } " media +.br +.RB "{ { " eth " | " ib " } " device +.IR "DEVICE" " }" +.RB "|" +.br +.RB "{ " udp +.B name +.IR NAME +.B localip +.IR LOCALIP " } }" +.br + +.ti -8 +.B tipc bearer list +.br + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc bearer --help +will show bearer help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. +.SH DESCRIPTION + +.SS Bearer identification +.TP +.BI "media " MEDIA +.br +Specifies the TIPC media type for a particular bearer to operate on. +Different media types have different ways of identifying a unique bearer. +For example, +.BR "ib " "and " eth +identify a bearer with a +.I DEVICE +while +.B udp +identify a bearer with a +.IR "LOCALIP " "and a " NAME + +.B ib +- Infiniband +.sp +.B eth +- Ethernet +.sp +.B udp +- User Datagram Protocol (UDP) +.sp + +.TP +.BI "name " NAME +.br +Logical bearer identifier valid for bearers on +.B udp +media. + +.TP +.BI "device " DEVICE +.br +Physical bearer device valid for bearers on +.B eth +and +.B ib +media. + +.SS Bearer properties + +.TP +.B domain +.br +The addressing domain (region) in which a bearer will establish links and accept +link establish requests. + +.TP +.B priority +.br +Default link priority inherited by all links subsequently established over a +bearer. A single bearer can only host one link to a particular node. This means +the default link priority for a bearer typically affects which bearer to use +when communicating with a particular node in an multi bearer setup. For more +info about link priority see +.BR tipc-link (8) + +.TP +.B tolerance +.br +Default link tolerance inherited by all links subsequently established over a +bearer. For more info about link tolerance see +.BR tipc-link (8) + +.TP +.B window +.br +Default link window inherited by all links subsequently established over a +bearer. For more info about the link window size see +.BR tipc-link (8) + +.SS UDP bearer options + +.TP +.BI "localip " LOCALIP +.br +Specify a local IP v4/v6 address for a +.B udp +bearer. + +.TP +.BI "localport " LOCALPORT +.br +Specify the local port for a +.B udp +bearer. The default port 6118 is used if no port is specified. + +.TP +.BI "remoteip " REMOTEIP +.br +Specify a remote IP for a +.B udp +bearer. If no remote IP is specified a +.B udp +bearer runs in multicast mode and tries to auto-discover its neighbours. +The multicast IP address is generated based on the TIPC network ID. If a remote +IP is specified the +.B udp +bearer runs in point-to-point mode. + +.TP +.BI "remoteport " REMOTEPORT +.br +Specify the remote port for a +.B udp +bearer. The default port 6118 is used if no port is specified. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-link (8), +.BR tipc-media (8), +.BR tipc-nametable (8), +.BR tipc-node (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc-link.8 b/man/man8/tipc-link.8 new file mode 100644 index 00000000..899b8825 --- /dev/null +++ b/man/man8/tipc-link.8 @@ -0,0 +1,225 @@ +.TH TIPC-LINK 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-link \- show links or modify link properties + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 + +.ti -8 +.B tipc link set +.RB "{ " "priority " +.IR PRIORITY +.RB "| " tolerance +.IR TOLERANCE +.RB "| " window +.IR "WINDOW " } +.BI "link " LINK + +.ti -8 +.B tipc link get +.RB "{ " "priority" " | " tolerance " | " window " } " link +.I LINK + +.ti -8 +.B tipc link statistics +.RB "{ " "show " "[ " link +.I LINK +.RB "] | " "reset +.BI "link " "LINK " +.R } + +.ti -8 +.B tipc link list +.br + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc link --help +will show link help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. +.SH DESCRIPTION + +.SS Link statistics + +.TP +.BR "ACTIVE " "link state" +.br +An +.B ACTIVE +link is serving traffic. Two links to the same node can become +.B ACTIVE +if they have the same link +.BR priority . +If there is more than two links with the same priority the additional links will +be put in +.B STANDBY +state. + +.TP +.BR "STANDBY " "link state" +.br +A +.B STANDBY +link has lower link priority than an +.B ACTIVE +link. A +.B STANDBY +link has control traffic flowing and is ready to take over should the +.B ACTIVE +link(s) go down. + +.TP +.B MTU +.br +The Maximum Transmission Unit. The two endpoints advertise their default or +configured +.B MTU +at initial link setup and will agree to use the lower of the two values should +they differ. + +.TP +.B Packets +.br +The total amount of transmitted or received TIPC packets on a link. Including +.BR "fragmented " "and " "bundled " packets. + +.TP +.B Fragments +.br +Represented in the form +.BR fragments / fragmented . +Where +.B fragmented +is the amount of data messages which have been broken into +.BR fragments . +Subsequently the +.B fragments +are the total amount of packets that the +.B fragmented +messages has been broken into. + +.TP +.B Bundles +.br +Represented in the form +.BR bundles / bundled . +If a link becomes congested the link will attempt to bundle data from small +.B bundled +packets into +.B bundles +of full MTU size packets before they are transmitted. + +.TP +.B Profile +.br +Shows the +.B average +packet size in octets/bytes for a +.B sample +of packets. It also shows the packet size distribution of the +.B sampled +packets in the intervals + +0-64 bytes +.br +64-256 bytes +.br +256-1024 bytes +.br +1024-4096 bytes +.br +4096-16384 bytes +.br +16384-32768 bytes +.br +32768-66000 bytes + +.TP +.B Message counters + +.B states +- Number of link state messages +.sp + +.B probes +- Link state messages with probe flag set. Typically sent when a link is idle +.sp + +.B nacks +- Number of negative acknowledgement (NACK) packets sent and received by the +link +.sp + +.B defs +- Number of packets received out of order +.sp + +.B dups +- Number of duplicate packets received + +.TP +.B Congestion link +The number of times an application has tried to send data when the TIPC link +was congested + +.TP +.B Send queue +.B Max +is the maximum amount of messages that has resided in the out queue during the +statistics collection period of a link. + +.B Avg +is the average outqueue size during the lifetime of a link. + +.SS Link properties + +.TP +.B priority +.br +The priority between logical TIPC links to a particular node. Link priority can +range from 0 (lowest) to 31 (highest). + +.TP +.B tolerance +.br +Link tolerance specifies the maximum time in milliseconds that TIPC will allow +a communication problem to exist before taking the link down. The default value +is 1500 milliseconds. + +.TP +.B window +.br +The link window controls how many unacknowledged messages a link endpoint can +have in its transmit queue before TIPC's congestion control mechanism is +activated. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-media (8), +.BR tipc-bearer (8), +.BR tipc-nametable (8), +.BR tipc-node (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc-media.8 b/man/man8/tipc-media.8 new file mode 100644 index 00000000..7f94efec --- /dev/null +++ b/man/man8/tipc-media.8 @@ -0,0 +1,86 @@ +.TH TIPC-MEDIA 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-media \- list or modify media properties + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 + +.ti -8 +.B tipc media set +.RB "{ " "priority " +.IR PRIORITY +.RB "| " tolerance +.IR TOLERANCE +.RB "| " window +.IR "WINDOW " } +.BI "media " MEDIA + +.ti -8 +.B tipc media get +.RB "{ " "priority" " | " tolerance " | " window " } " media +.I MEDIA + +.ti -8 +.B tipc media list +.br + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc media --help +will show media help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. +.SH DESCRIPTION + +.SS Media properties + +.TP +.B priority +.br +Default link priority inherited by all bearers subsequently enabled on a +media. For more info about link priority see +.BR tipc-link (8) + +.TP +.B tolerance +.br +Default link tolerance inherited by all bearers subsequently enabled on a +media. For more info about link tolerance see +.BR tipc-link (8) + +.TP +.B window +.br +Default link window inherited by all bearers subsequently enabled on a +media. For more info about link window see +.BR tipc-link (8) + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-bearer (8), +.BR tipc-link (8), +.BR tipc-nametable (8), +.BR tipc-node (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc-nametable.8 b/man/man8/tipc-nametable.8 new file mode 100644 index 00000000..c8d573f3 --- /dev/null +++ b/man/man8/tipc-nametable.8 @@ -0,0 +1,99 @@ +.TH TIPC-NAMETABLE 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-nametable \- show TIPC nametable + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 +.B tipc nametable show +.br + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc nametable --help +will show nametable help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. + +.SH DESCRIPTION +The nametable shows TIPC publication information. + +.SS Nametable format + +.TP +.B Type +.br +The 32-bit type field of the port name. The type field often indicates the class of service +provided by a port. + +.TP +.B Lower +.br +The lower bound of the 32-bit instance field of the port name. +The instance field is often used as as a sub-class indicator. + +.TP +.B Upper +.br +The upper bound of the 32-bit instance field of the port name. +The instance field is often used as as a sub-class indicator. +A difference in +.BR "lower " "and " upper +means the socket is bound to the port name range [lower,upper] + +.TP +.B Port Identity +.br +The unique socket (port) identifier within the TIPC cluster. The +.B port identity +consists of a node identity followed by a socket reference number. + +.TP +.B Publication +.br +The +.B publication +ID is a random number used internally to represent a publication. + +.TP +.B Scope +.br +The publication +.B scope +specifies the visibility of a bound port name. +The +.B scope +can be specified to comprise three different domains: +.BR node ", " "cluster " "and " zone. +Applications residing within the specified +.B scope +can see and access the port using the displayed port name. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-bearer (8), +.BR tipc-link (8), +.BR tipc-media (8), +.BR tipc-node (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc-node.8 b/man/man8/tipc-node.8 new file mode 100644 index 00000000..66418b35 --- /dev/null +++ b/man/man8/tipc-node.8 @@ -0,0 +1,71 @@ +.TH TIPC-NODE 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-node \- modify and show local node parameters or list peer nodes + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 +.B tipc node set +.RB "{ " "address " +.IR ADDRESS +.RB "| " netid +.IR NETID +.RB "} " + +.ti -8 +.B tipc node get +.RB "{ " "address" " | " netid " } " + +.ti -8 +.B tipc node list +.br + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc node --help +will show node help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. +.SH DESCRIPTION + +.SS Node parameters +.TP +.BI address +.br +The TIPC logical address. On the form x.y.z where x, y and z are unsigned +integers. + +.TP +.BI netid +.br +Network identity. Can by used to create individual TIPC clusters on the same +media. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-bearer (8), +.BR tipc-link (8), +.BR tipc-media (8), +.BR tipc-nametable (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc-socket.8 b/man/man8/tipc-socket.8 new file mode 100644 index 00000000..af18e35b --- /dev/null +++ b/man/man8/tipc-socket.8 @@ -0,0 +1,59 @@ +.TH TIPC-SOCKET 8 "02 Jun 2015" "iproute2" "Linux" + +./ For consistency, please keep padding right aligned. +./ For example '.B "foo " bar' and not '.B foo " bar"' + +.SH NAME +tipc-socket \- show TIPC socket (port) information + +.SH SYNOPSIS +.ad l +.in +8 + +.ti -8 +.B tipc socket list + +.SH OPTIONS +Options (flags) that can be passed anywhere in the command chain. +.TP +.BR "\-h" , " --help" +Show help about last valid command. For example +.B tipc socket --help +will show socket help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. + +.SH DESCRIPTION +A TIPC socket is represented by an unsigned integer. + +.TP +.SS Bound state +A bound socket has a logical TIPC port name associated with it. + +.TP +.SS Connected state +A connected socket is directly connected to another socket creating a point +to point connection between TIPC sockets. If the connection to X was made using +a logical port name Y that name will show up as +.BR "connected to " "X " "via " Y +. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc (8), +.BR tipc-bearer (8) +.BR tipc-link (8), +.BR tipc-media (8), +.BR tipc-nametable (8), +.BR tipc-node (8), +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe diff --git a/man/man8/tipc.8 b/man/man8/tipc.8 new file mode 100644 index 00000000..c1165523 --- /dev/null +++ b/man/man8/tipc.8 @@ -0,0 +1,99 @@ +.TH TIPC 8 "02 Jun 2015" "iproute2" "Linux" +.SH NAME +tipc \- a TIPC configuration and management tool +.SH SYNOPSIS + +.ad l +.in +8 +.ti -8 +.B tipc +.RI "[ " OPTIONS " ] " COMMAND " " ARGUMENTS " +.sp + +.ti -8 +.IR COMMAND " := { " +.BR bearer " | " link " | " media " | " nametable " | " node " | " socket " } +.sp + +.ti -8 +.IR OPTIONS " := { " +\fB\-h\fR[\fIhelp\fR] } + +.SH DESCRIPTION +The Transparent Inter-Process Communication (TIPC) protocol offers total address +transparency between processes which allows applications in a clustered computer +environment to communicate quickly and reliably with each other, regardless of +their location within the cluster. + +TIPC originated at the telecommunications manufacturer Ericsson. The first open +source version of TIPC was created in 2000 when Ericsson released its first +Linux version of TIPC. TIPC was introduced in the mainline Linux kernel in 2006 +and is now widely used both within and outside of Ericsson. + +.SH OPTIONS + +.TP +.BR "\-h" , " --help" +Show help about last given command. For example +.B tipc bearer --help +will show bearer help and +.B tipc --help +will show general help. The position of the option in the string is irrelevant. + +.SH COMMANDS + +.TP +.B BEARER +- Show or modify TIPC bearers + +.TP +.B LINK +- Show or modify TIPC links + +.TP +.B MEDIA +- Show or modify TIPC media + +.TP +.B NAMETABLE +- Show TIPC nametable + +.TP +.B NODE +- Show or modify TIPC node parameters + +.TP +.B SOCKET +- Show TIPC sockets + +.SH ARGUMENTS + +Command arguments are described in a command specific man page and typically +consists of nested commands along with key value pairs. +If no arguments are given a command typically shows its help text. The explicit +help option +.B -h +or +.B --help +can occur anywhere among the arguments and will show help for the last valid +command given. + +.SH EXIT STATUS +Exit status is 0 if command was successful or a positive integer upon failure. + +.SH SEE ALSO +.BR tipc-bearer (8), +.BR tipc-link (8), +.BR tipc-media (8), +.BR tipc-nametable (8), +.BR tipc-node (8), +.BR tipc-socket (8) +.br +.SH REPORTING BUGS +Report any bugs to the Network Developers mailing list +.B +where the development and maintenance is primarily done. +You do not have to be subscribed to the list to send a message there. + +.SH AUTHOR +Richard Alpe From 09a50f420bbf83546bfc685b2afa9435608eba1e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 7 Oct 2015 10:33:39 +0100 Subject: [PATCH 08/13] add tipc manpages to Makefile --- man/man8/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/man/man8/Makefile b/man/man8/Makefile index 9ffdaee3..1845987d 100644 --- a/man/man8/Makefile +++ b/man/man8/Makefile @@ -10,7 +10,9 @@ MAN8PAGES = $(TARGETS) ip.8 arpd.8 lnstat.8 routel.8 rtacct.8 rtmon.8 rtpr.8 ss. ip-addrlabel.8 ip-fou.8 ip-gue.8 ip-l2tp.8 \ ip-maddress.8 ip-monitor.8 ip-mroute.8 ip-neighbour.8 \ ip-netns.8 ip-ntable.8 ip-rule.8 ip-tunnel.8 ip-xfrm.8 \ - ip-tcp_metrics.8 ip-netconf.8 ip-token.8 + ip-tcp_metrics.8 ip-netconf.8 ip-token.8 \ + tipc.8 tipc-bearer.8 tipc-link.8 tipc-media.8 tipc-nametable.8 \ + tipc-node.8 tipc-socket.8 all: $(TARGETS) From 8aacb9bbbd741c2873ee90118264ae2d5bbd9ae3 Mon Sep 17 00:00:00 2001 From: Christoph Schulz Date: Fri, 25 Sep 2015 08:44:07 +0200 Subject: [PATCH 09/13] ip: allow using a device "help" (or a prefix thereof) Device names that match "help" or a prefix thereof should be allowed anywhere a device name can be used. Note that a suitable keyword ("dev" or "name", the latter for "ip tunnel") has to be used in these cases to resolve ambiguities. Signed-off-by: Christoph Schulz Reported-by: Leonhard Preis Reported-by: Wilhelm Wijkander --- ip/ip6tunnel.c | 2 +- ip/ipaddress.c | 2 +- ip/iplink.c | 3 +-- ip/ipmaddr.c | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ip/ip6tunnel.c b/ip/ip6tunnel.c index 62a8240f..9884efd4 100644 --- a/ip/ip6tunnel.c +++ b/ip/ip6tunnel.c @@ -287,7 +287,7 @@ static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p) if (strcmp(*argv, "name") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (p->name[0]) duparg2("name", *argv); diff --git a/ip/ipaddress.c b/ip/ipaddress.c index e5398472..e864ca65 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -1580,7 +1580,7 @@ static int ipaddr_list_flush_or_save(int argc, char **argv, int action) if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (filter_dev) duparg2("dev", *argv); diff --git a/ip/iplink.c b/ip/iplink.c index 1c452055..f30de86d 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -1148,8 +1148,7 @@ static int do_set(int argc, char **argv) } else { if (strcmp(*argv, "dev") == 0) NEXT_ARG(); - - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (dev) diff --git a/ip/ipmaddr.c b/ip/ipmaddr.c index a77a18fb..cbd6d115 100644 --- a/ip/ipmaddr.c +++ b/ip/ipmaddr.c @@ -257,7 +257,7 @@ static int multiaddr_list(int argc, char **argv) if (strcmp(*argv, "dev") == 0) { NEXT_ARG(); } - if (matches(*argv, "help") == 0) + else if (matches(*argv, "help") == 0) usage(); if (filter.dev) duparg2("dev", *argv); From 39e3d3836c1384506d0a76a496133c5361940770 Mon Sep 17 00:00:00 2001 From: Christophe Gouault Date: Fri, 2 Oct 2015 11:59:37 +0200 Subject: [PATCH 10/13] batch: support quoted strings Support quoting strings with " or ' in an iproute2 batch file. Enables to configure empty crypto keys (for ESP-null) or keys with spaces: xfrm state add src 1.1.1.1 dst 2.2.2.2 proto ah spi 0x1 \ mode tunnel auth hmac(sha1) "r4ezR/@kd6'749f2 6zf$" xfrm state add src 5.5.5.5 dst 2.2.2.2 proto esp spi 0x2 \ mode tunnel enc cipher_null "" Signed-off-by: Christophe Gouault --- lib/utils.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/utils.c b/lib/utils.c index 29b4f548..107e3f57 100644 --- a/lib/utils.c +++ b/lib/utils.c @@ -914,12 +914,31 @@ int makeargs(char *line, char *argv[], int maxargs) char *cp; int argc = 0; - for (cp = strtok(line, ws); cp; cp = strtok(NULL, ws)) { + for (cp = line + strspn(line, ws); *cp; cp += strspn(cp, ws)) { if (argc >= (maxargs - 1)) { fprintf(stderr, "Too many arguments to command\n"); exit(1); } + + /* word begins with quote */ + if (*cp == '\'' || *cp == '"') { + char quote = *cp++; + + argv[argc++] = cp; + /* find ending quote */ + cp = strchr(cp, quote); + if (cp == NULL) { + fprintf(stderr, "Unterminated quoted string\n"); + exit(1); + } + *cp++ = 0; + continue; + } + argv[argc++] = cp; + /* find end of word */ + cp += strcspn(cp, ws); + *cp++ = 0; } argv[argc] = NULL; From 6b53cb66e8fba101e9982c46f93ee095a8e8e709 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 12 Oct 2015 09:22:29 -0700 Subject: [PATCH 11/13] update kernel headers --- include/linux/if_ether.h | 1 + include/linux/tc_act/tc_skbedit.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index 4678e499..bf278d65 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h @@ -42,6 +42,7 @@ #define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ #define ETH_P_PUP 0x0200 /* Xerox PUP packet */ #define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ +#define ETH_P_TSN 0x22F0 /* TSN (IEEE 1722) packet */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ #define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ diff --git a/include/linux/tc_act/tc_skbedit.h b/include/linux/tc_act/tc_skbedit.h index 73026b35..7a2e910a 100644 --- a/include/linux/tc_act/tc_skbedit.h +++ b/include/linux/tc_act/tc_skbedit.h @@ -11,7 +11,8 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, see . + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place - Suite 330, Boston, MA 02111-1307 USA. * * Author: Alexander Duyck */ From 9de8c6d9765f284f8f15ccbe4af791259afe707e Mon Sep 17 00:00:00 2001 From: Wilson Kok Date: Sun, 11 Oct 2015 14:03:03 -0700 Subject: [PATCH 12/13] bridge: add batch command support This patch adds support to batch bridge commands. Follows ip batch code. Signed-off-by: Wilson Kok Signed-off-by: Roopa Prabhu Acked-by: Christophe Gouault --- bridge/bridge.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++ man/man8/bridge.8 | 11 +++++++++ 2 files changed, 70 insertions(+) diff --git a/bridge/bridge.c b/bridge/bridge.c index eaf09c84..72f153f2 100644 --- a/bridge/bridge.c +++ b/bridge/bridge.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "SNAPSHOT.h" #include "utils.h" @@ -23,6 +24,8 @@ int show_stats; int show_details; int compress_vlans; int timestamp; +char *batch_file; +int force; const char *_SL_; static void usage(void) __attribute__((noreturn)); @@ -31,6 +34,7 @@ static void usage(void) { fprintf(stderr, "Usage: bridge [ OPTIONS ] OBJECT { COMMAND | help }\n" +" bridge [ -force ] -batch filename\n" "where OBJECT := { link | fdb | mdb | vlan | monitor }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] |\n" " -o[neline] | -t[imestamp] | -n[etns] name |\n" @@ -71,6 +75,50 @@ static int do_cmd(const char *argv0, int argc, char **argv) return -1; } +static int batch(const char *name) +{ + char *line = NULL; + size_t len = 0; + int ret = EXIT_SUCCESS; + + if (name && strcmp(name, "-") != 0) { + if (freopen(name, "r", stdin) == NULL) { + fprintf(stderr, + "Cannot open file \"%s\" for reading: %s\n", + name, strerror(errno)); + return EXIT_FAILURE; + } + } + + if (rtnl_open(&rth, 0) < 0) { + fprintf(stderr, "Cannot open rtnetlink\n"); + return EXIT_FAILURE; + } + + cmdlineno = 0; + while (getcmdline(&line, &len, stdin) != -1) { + char *largv[100]; + int largc; + + largc = makeargs(line, largv, 100); + if (largc == 0) + continue; /* blank line */ + + if (do_cmd(largv[0], largc, largv)) { + fprintf(stderr, "Command failed %s:%d\n", + name, cmdlineno); + ret = EXIT_FAILURE; + if (!force) + break; + } + } + if (line) + free(line); + + rtnl_close(&rth); + return ret; +} + int main(int argc, char **argv) { @@ -123,6 +171,14 @@ main(int argc, char **argv) exit(-1); } else if (matches(opt, "-compressvlans") == 0) { ++compress_vlans; + } else if (matches(opt, "-force") == 0) { + ++force; + } else if (matches(opt, "-batch") == 0) { + argc--; + argv++; + if (argc <= 1) + usage(); + batch_file = argv[1]; } else { fprintf(stderr, "Option \"%s\" is unknown, try \"bridge help\".\n", @@ -134,6 +190,9 @@ main(int argc, char **argv) _SL_ = oneline ? "\\" : "\n"; + if (batch_file) + return batch(batch_file); + if (rtnl_open(&rth, 0) < 0) exit(1); diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index 5347a569..d45c7289 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -21,6 +21,7 @@ bridge \- show / manipulate bridge addresses and devices \fB\-V\fR[\fIersion\fR] | \fB\-s\fR[\fItatistics\fR] | \fB\-n\fR[\fIetns\fR] name } +\fB\-b\fR[\fIatch\fR] filename } .ti -8 .BR "bridge link set" @@ -137,6 +138,16 @@ to .RI "-n[etns] " NETNS " [ " OPTIONS " ] " OBJECT " { " COMMAND " | " .BR help " }" +.TP +.BR "\-b", " \-batch " +Read commands from provided file or standard input and invoke them. +First failure will cause termination of bridge command. + +.TP +.BR "\-force" +Don't terminate bridge command on errors in batch mode. +If there were any errors during execution of the commands, the application +return code will be non zero. .SH BRIDGE - COMMAND SYNTAX From 25bc3d3d4aac6d0ab20a01d922b8e8ad6eb2232e Mon Sep 17 00:00:00 2001 From: Satish Ashok Date: Mon, 12 Oct 2015 09:28:55 -0700 Subject: [PATCH 13/13] ip, bridge: document -timestamp option This patch documents bridge and ip -timestamp option Signed-off-by: Satish Ashok --- man/man8/bridge.8 | 3 +++ man/man8/ip.8 | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/man/man8/bridge.8 b/man/man8/bridge.8 index d45c7289..222a4381 100644 --- a/man/man8/bridge.8 +++ b/man/man8/bridge.8 @@ -308,6 +308,9 @@ link setting is configured on specified physical device .BI master link setting is configured on the software bridge (default) +.TP +.BR "\-t" , " \-timestamp" +display current time when using monitor option. .SS bridge link show - list bridge port configuration. diff --git a/man/man8/ip.8 b/man/man8/ip.8 index e6c2b32a..1bdee118 100644 --- a/man/man8/ip.8 +++ b/man/man8/ip.8 @@ -175,6 +175,10 @@ executes specified command over all objects, it depends if command supports this .BR "\-c" , " -color" Use color output. +.TP +.BR "\-t" , " \-timestamp" +display current time when using monitor option. + .SH IP - COMMAND SYNTAX .SS