[PATCH v2 0/2] Interim Path Manager
by Peter Krystad
Patchset includes the interim path manager plus sysctl setting of
the announce address and binding local address when creating subflows.
I also split the path manager into a seperate file.
v2:
rename to 'basic' path manager
remove pm_init definition
Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Implement basic path manager
net/mptcp/Makefile | 2 +-
net/mptcp/basic.c | 247 +++++++++++++++++++++++++++++++++++++++++++
net/mptcp/pm.c | 38 +++++--
net/mptcp/protocol.c | 2 +-
net/mptcp/protocol.h | 14 ++-
5 files changed, 290 insertions(+), 13 deletions(-)
create mode 100644 net/mptcp/basic.c
--
2.17.2
2 years, 10 months
Patent-question
by Christoph Paasch
Hello,
regarding the patent-question. From https://lwn.net/Articles/783673/, I see:
"
It looks like a fairly typical battle between a protocol pushed by the
largest Internet service providers, and one with a rather more grass-roots
origin. There is, however, another important thing to know about L4S:
Alcatel-Lucent claims a patent on the dual-queue algorithm. The company has
generously offered to make that patent available under "fair, reasonable,
and non-discriminatory" terms; such terms are, of course, highly
discriminatory against free software implementations. They make it
impossible to merge the affected code into a GPL-licensed kernel.
"
Is that true?
Christoph
2 years, 10 months
[PATCH] mptcp: allow dumping subflow context to userspace
by Davide Caratti
add ulp-specific diagnostic functions, so that subflow information can be
dumped to userspace programs like 'ss'.
Signed-off-by: Davide Caratti <dcaratti(a)redhat.com>
---
Notes:
changes since RFC:
- dump all subflow-related infos except keys
include/uapi/linux/inet_diag.h | 1 +
include/uapi/linux/mptcp.h | 34 ++++++++++++
net/mptcp/Makefile | 2 +-
net/mptcp/diag.c | 95 ++++++++++++++++++++++++++++++++++
net/mptcp/protocol.h | 3 ++
net/mptcp/subflow.c | 2 +
6 files changed, 136 insertions(+), 1 deletion(-)
create mode 100644 include/uapi/linux/mptcp.h
create mode 100644 net/mptcp/diag.c
diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h
index a1ff345b3f33..13d16b887512 100644
--- a/include/uapi/linux/inet_diag.h
+++ b/include/uapi/linux/inet_diag.h
@@ -163,6 +163,7 @@ enum {
INET_ULP_INFO_UNSPEC,
INET_ULP_INFO_NAME,
INET_ULP_INFO_TLS,
+ INET_ULP_INFO_MPTCP,
__INET_ULP_INFO_MAX,
};
#define INET_ULP_INFO_MAX (__INET_ULP_INFO_MAX - 1)
diff --git a/include/uapi/linux/mptcp.h b/include/uapi/linux/mptcp.h
new file mode 100644
index 000000000000..2856b89cc36e
--- /dev/null
+++ b/include/uapi/linux/mptcp.h
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
+#ifndef _UAPI_MPTCP_H
+#define _UAPI_MPTCP_H
+
+#include <linux/types.h>
+
+#define SUBFLOW_FLAGS_MCAP_REM BIT(0)
+#define SUBFLOW_FLAGS_MCAP_LOC BIT(1)
+#define SUBFLOW_FLAGS_JOIN_REM BIT(2)
+#define SUBFLOW_FLAGS_JOIN_LOC BIT(3)
+#define SUBFLOW_FLAGS_BKUP_REM BIT(4)
+#define SUBFLOW_FLAGS_BKUP_LOC BIT(5)
+#define SUBFLOW_FLAGS_4THACK BIT(6)
+#define SUBFLOW_FLAGS_CONNECTED BIT(7)
+#define SUBFLOW_FLAGS_MAPVALID BIT(8)
+
+enum {
+ MPTCP_SUBFLOW_UNSPEC,
+ MPTCP_SUBFLOW_TOKEN_REM,
+ MPTCP_SUBFLOW_TOKEN_LOC,
+ MPTCP_SUBFLOW_RELWRITE_SEQ,
+ MPTCP_SUBFLOW_MAP_SEQ,
+ MPTCP_SUBFLOW_MAP_SFSEQ,
+ MPTCP_SUBFLOW_SSN_OFFSET,
+ MPTCP_SUBFLOW_MAP_DATALEN,
+ MPTCP_SUBFLOW_FLAGS,
+ MPTCP_SUBFLOW_ID_REM,
+ MPTCP_SUBFLOW_ID_LOC,
+ MPTCP_SUBFLOW_PAD,
+ __MPTCP_SUBFLOW_MAX
+};
+
+#define MPTCP_SUBFLOW_MAX (__MPTCP_SUBFLOW_MAX - 1)
+#endif /* _UAPI_MPTCP_H */
diff --git a/net/mptcp/Makefile b/net/mptcp/Makefile
index 289fdf4339c1..6b556e2995ec 100644
--- a/net/mptcp/Makefile
+++ b/net/mptcp/Makefile
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_MPTCP) += mptcp.o
-mptcp-y := protocol.o subflow.o options.o token.o crypto.o pm.o ctrl.o
+mptcp-y := protocol.o subflow.o options.o token.o crypto.o pm.o ctrl.o diag.o
diff --git a/net/mptcp/diag.c b/net/mptcp/diag.c
new file mode 100644
index 000000000000..a42c96619faa
--- /dev/null
+++ b/net/mptcp/diag.c
@@ -0,0 +1,95 @@
+// SPDX-License-Identifier: GPL-2.0
+/* MPTCP socket monitoring support
+ *
+ * Copyright (c) 2019 Red Hat
+ *
+ * Author: Davide Caratti <dcaratti(a)redhat.com>
+ */
+
+#include <linux/kernel.h>
+#include <linux/net.h>
+#include <linux/inet_diag.h>
+#include <net/netlink.h>
+#include <uapi/linux/mptcp.h>
+#include "protocol.h"
+
+int subflow_get_info(const struct sock *sk, struct sk_buff *skb)
+{
+ struct subflow_context *sf;
+ struct nlattr *start;
+ u32 flags = 0;
+ int err;
+
+ start = nla_nest_start_noflag(skb, INET_ULP_INFO_MPTCP);
+ if (!start)
+ return -EMSGSIZE;
+
+ rcu_read_lock();
+ sf = rcu_dereference(inet_csk(sk)->icsk_ulp_data);
+ if (!sf) {
+ err = 0;
+ goto nla_failure;
+ }
+
+ if (sf->mp_capable)
+ flags |= SUBFLOW_FLAGS_MCAP_REM;
+ if (sf->request_mptcp)
+ flags |= SUBFLOW_FLAGS_MCAP_LOC;
+ if (sf->mp_join)
+ flags |= SUBFLOW_FLAGS_JOIN_REM;
+ if (sf->request_join)
+ flags |= SUBFLOW_FLAGS_JOIN_LOC;
+ if (sf->backup)
+ flags |= SUBFLOW_FLAGS_BKUP_REM;
+ if (sf->request_bkup)
+ flags |= SUBFLOW_FLAGS_BKUP_LOC;
+ if (sf->fourth_ack)
+ flags |= SUBFLOW_FLAGS_4THACK;
+ if (sf->conn_finished)
+ flags |= SUBFLOW_FLAGS_CONNECTED;
+ if (sf->map_valid)
+ flags |= SUBFLOW_FLAGS_MAPVALID;
+
+ if (nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_REM, sf->remote_token) ||
+ nla_put_u32(skb, MPTCP_SUBFLOW_TOKEN_LOC, sf->token) ||
+ nla_put_u32(skb, MPTCP_SUBFLOW_RELWRITE_SEQ, sf->rel_write_seq) ||
+ nla_put_u64_64bit(skb, MPTCP_SUBFLOW_MAP_SEQ, sf->map_seq,
+ MPTCP_SUBFLOW_PAD) ||
+ nla_put_u32(skb, MPTCP_SUBFLOW_MAP_SFSEQ, sf->map_subflow_seq) ||
+ nla_put_u32(skb, MPTCP_SUBFLOW_SSN_OFFSET, sf->ssn_offset) ||
+ nla_put_u16(skb, MPTCP_SUBFLOW_MAP_DATALEN, sf->map_data_len) ||
+ nla_put_u32(skb, MPTCP_SUBFLOW_FLAGS, flags) ||
+ nla_put_u8(skb, MPTCP_SUBFLOW_ID_REM, sf->remote_id) ||
+ nla_put_u8(skb, MPTCP_SUBFLOW_ID_LOC, sf->local_id)) {
+ err = -EMSGSIZE;
+ goto nla_failure;
+ }
+
+ rcu_read_unlock();
+ nla_nest_end(skb, start);
+ return 0;
+
+nla_failure:
+ rcu_read_unlock();
+ nla_nest_cancel(skb, start);
+ return err;
+}
+
+size_t subflow_get_info_size(const struct sock *sk)
+{
+ size_t size = 0;
+
+ size += nla_total_size(0) + /* INET_ULP_INFO_MPTCP */
+ nla_total_size(4) + /* MPTCP_SUBFLOW_TOKEN_REM */
+ nla_total_size(4) + /* MPTCP_SUBFLOW_TOKEN_LOC */
+ nla_total_size(4) + /* MPTCP_SUBFLOW_RELWRITE_SEQ */
+ nla_total_size_64bit(8) + /* MPTCP_SUBFLOW_MAP_SEQ */
+ nla_total_size(4) + /* MPTCP_SUBFLOW_MAP_SFSEQ */
+ nla_total_size(2) + /* MPTCP_SUBFLOW_SSN_OFFSET */
+ nla_total_size(2) + /* MPTCP_SUBFLOW_MAP_DATALEN */
+ nla_total_size(4) + /* MPTCP_SUBFLOW_FLAGS */
+ nla_total_size(1) + /* MPTCP_SUBFLOW_ID_REM */
+ nla_total_size(1) + /* MPTCP_SUBFLOW_ID_LOC */
+ 0;
+ return size;
+}
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index f3f293c82058..f38639cc35b4 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -314,4 +314,7 @@ static inline bool before64(__u64 seq1, __u64 seq2)
#define after64(seq2, seq1) before64(seq1, seq2)
+size_t subflow_get_info_size(const struct sock *sk);
+int subflow_get_info(const struct sock *sk, struct sk_buff *skb);
+
#endif /* __MPTCP_PROTOCOL_H */
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 80d297ce11d2..9c860fcc4232 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -495,6 +495,8 @@ static struct tcp_ulp_ops subflow_ulp_ops __read_mostly = {
.init = subflow_ulp_init,
.release = subflow_ulp_release,
.clone = subflow_ulp_clone,
+ .get_info = subflow_get_info,
+ .get_info_size = subflow_get_info_size,
};
static int subflow_ops_init(struct request_sock_ops *subflow_ops)
--
2.21.0
2 years, 10 months
[PATCH v2] mptcp: allow MPTCP sockets by default
by Matthieu Baerts
At LPC2019, the feedback was that it should be easy to create MPTCP
sockets to have testers. But still important to have ways to disable the
creation of new MPTCP sockets. It can be easily done via this new
sysctl, CGroups or SELinux. Netfilter can also be used to close existing
MPTCP connections if needed.
Signed-off-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>
---
Notes:
To be squashed in "mptcp: new sysctl to control the activation per NS"
v2:
- fix typo spotted by Mat ("static int" instead of "static void")
.topmsg | 7 +++----
net/mptcp/ctrl.c | 7 +++++++
tools/testing/selftests/net/mptcp/mptcp_connect.sh | 14 ++++++++++----
3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/.topmsg b/.topmsg
index 7ff9f3c96ff3..373f94c4b4bd 100644
--- a/.topmsg
+++ b/.topmsg
@@ -5,10 +5,9 @@ New MPTCP sockets will return -ENOPROTOOPT if MPTCP support is disabled
for the current net namespace.
For security reasons, it is interesting to have a global switch for
-MPTCP. To start, MPTCP will be disabled by default and only privileged
-users will be able to modify this. The reason is that because MPTCP is
-new, it will not be tested and reviewed by many and security issues can
-then take time to be discovered and fixed.
+MPTCP. The reason is that because MPTCP is new, it will not be tested
+and reviewed by many and security issues can then take time to be
+discovered and fixed.
The value of this new sysctl can be different per namespace. We can then
restrict the usage of MPTCP to the selected NS. In case of serious
diff --git a/net/mptcp/ctrl.c b/net/mptcp/ctrl.c
index 8d9f15f02369..33de3ced2ba7 100644
--- a/net/mptcp/ctrl.c
+++ b/net/mptcp/ctrl.c
@@ -43,6 +43,11 @@ static struct ctl_table mptcp_sysctl_table[] = {
{}
};
+static void mptcp_pernet_set_defaults(struct mptcp_pernet *pernet)
+{
+ pernet->mptcp_enabled = 1;
+}
+
static int mptcp_pernet_new_table(struct net *net, struct mptcp_pernet *pernet)
{
struct ctl_table_header *hdr;
@@ -85,6 +90,8 @@ static int __net_init mptcp_net_init(struct net *net)
{
struct mptcp_pernet *pernet = mptcp_get_pernet(net);
+ mptcp_pernet_set_defaults(pernet);
+
return mptcp_pernet_new_table(net, pernet);
}
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index d029bdc5946d..7d312bd9ac77 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -45,7 +45,6 @@ trap cleanup EXIT
for i in 1 2 3 4;do
ip netns add ns$i || exit $ksft_skip
ip -net ns$i link set lo up
- ip netns exec ns$i sysctl -q net.mptcp.enabled=1
done
# ns1 ns2 ns3 ns4
@@ -111,7 +110,14 @@ check_mptcp_disabled()
{
disabled_ns="ns_disabled"
ip netns add ${disabled_ns} || exit $ksft_skip
- # by default: sysctl net.mptcp.enabled=0
+
+ # net.mptcp.enabled should be enabled by default
+ if [ "$(ip netns exec ${disabled_ns} sysctl net.mptcp.enabled | awk '{ print $3 }')" -ne 1 ]; then
+ echo -e "net.mptcp.enabled sysctl is not 1 by default\t[ FAIL ]"
+ ret=1
+ return 1
+ fi
+ ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0
local err=0
LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -t $timeout -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \
@@ -119,12 +125,12 @@ check_mptcp_disabled()
ip netns delete ${disabled_ns}
if [ ${err} -eq 0 ]; then
- echo -e "MPTCP is not disabled by default as expected\t[ FAIL ]"
+ echo -e "New MPTCP socket cannot be blocked via sysctl\t[ FAIL ]"
ret=1
return 1
fi
- echo -e "MPTCP is disabled by default as expected\t[ OK ]"
+ echo -e "New MPTCP socket can be blocked via sysctl\t[ OK ]"
return 0
}
--
2.20.1
2 years, 10 months
[PATCH v2 0/2] mptcp: add MIB counters
by Florian Westphal
As mentioned earlier, here is v2 of the MIB counter patch set.
I've tossed all counters that aren't used (= have no spot that
increments them).
Tests still pass, counters get incremented, you can show them
via 'nstat' or "netststat -s".
2 years, 10 months
[PATCH v2] mptcp: Remove all traces of checksum support
by Peter Krystad
Since checksum support is not planned remove any references
that look it may be supported.
Also re-factor DSS option size calculation and make
DSS option size check for exactly correct lengths.
Signed-off-by: Peter Krystad <peter.krystad(a)linux.intel.com>
---
net/mptcp/options.c | 70 +++++++++++++++++---------------------------
net/mptcp/pm.c | 1 -
net/mptcp/protocol.c | 13 ++++----
net/mptcp/protocol.h | 4 +--
net/mptcp/subflow.c | 5 ----
5 files changed, 33 insertions(+), 60 deletions(-)
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index 42f8b9beaa41..2ee07f0c01d2 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -130,7 +130,6 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
*/
case MPTCPOPT_DSS:
pr_debug("DSS");
- mp_opt->dss = 1;
ptr++;
mp_opt->dss_flags = (*ptr++) & MPTCP_DSS_FLAG_MASK;
@@ -152,10 +151,27 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
expected_opsize += TCPOLEN_MPTCP_DSS_ACK64;
else
expected_opsize += TCPOLEN_MPTCP_DSS_ACK32;
+ }
+
+ if (mp_opt->use_map) {
+ if (mp_opt->dsn64)
+ expected_opsize += TCPOLEN_MPTCP_DSS_MAP64;
+ else
+ expected_opsize += TCPOLEN_MPTCP_DSS_MAP32;
+ }
- if (opsize < expected_opsize)
- break;
+ /* RFC 6824, Section 3.3:
+ * If a checksum is present, but its use had
+ * not been negotiated in the MP_CAPABLE handshake,
+ * the checksum field MUST be ignored.
+ */
+ if (opsize != expected_opsize &&
+ opsize != expected_opsize + TCPOLEN_MPTCP_DSS_CHECKSUM)
+ break;
+ mp_opt->dss = 1;
+
+ if (mp_opt->use_ack) {
if (mp_opt->ack64) {
mp_opt->data_ack = get_unaligned_be64(ptr);
ptr += 8;
@@ -163,19 +179,10 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
mp_opt->data_ack = get_unaligned_be32(ptr);
ptr += 4;
}
-
pr_debug("data_ack=%llu", mp_opt->data_ack);
}
if (mp_opt->use_map) {
- if (mp_opt->dsn64)
- expected_opsize += TCPOLEN_MPTCP_DSS_MAP64;
- else
- expected_opsize += TCPOLEN_MPTCP_DSS_MAP32;
-
- if (opsize < expected_opsize)
- break;
-
if (mp_opt->dsn64) {
mp_opt->data_seq = get_unaligned_be64(ptr);
ptr += 8;
@@ -190,13 +197,11 @@ void mptcp_parse_option(const unsigned char *ptr, int opsize,
mp_opt->data_len = get_unaligned_be16(ptr);
ptr += 2;
- /* Checksum not currently supported */
- mp_opt->checksum = 0;
-
- pr_debug("data_seq=%llu subflow_seq=%u data_len=%u ck=%u",
+ pr_debug("data_seq=%llu subflow_seq=%u data_len=%u",
mp_opt->data_seq, mp_opt->subflow_seq,
- mp_opt->data_len, mp_opt->checksum);
+ mp_opt->data_len);
}
+
break;
/* MPTCPOPT_ADD_ADDR
@@ -390,12 +395,8 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
if (!skb || (mpext && mpext->use_map)) {
unsigned int map_size;
- bool use_csum;
map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
- use_csum = subflow_ctx(sk)->use_checksum;
- if (use_csum)
- map_size += TCPOLEN_MPTCP_DSS_CHECKSUM;
if (map_size <= remaining) {
remaining -= map_size;
@@ -404,10 +405,8 @@ static bool mptcp_established_options_dss(struct sock *sk, struct sk_buff *skb,
opts->ext_copy.data_seq = mpext->data_seq;
opts->ext_copy.subflow_seq = mpext->subflow_seq;
opts->ext_copy.data_len = mpext->data_len;
- opts->ext_copy.checksum = mpext->checksum;
opts->ext_copy.use_map = 1;
opts->ext_copy.dsn64 = mpext->dsn64;
- opts->ext_copy.use_checksum = use_csum;
}
} else {
opts->ext_copy.use_map = 0;
@@ -614,10 +613,8 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
mpext->data_seq = mp_opt->data_seq;
mpext->subflow_seq = mp_opt->subflow_seq;
mpext->data_len = mp_opt->data_len;
- mpext->checksum = mp_opt->checksum;
mpext->use_map = 1;
mpext->dsn64 = mp_opt->dsn64;
- mpext->use_checksum = mp_opt->use_checksum;
}
mpext->data_fin = mp_opt->data_fin;
@@ -711,12 +708,8 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
}
if (mpext->use_map) {
- pr_debug("Updating DSS length and flags for map");
len += TCPOLEN_MPTCP_DSS_MAP64;
- if (mpext->use_checksum)
- len += TCPOLEN_MPTCP_DSS_CHECKSUM;
-
/* Use only 64-bit mapping flags for now, add
* support for optional 32-bit mappings later.
*/
@@ -725,10 +718,7 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
flags |= MPTCP_DSS_DATA_FIN;
}
- *ptr++ = htonl((TCPOPT_MPTCP << 24) |
- (len << 16) |
- (MPTCPOPT_DSS << 12) |
- (flags));
+ *ptr++ = mptcp_option(MPTCPOPT_DSS, len, 0, flags);
if (mpext->use_ack) {
put_unaligned_be64(mpext->data_ack, ptr);
@@ -736,18 +726,12 @@ void mptcp_write_options(__be32 *ptr, struct mptcp_out_options *opts)
}
if (mpext->use_map) {
- __u16 checksum;
-
- pr_debug("Writing map values");
put_unaligned_be64(mpext->data_seq, ptr);
ptr += 2;
- *ptr++ = htonl(mpext->subflow_seq);
-
- if (mpext->use_checksum)
- checksum = (u16 __force)mpext->checksum;
- else
- checksum = TCPOPT_NOP << 8 | TCPOPT_NOP;
- *ptr = htonl(mpext->data_len << 16 | checksum);
+ put_unaligned_be32(mpext->subflow_seq, ptr);
+ ptr += 1;
+ put_unaligned_be32(mpext->data_len << 16 |
+ TCPOPT_NOP << 8 | TCPOPT_NOP, ptr);
}
}
}
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index b02e3c0253f5..2e0b6650be63 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -74,7 +74,6 @@ int pm_create_subflow(u32 token, u8 remote_id, sa_family_t family,
if (family == AF_INET)
local.sin_addr.s_addr = addr->s_addr;
else
- local.sin_addr.s_addr = INADDR_ANY;
local.sin_addr.s_addr = htonl(INADDR_ANY);
remote.sin_family = msk->pm.remote_family;
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 9291ac84e175..d5daf601a067 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -305,13 +305,12 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
mpext->data_seq = *write_seq;
mpext->subflow_seq = subflow_ctx(ssk)->rel_write_seq;
mpext->data_len = ret;
- mpext->checksum = 0xbeef;
mpext->use_map = 1;
mpext->dsn64 = 1;
- pr_debug("data_seq=%llu subflow_seq=%u data_len=%u checksum=%u, dsn64=%d",
+ pr_debug("data_seq=%llu subflow_seq=%u data_len=%u dsn64=%d",
mpext->data_seq, mpext->subflow_seq, mpext->data_len,
- mpext->checksum, mpext->dsn64);
+ mpext->dsn64);
}
/* TODO: else fallback; allocation can fail, but we can't easily retire
* skbs from the write_queue, as we need to roll-back TCP status
@@ -482,9 +481,8 @@ static enum mapping_status mptcp_get_mapping(struct sock *ssk)
goto del_out;
}
- pr_debug("seq=%llu is64=%d ssn=%u data_len=%u ck=%u",
- mpext->data_seq, mpext->dsn64, mpext->subflow_seq,
- mpext->data_len, mpext->checksum);
+ pr_debug("seq=%llu is64=%d ssn=%u data_len=%u", mpext->data_seq,
+ mpext->dsn64, mpext->subflow_seq, mpext->data_len);
if (mpext->data_len == 0) {
pr_err("Infinite mapping not handled");
@@ -1225,8 +1223,7 @@ static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk)
msk->subflow = ssock;
subflow = subflow_ctx(msk->subflow->sk);
subflow->request_mptcp = 1; /* @@ if MPTCP enabled */
- subflow->request_cksum = 0; /* checksum not supported */
- subflow->request_version = 0; /* only v0 supported */
+ subflow->request_version = 0; /* currently only v0 supported */
sock_hold(ssock->sk);
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index f1f5ab3990ab..400fbb0060f3 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -173,7 +173,7 @@ struct subflow_request_sock {
struct tcp_request_sock sk;
u8 mp_capable : 1,
mp_join : 1,
- checksum : 1,
+ unused : 1,
backup : 1,
version : 4;
u8 local_id;
@@ -208,14 +208,12 @@ struct subflow_context {
u16 map_data_len;
u16 request_mptcp : 1, /* send MP_CAPABLE */
request_join : 1, /* send MP_JOIN */
- request_cksum : 1,
request_bkup : 1,
request_version : 4,
mp_capable : 1, /* remote is MPTCP capable */
mp_join : 1, /* remote is JOINing */
fourth_ack : 1, /* send initial DSS */
conn_finished : 1,
- use_checksum : 1,
map_valid : 1,
backup : 1;
u32 remote_nonce;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index 465c1fcc59ac..0c9b9a77f876 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -117,9 +117,6 @@ static void subflow_v4_init_req(struct request_sock *req,
subflow_req->version = listener->request_version;
else
subflow_req->version = rx_opt.mptcp.version;
- if ((rx_opt.mptcp.flags & MPTCP_CAP_CHECKSUM_REQD) ||
- listener->request_cksum)
- subflow_req->checksum = 1;
subflow_req->remote_key = rx_opt.mptcp.sndr_key;
pr_debug("syn seq=%u", TCP_SKB_CB(skb)->seq);
subflow_req->ssn_offset = TCP_SKB_CB(skb)->seq;
@@ -434,7 +431,6 @@ static int subflow_ulp_init(struct sock *sk)
tp->is_mptcp = 1;
icsk->icsk_af_ops = &subflow_specific;
ctx->tcp_sk_data_ready = sk->sk_data_ready;
- ctx->use_checksum = 0;
sk->sk_data_ready = subflow_data_ready;
out:
return err;
@@ -472,7 +468,6 @@ static void subflow_ulp_clone(const struct request_sock *req,
new_ctx->conn = NULL;
new_ctx->conn_finished = 1;
new_ctx->tcp_sk_data_ready = old_ctx->tcp_sk_data_ready;
- new_ctx->use_checksum = old_ctx->use_checksum;
if (subflow_req->mp_capable) {
new_ctx->mp_capable = 1;
--
2.17.2
2 years, 10 months
[PATCH] mptcp: prefix subflow routines with mptcp_
by Matthieu Baerts
Hello,
As planned, I looked at prefixing with mptcp_ all exposed subflow_xxx()
routines (functions and structures).
I did that directly in the TopGit tree. I just need an approval to push
the changes :)
I made sure each exported commit is compiling as before. I also fix an
additional warning:
- 397f992497aa: 1st patch in "mptcp: Associate MPTCP context with TCP
socket"
- 1ebb17ea7b40: conflict in
t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- ac3944a29ad8: conflict in
t/mptcp-Create-SUBFLOW-socket-for-incoming-connections
- a0f93af7bd70: build-fix, in "mptcp: Associate MPTCP context with TCP
socket"
- 27bbecae8653: conflict in
t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- 37e987cb2dce: conflict in
t/mptcp-Handle-MP_CAPABLE-options-for-outgoing-connections
- 135935f47ebb: build-fix, in "mptcp: add mptcp_poll"
- f9d12ac4153f: conflict in
t/mptcp-Create-SUBFLOW-socket-for-incoming-connections
- d1f30786e37e: build-fix, in "mptcp: Create SUBFLOW socket for incoming
connections" ## also removed unused vars that were already there before
- 771afd683bce: 2nd patch in "mptcp: Create SUBFLOW socket for incoming
connections"
- 1d1fd83c6490: conflict in t/mptcp-Add-key-generation-and-token-tree
- be827265d4c9: build-fix, in "mptcp: Add key generation and token tree"
- e422bac911a7: build-fix, in "mptcp: Add shutdown() socket operation"
- 29eb0d0b4053: build-fix, in "mptcp: Write MPTCP DSS headers to
outgoing data packets"
- ebebd5f0ddb9: conflict in t/mptcp-Implement-MPTCP-receive-path
- 6f97f6fbcca5: build-fix, in "mptcp: Implement MPTCP receive path"
- e6e99ca52ee9: conflict in t/mptcp-Add-path-manager-interface
- 6e6582b8fbd6: build-fix, in "mptcp: Add path manager interface"
- 780b8d642b52: build-fix, in "mptcp: Add ADD_ADDR handling"
- 7fbade176d28: conflict in
t/mptcp-Add-handling-of-incoming-MP_JOIN-requests
- 450c40831c1a: build-fix, in "mptcp: Add handling of incoming MP_JOIN
requests"
- e2cf185fa8ed: conflict in
t/mptcp-harmonize-locking-on-all-socket-operations
- a22dc45fb884: build-fix, in "mptcp: harmonize locking on all socket
operations."
- 03b30f5ab420: conflict in
t/mptcp-new-sysctl-to-control-the-activation-per-NS
- e456c89f9ee8: conflict in
t/mptcp-Add-handling-of-outgoing-MP_JOIN-requests
- ba1130a4e0ab: build-fix, in "mptcp: Add handling of outgoing MP_JOIN
requests"
- ae4d94be7818: 3rd patch in "mptcp: Add handling of outgoing MP_JOIN
requests"
- d092649e080a: build-fix, in "mptcp: Implement path manager interface
commands"
- 5a29aef0ec5e: conflict in
t/mptcp-Make-MPTCP-socket-block-wakeup-ignore-sk_receive_queue
- b864a19f93a7: conflict in
t/mptcp-queue-data-for-mptcp-level-retransmission
- 6fa2165ba14d: conflict in
t/mptcp-implement-memory-accounting-for-mptcp-rtx-queue
- 37cb660793c0: conflict in
t/mptcp-rework-mptcp_sendmsg_frag-to-accept-optional-dfrag
- 833fd784d834: conflict in
t/mptcp-implement-and-use-MPTCP-level-retransmission
Here is the diff:
diff --git a/net/mptcp/options.c b/net/mptcp/options.c
index dd16d2ab8cc7..5e575999e281 100644
--- a/net/mptcp/options.c
+++ b/net/mptcp/options.c
@@ -308,7 +308,7 @@ void mptcp_get_options(const struct sk_buff *skb,
bool mptcp_syn_options(struct sock *sk, unsigned int *size,
struct mptcp_out_options *opts)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
if (subflow->request_mptcp) {
pr_debug("local_key=%llu", subflow->local_key);
@@ -332,8 +332,8 @@ bool mptcp_syn_options(struct sock *sk, unsigned int
*size,
void mptcp_rcv_synsent(struct sock *sk)
{
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct tcp_sock *tp = tcp_sk(sk);
- struct subflow_context *subflow = subflow_ctx(sk);
if (subflow->request_mptcp && tp->rx_opt.mptcp.mp_capable) {
subflow->mp_capable = 1;
@@ -353,7 +353,7 @@ static bool mptcp_established_options_mp(struct sock
*sk, unsigned int *size,
unsigned int remaining,
struct mptcp_out_options *opts)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
if (subflow->mp_capable && !subflow->fourth_ack &&
remaining >= TCPOLEN_MPTCP_MPC_ACK) {
@@ -393,7 +393,7 @@ static bool mptcp_established_options_dss(struct
sock *sk, struct sk_buff *skb,
bool use_csum;
map_size = TCPOLEN_MPTCP_DSS_BASE + TCPOLEN_MPTCP_DSS_MAP64;
- use_csum = subflow_ctx(sk)->use_checksum;
+ use_csum = mptcp_subflow_ctx(sk)->use_checksum;
if (use_csum)
map_size += TCPOLEN_MPTCP_DSS_CHECKSUM;
@@ -426,11 +426,11 @@ static bool mptcp_established_options_dss(struct
sock *sk, struct sk_buff *skb,
dss_size += ack_size;
- msk = mptcp_sk(subflow_ctx(sk)->conn);
+ msk = mptcp_sk(mptcp_subflow_ctx(sk)->conn);
if (msk) {
opts->ext_copy.data_ack = msk->ack_seq;
} else {
- mptcp_crypto_key_sha1(subflow_ctx(sk)->remote_key,
+ mptcp_crypto_key_sha1(mptcp_subflow_ctx(sk)->remote_key,
NULL, &opts->ext_copy.data_ack);
opts->ext_copy.data_ack++;
}
@@ -454,7 +454,7 @@ static bool mptcp_established_options_addr(struct
sock *sk,
unsigned int remaining,
struct mptcp_out_options *opts)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
struct sockaddr_storage saddr;
u8 id;
@@ -485,7 +485,7 @@ bool mptcp_established_options(struct sock *sk,
struct sk_buff *skb,
unsigned int *size, unsigned int remaining,
struct mptcp_out_options *opts)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
unsigned int opt_size = 0;
bool ret = false;
@@ -514,7 +514,7 @@ bool mptcp_established_options(struct sock *sk,
struct sk_buff *skb,
bool mptcp_synack_options(const struct request_sock *req, unsigned int
*size,
struct mptcp_out_options *opts)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
if (subflow_req->mp_capable) {
opts->suboptions = OPTION_MPTCP_MPC_SYNACK;
@@ -578,7 +578,7 @@ void update_una(struct mptcp_sock *msk, struct
mptcp_options_received *mp_opt)
void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb,
struct tcp_options_received *opt_rx)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
struct mptcp_options_received *mp_opt;
struct mptcp_ext *mpext;
diff --git a/net/mptcp/pm.c b/net/mptcp/pm.c
index c8d6341c9683..7c7c00f9f7e8 100644
--- a/net/mptcp/pm.c
+++ b/net/mptcp/pm.c
@@ -75,7 +75,8 @@ int pm_create_subflow(u32 token, u8 remote_id)
remote.sin_port = htons(msk->dport);
remote.sin_addr.s_addr = msk->pm.remote_addr.s_addr;
- err = subflow_connect((struct sock *)msk, &local, &remote, remote_id);
+ err = mptcp_subflow_connect((struct sock *)msk, &local, &remote,
+ remote_id);
create_put:
sock_put((struct sock *)msk);
@@ -161,7 +162,7 @@ int pm_addr_signal(struct mptcp_sock *msk, u8 *id,
int pm_get_local_id(struct request_sock *req, struct sock *sk,
const struct sk_buff *skb)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
struct mptcp_sock *msk = mptcp_sk(sk);
if (!msk->pm.local_valid)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 01bc35fe9374..b54fecf528b9 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -80,7 +80,7 @@ static struct socket *mptcp_fallback_get_ref(const
struct mptcp_sock *msk)
static struct sock *mptcp_subflow_get_ref(const struct mptcp_sock *msk)
{
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
sock_owned_by_me((const struct sock *)msk);
@@ -305,7 +305,7 @@ static int mptcp_sendmsg_frag(struct sock *sk,
struct sock *ssk,
if (mpext) {
memset(mpext, 0, sizeof(*mpext));
mpext->data_seq = *write_seq;
- mpext->subflow_seq = subflow_ctx(ssk)->rel_write_seq;
+ mpext->subflow_seq = mptcp_subflow_ctx(ssk)->rel_write_seq;
mpext->data_len = ret;
mpext->checksum = 0xbeef;
mpext->use_map = 1;
@@ -322,7 +322,7 @@ static int mptcp_sendmsg_frag(struct sock *sk,
struct sock *ssk,
out:
*poffset += frag_truesize;
*write_seq += ret;
- subflow_ctx(ssk)->rel_write_seq += ret;
+ mptcp_subflow_ctx(ssk)->rel_write_seq += ret;
return ret;
}
@@ -410,14 +410,14 @@ static u64 expand_seq(u64 old_seq, u16
old_data_len, u64 seq)
return seq | ((old_seq + old_data_len + 1) & GENMASK_ULL(63, 32));
}
-static u64 get_map_offset(struct subflow_context *subflow)
+static u64 get_map_offset(struct mptcp_subflow_context *subflow)
{
return tcp_sk(mptcp_subflow_tcp_socket(subflow)->sk)->copied_seq -
subflow->ssn_offset -
subflow->map_subflow_seq;
}
-static u64 get_mapped_dsn(struct subflow_context *subflow)
+static u64 get_mapped_dsn(struct mptcp_subflow_context *subflow)
{
return subflow->map_seq + get_map_offset(subflow);
}
@@ -460,7 +460,7 @@ enum mapping_status {
static enum mapping_status mptcp_get_mapping(struct sock *ssk)
{
- struct subflow_context *subflow = subflow_ctx(ssk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(ssk);
struct mptcp_ext *mpext;
enum mapping_status ret;
struct sk_buff *skb;
@@ -556,7 +556,7 @@ static void mptcp_wait_data(struct sock *sk, long
*timeo)
remove_wait_queue(sk_sleep(sk), &wait);
}
-static void warn_bad_map(struct subflow_context *subflow, u32 ssn)
+static void warn_bad_map(struct mptcp_subflow_context *subflow, u32 ssn)
{
WARN_ONCE(1, "Bad mapping: ssn=%d map_seq=%d map_data_len=%d",
ssn, subflow->map_subflow_seq, subflow->map_data_len);
@@ -566,7 +566,7 @@ static int mptcp_recvmsg(struct sock *sk, struct
msghdr *msg, size_t len,
int nonblock, int flags, int *addr_len)
{
struct mptcp_sock *msk = mptcp_sk(sk);
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
struct mptcp_read_arg arg;
read_descriptor_t desc;
struct socket *ssock;
@@ -579,7 +579,8 @@ static int mptcp_recvmsg(struct sock *sk, struct
msghdr *msg, size_t len,
ssock = __mptcp_fallback_get_ref(msk);
if (ssock) {
release_sock(sk);
- pr_debug("fallback-read subflow=%p", subflow_ctx(ssock->sk));
+ pr_debug("fallback-read subflow=%p",
+ mptcp_subflow_ctx(ssock->sk));
copied = sock_recvmsg(ssock, msg, flags);
sock_put(ssock->sk);
return copied;
@@ -591,7 +592,7 @@ static int mptcp_recvmsg(struct sock *sk, struct
msghdr *msg, size_t len,
return -ENOTCONN;
}
- subflow = subflow_ctx(ssk);
+ subflow = mptcp_subflow_ctx(ssk);
tp = tcp_sk(ssk);
lock_sock(ssk);
@@ -896,8 +897,8 @@ static void mptcp_cancel_rtx_work(struct sock *sk)
static void mptcp_close(struct sock *sk, long timeout)
{
+ struct mptcp_subflow_context *subflow, *tmp;
struct mptcp_sock *msk = mptcp_sk(sk);
- struct subflow_context *subflow, *tmp;
struct socket *ssk = NULL;
mptcp_token_destroy(msk->token);
@@ -941,17 +942,19 @@ static struct sock *mptcp_accept(struct sock *sk,
int flags, int *err,
bool kern)
{
struct mptcp_sock *msk = mptcp_sk(sk);
- struct socket *listener = msk->subflow;
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
struct socket *new_sock;
+ struct socket *listener;
struct sock *newsk;
- pr_debug("msk=%p, listener=%p", msk, subflow_ctx(listener->sk));
+ listener = msk->subflow;
+
+ pr_debug("msk=%p, listener=%p", msk, mptcp_subflow_ctx(listener->sk));
*err = kernel_accept(listener, &new_sock, flags);
if (*err < 0)
return NULL;
- subflow = subflow_ctx(new_sock->sk);
+ subflow = mptcp_subflow_ctx(new_sock->sk);
pr_debug("msk=%p, new subflow=%p, ", msk, subflow);
if (subflow->mp_capable) {
@@ -1096,15 +1099,18 @@ static int mptcp_get_port(struct sock *sk,
unsigned short snum)
{
struct mptcp_sock *msk = mptcp_sk(sk);
- pr_debug("msk=%p, subflow=%p", msk, subflow_ctx(msk->subflow->sk));
+ pr_debug("msk=%p, subflow=%p", msk,
+ mptcp_subflow_ctx(msk->subflow->sk));
return inet_csk_get_port(msk->subflow->sk, snum);
}
void mptcp_finish_connect(struct sock *sk, int mp_capable)
{
+ struct mptcp_subflow_context *subflow;
struct mptcp_sock *msk = mptcp_sk(sk);
- struct subflow_context *subflow = subflow_ctx(msk->subflow->sk);
+
+ subflow = mptcp_subflow_ctx(msk->subflow->sk);
if (mp_capable) {
u64 ack_seq;
@@ -1158,7 +1164,7 @@ void mptcp_finish_connect(struct sock *sk, int
mp_capable)
void mptcp_finish_join(struct sock *sk)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct mptcp_sock *msk = mptcp_sk(subflow->conn);
pr_debug("msk=%p, subflow=%p", msk, subflow);
@@ -1173,7 +1179,7 @@ void mptcp_finish_join(struct sock *sk)
bool mptcp_sk_is_subflow(const struct sock *sk)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
return subflow->mp_join == 1;
}
@@ -1206,8 +1212,8 @@ static struct proto mptcp_prot = {
static struct socket *mptcp_socket_create_get(struct mptcp_sock *msk)
{
+ struct mptcp_subflow_context *subflow;
struct sock *sk = (struct sock *)msk;
- struct subflow_context *subflow;
struct socket *ssock;
int err;
@@ -1216,14 +1222,14 @@ static struct socket
*mptcp_socket_create_get(struct mptcp_sock *msk)
if (ssock)
goto release;
- err = subflow_create_socket(sk, &ssock);
+ err = mptcp_subflow_create_socket(sk, &ssock);
if (err) {
ssock = ERR_PTR(err);
goto release;
}
msk->subflow = ssock;
- subflow = subflow_ctx(msk->subflow->sk);
+ subflow = mptcp_subflow_ctx(msk->subflow->sk);
subflow->request_mptcp = 1; /* @@ if MPTCP enabled */
subflow->request_cksum = 0; /* checksum not supported */
subflow->request_version = 0; /* only v0 supported */
@@ -1356,7 +1362,7 @@ static int mptcp_stream_accept(struct socket
*sock, struct socket *newsock,
static __poll_t mptcp_poll(struct file *file, struct socket *sock,
struct poll_table_struct *wait)
{
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
const struct mptcp_sock *msk;
struct sock *sk = sock->sk;
struct socket *ssock;
@@ -1386,7 +1392,7 @@ static __poll_t mptcp_poll(struct file *file,
struct socket *sock,
static int mptcp_shutdown(struct socket *sock, int how)
{
struct mptcp_sock *msk = mptcp_sk(sock->sk);
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
struct socket *ssock;
int ret = 0;
@@ -1439,7 +1445,7 @@ void mptcp_proto_init(void)
if (percpu_counter_init(&mptcp_sockets_allocated, 0, GFP_KERNEL))
panic("Failed to allocate MPTCP pcpu counter\n");
- subflow_init();
+ mptcp_subflow_init();
pm_init();
if (proto_register(&mptcp_prot, 1) != 0)
diff --git a/net/mptcp/protocol.h b/net/mptcp/protocol.h
index dc75401cca0b..0c6bc8617cf4 100644
--- a/net/mptcp/protocol.h
+++ b/net/mptcp/protocol.h
@@ -169,7 +169,7 @@ static inline struct mptcp_data_frag
*mptcp_rtx_head(const struct sock *sk)
return list_first_entry(&msk->rtx_queue, struct mptcp_data_frag, list);
}
-struct subflow_request_sock {
+struct mptcp_subflow_request_sock {
struct tcp_request_sock sk;
u8 mp_capable : 1,
mp_join : 1,
@@ -188,14 +188,14 @@ struct subflow_request_sock {
u32 remote_nonce;
};
-static inline
-struct subflow_request_sock *subflow_rsk(const struct request_sock *rsk)
+static inline struct mptcp_subflow_request_sock *
+mptcp_subflow_rsk(const struct request_sock *rsk)
{
- return (struct subflow_request_sock *)rsk;
+ return (struct mptcp_subflow_request_sock *)rsk;
}
/* MPTCP subflow context */
-struct subflow_context {
+struct mptcp_subflow_context {
struct list_head node;/* conn_list of subflows */
u64 local_key;
u64 remote_key;
@@ -233,25 +233,27 @@ struct subflow_context {
struct rcu_head rcu;
};
-static inline struct subflow_context *subflow_ctx(const struct sock *sk)
+static inline struct mptcp_subflow_context *
+mptcp_subflow_ctx(const struct sock *sk)
{
struct inet_connection_sock *icsk = inet_csk(sk);
+
/* Use RCU on icsk_ulp_data only for sock diag code */
- return (__force struct subflow_context *)icsk->icsk_ulp_data;
+ return (__force struct mptcp_subflow_context *)icsk->icsk_ulp_data;
}
static inline struct socket *
-mptcp_subflow_tcp_socket(const struct subflow_context *subflow)
+mptcp_subflow_tcp_socket(const struct mptcp_subflow_context *subflow)
{
return subflow->tcp_sock;
}
int mptcp_is_enabled(struct net *net);
-void subflow_init(void);
-int subflow_connect(struct sock *sk, struct sockaddr_in *local,
- struct sockaddr_in *remote, u8 remote_id);
-int subflow_create_socket(struct sock *sk, struct socket **new_sock);
+void mptcp_subflow_init(void);
+int mptcp_subflow_connect(struct sock *sk, struct sockaddr_in *local,
+ struct sockaddr_in *remote, u8 remote_id);
+int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock);
extern const struct inet_connection_sock_af_ops ipv4_specific;
diff --git a/net/mptcp/subflow.c b/net/mptcp/subflow.c
index c86ce35580cd..7a94049587cc 100644
--- a/net/mptcp/subflow.c
+++ b/net/mptcp/subflow.c
@@ -20,7 +20,7 @@
static int subflow_rebuild_header(struct sock *sk)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
int err = 0;
if (subflow->request_mptcp && !subflow->token) {
@@ -43,7 +43,7 @@ static int subflow_rebuild_header(struct sock *sk)
static void subflow_req_destructor(struct request_sock *req)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
pr_debug("subflow_req=%p", subflow_req);
@@ -56,7 +56,7 @@ static void subflow_req_destructor(struct request_sock
*req)
static bool subflow_token_join_request(struct request_sock *req,
const struct sk_buff *skb)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
u8 hmac[MPTCPOPT_HMAC_LEN];
struct mptcp_sock *msk;
@@ -88,8 +88,8 @@ static void subflow_v4_init_req(struct request_sock *req,
const struct sock *sk_listener,
struct sk_buff *skb)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
- struct subflow_context *listener = subflow_ctx(sk_listener);
+ struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk_listener);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
struct tcp_options_received rx_opt;
tcp_rsk(req)->is_mptcp = 1;
@@ -138,7 +138,7 @@ static void subflow_v4_init_req(struct request_sock
*req,
}
/* validate received truncated hmac and create hmac for third ACK */
-static bool subflow_thmac_valid(struct subflow_context *subflow)
+static bool subflow_thmac_valid(struct mptcp_subflow_context *subflow)
{
u8 hmac[MPTCPOPT_HMAC_LEN];
u64 thmac;
@@ -158,7 +158,7 @@ static bool subflow_thmac_valid(struct
subflow_context *subflow)
static void subflow_finish_connect(struct sock *sk, const struct
sk_buff *skb)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
inet_sk_rx_dst_set(sk, skb);
@@ -166,7 +166,7 @@ static void subflow_finish_connect(struct sock *sk,
const struct sk_buff *skb)
return;
if (subflow->mp_capable && !subflow->conn_finished) {
- pr_debug("subflow=%p, remote_key=%llu", subflow_ctx(sk),
+ pr_debug("subflow=%p, remote_key=%llu", mptcp_subflow_ctx(sk),
subflow->remote_key);
mptcp_finish_connect(subflow->conn, subflow->mp_capable);
subflow->conn_finished = 1;
@@ -177,7 +177,7 @@ static void subflow_finish_connect(struct sock *sk,
const struct sk_buff *skb)
}
} else if (subflow->mp_join && !subflow->conn_finished) {
pr_debug("subflow=%p, thmac=%llu, remote_nonce=%u",
- subflow_ctx(sk), subflow->thmac,
+ subflow, subflow->thmac,
subflow->remote_nonce);
if (!subflow_thmac_valid(subflow)) {
subflow->mp_join = 0;
@@ -200,7 +200,7 @@ static struct tcp_request_sock_ops
subflow_request_sock_ipv4_ops;
static int subflow_conn_request(struct sock *sk, struct sk_buff *skb)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
pr_debug("subflow=%p", subflow);
@@ -220,11 +220,12 @@ static int subflow_conn_request(struct sock *sk,
struct sk_buff *skb)
static bool subflow_hmac_valid(const struct request_sock *req,
const struct tcp_options_received *rx_opt)
{
- const struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ const struct mptcp_subflow_request_sock *subflow_req;
u8 hmac[MPTCPOPT_HMAC_LEN];
struct mptcp_sock *msk;
bool ret;
+ subflow_req = mptcp_subflow_rsk(req);
msk = mptcp_token_get_sock(subflow_req->token);
if (!msk)
return false;
@@ -248,15 +249,15 @@ static struct sock *subflow_syn_recv_sock(const
struct sock *sk,
struct request_sock *req_unhash,
bool *own_req)
{
- struct subflow_context *listener = subflow_ctx(sk);
- struct subflow_request_sock *subflow_req;
+ struct mptcp_subflow_context *listener = mptcp_subflow_ctx(sk);
+ struct mptcp_subflow_request_sock *subflow_req;
struct tcp_options_received opt_rx;
struct sock *child;
pr_debug("listener=%p, req=%p, conn=%p", listener, req, listener->conn);
/* if the sk is MP_CAPABLE, we already received the client key */
- subflow_req = subflow_rsk(req);
+ subflow_req = mptcp_subflow_rsk(req);
if (!subflow_req->mp_capable && subflow_req->mp_join) {
opt_rx.mptcp.mp_join = 0;
mptcp_get_options(skb, &opt_rx);
@@ -268,7 +269,7 @@ static struct sock *subflow_syn_recv_sock(const
struct sock *sk,
child = tcp_v4_syn_recv_sock(sk, skb, req, dst, req_unhash, own_req);
if (child && *own_req) {
- struct subflow_context *ctx = subflow_ctx(child);
+ struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(child);
if (!ctx)
goto close_child;
@@ -302,7 +303,7 @@ static struct inet_connection_sock_af_ops
subflow_specific;
static void subflow_data_ready(struct sock *sk)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct sock *parent = subflow->conn;
pr_debug("sk=%p", sk);
@@ -319,23 +320,23 @@ static void subflow_data_ready(struct sock *sk)
}
}
-int subflow_connect(struct sock *sk, struct sockaddr_in *local,
- struct sockaddr_in *remote, u8 remote_id)
+int mptcp_subflow_connect(struct sock *sk, struct sockaddr_in *local,
+ struct sockaddr_in *remote, u8 remote_id)
{
struct mptcp_sock *msk = mptcp_sk(sk);
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
struct socket *sf;
u32 remote_token;
int err;
lock_sock(sk);
- err = subflow_create_socket(sk, &sf);
+ err = mptcp_subflow_create_socket(sk, &sf);
if (err) {
release_sock(sk);
return err;
}
- subflow = subflow_ctx(sf->sk);
+ subflow = mptcp_subflow_ctx(sf->sk);
subflow->remote_key = msk->remote_key;
subflow->local_key = msk->local_key;
subflow->token = msk->token;
@@ -369,9 +370,9 @@ int subflow_connect(struct sock *sk, struct
sockaddr_in *local,
return err;
}
-int subflow_create_socket(struct sock *sk, struct socket **new_sock)
+int mptcp_subflow_create_socket(struct sock *sk, struct socket **new_sock)
{
- struct subflow_context *subflow;
+ struct mptcp_subflow_context *subflow;
struct net *net = sock_net(sk);
struct socket *sf;
int err;
@@ -387,7 +388,7 @@ int subflow_create_socket(struct sock *sk, struct
socket **new_sock)
if (err)
return err;
- subflow = subflow_ctx(sf->sk);
+ subflow = mptcp_subflow_ctx(sf->sk);
pr_debug("subflow=%p", subflow);
*new_sock = sf;
@@ -397,12 +398,12 @@ int subflow_create_socket(struct sock *sk, struct
socket **new_sock)
return 0;
}
-static struct subflow_context *subflow_create_ctx(struct sock *sk,
- struct socket *sock,
- gfp_t priority)
+static struct mptcp_subflow_context *subflow_create_ctx(struct sock *sk,
+ struct socket *sock,
+ gfp_t priority)
{
struct inet_connection_sock *icsk = inet_csk(sk);
- struct subflow_context *ctx;
+ struct mptcp_subflow_context *ctx;
ctx = kzalloc(sizeof(*ctx), priority);
if (!ctx)
@@ -419,9 +420,9 @@ static struct subflow_context
*subflow_create_ctx(struct sock *sk,
static int subflow_ulp_init(struct sock *sk)
{
- struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
- struct subflow_context *ctx;
+ struct mptcp_subflow_context *ctx;
+ struct tcp_sock *tp = tcp_sk(sk);
int err = 0;
ctx = subflow_create_ctx(sk, sk->sk_socket, GFP_KERNEL);
@@ -443,7 +444,7 @@ static int subflow_ulp_init(struct sock *sk)
static void subflow_ulp_release(struct sock *sk)
{
- struct subflow_context *ctx = subflow_ctx(sk);
+ struct mptcp_subflow_context *ctx = mptcp_subflow_ctx(sk);
if (!ctx)
return;
@@ -458,9 +459,9 @@ static void subflow_ulp_clone(const struct
request_sock *req,
struct sock *newsk,
const gfp_t priority)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
- struct subflow_context *old_ctx = subflow_ctx(newsk);
- struct subflow_context *new_ctx;
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
+ struct mptcp_subflow_context *old_ctx = mptcp_subflow_ctx(newsk);
+ struct mptcp_subflow_context *new_ctx;
/* newsk->sk_socket is NULL at this point */
new_ctx = subflow_create_ctx(newsk, NULL, priority);
@@ -500,7 +501,7 @@ static struct tcp_ulp_ops subflow_ulp_ops
__read_mostly = {
static int subflow_ops_init(struct request_sock_ops *subflow_ops)
{
- subflow_ops->obj_size = sizeof(struct subflow_request_sock);
+ subflow_ops->obj_size = sizeof(struct mptcp_subflow_request_sock);
subflow_ops->slab_name = "request_sock_subflow";
subflow_ops->slab = kmem_cache_create(subflow_ops->slab_name,
@@ -516,7 +517,7 @@ static int subflow_ops_init(struct request_sock_ops
*subflow_ops)
return 0;
}
-void subflow_init(void)
+void mptcp_subflow_init(void)
{
subflow_request_sock_ops = tcp_request_sock_ops;
if (subflow_ops_init(&subflow_request_sock_ops) != 0)
diff --git a/net/mptcp/token.c b/net/mptcp/token.c
index b3069ef16555..a0d8f6e323b2 100644
--- a/net/mptcp/token.c
+++ b/net/mptcp/token.c
@@ -51,7 +51,7 @@ static int token_used __read_mostly;
*/
int mptcp_token_new_request(struct request_sock *req)
{
- struct subflow_request_sock *subflow_req = subflow_rsk(req);
+ struct mptcp_subflow_request_sock *subflow_req = mptcp_subflow_rsk(req);
int err;
while (1) {
@@ -96,7 +96,7 @@ int mptcp_token_new_request(struct request_sock *req)
*/
int mptcp_token_new_connect(struct sock *sk)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
struct sock *mptcp_sock = subflow->conn;
int err;
@@ -154,7 +154,7 @@ int mptcp_token_new_accept(u32 token)
*/
void mptcp_token_update_accept(struct sock *sk, struct sock *conn)
{
- struct subflow_context *subflow = subflow_ctx(sk);
+ struct mptcp_subflow_context *subflow = mptcp_subflow_ctx(sk);
void __rcu **slot;
spin_lock_bh(&token_tree_lock);
It is quite big but I only renamed functions and structures and
sometimes moved functions to keep the reversed Xmas tree.
Ideally, I would like to push this before applying other patches because
it is quite big and the rebase is already made on my side :) (I can
still work with a copy of the tree but would be easier to push this :) )
Cheers,
Matt
--
Matthieu Baerts | R&D Engineer
matthieu.baerts(a)tessares.net
Tessares SA | Hybrid Access Solutions
www.tessares.net
1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
2 years, 10 months
[PATCH] mptcp: fix retransmit timer update
by Paolo Abeni
Mat noted the current code access ssk data outside the relevant
socket lock. Fix that moving the update in such scope
Fixes: 28d2e02041c9 ("mptcp: implement and use MPTCP-level retransmission")
Signed-off-by: Paolo Abeni <pabeni(a)redhat.com>
---
I'm ok with squashing this into the fixed commit
---
net/mptcp/protocol.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 439d6744c8e2..a26b74a706c0 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -830,11 +830,11 @@ static void mptcp_retransmit(struct work_struct *work)
dfrag->offset = orig_offset;
dfrag->data_len = orig_len;
+ mptcp_set_timeout(sk, ssk);
release_sock(ssk);
sock_put(ssk);
reset_unlock:
- mptcp_set_timeout(sk, ssk);
if (!mptcp_timer_pending(sk))
mptcp_reset_timer(sk);
--
2.21.0
2 years, 10 months
some squashing needed?
by Paolo Abeni
Hi all,
the current series is pretty big, and it will likely grow before it
will be feature complete.
I think we should look after some squashing, but how do we do that?
Just asking good/poor Matt: "please squash chunk 1 of patch X into
patch Y, <etc...>" ? (Yep Matt, you are authorized to hate me after
that suggestion!)
Resending the whole squashed series/specific patches for a
partial/complete replace?
Is there any smarter options available?
Thanks,
Paolo
2 years, 10 months
[PATCH 0/2] Add prefix to path management routines
by Peter Krystad
Make minor changes as proposed in Interim Path Manager patchset,
and then add mptcp_ prefix to all path management api routines.
squashto: Implement path manager interface commands
Peter Krystad (2):
mptcp: Minor changes to path manager interface
mptcp: Prefix path management routines with mptcp_
net/mptcp/options.c | 10 ++++---
net/mptcp/pm.c | 63 ++++++++++++++++++++++++++------------------
net/mptcp/protocol.c | 5 ++--
net/mptcp/protocol.h | 35 +++++++++++++++---------
net/mptcp/subflow.c | 2 +-
5 files changed, 69 insertions(+), 46 deletions(-)
--
2.17.2
2 years, 10 months