* [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS
@ 2026-07-13 8:04 David 'equinox' Lamparter
2026-07-13 13:24 ` kernel test robot
2026-07-13 14:17 ` kernel test robot
0 siblings, 2 replies; 4+ messages in thread
From: David 'equinox' Lamparter @ 2026-07-13 8:04 UTC (permalink / raw)
To: Matthieu Baerts, Mat Martineau, Geliang Tang
Cc: netdev, mptcp, David 'equinox' Lamparter
The IPV6_TCLASS setsockopt just needs to be forwarded to the individual
TCP sockets, like IP_TOS is already handled for IPv4. The code here is
pretty much identical, except there's no helper for IPv6 like IPv4's
__ip_sock_set_tos().
Coincidentally, ssh uses this sockopt and prints an error in the middle
of your ongoing SSH session when it doesn't work (very annoying when
doing SCP/SFTP on a multiplexed session.)
Signed-off-by: David 'equinox' Lamparter <equinox@diac24.net>
Cc: Matthieu Baerts <matttbe@kernel.org>
Cc: Mat Martineau <martineau@kernel.org>
Cc: Geliang Tang <geliang@kernel.org>
---
note: I wasn't entirely sure what tree this should be on top of, with the
mptcp trees on github & kernel.org; this is on top of net-next. It
shouldn't really matter though.
---
net/mptcp/sockopt.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/net/mptcp/sockopt.c b/net/mptcp/sockopt.c
index fcf6feb2a9eb..edddafebb8de 100644
--- a/net/mptcp/sockopt.c
+++ b/net/mptcp/sockopt.c
@@ -394,6 +394,35 @@ static int mptcp_setsockopt_sol_socket(struct mptcp_sock *msk, int optname,
return -EOPNOTSUPP;
}
+static int mptcp_setsockopt_v6_set_tclass(struct mptcp_sock *msk, int optname,
+ sockptr_t optval, unsigned int optlen)
+{
+ struct mptcp_subflow_context *subflow;
+ struct sock *sk = (struct sock *)msk;
+ int err, val;
+
+ err = ipv6_setsockopt(sk, SOL_IPV6, optname, optval, optlen);
+
+ if (err != 0)
+ return err;
+
+ lock_sock(sk);
+ sockopt_seq_inc(msk);
+ val = READ_ONCE(inet6_sk(sk)->tclass);
+ mptcp_for_each_subflow(msk, subflow) {
+ struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
+ bool slow;
+
+ slow = lock_sock_fast(ssk);
+ inet6_sk(ssk)->tclass = val;
+ sk_dst_reset(ssk);
+ unlock_sock_fast(ssk, slow);
+ }
+ release_sock(sk);
+
+ return 0;
+}
+
static int mptcp_setsockopt_v6(struct mptcp_sock *msk, int optname,
sockptr_t optval, unsigned int optlen)
{
@@ -436,6 +465,8 @@ static int mptcp_setsockopt_v6(struct mptcp_sock *msk, int optname,
release_sock(sk);
break;
+ case IPV6_TCLASS:
+ return mptcp_setsockopt_v6_set_tclass(msk, optname, optval, optlen);
}
return ret;
@@ -1485,6 +1516,9 @@ static int mptcp_getsockopt_v6(struct mptcp_sock *msk, int optname,
struct sock *sk = (void *)msk;
switch (optname) {
+ case IPV6_TCLASS:
+ return mptcp_put_int_option(msk, optval, optlen,
+ READ_ONCE(inet6_sk(sk)->tclass));
case IPV6_V6ONLY:
return mptcp_put_int_option(msk, optval, optlen,
sk->sk_ipv6only);
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS
2026-07-13 8:04 [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS David 'equinox' Lamparter
@ 2026-07-13 13:24 ` kernel test robot
2026-07-13 13:49 ` David 'equinox' Lamparter
2026-07-13 14:17 ` kernel test robot
1 sibling, 1 reply; 4+ messages in thread
From: kernel test robot @ 2026-07-13 13:24 UTC (permalink / raw)
To: David 'equinox' Lamparter, Matthieu Baerts, Mat Martineau,
Geliang Tang
Cc: oe-kbuild-all, netdev, mptcp, David 'equinox' Lamparter
Hi David,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/David-equinox-Lamparter/mptcp-sockopt-implement-IPV6_TCLASS/20260713-162825
base: net-next/main
patch link: https://lore.kernel.org/r/20260713080634.296011-1-equinox%40diac24.net
patch subject: [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS
config: sparc-randconfig-001 (https://download.01.org/0day-ci/archive/20260713/202607132109.n8GCw6cD-lkp@intel.com/config)
compiler: sparc-linux-gcc (GCC) 16.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260713/202607132109.n8GCw6cD-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607132109.n8GCw6cD-lkp@intel.com/
All errors (new ones prefixed by >>):
sparc-linux-ld: net/mptcp/sockopt.o: in function `mptcp_setsockopt_v6':
>> sockopt.c:(.text+0x908): undefined reference to `ipv6_setsockopt'
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS
2026-07-13 8:04 [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS David 'equinox' Lamparter
2026-07-13 13:24 ` kernel test robot
@ 2026-07-13 14:17 ` kernel test robot
1 sibling, 0 replies; 4+ messages in thread
From: kernel test robot @ 2026-07-13 14:17 UTC (permalink / raw)
To: David 'equinox' Lamparter, Matthieu Baerts, Mat Martineau,
Geliang Tang
Cc: llvm, oe-kbuild-all, netdev, mptcp,
David 'equinox' Lamparter
Hi David,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/David-equinox-Lamparter/mptcp-sockopt-implement-IPV6_TCLASS/20260713-162825
base: net-next/main
patch link: https://lore.kernel.org/r/20260713080634.296011-1-equinox%40diac24.net
patch subject: [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260713/202607131605.i02odG4b-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260713/202607131605.i02odG4b-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202607131605.i02odG4b-lkp@intel.com/
All errors (new ones prefixed by >>):
>> ld.lld: error: undefined symbol: ipv6_setsockopt
>>> referenced by sockopt.c:404 (net/mptcp/sockopt.c:404)
>>> vmlinux.o:(mptcp_setsockopt)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-13 14:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-13 8:04 [PATCH net-next] mptcp: sockopt: implement IPV6_TCLASS David 'equinox' Lamparter
2026-07-13 13:24 ` kernel test robot
2026-07-13 13:49 ` David 'equinox' Lamparter
2026-07-13 14:17 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox