Skip to content

Commit dcebeb8

Browse files
committed
Merge branch 'mptcp-fixes'
Mat Martineau says: ==================== mptcp: A few fixes This set has three separate changes for the net-next tree: Patch 1 guarantees safe handling and a warning if a NULL value is encountered when gathering subflow data for the MPTCP_SUBFLOW_ADDRS socket option. Patch 2 increases the default number of subflows allowed per MPTCP connection. Patch 3 makes an existing function 'static'. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 295711f + 3828c51 commit dcebeb8

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

net/mptcp/pm_netlink.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -654,9 +654,9 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk)
654654
}
655655
}
656656

657-
int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
658-
struct mptcp_addr_info *addr,
659-
u8 bkup)
657+
static int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
658+
struct mptcp_addr_info *addr,
659+
u8 bkup)
660660
{
661661
struct mptcp_subflow_context *subflow;
662662

@@ -2052,6 +2052,9 @@ static int __net_init pm_nl_init_net(struct net *net)
20522052
struct pm_nl_pernet *pernet = net_generic(net, pm_nl_pernet_id);
20532053

20542054
INIT_LIST_HEAD_RCU(&pernet->local_addr_list);
2055+
2056+
/* Cit. 2 subflows ought to be enough for anybody. */
2057+
pernet->subflows_max = 2;
20552058
pernet->next_id = 1;
20562059
pernet->stale_loss_cnt = 4;
20572060
spin_lock_init(&pernet->lock);

net/mptcp/protocol.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,6 @@ void mptcp_pm_nl_addr_send_ack(struct mptcp_sock *msk);
736736
void mptcp_pm_rm_addr_received(struct mptcp_sock *msk,
737737
const struct mptcp_rm_list *rm_list);
738738
void mptcp_pm_mp_prio_received(struct sock *sk, u8 bkup);
739-
int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk,
740-
struct mptcp_addr_info *addr,
741-
u8 bkup);
742739
void mptcp_pm_mp_fail_received(struct sock *sk, u64 fail_seq);
743740
void mptcp_pm_free_anno_list(struct mptcp_sock *msk);
744741
bool mptcp_pm_sport_in_anno_list(struct mptcp_sock *msk, const struct sock *sk);

net/mptcp/sockopt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,6 +861,9 @@ static void mptcp_get_sub_addrs(const struct sock *sk, struct mptcp_subflow_addr
861861
} else if (sk->sk_family == AF_INET6) {
862862
const struct ipv6_pinfo *np = inet6_sk(sk);
863863

864+
if (WARN_ON_ONCE(!np))
865+
return;
866+
864867
a->sin6_local.sin6_family = AF_INET6;
865868
a->sin6_local.sin6_port = inet->inet_sport;
866869

tools/testing/selftests/net/mptcp/mptcp_join.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,12 +945,15 @@ subflows_tests()
945945

946946
# subflow limited by client
947947
reset
948+
ip netns exec $ns1 ./pm_nl_ctl limits 0 0
949+
ip netns exec $ns2 ./pm_nl_ctl limits 0 0
948950
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
949951
run_tests $ns1 $ns2 10.0.1.1
950952
chk_join_nr "single subflow, limited by client" 0 0 0
951953

952954
# subflow limited by server
953955
reset
956+
ip netns exec $ns1 ./pm_nl_ctl limits 0 0
954957
ip netns exec $ns2 ./pm_nl_ctl limits 0 1
955958
ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
956959
run_tests $ns1 $ns2 10.0.1.1
@@ -973,7 +976,7 @@ subflows_tests()
973976
run_tests $ns1 $ns2 10.0.1.1
974977
chk_join_nr "multiple subflows" 2 2 2
975978

976-
# multiple subflows limited by serverf
979+
# multiple subflows limited by server
977980
reset
978981
ip netns exec $ns1 ./pm_nl_ctl limits 0 1
979982
ip netns exec $ns2 ./pm_nl_ctl limits 0 2

tools/testing/selftests/net/mptcp/pm_netlink.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ check()
7070

7171
check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "defaults addr list"
7272
check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
73-
subflows 0" "defaults limits"
73+
subflows 2" "defaults limits"
7474

7575
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.1
7676
ip netns exec $ns1 ./pm_nl_ctl add 10.0.1.2 flags subflow dev lo
@@ -118,11 +118,11 @@ check "ip netns exec $ns1 ./pm_nl_ctl dump" "" "flush addrs"
118118

119119
ip netns exec $ns1 ./pm_nl_ctl limits 9 1
120120
check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
121-
subflows 0" "rcv addrs above hard limit"
121+
subflows 2" "rcv addrs above hard limit"
122122

123123
ip netns exec $ns1 ./pm_nl_ctl limits 1 9
124124
check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 0
125-
subflows 0" "subflows above hard limit"
125+
subflows 2" "subflows above hard limit"
126126

127127
ip netns exec $ns1 ./pm_nl_ctl limits 8 8
128128
check "ip netns exec $ns1 ./pm_nl_ctl limits" "accept 8

0 commit comments

Comments
 (0)