ip: add fastopen_no_cookie option to ip route

This patch adds fastopen_no_cookie option to enable/disable TCP fastopen
without a cookie on a per-route basis.

Support in Linux was added with 71c02379c762 (tcp: Configure TFO without
cookie per socket and/or per route).

Cc: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Christoph Paasch <cpaasch@apple.com>
This commit is contained in:
Christoph Paasch 2017-10-31 14:54:52 -07:00 committed by Stephen Hemminger
parent 21440d19d9
commit e54ed38074
2 changed files with 33 additions and 17 deletions

View File

@ -41,21 +41,22 @@ enum list_action {
IPROUTE_SAVE, IPROUTE_SAVE,
}; };
static const char *mx_names[RTAX_MAX+1] = { static const char *mx_names[RTAX_MAX+1] = {
[RTAX_MTU] = "mtu", [RTAX_MTU] = "mtu",
[RTAX_WINDOW] = "window", [RTAX_WINDOW] = "window",
[RTAX_RTT] = "rtt", [RTAX_RTT] = "rtt",
[RTAX_RTTVAR] = "rttvar", [RTAX_RTTVAR] = "rttvar",
[RTAX_SSTHRESH] = "ssthresh", [RTAX_SSTHRESH] = "ssthresh",
[RTAX_CWND] = "cwnd", [RTAX_CWND] = "cwnd",
[RTAX_ADVMSS] = "advmss", [RTAX_ADVMSS] = "advmss",
[RTAX_REORDERING] = "reordering", [RTAX_REORDERING] = "reordering",
[RTAX_HOPLIMIT] = "hoplimit", [RTAX_HOPLIMIT] = "hoplimit",
[RTAX_INITCWND] = "initcwnd", [RTAX_INITCWND] = "initcwnd",
[RTAX_FEATURES] = "features", [RTAX_FEATURES] = "features",
[RTAX_RTO_MIN] = "rto_min", [RTAX_RTO_MIN] = "rto_min",
[RTAX_INITRWND] = "initrwnd", [RTAX_INITRWND] = "initrwnd",
[RTAX_QUICKACK] = "quickack", [RTAX_QUICKACK] = "quickack",
[RTAX_CC_ALGO] = "congctl", [RTAX_CC_ALGO] = "congctl",
[RTAX_FASTOPEN_NO_COOKIE] = "fastopen_no_cookie"
}; };
static void usage(void) __attribute__((noreturn)); static void usage(void) __attribute__((noreturn));
@ -90,7 +91,7 @@ static void usage(void)
" [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n" " [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n"
" [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n" " [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n"
" [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]\n" " [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]\n"
" [ pref PREF ] [ expires TIME ]\n" " [ pref PREF ] [ expires TIME ] [ fastopen_no_cookie BOOL ]\n"
"TYPE := { unicast | local | broadcast | multicast | throw |\n" "TYPE := { unicast | local | broadcast | multicast | throw |\n"
" unreachable | prohibit | blackhole | nat }\n" " unreachable | prohibit | blackhole | nat }\n"
"TABLE_ID := [ local | main | default | all | NUMBER ]\n" "TABLE_ID := [ local | main | default | all | NUMBER ]\n"
@ -1224,6 +1225,15 @@ static int iproute_modify(int cmd, unsigned int flags, int argc, char **argv)
addattr8(&req.n, sizeof(req), RTA_TTL_PROPAGATE, addattr8(&req.n, sizeof(req), RTA_TTL_PROPAGATE,
ttl_prop); ttl_prop);
} else if (matches(*argv, "fastopen_no_cookie") == 0) {
unsigned int fastopen_no_cookie;
NEXT_ARG();
if (get_unsigned(&fastopen_no_cookie, *argv, 0))
invarg("\"fastopen_no_cookie\" value is invalid\n", *argv);
if (fastopen_no_cookie != 1 && fastopen_no_cookie != 0)
invarg("\"fastopen_no_cookie\" value should be 0 or 1\n", *argv);
rta_addattr32(mxrta, sizeof(mxbuf), RTAX_FASTOPEN_NO_COOKIE, fastopen_no_cookie);
} else { } else {
int type; int type;
inet_prefix dst; inet_prefix dst;

View File

@ -141,7 +141,9 @@ replace " } "
.B pref .B pref
.IR PREF " ] [ " .IR PREF " ] [ "
.B expires .B expires
.IR TIME " ]" .IR TIME " ] ["
.B fastopen_no_cookie
.IR BOOL " ]"
.ti -8 .ti -8
.IR TYPE " := [ " .IR TYPE " := [ "
@ -524,6 +526,10 @@ sysctl is set to 0.
.BI quickack " BOOL " "(3.11+ only)" .BI quickack " BOOL " "(3.11+ only)"
Enable or disable quick ack for connections to this destination. Enable or disable quick ack for connections to this destination.
.TP
.BI fastopen_no_cookie " BOOL " "(4.15+ only)"
Enable TCP Fastopen without a cookie for connections to this destination.
.TP .TP
.BI congctl " NAME " "(3.20+ only)" .BI congctl " NAME " "(3.20+ only)"
.TP .TP