All of lore.kernel.org
 help / color / mirror / Atom feed
* [iproute PATCH 0/4] Smaller link type help review
@ 2017-03-28 21:19 Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 1/4] ip: link: bond: Fix whitespace in help text Phil Sutter
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Phil Sutter @ 2017-03-28 21:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

This series addresses some minor nits with link type specific help
texts:

* Unify coding style of print_help() callbacks (or the functions they
  call.

* Unify output as much as possible for a common look and feel.

* Make sure there's type specific help for each type listed in 'ip link
  help'.

Phil Sutter (4):
  ip: link: bond: Fix whitespace in help text
  ip: link: macvlan: Add newline to help output
  ip: link: Unify link type help functions a bit
  ip: link: Add missing link type help texts

 ip/Makefile         |  3 ++-
 ip/iplink_bond.c    |  2 +-
 ip/iplink_dummy.c   | 16 ++++++++++++++++
 ip/iplink_geneve.c  | 28 ++++++++++++++++++----------
 ip/iplink_ifb.c     | 16 ++++++++++++++++
 ip/iplink_ipoib.c   |  4 +++-
 ip/iplink_macvlan.c |  1 +
 ip/iplink_nlmon.c   | 16 ++++++++++++++++
 ip/iplink_team.c    | 25 +++++++++++++++++++++++++
 ip/iplink_vcan.c    | 16 ++++++++++++++++
 ip/iplink_vlan.c    | 15 +++++++++------
 ip/iplink_vxlan.c   | 44 +++++++++++++++++++++++++++++---------------
 ip/link_gre.c       | 36 +++++++++++++++++++++++-------------
 ip/link_gre6.c      | 47 ++++++++++++++++++++++++++++-------------------
 ip/link_ip6tnl.c    | 46 +++++++++++++++++++++++++++-------------------
 ip/link_iptnl.c     | 38 ++++++++++++++++++++++++++------------
 ip/link_vti.c       | 17 +++++++++--------
 17 files changed, 265 insertions(+), 105 deletions(-)
 create mode 100644 ip/iplink_dummy.c
 create mode 100644 ip/iplink_ifb.c
 create mode 100644 ip/iplink_nlmon.c
 create mode 100644 ip/iplink_team.c
 create mode 100644 ip/iplink_vcan.c

-- 
2.11.0

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [iproute PATCH 1/4] ip: link: bond: Fix whitespace in help text
  2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
@ 2017-03-28 21:19 ` Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 2/4] ip: link: macvlan: Add newline to help output Phil Sutter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-03-28 21:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/iplink_bond.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ip/iplink_bond.c b/ip/iplink_bond.c
index fe83479a091a8..772b05fd89eaf 100644
--- a/ip/iplink_bond.c
+++ b/ip/iplink_bond.c
@@ -133,7 +133,7 @@ static void print_explain(FILE *f)
 		"                [ min_links MIN_LINKS ]\n"
 		"                [ lp_interval LP_INTERVAL ]\n"
 		"                [ packets_per_slave PACKETS_PER_SLAVE ]\n"
-		"		 [ tlb_dynamic_lb TLB_DYNAMIC_LB ]\n"
+		"                [ tlb_dynamic_lb TLB_DYNAMIC_LB ]\n"
 		"                [ lacp_rate LACP_RATE ]\n"
 		"                [ ad_select AD_SELECT ]\n"
 		"                [ ad_user_port_key PORTKEY ]\n"
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [iproute PATCH 2/4] ip: link: macvlan: Add newline to help output
  2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 1/4] ip: link: bond: Fix whitespace in help text Phil Sutter
@ 2017-03-28 21:19 ` Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 3/4] ip: link: Unify link type help functions a bit Phil Sutter
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-03-28 21:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

A newline between synopsis and variable definition looks nice and is
consistent with others.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/iplink_macvlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ip/iplink_macvlan.c b/ip/iplink_macvlan.c
index b9a146f271186..662eb6ff9507c 100644
--- a/ip/iplink_macvlan.c
+++ b/ip/iplink_macvlan.c
@@ -31,6 +31,7 @@ static void print_explain(struct link_util *lu, FILE *f)
 {
 	fprintf(f,
 		"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS\n"
+		"\n"
 		"MODE: private | vepa | bridge | passthru | source\n"
 		"MODE_FLAG: null | nopromisc\n"
 		"MODE_OPTS: for mode \"source\":\n"
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [iproute PATCH 3/4] ip: link: Unify link type help functions a bit
  2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 1/4] ip: link: bond: Fix whitespace in help text Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 2/4] ip: link: macvlan: Add newline to help output Phil Sutter
