Re: [PATCH v4 1/2] net/tls: support maximum record size limit
From: Wilfred Mallawa <hidden>
Date: 2025-09-25 05:39:23
Also in:
linux-doc, linux-kselftest, lkml
From: Wilfred Mallawa <hidden>
Date: 2025-09-25 05:39:23
Also in:
linux-doc, linux-kselftest, lkml
On Wed, 2025-09-24 at 19:50 +0200, Sabrina Dubroca wrote:
[...]
quoted
+ static int do_tls_setsockopt(struct sock *sk, int optname, sockptr_t optval, unsigned int optlen) {@@ -833,6 +898,9 @@ static int do_tls_setsockopt(struct sock *sk,int optname, sockptr_t optval, case TLS_RX_EXPECT_NO_PAD: rc = do_tls_setsockopt_no_pad(sk, optval, optlen); break; + case TLS_TX_RECORD_SIZE_LIM: + rc = do_tls_setsockopt_tx_record_size(sk, optval, optlen);I think we want to lock the socket here, to avoid any concurrent send()? Especially now with the ->open_rec check.
Yeah that's a good point, will fixup!
quoted
@@ -1111,6 +1180,11 @@ static int tls_get_info(struct sock *sk,struct sk_buff *skb, bool net_admin) goto nla_failure; } + err = nla_put_u16(skb, TLS_INFO_TX_RECORD_SIZE_LIM, + ctx->tx_record_size_limit);I'm not sure here: if we do the +1 adjustment we'd be consistent with the value reported by getsockopt, but OTOH users may get confused about seeing a value larger than TLS_MAX_PAYLOAD_SIZE.
Makes sense to keep the behaviour the same as getsockopt() right? So add the +1 changes here based on version (same as getsockopt()). In which case, it should never exceed TLS_MAX_PAYLOAD_SIZE. Regards, Wilfred