2025-10-21, 19:29:17 +1000, Wilfred Mallawa wrote:
diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c index 39a2ab47fe72..b234d44bd789 100644 --- a/net/tls/tls_main.c +++ b/net/tls/tls_main.c @@ -541,6 +541,32 @@ static int do_tls_getsockopt_no_pad(struct sock *sk, char __user *optval, return 0; } +static int do_tls_getsockopt_tx_payload_len(struct sock *sk, char __user *optval,
int __user *optlen)
+{
- struct tls_context *ctx = tls_get_ctx(sk);
- u16 payload_len = ctx->tx_max_payload_len;
- int len;
- if (get_user(len, optlen))
return -EFAULT;
- /* For TLS 1.3 payload length includes ContentType */
- if (ctx->prot_info.version == TLS_1_3_VERSION)
payload_len++;
I'm not sure why you introduced this compared to v6?
The ContentType isn't really payload (stuff passed to send() by userspace), so I think the setsockopt behavior (ignoring the extra 1B) makes more sense.
Either way, we should really avoid this asymmetry between getsockopt and setsockopt. Whatever value is fed through setsockopt should be what we get back with getsockopt. Otherwise, the API gets quite confusing for users.
The rest of the patch looks ok.