diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-07 17:00:53 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-04-07 17:00:53 +0200 |
commit | d5342a1ad13be16eaf6b78fe57e36679406ef85e (patch) | |
tree | dceb600732d4ecddce49a8f6aa5f04036810b14f /networking/libiproute | |
parent | 1140bf39ab113aefee8079755fac618bf6314db6 (diff) | |
download | busybox-d5342a1ad13be16eaf6b78fe57e36679406ef85e.tar.gz |
iproute: support advmss option
function old new delta
iproute_modify 1164 1221 +57
str_is_lock - 22 +22
packed_usage 31372 31382 +10
do_iproute 157 132 -25
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 2/1 up/down: 89/-25) Total: 64 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking/libiproute')
-rw-r--r-- | networking/libiproute/iproute.c | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/networking/libiproute/iproute.c b/networking/libiproute/iproute.c index 62fa6efd3..fa616f8fc 100644 --- a/networking/libiproute/iproute.c +++ b/networking/libiproute/iproute.c @@ -322,17 +322,25 @@ static int FAST_FUNC print_route(const struct sockaddr_nl *who UNUSED_PARAM, return 0; } +static int str_is_lock(const char *str) +{ + return strcmp(str, "lock") == 0; +} + /* Return value becomes exitcode. It's okay to not return at all */ static int iproute_modify(int cmd, unsigned flags, char **argv) { /* If you add stuff here, update iproute_full_usage */ static const char keywords[] ALIGN1 = - "src\0""via\0""mtu\0""scope\0""protocol\0"IF_FEATURE_IP_RULE("table\0") + "src\0""via\0" + "mtu\0""advmss\0" + "scope\0""protocol\0"IF_FEATURE_IP_RULE("table\0") "dev\0""oif\0""to\0""metric\0""onlink\0"; enum { ARG_src, ARG_via, ARG_mtu, + ARG_advmss, ARG_scope, ARG_protocol, IF_FEATURE_IP_RULE(ARG_table,) @@ -405,12 +413,21 @@ IF_FEATURE_IP_RULE(ARG_table,) } else if (arg == ARG_mtu) { unsigned mtu; NEXT_ARG(); - if (strcmp(*argv, "lock") == 0) { + if (str_is_lock(*argv)) { mxlock |= (1 << RTAX_MTU); NEXT_ARG(); } mtu = get_unsigned(*argv, "mtu"); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_MTU, mtu); + } else if (arg == ARG_advmss) { + unsigned mss; + NEXT_ARG(); + if (str_is_lock(*argv)) { + mxlock |= (1 << RTAX_ADVMSS); + NEXT_ARG(); + } + mss = get_unsigned(*argv, "advmss"); + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_ADVMSS, mss); } else if (arg == ARG_scope) { uint32_t scope; NEXT_ARG(); @@ -505,16 +522,6 @@ IF_FEATURE_IP_RULE(ARG_table,) if (get_unsigned(&hoplimit, *argv, 0)) invarg("\"hoplimit\" value is invalid\n", *argv); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_HOPLIMIT, hoplimit); - } else if (strcmp(*argv, "advmss") == 0) { - unsigned mss; - NEXT_ARG(); - if (strcmp(*argv, "lock") == 0) { - mxlock |= (1<<RTAX_ADVMSS); - NEXT_ARG(); - } - if (get_unsigned(&mss, *argv, 0)) - invarg("\"mss\" value is invalid\n", *argv); - rta_addattr32(mxrta, sizeof(mxbuf), RTAX_ADVMSS, mss); } else if (matches(*argv, "reordering") == 0) { unsigned reord; NEXT_ARG(); |