Merge branch 'mptcp-fixes'
Mat Martineau says: ==================== MPTCP fixes Here are a few fixes for the -net tree. Patch 1 fixes an attempt to access a tcp-specific field that does not exist in mptcp sockets. Patches 2 and 3 remove warning/error log output that could be flooded. Patch 4 performs more validation on address advertisement echo packets to improve RFC 8684 compliance. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
6dfa87b492
@ -130,7 +130,6 @@ static void mptcp_parse_option(const struct sk_buff *skb,
|
||||
memcpy(mp_opt->hmac, ptr, MPTCPOPT_HMAC_LEN);
|
||||
pr_debug("MP_JOIN hmac");
|
||||
} else {
|
||||
pr_warn("MP_JOIN bad option size");
|
||||
mp_opt->mp_join = 0;
|
||||
}
|
||||
break;
|
||||
@ -1024,7 +1023,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)
|
||||
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ADDADDR);
|
||||
} else {
|
||||
mptcp_pm_add_addr_echoed(msk, &mp_opt.addr);
|
||||
mptcp_pm_del_add_timer(msk, &mp_opt.addr);
|
||||
mptcp_pm_del_add_timer(msk, &mp_opt.addr, true);
|
||||
MPTCP_INC_STATS(sock_net(sk), MPTCP_MIB_ECHOADD);
|
||||
}
|
||||
|
||||
|
@ -346,18 +346,18 @@ out:
|
||||
|
||||
struct mptcp_pm_add_entry *
|
||||
mptcp_pm_del_add_timer(struct mptcp_sock *msk,
|
||||
struct mptcp_addr_info *addr)
|
||||
struct mptcp_addr_info *addr, bool check_id)
|
||||
{
|
||||
struct mptcp_pm_add_entry *entry;
|
||||
struct sock *sk = (struct sock *)msk;
|
||||
|
||||
spin_lock_bh(&msk->pm.lock);
|
||||
entry = mptcp_lookup_anno_list_by_saddr(msk, addr);
|
||||
if (entry)
|
||||
if (entry && (!check_id || entry->addr.id == addr->id))
|
||||
entry->retrans_times = ADD_ADDR_RETRANS_MAX;
|
||||
spin_unlock_bh(&msk->pm.lock);
|
||||
|
||||
if (entry)
|
||||
if (entry && (!check_id || entry->addr.id == addr->id))
|
||||
sk_stop_timer_sync(sk, &entry->add_timer);
|
||||
|
||||
return entry;
|
||||
@ -1064,7 +1064,7 @@ static bool remove_anno_list_by_saddr(struct mptcp_sock *msk,
|
||||
{
|
||||
struct mptcp_pm_add_entry *entry;
|
||||
|
||||
entry = mptcp_pm_del_add_timer(msk, addr);
|
||||
entry = mptcp_pm_del_add_timer(msk, addr, false);
|
||||
if (entry) {
|
||||
list_del(&entry->list);
|
||||
kfree(entry);
|
||||
|
@ -2424,13 +2424,12 @@ static int __mptcp_init_sock(struct sock *sk)
|
||||
timer_setup(&msk->sk.icsk_retransmit_timer, mptcp_retransmit_timer, 0);
|
||||
timer_setup(&sk->sk_timer, mptcp_timeout_timer, 0);
|
||||
|
||||
tcp_assign_congestion_control(sk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mptcp_init_sock(struct sock *sk)
|
||||
{
|
||||
struct inet_connection_sock *icsk = inet_csk(sk);
|
||||
struct net *net = sock_net(sk);
|
||||
int ret;
|
||||
|
||||
@ -2448,6 +2447,16 @@ static int mptcp_init_sock(struct sock *sk)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* fetch the ca name; do it outside __mptcp_init_sock(), so that clone will
|
||||
* propagate the correct value
|
||||
*/
|
||||
tcp_assign_congestion_control(sk);
|
||||
strcpy(mptcp_sk(sk)->ca_name, icsk->icsk_ca_ops->name);
|
||||
|
||||
/* no need to keep a reference to the ops, the name will suffice */
|
||||
tcp_cleanup_congestion_control(sk);
|
||||
icsk->icsk_ca_ops = NULL;
|
||||
|
||||
sk_sockets_allocated_inc(sk);
|
||||
sk->sk_rcvbuf = sock_net(sk)->ipv4.sysctl_tcp_rmem[1];
|
||||
sk->sk_sndbuf = sock_net(sk)->ipv4.sysctl_tcp_wmem[1];
|
||||
@ -2622,7 +2631,6 @@ static void __mptcp_destroy_sock(struct sock *sk)
|
||||
sk_stream_kill_queues(sk);
|
||||
xfrm_sk_free_policy(sk);
|
||||
|
||||
tcp_cleanup_congestion_control(sk);
|
||||
sk_refcnt_debug_release(sk);
|
||||
mptcp_dispose_initial_subflow(msk);
|
||||
sock_put(sk);
|
||||
|
@ -258,6 +258,7 @@ struct mptcp_sock {
|
||||
} rcvq_space;
|
||||
|
||||
u32 setsockopt_seq;
|
||||
char ca_name[TCP_CA_NAME_MAX];
|
||||
};
|
||||
|
||||
#define mptcp_lock_sock(___sk, cb) do { \
|
||||
@ -671,7 +672,7 @@ void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
|
||||
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);
|
||||
struct mptcp_pm_add_entry *
|
||||
mptcp_pm_del_add_timer(struct mptcp_sock *msk,
|
||||
struct mptcp_addr_info *addr);
|
||||
struct mptcp_addr_info *addr, bool check_id);
|
||||
struct mptcp_pm_add_entry *
|
||||
mptcp_lookup_anno_list_by_saddr(struct mptcp_sock *msk,
|
||||
struct mptcp_addr_info *addr);
|
||||
|
@ -547,7 +547,7 @@ static int mptcp_setsockopt_sol_tcp_congestion(struct mptcp_sock *msk, sockptr_t
|
||||
}
|
||||
|
||||
if (ret == 0)
|
||||
tcp_set_congestion_control(sk, name, false, cap_net_admin);
|
||||
strcpy(msk->ca_name, name);
|
||||
|
||||
release_sock(sk);
|
||||
return ret;
|
||||
@ -705,7 +705,7 @@ static void sync_socket_options(struct mptcp_sock *msk, struct sock *ssk)
|
||||
sock_valbool_flag(ssk, SOCK_DBG, sock_flag(sk, SOCK_DBG));
|
||||
|
||||
if (inet_csk(sk)->icsk_ca_ops != inet_csk(ssk)->icsk_ca_ops)
|
||||
tcp_set_congestion_control(ssk, inet_csk(sk)->icsk_ca_ops->name, false, true);
|
||||
tcp_set_congestion_control(ssk, msk->ca_name, false, true);
|
||||
}
|
||||
|
||||
static void __mptcp_sockopt_sync(struct mptcp_sock *msk, struct sock *ssk)
|
||||
|
@ -867,7 +867,6 @@ static enum mapping_status get_mapping_status(struct sock *ssk,
|
||||
|
||||
data_len = mpext->data_len;
|
||||
if (data_len == 0) {
|
||||
pr_err("Infinite mapping not handled");
|
||||
MPTCP_INC_STATS(sock_net(ssk), MPTCP_MIB_INFINITEMAPRX);
|
||||
return MAPPING_INVALID;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user