From 4eaa0f7729e96660f69a6c4f4db6d608c420c05d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 7 Apr 2017 18:14:46 +0200 Subject: ipaddress: tweak help text Signed-off-by: Denys Vlasenko --- networking/ip.c | 19 +++++++++++-------- networking/libiproute/ipaddress.c | 10 +++++++--- 2 files changed, 18 insertions(+), 11 deletions(-) (limited to 'networking') diff --git a/networking/ip.c b/networking/ip.c index 0d66d53..36975c0 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -140,17 +140,17 @@ //kbuild:lib-$(CONFIG_IPTUNNEL) += ip.o //kbuild:lib-$(CONFIG_IPNEIGH) += ip.o +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define ipaddr_trivial_usage //usage: "add|del IFADDR dev IFACE | show|flush [dev IFACE] [to PREFIX]" //usage:#define ipaddr_full_usage "\n\n" //usage: "ipaddr add|change|replace|delete IFADDR dev IFACE\n" -//usage: "ipaddr show|flush [dev IFACE] [scope SCOPE-ID]\n" -//usage: " [to PREFIX] [label PATTERN]\n" -//usage: " IFADDR := PREFIX | ADDR peer PREFIX\n" -//usage: " [broadcast ADDR] [anycast ADDR]\n" +//usage: " IFADDR := PREFIX | ADDR peer PREFIX [broadcast ADDR] [anycast ADDR]\n" //usage: " [label STRING] [scope SCOPE-ID]\n" +//usage: "ipaddr show|flush [dev IFACE] [scope SCOPE-ID] [to PREFIX] [label PATTERN]\n" //usage: " SCOPE-ID := [host|link|global|NUMBER]" //usage: +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define iplink_trivial_usage //usage: "set IFACE [up|down] [arp on|off] | show [IFACE]" //usage:#define iplink_full_usage "\n\n" @@ -158,19 +158,20 @@ //usage: " [mtu NUM] [name NAME] [qlen NUM] [address MAC]\n" //usage: "iplink show [IFACE]" //usage: +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define iproute_trivial_usage //usage: "list|flush|add|del|change|append|replace|test ROUTE" //usage:#define iproute_full_usage "\n\n" //usage: "iproute list|flush SELECTOR\n" //usage: " SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" -//usage: " PREFIX := default|ADDRESS/MASK\n" -//usage: "iproute get ADDRESS [from ADDRESS iif IFACE]\n" +//usage: " PREFIX := default|ADDR/MASK\n" +//usage: "iproute get ADDR [from ADDR iif IFACE]\n" //usage: " [oif IFACE] [tos TOS]\n" //usage: "iproute add|del|change|append|replace|test ROUTE\n" //usage: " ROUTE := NODE_SPEC [INFO_SPEC]\n" //usage: " NODE_SPEC := PREFIX"IF_FEATURE_IP_RULE(" [table TABLE_ID]")" [proto RTPROTO] [scope SCOPE] [metric METRIC]\n" //usage: " INFO_SPEC := NH OPTIONS\n" -//usage: " NH := [via [inet|inet6] ADDRESS] [dev IFACE] [src ADDRESS] [onlink]\n" +//usage: " NH := [via [inet|inet6] ADDR] [dev IFACE] [src ADDR] [onlink]\n" //usage: " OPTIONS := [mtu [lock] NUM] [advmss [lock] NUM]" //upstream man ip-route: //====================== @@ -199,16 +200,18 @@ //ENCAP_MPLS := mpls [ LABEL ] //ENCAP_IP := ip id TUNNEL_ID dst REMOTE_IP [ tos TOS ] [ ttl TTL ] //usage: +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define iprule_trivial_usage //usage: "[list] | add|del SELECTOR ACTION" //usage:#define iprule_full_usage "\n\n" //usage: " SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK]\n" //usage: " [dev IFACE] [pref NUMBER]\n" -//usage: " ACTION := [table TABLE_ID] [nat ADDRESS]\n" +//usage: " ACTION := [table TABLE_ID] [nat ADDR]\n" //usage: " [prohibit|reject|unreachable]\n" //usage: " [realms [SRCREALM/]DSTREALM]\n" //usage: " TABLE_ID := [local|main|default|NUMBER]" //usage: +//--------------123456789.123456789.123456789.123456789.123456789.123456789.123456789.123....79 //usage:#define iptunnel_trivial_usage //usage: "add|change|del|show [NAME]\n" //usage: " [mode ipip|gre|sit]\n" diff --git a/networking/libiproute/ipaddress.c b/networking/libiproute/ipaddress.c index d9e0996..36d6b65 100644 --- a/networking/libiproute/ipaddress.c +++ b/networking/libiproute/ipaddress.c @@ -593,9 +593,13 @@ static int default_scope(inet_prefix *lcl) /* Return value becomes exitcode. It's okay to not return at all */ static int ipaddr_modify(int cmd, int flags, char **argv) { + /* If you add stuff here, update ipaddr_full_usage */ static const char option[] ALIGN1 = "peer\0""remote\0""broadcast\0""brd\0" "anycast\0""scope\0""dev\0""label\0""local\0"; +#define option_peer option +#define option_broadcast (option + sizeof("peer") + sizeof("remote")) +#define option_anycast (option_broadcast + sizeof("broadcast") + sizeof("brd")) struct rtnl_handle rth; struct { struct nlmsghdr n; @@ -627,7 +631,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv) if (arg <= 1) { /* peer, remote */ if (peer_len) { - duparg("peer", *argv); + duparg(option_peer, *argv); } get_prefix(&peer, *argv, req.ifa.ifa_family); peer_len = peer.bytelen; @@ -639,7 +643,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv) } else if (arg <= 3) { /* broadcast, brd */ inet_prefix addr; if (brd_len) { - duparg("broadcast", *argv); + duparg(option_broadcast, *argv); } if (LONE_CHAR(*argv, '+')) { brd_len = -1; @@ -655,7 +659,7 @@ static int ipaddr_modify(int cmd, int flags, char **argv) } else if (arg == 4) { /* anycast */ inet_prefix addr; if (any_len) { - duparg("anycast", *argv); + duparg(option_anycast, *argv); } get_addr(&addr, *argv, req.ifa.ifa_family); if (req.ifa.ifa_family == AF_UNSPEC) { -- cgit v1.1