@ 2017-03-28 21:19 ` Phil Sutter
  2017-03-28 21:19 ` [iproute PATCH 4/4] ip: link: Add missing link type help texts Phil Sutter
  2017-04-04 21:53 ` [iproute PATCH 0/4] Smaller link type help review Stephen Hemminger
  4 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-03-28 21:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

Take help function in iplink_bridge.c as an example and make other link
types' help functions similar:

* Use a single fprintf() call (if possible).
* Don't state a full command line, just "... type OPTIONS".
* Put every option in it's own line, align options by column.
* List mandatory options first.

link_veth.c is intentionally left untouched because it's 'peer' option
eats all kinds of generic link options and the help text points this out
without duplicating all the options there again.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/iplink_geneve.c | 28 ++++++++++++++++++----------
 ip/iplink_ipoib.c  |  4 +++-
 ip/iplink_vlan.c   | 15 +++++++++------
 ip/iplink_vxlan.c  | 44 +++++++++++++++++++++++++++++---------------
 ip/link_gre.c      | 36 +++++++++++++++++++++++-------------
 ip/link_gre6.c     | 47 ++++++++++++++++++++++++++++-------------------
 ip/link_ip6tnl.c   | 46 +++++++++++++++++++++++++++-------------------
 ip/link_iptnl.c    | 38 ++++++++++++++++++++++++++------------
 ip/link_vti.c      | 17 +++++++++--------
 9 files changed, 172 insertions(+), 103 deletions(-)

diff --git a/ip/iplink_geneve.c b/ip/iplink_geneve.c
index 1e6669d07d603..2c510fceb3c97 100644
--- a/ip/iplink_geneve.c
+++ b/ip/iplink_geneve.c
@@ -17,16 +17,24 @@
 
 static void print_explain(FILE *f)
 {
-	fprintf(f, "Usage: ... geneve id VNI remote ADDR\n");
-	fprintf(f, "                 [ ttl TTL ] [ tos TOS ] [ flowlabel LABEL ]\n");
-	fprintf(f, "                 [ dstport PORT ] [ [no]external ]\n");
-	fprintf(f, "                 [ [no]udpcsum ] [ [no]udp6zerocsumtx ] [ [no]udp6zerocsumrx ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: VNI   := 0-16777215\n");
-	fprintf(f, "       ADDR  := IP_ADDRESS\n");
-	fprintf(f, "       TOS   := { NUMBER | inherit }\n");
-	fprintf(f, "       TTL   := { 1..255 | inherit }\n");
-	fprintf(f, "       LABEL := 0-1048575\n");
+	fprintf(f,
+		"Usage: ... geneve id VNI\n"
+		"                  remote ADDR\n"
+		"                  [ ttl TTL ]\n"
+		"                  [ tos TOS ]\n"
+		"                  [ flowlabel LABEL ]\n"
+		"                  [ dstport PORT ]\n"
+		"                  [ [no]external ]\n"
+		"                  [ [no]udpcsum ]\n"
+		"                  [ [no]udp6zerocsumtx ]\n"
+		"                  [ [no]udp6zerocsumrx ]\n"
+		"\n"
+		"Where: VNI   := 0-16777215\n"
+		"       ADDR  := IP_ADDRESS\n"
+		"       TOS   := { NUMBER | inherit }\n"
+		"       TTL   := { 1..255 | inherit }\n"
+		"       LABEL := 0-1048575\n"
+	);
 }
 
 static void explain(void)
diff --git a/ip/iplink_ipoib.c b/ip/iplink_ipoib.c
index cb204af4a25b5..86dc65caa5e01 100644
--- a/ip/iplink_ipoib.c
+++ b/ip/iplink_ipoib.c
@@ -22,7 +22,9 @@
 static void print_explain(FILE *f)
 {
 	fprintf(f,
-		"Usage: ... ipoib [pkey PKEY] [mode {datagram | connected}][umcast {0|1}]\n"
+		"Usage: ... ipoib [ pkey PKEY ]\n"
+		"                 [ mode {datagram | connected} ]\n"
+		"                 [ umcast {0|1} ]\n"
 		"\n"
 		"PKEY  := 0x8001-0xffff\n"
 	);
diff --git a/ip/iplink_vlan.c b/ip/iplink_vlan.c
index 144c83cbf1f37..b47236d8054de 100644
--- a/ip/iplink_vlan.c
+++ b/ip/iplink_vlan.c
@@ -21,14 +21,17 @@
 static void print_explain(FILE *f)
 {
 	fprintf(f,
-		"Usage: ... vlan [ protocol VLANPROTO ] id VLANID                [ FLAG-LIST ]\n"
-		"                [ ingress-qos-map QOS-MAP ] [ egress-qos-map QOS-MAP ]\n"
+		"Usage: ... vlan id VLANID\n"
+		"                [ protocol VLANPROTO ]\n"
+		"                [ reorder_hdr { on | off } ]\n"
+		"                [ gvrp { on | off } ]\n"
+		"                [ mvrp { on | off } ]\n"
+		"                [ loose_binding { on | off } ]\n"
+		"                [ ingress-qos-map QOS-MAP ]\n"
+		"                [ egress-qos-map QOS-MAP ]\n"
 		"\n"
-		"VLANPROTO: [ 802.1Q / 802.1ad ]\n"
 		"VLANID := 0-4095\n"
-		"FLAG-LIST := [ FLAG-LIST ] FLAG\n"
-		"FLAG := [ reorder_hdr { on | off } ] [ gvrp { on | off } ] [ mvrp { on | off } ]\n"
-		"        [ loose_binding { on | off } ]\n"
+		"VLANPROTO: [ 802.1Q / 802.1ad ]\n"
 		"QOS-MAP := [ QOS-MAP ] QOS-MAPPING\n"
 		"QOS-MAPPING := FROM:TO\n"
 	);
diff --git a/ip/iplink_vxlan.c b/ip/iplink_vxlan.c
index fef7d3af4990f..b4ebb1394e702 100644
--- a/ip/iplink_vxlan.c
+++ b/ip/iplink_vxlan.c
@@ -23,21 +23,35 @@
 
 static void print_explain(FILE *f)
 {
-	fprintf(f, "Usage: ... vxlan id VNI [ { group | remote } IP_ADDRESS ] [ local ADDR ]\n");
-	fprintf(f, "                 [ ttl TTL ] [ tos TOS ] [ flowlabel LABEL ] [ dev PHYS_DEV ]\n");
-	fprintf(f, "                 [ dstport PORT ] [ srcport MIN MAX ]\n");
-	fprintf(f, "                 [ [no]learning ] [ [no]proxy ] [ [no]rsc ]\n");
-	fprintf(f, "                 [ [no]l2miss ] [ [no]l3miss ]\n");
-	fprintf(f, "                 [ ageing SECONDS ] [ maxaddress NUMBER ]\n");
-	fprintf(f, "                 [ [no]udpcsum ] [ [no]udp6zerocsumtx ] [ [no]udp6zerocsumrx ]\n");
-	fprintf(f, "                 [ [no]remcsumtx ] [ [no]remcsumrx ]\n");
-	fprintf(f, "                 [ [no]external ] [ gbp ] [ gpe ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: VNI   := 0-16777215\n");
-	fprintf(f, "       ADDR  := { IP_ADDRESS | any }\n");
-	fprintf(f, "       TOS   := { NUMBER | inherit }\n");
-	fprintf(f, "       TTL   := { 1..255 | inherit }\n");
-	fprintf(f, "       LABEL := 0-1048575\n");
+	fprintf(f,
+		"Usage: ... vxlan id VNI\n"
+		"                 [ { group | remote } IP_ADDRESS ]\n"
+		"                 [ local ADDR ]\n"
+		"                 [ ttl TTL ]\n"
+		"                 [ tos TOS ]\n"
+		"                 [ flowlabel LABEL ]\n"
+		"                 [ dev PHYS_DEV ]\n"
+		"                 [ dstport PORT ]\n"
+		"                 [ srcport MIN MAX ]\n"
+		"                 [ [no]learning ]\n"
+		"                 [ [no]proxy ]\n"
+		"                 [ [no]rsc ]\n"
+		"                 [ [no]l2miss ]\n"
+		"                 [ [no]l3miss ]\n"
+		"                 [ ageing SECONDS ]\n"
+		"                 [ maxaddress NUMBER ]\n"
+		"                 [ [no]udpcsum ]\n"
+		"                 [ [no]udp6zerocsumtx ]\n"
+		"                 [ [no]udp6zerocsumrx ]\n"
+		"                 [ [no]remcsumtx ] [ [no]remcsumrx ]\n"
+		"                 [ [no]external ] [ gbp ] [ gpe ]\n"
+		"\n"
+		"Where: VNI   := 0-16777215\n"
+		"       ADDR  := { IP_ADDRESS | any }\n"
+		"       TOS   := { NUMBER | inherit }\n"
+		"       TTL   := { 1..255 | inherit }\n"
+		"       LABEL := 0-1048575\n"
+	);
 }
 
 static void explain(void)
diff --git a/ip/link_gre.c b/ip/link_gre.c
index 3b99e56f40748..35d437a15562c 100644
--- a/ip/link_gre.c
+++ b/ip/link_gre.c
@@ -25,19 +25,29 @@
 
 static void print_usage(FILE *f)
 {
-	fprintf(f, "Usage: ip link { add | set | change | replace | del } NAME\n");
-	fprintf(f, "          type { gre | gretap } [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(f, "          [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
-	fprintf(f, "          [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n");
-	fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
-	fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-	fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: NAME := STRING\n");
-	fprintf(f, "       ADDR := { IP_ADDRESS | any }\n");
-	fprintf(f, "       TOS  := { NUMBER | inherit }\n");
-	fprintf(f, "       TTL  := { 1..255 | inherit }\n");
-	fprintf(f, "       KEY  := { DOTTED_QUAD | NUMBER }\n");
+	fprintf(f,
+		"Usage: ... { gre | gretap } [ remote ADDR ]\n"
+		"                            [ local ADDR ]\n"
+		"                            [ [i|o]seq ]\n"
+		"                            [ [i|o]key KEY ]\n"
+		"                            [ [i|o]csum ]\n"
+		"                            [ ttl TTL ]\n"
+		"                            [ tos TOS ]\n"
+		"                            [ [no]pmtudisc ]\n"
+		"                            [ dev PHYS_DEV ]\n"
+		"                            [ noencap ]\n"
+		"                            [ encap { fou | gue | none } ]\n"
+		"                            [ encap-sport PORT ]\n"
+		"                            [ encap-dport PORT ]\n"
+		"                            [ [no]encap-csum ]\n"
+		"                            [ [no]encap-csum6 ]\n"
+		"                            [ [no]encap-remcsum ]\n"
+		"\n"
+		"Where: ADDR := { IP_ADDRESS | any }\n"
+		"       TOS  := { NUMBER | inherit }\n"
+		"       TTL  := { 1..255 | inherit }\n"
+		"       KEY  := { DOTTED_QUAD | NUMBER }\n"
+	);
 }
 
 static void usage(void) __attribute__((noreturn));
diff --git a/ip/link_gre6.c b/ip/link_gre6.c
index d00db1f8919db..a91f635760faa 100644
--- a/ip/link_gre6.c
+++ b/ip/link_gre6.c
@@ -32,25 +32,34 @@
 
 static void print_usage(FILE *f)
 {
-	fprintf(f, "Usage: ip link { add | set | change | replace | del } NAME\n");
-	fprintf(f, "          type { ip6gre | ip6gretap } [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(f, "          [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
-	fprintf(f, "          [ hoplimit TTL ] [ encaplimit ELIM ]\n");
-	fprintf(f, "          [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
-	fprintf(f, "          [ dscp inherit ] [ dev PHYS_DEV ]\n");
-	fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
-	fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-	fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: NAME      := STRING\n");
-	fprintf(f, "       ADDR      := IPV6_ADDRESS\n");
-	fprintf(f, "       TTL       := { 0..255 } (default=%d)\n",
-		DEFAULT_TNL_HOP_LIMIT);
-	fprintf(f, "       KEY       := { DOTTED_QUAD | NUMBER }\n");
-	fprintf(f, "       ELIM      := { none | 0..255 }(default=%d)\n",
-		IPV6_DEFAULT_TNL_ENCAP_LIMIT);
-	fprintf(f, "       TCLASS    := { 0x0..0xff | inherit }\n");
-	fprintf(f, "       FLOWLABEL := { 0x0..0xfffff | inherit }\n");
+	fprintf(f,
+		"Usage: ... { ip6gre | ip6gretap } [ remote ADDR ]\n"
+		"                                  [ local ADDR ]\n"
+		"                                  [ [i|o]seq ]\n"
+		"                                  [ [i|o]key KEY ]\n"
+		"                                  [ [i|o]csum ]\n"
+		"                                  [ hoplimit TTL ]\n"
+		"                                  [ encaplimit ELIM ]\n"
+		"                                  [ tclass TCLASS ]\n"
+		"                                  [ flowlabel FLOWLABEL ]\n"
+		"                                  [ dscp inherit ]\n"
+		"                                  [ dev PHYS_DEV ]\n"
+		"                                  [ noencap ]\n"
+		"                                  [ encap { fou | gue | none } ]\n"
+		"                                  [ encap-sport PORT ]\n"
+		"                                  [ encap-dport PORT ]\n"
+		"                                  [ [no]encap-csum ]\n"
+		"                                  [ [no]encap-csum6 ]\n"
+		"                                  [ [no]encap-remcsum ]\n"
+		"\n"
+		"Where: ADDR      := IPV6_ADDRESS\n"
+		"       TTL       := { 0..255 } (default=%d)\n"
+		"       KEY       := { DOTTED_QUAD | NUMBER }\n"
+		"       ELIM      := { none | 0..255 }(default=%d)\n"
+		"       TCLASS    := { 0x0..0xff | inherit }\n"
+		"       FLOWLABEL := { 0x0..0xfffff | inherit }\n",
+		DEFAULT_TNL_HOP_LIMIT, IPV6_DEFAULT_TNL_ENCAP_LIMIT
+	);
 }
 
 static void usage(void) __attribute__((noreturn));
diff --git a/ip/link_ip6tnl.c b/ip/link_ip6tnl.c
index 051c89f4fe57c..6bb968d3c9189 100644
--- a/ip/link_ip6tnl.c
+++ b/ip/link_ip6tnl.c
@@ -31,25 +31,33 @@
 
 static void print_usage(FILE *f)
 {
-	fprintf(f, "Usage: ip link { add | set | change | replace | del } NAME\n");
-	fprintf(f, "          [ mode { ip6ip6 | ipip6 | any } ]\n");
-	fprintf(f, "          type ip6tnl [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(f, "          [ dev PHYS_DEV ] [ encaplimit ELIM ]\n");
-	fprintf(f, "          [ hoplimit HLIM ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
-	fprintf(f, "          [ dscp inherit ] [ fwmark inherit ]\n");
-	fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
-	fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-	fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
-	fprintf(f, "          [ external ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: NAME      := STRING\n");
-	fprintf(f, "       ADDR      := IPV6_ADDRESS\n");
-	fprintf(f, "       ELIM      := { none | 0..255 }(default=%d)\n",
-		IPV6_DEFAULT_TNL_ENCAP_LIMIT);
-	fprintf(f, "       HLIM      := 0..255 (default=%d)\n",
-		DEFAULT_TNL_HOP_LIMIT);
-	fprintf(f, "       TCLASS    := { 0x0..0xff | inherit }\n");
-	fprintf(f, "       FLOWLABEL := { 0x0..0xfffff | inherit }\n");
+	fprintf(f,
+		"Usage: ... ip6tnl [ mode { ip6ip6 | ipip6 | any } ]\n"
+		"                  [ remote ADDR ]\n"
+		"                  [ local ADDR ]\n"
+		"                  [ dev PHYS_DEV ]\n"
+		"                  [ encaplimit ELIM ]\n"
+		"                  [ hoplimit HLIM ]\n"
+		"                  [ tclass TCLASS ]\n"
+		"                  [ flowlabel FLOWLABEL ]\n"
+		"                  [ dscp inherit ]\n"
+		"                  [ fwmark inherit ]\n"
+		"                  [ noencap ]\n"
+		"                  [ encap { fou | gue | none } ]\n"
+		"                  [ encap-sport PORT ]\n"
+		"                  [ encap-dport PORT ]\n"
+		"                  [ [no]encap-csum ]\n"
+		"                  [ [no]encap-csum6 ]\n"
+		"                  [ [no]encap-remcsum ]\n"
+		"                  [ external ]\n"
+		"\n"
+		"Where: ADDR      := IPV6_ADDRESS\n"
+		"       ELIM      := { none | 0..255 }(default=%d)\n"
+		"       HLIM      := 0..255 (default=%d)\n"
+		"       TCLASS    := { 0x0..0xff | inherit }\n"
+		"       FLOWLABEL := { 0x0..0xfffff | inherit }\n",
+		IPV6_DEFAULT_TNL_ENCAP_LIMIT, DEFAULT_TNL_HOP_LIMIT
+	);
 }
 
 static void usage(void) __attribute__((noreturn));
diff --git a/ip/link_iptnl.c b/ip/link_iptnl.c
index a96b1eb4c94ce..f180b921e4710 100644
--- a/ip/link_iptnl.c
+++ b/ip/link_iptnl.c
@@ -25,21 +25,35 @@
 
 static void print_usage(FILE *f, int sit)
 {
-	fprintf(f, "Usage: ip link { add | set | change | replace | del } NAME\n");
-	fprintf(f, "          type { ipip | sit } [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(f, "          [ ttl TTL ] [ tos TOS ] [ [no]pmtudisc ] [ dev PHYS_DEV ]\n");
-	fprintf(f, "          [ 6rd-prefix ADDR ] [ 6rd-relay_prefix ADDR ] [ 6rd-reset ]\n");
-	fprintf(f, "          [ noencap ] [ encap { fou | gue | none } ]\n");
-	fprintf(f, "          [ encap-sport PORT ] [ encap-dport PORT ]\n");
-	fprintf(f, "          [ [no]encap-csum ] [ [no]encap-csum6 ] [ [no]encap-remcsum ]\n");
+	const char *type = sit ? "sit " : "ipip";
+
+	fprintf(f,
+		"Usage: ... %s [ remote ADDR ]\n"
+		"                [ local ADDR ]\n"
+		"                [ ttl TTL ]\n"
+		"                [ tos TOS ]\n"
+		"                [ [no]pmtudisc ]\n"
+		"                [ dev PHYS_DEV ]\n"
+		"                [ 6rd-prefix ADDR ]\n"
+		"                [ 6rd-relay_prefix ADDR ]\n"
+		"                [ 6rd-reset ]\n"
+		"                [ noencap ]\n"
+		"                [ encap { fou | gue | none } ]\n"
+		"                [ encap-sport PORT ]\n"
+		"                [ encap-dport PORT ]\n"
+		"                [ [no]encap-csum ]\n"
+		"                [ [no]encap-csum6 ]\n"
+		"                [ [no]encap-remcsum ]\n",
+		type
+	);
 	if (sit) {
-		fprintf(f, "          [ mode { ip6ip | ipip | any } ]\n");
-		fprintf(f, "          [ isatap ]\n");
+		fprintf(f,
+			"                [ mode { ip6ip | ipip | any } ]\n"
+			"                [ isatap ]\n");
 	}
-	fprintf(f, "          [ external ]\n");
+	fprintf(f, "                [ external ]\n");
 	fprintf(f, "\n");
-	fprintf(f, "Where: NAME := STRING\n");
-	fprintf(f, "       ADDR := { IP_ADDRESS | any }\n");
+	fprintf(f, "Where: ADDR := { IP_ADDRESS | any }\n");
 	fprintf(f, "       TOS  := { NUMBER | inherit }\n");
 	fprintf(f, "       TTL  := { 1..255 | inherit }\n");
 }
diff --git a/ip/link_vti.c b/ip/link_vti.c
index 93bbce44423da..95bc23e928972 100644
--- a/ip/link_vti.c
+++ b/ip/link_vti.c
@@ -26,14 +26,15 @@
 
 static void print_usage(FILE *f)
 {
-	fprintf(f, "Usage: ip link { add | set | change | replace | del } NAME\n");
-	fprintf(f, "          type { vti } [ remote ADDR ] [ local ADDR ]\n");
-	fprintf(f, "          [ [i|o]key KEY ]\n");
-	fprintf(f, "          [ dev PHYS_DEV ]\n");
-	fprintf(f, "\n");
-	fprintf(f, "Where: NAME := STRING\n");
-	fprintf(f, "       ADDR := { IP_ADDRESS }\n");
-	fprintf(f, "       KEY  := { DOTTED_QUAD | NUMBER }\n");
+	fprintf(f,
+		"Usage: ... vti [ remote ADDR ]\n"
+		"               [ local ADDR ]\n"
+		"               [ [i|o]key KEY ]\n"
+		"               [ dev PHYS_DEV ]\n"
+		"\n"
+		"Where: ADDR := { IP_ADDRESS }\n"
+		"       KEY  := { DOTTED_QUAD | NUMBER }\n"
+	);
 }
 
 static void usage(void) __attribute__((noreturn));
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [iproute PATCH 4/4] ip: link: Add missing link type help texts
  2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
                   ` (2 preceding siblings ...)
  2017-03-28 21:19 ` [iproute PATCH 3/4] ip: link: Unify link type help functions a bit Phil Sutter
@ 2017-03-28 21:19 ` Phil Sutter
  2017-04-04 21:53 ` [iproute PATCH 0/4] Smaller link type help review Stephen Hemminger
  4 siblings, 0 replies; 6+ messages in thread
From: Phil Sutter @ 2017-03-28 21:19 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

These are basically stubs: The types which lacked their own help text
simply don't accept any options (yet). Still it might be a bit confusing
to users if they are presented with the generic 'ip link' help text
instead of something saying there are no type specific options.

Signed-off-by: Phil Sutter <phil@nwl.cc>
---
 ip/Makefile       |  3 ++-
 ip/iplink_dummy.c | 16 ++++++++++++++++
 ip/iplink_ifb.c   | 16 ++++++++++++++++
 ip/iplink_nlmon.c | 16 ++++++++++++++++
 ip/iplink_team.c  | 25 +++++++++++++++++++++++++
 ip/iplink_vcan.c  | 16 ++++++++++++++++
 6 files changed, 91 insertions(+), 1 deletion(-)
 create mode 100644 ip/iplink_dummy.c
 create mode 100644 ip/iplink_ifb.c
 create mode 100644 ip/iplink_nlmon.c
 create mode 100644 ip/iplink_team.c
 create mode 100644 ip/iplink_vcan.c

diff --git a/ip/Makefile b/ip/Makefile
index 4276a34b529e3..035d42c74f90b 100644
--- a/ip/Makefile
+++ b/ip/Makefile
@@ -1,7 +1,8 @@
 IPOBJ=ip.o ipaddress.o ipaddrlabel.o iproute.o iprule.o ipnetns.o \
     rtm_map.o iptunnel.o ip6tunnel.o tunnel.o ipneigh.o ipntable.o iplink.o \
     ipmaddr.o ipmonitor.o ipmroute.o ipprefix.o iptuntap.o iptoken.o \
-    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o \
+    ipxfrm.o xfrm_state.o xfrm_policy.o xfrm_monitor.o iplink_dummy.o \
+    iplink_ifb.o iplink_nlmon.o iplink_team.o iplink_vcan.o \
     iplink_vlan.o link_veth.o link_gre.o iplink_can.o iplink_xdp.o \
     iplink_macvlan.o ipl2tp.o link_vti.o link_vti6.o \
     iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \
diff --git a/ip/iplink_dummy.c b/ip/iplink_dummy.c
new file mode 100644
index 0000000000000..cf78ea5bca926
--- /dev/null
+++ b/ip/iplink_dummy.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void dummy_print_help(struct link_util *lu,
+			    int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... dummy\n");
+}
+
+struct link_util dummy_link_util = {
+	.id		= "dummy",
+	.print_help	= dummy_print_help,
+};
diff --git a/ip/iplink_ifb.c b/ip/iplink_ifb.c
new file mode 100644
index 0000000000000..d7dc8f987d120
--- /dev/null
+++ b/ip/iplink_ifb.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void ifb_print_help(struct link_util *lu,
+			    int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... ifb\n");
+}
+
+struct link_util ifb_link_util = {
+	.id		= "ifb",
+	.print_help	= ifb_print_help,
+};
diff --git a/ip/iplink_nlmon.c b/ip/iplink_nlmon.c
new file mode 100644
index 0000000000000..51d5919a75d3d
--- /dev/null
+++ b/ip/iplink_nlmon.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void nlmon_print_help(struct link_util *lu,
+			    int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... nlmon\n");
+}
+
+struct link_util nlmon_link_util = {
+	.id		= "nlmon",
+	.print_help	= nlmon_print_help,
+};
diff --git a/ip/iplink_team.c b/ip/iplink_team.c
new file mode 100644
index 0000000000000..6225268dda2dc
--- /dev/null
+++ b/ip/iplink_team.c
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void team_print_help(struct link_util *lu,
+			    int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... team\n");
+}
+
+static void team_slave_print_help(struct link_util *lu,
+				  int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... team_slave\n");
+}
+
+struct link_util team_link_util = {
+	.id		= "team",
+	.print_help	= team_print_help,
+}, team_slave_link_util = {
+	.id		= "team_slave",
+	.print_help	= team_slave_print_help,
+};
diff --git a/ip/iplink_vcan.c b/ip/iplink_vcan.c
new file mode 100644
index 0000000000000..b7ae15f072a4e
--- /dev/null
+++ b/ip/iplink_vcan.c
@@ -0,0 +1,16 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "utils.h"
+#include "ip_common.h"
+
+static void vcan_print_help(struct link_util *lu,
+			    int argc, char **argv, FILE *f)
+{
+	fprintf(f, "Usage: ... vcan\n");
+}
+
+struct link_util vcan_link_util = {
+	.id		= "vcan",
+	.print_help	= vcan_print_help,
+};
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [iproute PATCH 0/4] Smaller link type help review
  2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
                   ` (3 preceding siblings ...)
  2017-03-28 21:19 ` [iproute PATCH 4/4] ip: link: Add missing link type help texts Phil Sutter
@ 2017-04-04 21:53 ` Stephen Hemminger
  4 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2017-04-04 21:53 UTC (permalink / raw)
  To: Phil Sutter; +Cc: netdev

On Tue, 28 Mar 2017 23:19:35 +0200
Phil Sutter <phil@nwl.cc> wrote:

> This series addresses some minor nits with link type specific help
> texts:
> 
> * Unify coding style of print_help() callbacks (or the functions they
>   call.
> 
> * Unify output as much as possible for a common look and feel.
> 
> * Make sure there's type specific help for each type listed in 'ip link
>   help'.
> 
> Phil Sutter (4):
>   ip: link: bond: Fix whitespace in help text
>   ip: link: macvlan: Add newline to help output
>   ip: link: Unify link type help functions a bit
>   ip: link: Add missing link type help texts
> 
>  ip/Makefile         |  3 ++-
>  ip/iplink_bond.c    |  2 +-
>  ip/iplink_dummy.c   | 16 ++++++++++++++++
>  ip/iplink_geneve.c  | 28 ++++++++++++++++++----------
>  ip/iplink_ifb.c     | 16 ++++++++++++++++
>  ip/iplink_ipoib.c   |  4 +++-
>  ip/iplink_macvlan.c |  1 +
>  ip/iplink_nlmon.c   | 16 ++++++++++++++++
>  ip/iplink_team.c    | 25 +++++++++++++++++++++++++
>  ip/iplink_vcan.c    | 16 ++++++++++++++++
>  ip/iplink_vlan.c    | 15 +++++++++------
>  ip/iplink_vxlan.c   | 44 +++++++++++++++++++++++++++++---------------
>  ip/link_gre.c       | 36 +++++++++++++++++++++++-------------
>  ip/link_gre6.c      | 47 ++++++++++++++++++++++++++++-------------------
>  ip/link_ip6tnl.c    | 46 +++++++++++++++++++++++++++-------------------
>  ip/link_iptnl.c     | 38 ++++++++++++++++++++++++++------------
>  ip/link_vti.c       | 17 +++++++++--------
>  17 files changed, 265 insertions(+), 105 deletions(-)
>  create mode 100644 ip/iplink_dummy.c
>  create mode 100644 ip/iplink_ifb.c
>  create mode 100644 ip/iplink_nlmon.c
>  create mode 100644 ip/iplink_team.c
>  create mode 100644 ip/iplink_vcan.c
> 

All 4 Applied

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-04-04 21:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-28 21:19 [iproute PATCH 0/4] Smaller link type help review Phil Sutter
2017-03-28 21:19 ` [iproute PATCH 1/4] ip: link: bond: Fix whitespace in help text Phil Sutter
2017-03-28 21:19 ` [iproute PATCH 2/4] ip: link: macvlan: Add newline to help output Phil Sutter
2017-03-28 21:19 ` [iproute PATCH 3/4] ip: link: Unify link type help functions a bit Phil Sutter
2017-03-28 21:19 ` [iproute PATCH 4/4] ip: link: Add missing link type help texts Phil Sutter
2017-04-04 21:53 ` [iproute PATCH 0/4] Smaller link type help review Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.