diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-08-26 12:16:47 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-08-26 12:16:47 +0000 |
commit | 679f546c5aa97e75a655a2b0f0cd0cddf2ccdafb (patch) | |
tree | 7f836d090967d614dcf616e63763b829e9e9a772 /usr/src/uts/common | |
parent | f0e88e824573addb114d76d4bb019113c7c2d445 (diff) | |
parent | 3ee4fc2aa6b5136515cc3eed32d3c6ef33e37471 (diff) | |
download | illumos-joyent-679f546c5aa97e75a655a2b0f0cd0cddf2ccdafb.tar.gz |
[illumos-gate merge]
commit 3ee4fc2aa6b5136515cc3eed32d3c6ef33e37471
11552 Want a more modern nawk(1)
commit ac05f74f7be0e256003b8dd2492cf96ac4ecda1d
11551 Clean up nawk(1) usage in illumos-gate
commit e6d6c189fa3a95d7aa27bbe0aeacf7c1a6b57c8c
11550 Want tests for nawk(1)
commit 72737c91abd19e2597bf00bb225ad2dec71c8d06
3635 kstat_queue(9F) should not mention kstat_create()
commit d49945110829673d27d215f4db010ac1d22a68de
11554 Want TCP_CONGESTION socket option
commit 45a4b79d042e642c2ed7090ec290469ccf8fc563
11553 Want pluggable TCP congestion control algorithms
commit 867a2ce85cd3f659cb7bc187ba93a095fe1df597
10857 nanf.3m and nanl.3m should be linked to nan.3m
Conflicts:
usr/src/uts/common/inet/tcp/tcp.c
usr/src/uts/Makefile.uts
usr/src/test/util-tests/tests/awk/tests/T.lilly
usr/src/test/util-tests/tests/awk/tests/T.gawk
usr/src/test/util-tests/tests/awk/tests/T.clv
usr/src/test/util-tests/tests/awk/tests/T.chem
usr/src/test/util-tests/tests/awk/bugs-fixed/system-status.awk
usr/src/test/util-tests/tests/awk/Makefile
usr/src/test/util-tests/tests/Makefile
usr/src/pkg/manifests/system-test-utiltest.mf
usr/src/cmd/awk/lib.c
exception_lists/cstyle
Diffstat (limited to 'usr/src/uts/common')
-rw-r--r-- | usr/src/uts/common/inet/tcp/tcp_opt_data.c | 48 | ||||
-rw-r--r-- | usr/src/uts/common/netinet/tcp.h | 1 |
2 files changed, 48 insertions, 1 deletions
diff --git a/usr/src/uts/common/inet/tcp/tcp_opt_data.c b/usr/src/uts/common/inet/tcp/tcp_opt_data.c index 4774412992..ea4760e6bb 100644 --- a/usr/src/uts/common/inet/tcp/tcp_opt_data.c +++ b/usr/src/uts/common/inet/tcp/tcp_opt_data.c @@ -21,7 +21,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011 Nexenta Systems, Inc. All rights reserved. - * Copyright 2016 Joyent, Inc. + * Copyright 2019 Joyent, Inc. * Copyright (c) 2016 by Delphix. All rights reserved. */ @@ -34,6 +34,7 @@ #include <sys/xti_inet.h> #include <sys/policy.h> +#include <inet/cc.h> #include <inet/common.h> #include <netinet/ip6.h> #include <inet/ip.h> @@ -142,6 +143,9 @@ opdes_t tcp_opt_arr[] = { { TCP_LINGER2, IPPROTO_TCP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 }, +{ TCP_CONGESTION, IPPROTO_TCP, OA_RW, OA_RW, OP_NP, + OP_VARLEN, CC_ALGO_NAME_MAX, 0 }, + { IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP, (OP_VARLEN|OP_NODEFAULT), IP_MAX_OPT_LENGTH + IP_ADDR_LEN, -1 /* not initialized */ }, @@ -434,6 +438,13 @@ tcp_opt_get(conn_t *connp, int level, int name, uchar_t *ptr) case TCP_KEEPALIVE_ABORT_THRESHOLD: *i1 = tcp->tcp_ka_abort_thres; return (sizeof (int)); + case TCP_CONGESTION: { + size_t len = strlcpy((char *)ptr, CC_ALGO(tcp)->name, + CC_ALGO_NAME_MAX); + if (len >= CC_ALGO_NAME_MAX) + return (-1); + return (len + 1); + } case TCP_CORK: *i1 = tcp->tcp_cork; return (sizeof (int)); @@ -958,6 +969,41 @@ tcp_opt_set(conn_t *connp, uint_t optset_context, int level, int name, tcp->tcp_ka_rinterval = 0; } break; + case TCP_CONGESTION: { + struct cc_algo *algo; + + if (checkonly) { + break; + } + + /* + * Make sure the string is NUL-terminated. Some + * consumers pass only the number of characters + * in the string, and don't include the NUL + * terminator, so we set it for them. + */ + if (inlen < CC_ALGO_NAME_MAX) { + invalp[inlen] = '\0'; + } + invalp[CC_ALGO_NAME_MAX - 1] = '\0'; + + if ((algo = cc_load_algo((char *)invalp)) == NULL) { + return (ENOENT); + } + + if (CC_ALGO(tcp)->cb_destroy != NULL) { + CC_ALGO(tcp)->cb_destroy(&tcp->tcp_ccv); + } + + CC_DATA(tcp) = NULL; + CC_ALGO(tcp) = algo; + + if (CC_ALGO(tcp)->cb_init != NULL) { + VERIFY0(CC_ALGO(tcp)->cb_init(&tcp->tcp_ccv)); + } + + break; + } case TCP_CORK: if (!checkonly) { /* diff --git a/usr/src/uts/common/netinet/tcp.h b/usr/src/uts/common/netinet/tcp.h index f6c2fc160b..e79c1a571d 100644 --- a/usr/src/uts/common/netinet/tcp.h +++ b/usr/src/uts/common/netinet/tcp.h @@ -129,6 +129,7 @@ struct tcphdr { #define TCP_KEEPIDLE 0x22 #define TCP_KEEPCNT 0x23 #define TCP_KEEPINTVL 0x24 +#define TCP_CONGESTION 0x25 #ifdef __cplusplus } |