--- zzzz-none-000/linux-4.19.183/net/ipv4/ip_sockglue.c 2021-03-24 10:07:39.000000000 +0000 +++ bcm63-7530ax-756/linux-4.19.183/net/ipv4/ip_sockglue.c 2023-06-28 08:54:21.000000000 +0000 @@ -44,6 +44,10 @@ #endif #include +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) +#include + +#endif #include #include @@ -655,7 +659,11 @@ break; old = rcu_dereference_protected(inet->inet_opt, lockdep_sock_is_held(sk)); +#if !defined(CONFIG_BCM_KF_MPTCP) || !defined(CONFIG_BCM_MPTCP) if (inet->is_icsk) { +#else + if (inet->is_icsk && !is_meta_sk(sk)) { +#endif struct inet_connection_sock *icsk = inet_csk(sk); #if IS_ENABLED(CONFIG_IPV6) if (sk->sk_family == PF_INET || @@ -749,6 +757,22 @@ inet->tos = val; sk->sk_priority = rt_tos2priority(val); sk_dst_reset(sk); +#if defined(CONFIG_BCM_KF_MPTCP) && defined(CONFIG_BCM_MPTCP) + /* Update TOS on mptcp subflow */ + if (is_meta_sk(sk)) { + struct mptcp_tcp_sock *mptcp; + + mptcp_for_each_sub(tcp_sk(sk)->mpcb, mptcp) { + struct sock *sk_it = mptcp_to_sock(mptcp); + + if (inet_sk(sk_it)->tos != inet_sk(sk)->tos) { + inet_sk(sk_it)->tos = inet_sk(sk)->tos; + sk_it->sk_priority = sk->sk_priority; + sk_dst_reset(sk_it); + } + } + } +#endif } break; case IP_TTL: