From 5caba410c20f621dc9f001c1fc3aac104d1f6cd2 Mon Sep 17 00:00:00 2001 From: Alexander Alemayhu Date: Sun, 26 Mar 2017 21:11:14 +0200 Subject: [PATCH 1/8] man: fix man page warnings While generating PDFs from the man pages, I saw the warning below from several files. Compared the tc-matchall.8 with bridge.8 and used .RI instead of .R. It should have no effect on the man page rendering. `R' is a string (producing the registered sign), not a macro. Signed-off-by: Alexander Alemayhu --- man/man8/tc-flower.8 | 2 +- man/man8/tc-ife.8 | 2 +- man/man8/tc-matchall.8 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/man/man8/tc-flower.8 b/man/man8/tc-flower.8 index fc5bac50..ba290657 100644 --- a/man/man8/tc-flower.8 +++ b/man/man8/tc-flower.8 @@ -20,7 +20,7 @@ flower \- flow based traffic control filter .B indev .IR ifname " | " .BR skip_sw " | " skip_hw -.R " | { " +.RI " | { " .BR dst_mac " | " src_mac " } " .IR MASKED_LLADDR " | " .B vlan_id diff --git a/man/man8/tc-ife.8 b/man/man8/tc-ife.8 index dae8b9be..a8f1f287 100644 --- a/man/man8/tc-ife.8 +++ b/man/man8/tc-ife.8 @@ -13,7 +13,7 @@ IFE - encapsulate/decapsulate metadata .IR SMAC " ] " .RB "[ " type .IR TYPE " ] " -.R "[ " +.RI "[ " .IR CONTROL " ] " .RB "[ " index .IR INDEX " ] " diff --git a/man/man8/tc-matchall.8 b/man/man8/tc-matchall.8 index 53b2194e..e3cddb1f 100644 --- a/man/man8/tc-matchall.8 +++ b/man/man8/tc-matchall.8 @@ -7,7 +7,7 @@ matchall \- traffic control filter that matches every packet .ti -8 .BR tc " " filter " ... " matchall " [ " .BR skip_sw " | " skip_hw -.R " ] [ " +.RI " ] [ " .B action .IR ACTION_SPEC " ] [ " .B classid From 878babffec8357c49b0d0fd0bbd5782ce432329d Mon Sep 17 00:00:00 2001 From: Roman Mashak Date: Wed, 22 Mar 2017 14:00:31 -0400 Subject: [PATCH 2/8] tc: print skbedit action when dumping actions. Signed-off-by: Roman Mashak --- tc/m_skbedit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tc/m_skbedit.c b/tc/m_skbedit.c index 8660d603..638715f6 100644 --- a/tc/m_skbedit.c +++ b/tc/m_skbedit.c @@ -214,6 +214,8 @@ static int print_skbedit(struct action_util *au, FILE *f, struct rtattr *arg) fprintf(f, " ptype %d", *ptype); } + fprintf(f, " %s", action_n2a(p->action)); + fprintf(f, "\n\t index %u ref %d bind %d", p->index, p->refcnt, p->bindcnt); From 3fbb5d43bb759c7501404d8a92ae95e058c1763a Mon Sep 17 00:00:00 2001 From: Sabrina Dubroca Date: Tue, 28 Mar 2017 17:56:48 +0200 Subject: [PATCH 3/8] man: ip-link.8: document bridge options Signed-off-by: Phil Sutter Signed-off-by: Sabrina Dubroca --- man/man8/ip-link.8.in | 229 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 229 insertions(+) diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in index 3f5d57c2..15b32bc6 100644 --- a/man/man8/ip-link.8.in +++ b/man/man8/ip-link.8.in @@ -989,6 +989,235 @@ corresponds to the 2010 version of the HSR standard. Option "1" activates the 2012 version. .in -8 +.TP +BRIDGE Type Support +For a link of type +.I BRIDGE +the following additional arguments are supported: + +.BI "ip link add " DEVICE " type bridge " +[ +.BI ageing_time " AGEING_TIME " +] [ +.BI group_fwd_mask " MASK " +] [ +.BI group_address " ADDRESS " +] [ +.BI forward_delay " FORWARD_DELAY " +] [ +.BI hello_time " HELLO_TIME " +] [ +.BI max_age " MAX_AGE " +] [ +.BI stp_state " STP_STATE " +] [ +.BI priority " PRIORITY " +] [ +.BI vlan_filtering " VLAN_FILTERING " +] [ +.BI vlan_protocol " VLAN_PROTOCOL " +] [ +.BI vlan_default_pvid " VLAN_DEFAULT_PVID " +] [ +.BI vlan_stats_enabled " VLAN_STATS_ENABLED " +] [ +.BI mcast_snooping " MULTICAST_SNOOPING " +] [ +.BI mcast_router " MULTICAST_ROUTER " +] [ +.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR " +] [ +.BI mcast_querier " MULTICAST_QUERIER " +] [ +.BI mcast_hash_elasticity " HASH_ELASTICITY " +] [ +.BI mcast_hash_max " HASH_MAX " +] [ +.BI mcast_last_member_count " LAST_MEMBER_COUNT " +] [ +.BI mcast_startup_query_count " STARTUP_QUERY_COUNT " +] [ +.BI mcast_last_member_interval " LAST_MEMBER_INTERVAL " +] [ +.BI mcast_membership_interval " MEMBERSHIP_INTERVAL " +] [ +.BI mcast_querier_interval " QUERIER_INTERVAL " +] [ +.BI mcast_query_interval " QUERY_INTERVAL " +] [ +.BI mcast_query_response_interval " QUERY_RESPONSE_INTERVAL " +] [ +.BI mcast_startup_query_interval " STARTUP_QUERY_INTERVAL " +] [ +.BI mcast_stats_enabled " MCAST_STATS_ENABLED " +] [ +.BI mcast_igmp_version " IGMP_VERSION " +] [ +.BI mcast_mld_version " MLD_VERSION " +] [ +.BI nf_call_iptables " NF_CALL_IPTABLES " +] [ +.BI nf_call_ip6tables " NF_CALL_IP6TABLES " +] [ +.BI nf_call_arptables " NF_CALL_ARPTABLES " +] + +.in +8 +.sp +.BI ageing_time " AGEING_TIME " +- configure the bridge's FDB entries ageing time, ie the number of seconds a MAC address will be kept in the FDB after a packet has been received from that address. after this time has passed, entries are cleaned up. + +.BI group_fwd_mask " MASK " +- set the group forward mask. This is the bitmask that is applied to decide whether to forward incoming frames destined to link-local addresses, ie addresses of the form 01:80:C2:00:00:0X (defaults to 0, ie the bridge does not forward any link-local frames). + +.BI group_address " ADDRESS " +- set the MAC address of the multicast group this bridge uses for STP. The address must be a link-local address in standard Ethernet MAC address format, ie an address of the form 01:80:C2:00:00:0X, with X in [0, 4..f]. + +.BI forward_delay " FORWARD_DELAY " +- set the forwarding delay in seconds, ie the time spent in LISTENING state (before moving to LEARNING) and in LEARNING state (before moving to FORWARDING). Only relevant if STP is enabled. Valid values are between 2 and 30. + +.BI hello_time " HELLO_TIME " +- set the time in seconds between hello packets sent by the bridge, when it is a root bridge or a designated bridges. Only relevant if STP is enabled. Valid values are between 1 and 10. + +.BI max_age " MAX_AGE " +- set the hello packet timeout, ie the time in seconds until another bridge in the spanning tree is assumed to be dead, after reception of its last hello message. Only relevant if STP is enabled. Valid values are between 6 and 40. + +.BI stp_state " STP_STATE " +- turn spanning tree protocol on +.RI ( STP_STATE " > 0) " +or off +.RI ( STP_STATE " == 0). " +for this bridge. + +.BI priority " PRIORITY " +- set this bridge's spanning tree priority, used during STP root bridge election. +.I PRIORITY +is a 16bit unsigned integer. + +.BI vlan_filtering " VLAN_FILTERING " +- turn VLAN filtering on +.RI ( VLAN_FILTERING " > 0) " +or off +.RI ( VLAN_FILTERING " == 0). " +When disabled, the bridge will not consider the VLAN tag when handling packets. + +.BR vlan_protocol " { " 802.1Q " | " 802.1ad " } " +- set the protocol used for VLAN filtering. + +.BI vlan_default_pvid " VLAN_DEFAULT_PVID " +- set the default PVID (native/untagged VLAN ID) for this bridge. + +.BI vlan_stats_enabled " VLAN_STATS_ENABLED " +- enable +.RI ( VLAN_STATS_ENABLED " == 1) " +or disable +.RI ( VLAN_STATS_ENABLED " == 0) " +per-VLAN stats accounting. + +.BI mcast_snooping " MULTICAST_SNOOPING " +- turn multicast snooping on +.RI ( MULTICAST_SNOOPING " > 0) " +or off +.RI ( MULTICAST_SNOOPING " == 0). " + +.BI mcast_router " MULTICAST_ROUTER " +- set bridge's multicast router if IGMP snooping is enabled. +.I MULTICAST_ROUTER +is an integer value having the following meaning: +.in +8 +.sp +.B 0 +- disabled. + +.B 1 +- automatic (queried). + +.B 2 +- permanently enabled. +.in -8 + +.BI mcast_query_use_ifaddr " MCAST_QUERY_USE_IFADDR " +- whether to use the bridge's own IP address as source address for IGMP queries +.RI ( MCAST_QUERY_USE_IFADDR " > 0) " +or the default of 0.0.0.0 +.RI ( MCAST_QUERY_USE_IFADDR " == 0). " + +.BI mcast_querier " MULTICAST_QUERIER " +- enable +.RI ( MULTICAST_QUERIER " > 0) " +or disable +.RI ( MULTICAST_QUERIER " == 0) " +IGMP querier, ie sending of multicast queries by the bridge (default: disabled). + +.BI mcast_querier_interval " QUERIER_INTERVAL " +- interval between queries sent by other routers. if no queries are seen after this delay has passed, the bridge will start to send its own queries (as if +.BI mcast_querier +was enabled). + +.BI mcast_hash_elasticity " HASH_ELASTICITY " +- set multicast database hash elasticity, ie the maximum chain length in the multicast hash table (defaults to 4). + +.BI mcast_hash_max " HASH_MAX " +- set maximum size of multicast hash table (defaults to 512, value must be a power of 2). + +.BI mcast_last_member_count " LAST_MEMBER_COUNT " +- set multicast last member count, ie the number of queries the bridge will send before stopping forwarding a multicast group after a "leave" message has been received (defaults to 2). + +.BI mcast_last_member_interval " LAST_MEMBER_INTERVAL " +- interval between queries to find remaining members of a group, after a "leave" message is received. + +.BI mcast_startup_query_count " STARTUP_QUERY_COUNT " +- set the number of IGMP queries to send during startup phase (defaults to 2). + +.BI mcast_startup_query_interval " STARTUP_QUERY_INTERVAL " +- interval between queries in the startup phase. + +.BI mcast_query_interval " QUERY_INTERVAL " +- interval between queries sent by the bridge after the end of the startup phase. + +.BI mcast_query_response_interval " QUERY_RESPONSE_INTERVAL " +- set the Max Response Time/Maximum Response Delay for IGMP/MLD queries sent by the bridge. + +.BI mcast_membership_interval " MEMBERSHIP_INTERVAL " +- delay after which the bridge will leave a group, if no membership reports for this group are received. + +.BI mcast_stats_enabled " MCAST_STATS_ENABLED " +- enable +.RI ( MCAST_STATS_ENABLED " > 0) " +or disable +.RI ( MCAST_STATS_ENABLED " == 0) " +multicast (IGMP/MLD) stats accounting. + +.BI mcast_igmp_version " IGMP_VERSION " +- set the IGMP version. + +.BI mcast_mld_version " MLD_VERSION " +- set the MLD version. + +.BI nf_call_iptables " NF_CALL_IPTABLES " +- enable +.RI ( NF_CALL_IPTABLES " > 0) " +or disable +.RI ( NF_CALL_IPTABLES " == 0) " +iptables hooks on the bridge. + +.BI nf_call_ip6tables " NF_CALL_IP6TABLES " +- enable +.RI ( NF_CALL_IP6TABLES " > 0) " +or disable +.RI ( NF_CALL_IP6TABLES " == 0) " +ip6tables hooks on the bridge. + +.BI nf_call_arptables " NF_CALL_ARPTABLES " +- enable +.RI ( NF_CALL_ARPTABLES " > 0) " +or disable +.RI ( NF_CALL_ARPTABLES " == 0) " +arptables hooks on the bridge. + + +.in-8 + .TP MACsec Type Support For a link of type From be985020ab4e71547ce3ad5590caf9a61968bedf Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 28 Mar 2017 23:19:36 +0200 Subject: [PATCH 4/8] ip: link: bond: Fix whitespace in help text Signed-off-by: Phil Sutter --- 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 fe83479a..772b05fd 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" From e336868e0925e77fe933d83711941cafa6134e25 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 28 Mar 2017 23:19:37 +0200 Subject: [PATCH 5/8] ip: link: macvlan: Add newline to help output A newline between synopsis and variable definition looks nice and is consistent with others. Signed-off-by: Phil Sutter --- ip/iplink_macvlan.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ip/iplink_macvlan.c b/ip/iplink_macvlan.c index b9a146f2..662eb6ff 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" From 8b47135474cde4f0f8c9991741132b930bf3e192 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 28 Mar 2017 23:19:38 +0200 Subject: [PATCH 6/8] ip: link: Unify link type help functions a bit 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 --- 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 1e6669d0..2c510fce 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 cb204af4..86dc65ca 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 144c83cb..b47236d8 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 fef7d3af..b4ebb139 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 3b99e56f..35d437a1 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 d00db1f8..a91f6357 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 051c89f4..6bb968d3 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 a96b1eb4..f180b921 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 93bbce44..95bc23e9 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)); From 9fd7b86c2de91935ab736ef6df119a0c691cdfdc Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 28 Mar 2017 23:19:39 +0200 Subject: [PATCH 7/8] ip: link: Add missing link type help texts 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 --- 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 4276a34b..035d42c7 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 00000000..cf78ea5b --- /dev/null +++ b/ip/iplink_dummy.c @@ -0,0 +1,16 @@ +#include +#include + +#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 00000000..d7dc8f98 --- /dev/null +++ b/ip/iplink_ifb.c @@ -0,0 +1,16 @@ +#include +#include + +#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 00000000..51d5919a --- /dev/null +++ b/ip/iplink_nlmon.c @@ -0,0 +1,16 @@ +#include +#include + +#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 00000000..6225268d --- /dev/null +++ b/ip/iplink_team.c @@ -0,0 +1,25 @@ +#include +#include + +#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 00000000..b7ae15f0 --- /dev/null +++ b/ip/iplink_vcan.c @@ -0,0 +1,16 @@ +#include +#include + +#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, +}; From 058d28b44c6cc66e5cdce31e80dc7284ccb22017 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 4 Apr 2017 17:08:43 +0200 Subject: [PATCH 8/8] man: ip-link: Specify min/max values for bridge slave priority and cost The values are parsed as u16/u32, but kernel limits allowed values. Signed-off-by: Phil Sutter --- man/man8/ip-link.8.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/man/man8/ip-link.8.in b/man/man8/ip-link.8.in index 15b32bc6..a5ddfe7a 100644 --- a/man/man8/ip-link.8.in +++ b/man/man8/ip-link.8.in @@ -1714,10 +1714,10 @@ is a number representing the following states: .BR 4 " (blocking)." .BI priority " PRIO" -- set port priority (a 16bit unsigned value). +- set port priority (allowed values are between 0 and 63, inclusively). .BI cost " COST" -- set port cost (a 32bit unsigned value). +- set port cost (allowed values are between 1 and 65535, inclusively). .BR guard " { " on " | " off " }" - block incoming BPDU packets on this port.