ADD_ADDR: ports support
Subsystems (3)
Geliang Tang
v4 cover ADD_ADDR: ports support
v4:
- hold msk->pm.lock in mptcp_pm_sport_in_anno_list.
- Merge the patchset 'Squash to "ADD_ADDR: ports support v3"' into v4.
v3:
- add two new patches, 8 and 11
- add more IS_ENABLED(CONFIG_MPTCP_IPV6) in patch 2
- define TCPOLEN_MPTCP_ADD_ADDR_HMAC in patch 4
- add flags check in patch 10
- update the testcases
v2:
- change mptcp_out_options's port field in CPU bype order.
- keep mptcp_options_received's port field in CPU bype order.
- add two new patches to simplify ADD_ADDR suboption writing.
- update mptcp_add_addr_len helper use adding up size.
- add more commit messages.
v1:
This series is the first version of ADD_ADDR ports support. I have solved the listener problem which I mentioned at the meeting on 15th of October by adding a new listening socket from the userspace (see patch 8). Up to now this patchset works well.
Geliang Tang (13):
mptcp: unify ADD_ADDR and echo suboptions writing
mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing
mptcp: add port support for ADD_ADDR suboption writing
mptcp: use adding up size to get ADD_ADDR length
mptcp: add the outgoing ADD_ADDR port support
mptcp: send out dedicated packet for ADD_ADDR using port
mptcp: add port parameter for mptcp_pm_announce_addr
mptcp: print out port and ahmac when receiving ADD_ADDR
mptcp: add port number check for MP_JOIN
mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink
selftests: mptcp: add port argument for pm_nl_ctl
mptcp: add the mibs for ADD_ADDR with port
selftests: mptcp: add testcases for ADD_ADDR with port
include/net/mptcp.h | 1 + net/mptcp/mib.c | 4 + net/mptcp/mib.h | 4 + net/mptcp/options.c | 107 +++++++++++------- net/mptcp/pm.c | 14 ++- net/mptcp/pm_netlink.c | 46 +++++++- net/mptcp/protocol.h | 38 +++++-- net/mptcp/subflow.c | 37 ++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 103 ++++++++++++++++- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +++- 10 files changed, 313 insertions(+), 65 deletions(-)
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 1/13 mptcp: unify ADD_ADDR and echo suboptions writing
There are two differences between ADD_ADDR suboption and ADD_ADDR echo
suboption: The length of the former is 8 octets longer than the length of the latter. The former's echo-flag is 0, and latter's echo-flag is 1.
This patch added two local variables, len and echo, to unify ADD_ADDR and ADD_ADDR echo suboptions writing.
--- net/mptcp/options.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-)
net/mptcp/options.c +19 -18
@@ -1067,15 +1067,16 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, mp_capable_done:if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { -if (opts->ahmac) - *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , -TCPOLEN_MPTCP_ADD_ADDR ,0 , - opts->addr_id); -else - *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , -TCPOLEN_MPTCP_ADD_ADDR_BASE , -MPTCP_ADDR_ECHO , - opts->addr_id); +u8 len =TCPOLEN_MPTCP_ADD_ADDR_BASE ; +u8 echo =MPTCP_ADDR_ECHO ; + +if (opts->ahmac) { + len +=sizeof (opts->ahmac); + echo =0 ; + } + + *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , + len, echo, opts->addr_id);memcpy ((u8 *)ptr, (u8 *)&opts->addr.s_addr,4 ); ptr +=1 ;if (opts->ahmac) {
@@ -1086,15 +1087,15 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp,#if IS_ENABLED (CONFIG_MPTCP_IPV6 )if (OPTION_MPTCP_ADD_ADDR6 & opts->suboptions) { -if (opts->ahmac) - *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , -TCPOLEN_MPTCP_ADD_ADDR6 ,0 , - opts->addr_id); -else - *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , -TCPOLEN_MPTCP_ADD_ADDR6_BASE , -MPTCP_ADDR_ECHO , - opts->addr_id); +u8 len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ; +u8 echo =MPTCP_ADDR_ECHO ; + +if (opts->ahmac) { + len +=sizeof (opts->ahmac); + echo =0 ; + } + *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , + len, echo, opts->addr_id);memcpy ((u8 *)ptr, opts->addr6.s6_addr,16 ); ptr +=4 ;if (opts->ahmac) {
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 2/13 mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing
The length of ADD_ADDR6 is 12 octets longer than ADD_ADDR. That's the only difference between them.
This patch dropped the duplicate code between ADD_ADDR and ADD_ADDR6 suboptions writing, and unify them into one.
--- net/mptcp/options.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-)
net/mptcp/options.c +17 -20
@@ -1066,10 +1066,19 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, } mp_capable_done: -if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { + if ((OPTION_MPTCP_ADD_ADDR +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + |OPTION_MPTCP_ADD_ADDR6 +#endif + ) & opts->suboptions) {u8 len =TCPOLEN_MPTCP_ADD_ADDR_BASE ;u8 echo =MPTCP_ADDR_ECHO ; +#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) +if (OPTION_MPTCP_ADD_ADDR6 & opts->suboptions) + len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ; +#endif +if (opts->ahmac) { len +=sizeof (opts->ahmac); echo =0 ;
@@ -1077,33 +1086,21 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , len, echo, opts->addr_id); -memcpy ((u8 *)ptr, (u8 *)&opts->addr.s_addr,4 ); - ptr +=1 ; -if (opts->ahmac) { -put_unaligned_be64 (opts->ahmac, ptr); - ptr +=2 ; +if (OPTION_MPTCP_ADD_ADDR & opts->suboptions) { +memcpy ((u8 *)ptr, (u8 *)&opts->addr.s_addr,4 ); + ptr +=1 ; } - } -#if IS_ENABLED (CONFIG_MPTCP_IPV6 ) -if (OPTION_MPTCP_ADD_ADDR6 & opts->suboptions) { -u8 len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ; -u8 echo =MPTCP_ADDR_ECHO ; - -if (opts->ahmac) { - len +=sizeof (opts->ahmac); - echo =0 ; + else if (OPTION_MPTCP_ADD_ADDR6 & opts->suboptions) { +memcpy ((u8 *)ptr, opts->addr6.s6_addr,16 ); + ptr +=4 ; } - *ptr++ =mptcp_option (MPTCPOPT_ADD_ADDR , - len, echo, opts->addr_id); -memcpy ((u8 *)ptr, opts->addr6.s6_addr,16 ); - ptr +=4 ; +#endif if (opts->ahmac) {put_unaligned_be64 (opts->ahmac, ptr); ptr +=2 ; } } -#endif if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { *ptr++ = mptcp_option(MPTCPOPT_RM_ADDR,
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 3/13 mptcp: add port support for ADD_ADDR suboption writing
In rfc8684, the length of ADD_ADDR suboption with IPv4 address and port is 18 octets, but mptcp_write_options is 32-bit aligned, so we need to pad it to 20 octets. All the other port related option lengths need to be added up 2 octets similarly.
This patch added a new field 'port' in mptcp_out_options. When this field is set with a port number, we need to add up 4 octets for the ADD_ADDR suboption, and put the port number into the suboption.
--- include/net/mptcp.h | 1 + net/mptcp/options.c | 30 +++++++++++++++++++++++++++--- net/mptcp/protocol.h | 10 +++++----- 3 files changed, 33 insertions(+), 8 deletions(-)
include/net/mptcp.h +1 -0
@@ -46,6 +46,7 @@ struct mptcp_out_options {#endif };u8 addr_id; +u16 port;u64 ahmac;u8 rm_id;u8 join_id;
net/mptcp/options.c +27 -3
@@ -1079,6 +1079,9 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ;#endif +if (opts->port) + len +=TCPOLEN_MPTCP_PORT_LEN ; +if (opts->ahmac) { len +=sizeof (opts->ahmac); echo =0 ;
@@ -1096,9 +1099,30 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, ptr += 4; }#endif -if (opts->ahmac) { -put_unaligned_be64 (opts->ahmac, ptr); - ptr +=2 ; + +if (!opts->port) { +if (opts->ahmac) { +put_unaligned_be64 (opts->ahmac, ptr); + ptr +=2 ; + } + }else { +if (opts->ahmac) { +u8 *bptr = (u8 *)ptr; + +put_unaligned_be16 (opts->port, bptr); + bptr +=2 ; +put_unaligned_be64 (opts->ahmac, bptr); + bptr +=8 ; +put_unaligned_be16 (TCPOPT_NOP <<8 | +TCPOPT_NOP , bptr); + + ptr +=3 ; + }else { +put_unaligned_be32 (opts->port <<16 | +TCPOPT_NOP <<8 | +TCPOPT_NOP , ptr); + ptr +=1 ; + } } }
net/mptcp/protocol.h +5 -5
@@ -49,14 +49,14 @@#define TCPOLEN_MPTCP_DSS_MAP64 14#define TCPOLEN_MPTCP_DSS_CHECKSUM 2#define TCPOLEN_MPTCP_ADD_ADDR 16 -#define TCPOLEN_MPTCP_ADD_ADDR_PORT 18 +#define TCPOLEN_MPTCP_ADD_ADDR_PORT 20#define TCPOLEN_MPTCP_ADD_ADDR_BASE 8 -#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 10 +#define TCPOLEN_MPTCP_ADD_ADDR_BASE_PORT 12#define TCPOLEN_MPTCP_ADD_ADDR6 28 -#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 30 +#define TCPOLEN_MPTCP_ADD_ADDR6_PORT 32#define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20 -#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 22 -#define TCPOLEN_MPTCP_PORT_LEN 2 +#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24 +#define TCPOLEN_MPTCP_PORT_LEN 4#define TCPOLEN_MPTCP_RM_ADDR_BASE 4/* MPTCP MP_JOIN flags */
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 4/13 mptcp: use adding up size to get ADD_ADDR length
This patch uses adding up size to get the ADD_ADDR suboption length rather than returning the ADD_ADDR size constants.
--- net/mptcp/protocol.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
net/mptcp/protocol.h +9 -4
@@ -57,6 +57,7 @@#define TCPOLEN_MPTCP_ADD_ADDR6_BASE 20#define TCPOLEN_MPTCP_ADD_ADDR6_BASE_PORT 24#define TCPOLEN_MPTCP_PORT_LEN 4 +#define TCPOLEN_MPTCP_ADD_ADDR_HMAC 8#define TCPOLEN_MPTCP_RM_ADDR_BASE 4/* MPTCP MP_JOIN flags */
@@ -546,10 +547,14 @@ static inline bool mptcp_pm_should_rm_signal(struct mptcp_sock *msk)static inline unsigned int mptcp_add_addr_len (int family,bool echo) { -if (family ==AF_INET ) -return echo ?TCPOLEN_MPTCP_ADD_ADDR_BASE - :TCPOLEN_MPTCP_ADD_ADDR ; -return echo ?TCPOLEN_MPTCP_ADD_ADDR6_BASE :TCPOLEN_MPTCP_ADD_ADDR6 ; +u8 len =TCPOLEN_MPTCP_ADD_ADDR_BASE ; + +if (family ==AF_INET6 ) + len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ; +if (!echo) + len +=TCPOLEN_MPTCP_ADD_ADDR_HMAC ; + +return len; } bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining,
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 5/13 mptcp: add the outgoing ADD_ADDR port support
This patch added a new add_addr_signal type named MPTCP_ADD_ADDR_PORT, to identify it is an address with port to be added.
It also added a new parameter 'port' for both mptcp_add_addr_len and mptcp_pm_add_addr_signal.
In mptcp_established_options_add_addr, we check whether the announced address is added with port. If it is, we put this port number to mptcp_out_options's port field.
--- net/mptcp/options.c | 10 +++++++--- net/mptcp/pm.c | 5 +++-- net/mptcp/protocol.h | 12 ++++++++++-- 3 files changed, 20 insertions(+), 7 deletions(-)
net/mptcp/options.c +7 -3
@@ -586,6 +586,7 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *unsigned int opt_size = *size;struct mptcp_addr_info saddr;bool echo; +bool port;int len; if (mptcp_pm_should_add_signal_ipv6(msk) &&
@@ -597,10 +598,10 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * }if (!mptcp_pm_should_add_signal (msk) || - !(mptcp_pm_add_addr_signal (msk, remaining, &saddr, &echo))) + !(mptcp_pm_add_addr_signal (msk, remaining, &saddr, &echo, &port)))return false; - len =mptcp_add_addr_len (saddr.family, echo); + len =mptcp_add_addr_len (saddr.family, echo, port);if (remaining < len)return false;
@@ -608,6 +609,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *if (drop_other_suboptions) *size -= opt_size; opts->addr_id = saddr.id; +if (port) + opts->port =ntohs (saddr.port);if (saddr.family ==AF_INET ) { opts->suboptions |=OPTION_MPTCP_ADD_ADDR ; opts->addr = saddr.addr;
@@ -630,7 +633,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff * } }#endif -pr_debug ("addr_id=%d, ahmac=%llu, echo=%d" , opts->addr_id, opts->ahmac, echo); +pr_debug ("addr_id=%d, ahmac=%llu, echo=%d, port=%d" , + opts->addr_id, opts->ahmac, echo, opts->port);return true; }
net/mptcp/pm.c +3 -2
@@ -188,7 +188,7 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, u8 rm_id)/* path manager helpers */ bool mptcp_pm_add_addr_signal (struct mptcp_sock *msk,unsigned int remaining, -struct mptcp_addr_info *saddr,bool *echo) +struct mptcp_addr_info *saddr,bool *echo,bool *port) {int ret = false;
@@ -199,8 +199,9 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, goto out_unlock; *echo =mptcp_pm_should_add_signal_echo (msk); + *port =mptcp_pm_should_add_signal_port (msk); -if (remaining <mptcp_add_addr_len (msk->pm.local.family, *echo)) +if (remaining <mptcp_add_addr_len (msk->pm.local.family, *echo, *port)) goto out_unlock; *saddr = msk->pm.local;
net/mptcp/protocol.h +10 -2
@@ -172,6 +172,7 @@ enum mptcp_add_addr_status {MPTCP_ADD_ADDR_SIGNAL ,MPTCP_ADD_ADDR_ECHO ,MPTCP_ADD_ADDR_IPV6 , + MPTCP_ADD_ADDR_PORT, }; struct mptcp_pm_data {
@@ -540,12 +541,17 @@ static inline bool mptcp_pm_should_add_signal_ipv6(struct mptcp_sock *msk)return READ_ONCE (msk->pm.add_addr_signal) &BIT (MPTCP_ADD_ADDR_IPV6 ); } +static inline bool mptcp_pm_should_add_signal_port (struct mptcp_sock *msk) +{ +return READ_ONCE (msk->pm.add_addr_signal) &BIT (MPTCP_ADD_ADDR_PORT ); +} +static inline bool mptcp_pm_should_rm_signal (struct mptcp_sock *msk) {return READ_ONCE (msk->pm.rm_addr_signal); } -static inline unsigned int mptcp_add_addr_len (int family,bool echo) +static inline unsigned int mptcp_add_addr_len (int family,bool echo,bool port) {u8 len =TCPOLEN_MPTCP_ADD_ADDR_BASE ;
@@ -553,12 +559,14 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo) len =TCPOLEN_MPTCP_ADD_ADDR6_BASE ;if (!echo) len +=TCPOLEN_MPTCP_ADD_ADDR_HMAC ; +if (port) + len +=TCPOLEN_MPTCP_PORT_LEN ;return len; }bool mptcp_pm_add_addr_signal (struct mptcp_sock *msk,unsigned int remaining, -struct mptcp_addr_info *saddr,bool *echo); +struct mptcp_addr_info *saddr,bool *echo,bool *port);bool mptcp_pm_rm_addr_signal (struct mptcp_sock *msk,unsigned int remaining,u8 *rm_id);int mptcp_pm_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 6/13 mptcp: send out dedicated packet for ADD_ADDR using port
The process is similar to that of the ADD_ADDR IPv6, this patch also sent out a pure ack for the ADD_ADDR using port.
--- net/mptcp/options.c | 3 ++- net/mptcp/pm.c | 3 ++- net/mptcp/pm_netlink.c | 14 +++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-)
net/mptcp/options.c +2 -1
@@ -589,7 +589,8 @@ static bool mptcp_established_options_add_addr(struct sock *sk, struct sk_buff *bool port;int len; -if (mptcp_pm_should_add_signal_ipv6 (msk) && +if ((mptcp_pm_should_add_signal_ipv6 (msk) || +mptcp_pm_should_add_signal_port (msk)) && skb &&skb_is_tcp_pure_ack (skb)) {pr_debug ("drop other suboptions" ); opts->suboptions =0 ;
net/mptcp/pm.c +2 -1
@@ -167,7 +167,8 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,void mptcp_pm_add_addr_send_ack (struct mptcp_sock *msk) { -if (!mptcp_pm_should_add_signal_ipv6 (msk)) +if (!mptcp_pm_should_add_signal_ipv6 (msk) && + !mptcp_pm_should_add_signal_port (msk))return ;mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_SEND_ACK );
net/mptcp/pm_netlink.c +11 -3
@@ -407,7 +407,8 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow; -if (!mptcp_pm_should_add_signal_ipv6 (msk)) +if (!mptcp_pm_should_add_signal_ipv6 (msk) && + !mptcp_pm_should_add_signal_port (msk))return ;__mptcp_flush_join_list (msk);
@@ -417,14 +418,21 @@ void mptcp_pm_nl_add_addr_send_ack(struct mptcp_sock *msk)u8 add_addr;spin_unlock_bh (&msk->pm.lock); -pr_debug ("send ack for add_addr6" ); +if (mptcp_pm_should_add_signal_ipv6 (msk)) +pr_debug ("send ack for add_addr6" ); +if (mptcp_pm_should_add_signal_port (msk)) +pr_debug ("send ack for add_addr_port" ); +lock_sock (ssk);tcp_send_ack (ssk);release_sock (ssk);spin_lock_bh (&msk->pm.lock); add_addr =READ_ONCE (msk->pm.add_addr_signal); - add_addr &= ~BIT (MPTCP_ADD_ADDR_IPV6 ); +if (mptcp_pm_should_add_signal_ipv6 (msk)) + add_addr &= ~BIT (MPTCP_ADD_ADDR_IPV6 ); +if (mptcp_pm_should_add_signal_port (msk)) + add_addr &= ~BIT (MPTCP_ADD_ADDR_PORT );WRITE_ONCE (msk->pm.add_addr_signal, add_addr); } }
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 7/13 mptcp: add port parameter for mptcp_pm_announce_addr
This patch added a new parameter 'port' for mptcp_pm_announce_addr. If this parameter is true, we set the MPTCP_ADD_ADDR_PORT bit of the add_addr_signal. That means the announced address is added with a port number.
--- net/mptcp/pm.c | 6 ++++-- net/mptcp/pm_netlink.c | 9 ++++++--- net/mptcp/protocol.h | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-)
net/mptcp/pm.c +4 -2
@@ -14,7 +14,7 @@int mptcp_pm_announce_addr (struct mptcp_sock *msk,const struct mptcp_addr_info *addr, -bool echo) +bool echo,bool port) {u8 add_addr =READ_ONCE (msk->pm.add_addr_signal);
@@ -26,6 +26,8 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk, add_addr |=BIT (MPTCP_ADD_ADDR_ECHO );if (addr->family ==AF_INET6 ) add_addr |=BIT (MPTCP_ADD_ADDR_IPV6 ); +if (port) + add_addr |=BIT (MPTCP_ADD_ADDR_PORT );WRITE_ONCE (msk->pm.add_addr_signal, add_addr);return 0 ; }
@@ -156,7 +158,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,spin_lock_bh (&pm->lock);if (!READ_ONCE (pm->accept_addr)) { -mptcp_pm_announce_addr (msk, addr, true); +mptcp_pm_announce_addr (msk, addr, true, addr->port);mptcp_pm_add_addr_send_ack (msk); }else if (mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_RECEIVED )) { pm->remote = *addr;
net/mptcp/pm_netlink.c +6 -3
@@ -227,7 +227,7 @@ static void mptcp_pm_add_timer(struct timer_list *timer)if (!mptcp_pm_should_add_signal (msk)) {pr_debug ("retransmit ADD_ADDR id=%d" , entry->addr.id); -mptcp_pm_announce_addr (msk, &entry->addr, false); +mptcp_pm_announce_addr (msk, &entry->addr, false, entry->addr.port);mptcp_pm_add_addr_send_ack (msk); entry->retrans_times++; }
@@ -328,7 +328,7 @@ static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)if (local) {if (mptcp_pm_alloc_anno_list (msk, local)) { msk->pm.add_addr_signaled++; -mptcp_pm_announce_addr (msk, &local->addr, false); +mptcp_pm_announce_addr (msk, &local->addr, false, local->addr.port);mptcp_pm_nl_add_addr_send_ack (msk); } }else {
@@ -376,6 +376,7 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)struct sock *sk = (struct sock *)msk;struct mptcp_addr_info remote;struct mptcp_addr_info local; +bool use_port = false; pr_debug("accepted %d:%d remote family %d", msk->pm.add_addr_accepted, msk->pm.add_addr_accept_max,
@@ -392,6 +393,8 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk) remote = msk->pm.remote;if (!remote.port) remote.port = sk->sk_dport; +else + use_port = true;memset (&local,0 ,sizeof (local)); local.family = remote.family;
@@ -399,7 +402,7 @@ void mptcp_pm_nl_add_addr_received(struct mptcp_sock *msk)__mptcp_subflow_connect ((struct sock *)msk, &local, &remote);spin_lock_bh (&msk->pm.lock); -mptcp_pm_announce_addr (msk, &remote, true); +mptcp_pm_announce_addr (msk, &remote, true, use_port);mptcp_pm_nl_add_addr_send_ack (msk); }
net/mptcp/protocol.h +1 -1
@@ -522,7 +522,7 @@ mptcp_pm_del_add_timer(struct mptcp_sock *msk,int mptcp_pm_announce_addr (struct mptcp_sock *msk,const struct mptcp_addr_info *addr, -bool echo); +bool echo,bool port);int mptcp_pm_remove_addr (struct mptcp_sock *msk,u8 local_id);int mptcp_pm_remove_subflow (struct mptcp_sock *msk,u8 local_id);
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 8/13 mptcp: print out port and ahmac when receiving ADD_ADDR
This patch printed out more debugging information for the ADD_ADDR suboption parsing on the incoming path.
--- net/mptcp/options.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/mptcp/options.c +3 -3
@@ -242,9 +242,6 @@ static void mptcp_parse_option(const struct sk_buff *skb, mp_opt->add_addr =1 ; mp_opt->addr_id = *ptr++; -pr_debug ("ADD_ADDR%s: id=%d, echo=%d" , - (mp_opt->family ==MPTCP_ADDR_IPVERSION_6 ) ?"6" :"" , - mp_opt->addr_id, mp_opt->echo);if (mp_opt->family ==MPTCP_ADDR_IPVERSION_4 ) {memcpy ((u8 *)&mp_opt->addr.s_addr, (u8 *)ptr,4 ); ptr +=4 ;
@@ -269,6 +266,9 @@ static void mptcp_parse_option(const struct sk_buff *skb, mp_opt->ahmac =get_unaligned_be64 (ptr); ptr +=8 ; } +pr_debug ("ADD_ADDR%s: id=%d, ahmac=%llu, echo=%d, port=%d" , + (mp_opt->family ==MPTCP_ADDR_IPVERSION_6 ) ?"6" :"" , + mp_opt->addr_id, mp_opt->ahmac, mp_opt->echo, mp_opt->port);break ;case MPTCPOPT_RM_ADDR :
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 9/13 mptcp: add port number check for MP_JOIN
This patch added two new helpers, subflow_use_different_sport and subflow_use_different_dport, to check whether the subflow's source or destination port number is different from the msk's port number.
When we received the MP_JOIN's SYN/SYNACK/ACK, we do these port number checks. If the subflow's source port number is different, we use another new helper mptcp_pm_sport_in_anno_list to check whether this port number is announced. If it isn't, we need to abort this connection.
--- net/mptcp/pm_netlink.c | 18 ++++++++++++++++++ net/mptcp/protocol.h | 1 + net/mptcp/subflow.c | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+)
net/mptcp/pm_netlink.c +18 -0
@@ -201,6 +201,24 @@ lookup_anno_list_by_saddr(struct mptcp_sock *msk,return NULL ; } +bool mptcp_pm_sport_in_anno_list (struct mptcp_sock *msk,const struct sock *sk) +{ +struct mptcp_pm_add_entry *entry; +bool ret = false; + +spin_lock_bh (&msk->pm.lock); +list_for_each_entry (entry, &msk->pm.anno_list, list) { +if (entry->addr.port ==inet_sk (sk)->inet_sport) { + ret = true; + goto out; + } + } + +out: +spin_unlock_bh (&msk->pm.lock); +return ret; +} +static void mptcp_pm_add_timer (struct timer_list *timer) {struct mptcp_pm_add_entry *entry =from_timer (entry, timer, add_timer);
net/mptcp/protocol.h +1 -0
@@ -516,6 +516,7 @@ void mptcp_pm_add_addr_received(struct mptcp_sock *msk,void mptcp_pm_add_addr_send_ack (struct mptcp_sock *msk);void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,u8 rm_id);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);
net/mptcp/subflow.c +34 -0
@@ -112,6 +112,11 @@ static int __subflow_init_req(struct request_sock *req, const struct sock *sk_lireturn 0 ; } +static bool subflow_use_different_sport (struct mptcp_sock *msk,const struct sock *sk) +{ +return inet_sk (sk)->inet_sport !=inet_sk ((struct sock *)msk)->inet_sport; +} +static void subflow_init_req (struct request_sock *req,const struct sock *sk_listener,struct sk_buff *skb)
@@ -182,6 +187,16 @@ static void subflow_init_req(struct request_sock *req,pr_debug ("token=%u, remote_nonce=%u msk=%p" , subflow_req->token, subflow_req->remote_nonce, subflow_req->msk); + +if (subflow_use_different_sport (subflow_req->msk, sk_listener)) { +pr_debug ("syn inet_sport=%d %d" , +ntohs (inet_sk (sk_listener)->inet_sport), +ntohs (inet_sk ((struct sock *)subflow_req->msk)->inet_sport)); +if (!mptcp_pm_sport_in_anno_list (subflow_req->msk, sk_listener)) { + subflow_req->mp_join =0 ; +return ; + } + } } }
@@ -284,6 +299,11 @@ void mptcp_subflow_reset(struct sock *ssk)sock_hold (sk); } +static bool subflow_use_different_dport (struct mptcp_sock *msk,const struct sock *sk) +{ +return inet_sk (sk)->inet_dport !=inet_sk ((struct sock *)msk)->inet_dport; +} +static void subflow_finish_connect (struct sock *sk,const struct sk_buff *skb) {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);
@@ -349,6 +369,12 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb) subflow->mp_join =1 ;MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_JOINSYNACKRX ); + +if (subflow_use_different_dport (mptcp_sk (parent), sk)) { +pr_debug ("synack inet_dport=%d %d" , +ntohs (inet_sk (sk)->inet_dport), +ntohs (inet_sk (parent)->inet_dport)); + } }else if (mptcp_check_fallback (sk)) { fallback:mptcp_rcv_space_init (mptcp_sk (parent), sk);
@@ -611,6 +637,14 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk,SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_JOINACKRX );tcp_rsk (req)->drop_req = true; + +if (subflow_use_different_sport (owner, sk)) { +pr_debug ("ack inet_sport=%d %d" , +ntohs (inet_sk (sk)->inet_sport), +ntohs (inet_sk ((struct sock *)owner)->inet_sport)); +if (!mptcp_pm_sport_in_anno_list (owner, sk)) + goto out; + } } }
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 10/13 mptcp: deal with MPTCP_PM_ADDR_ATTR_PORT in PM netlink
This patch added the MPTCP_PM_ADDR_ATTR_PORT filling and parsing in PM netlink.
--- net/mptcp/pm_netlink.c | 5 +++++ 1 file changed, 5 insertions(+)
net/mptcp/pm_netlink.c +5 -0
@@ -742,6 +742,9 @@ static int mptcp_pm_parse_addr(struct nlattr *attr, struct genl_info *info,if (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]) entry->addr.flags =nla_get_u32 (tb[MPTCP_PM_ADDR_ATTR_FLAGS ]); +if (tb[MPTCP_PM_ADDR_ATTR_PORT ]) + entry->addr.port =htons (nla_get_u16 (tb[MPTCP_PM_ADDR_ATTR_PORT ])); +return 0 ; }
@@ -928,6 +931,8 @@ static int mptcp_nl_fill_addr(struct sk_buff *skb,if (nla_put_u16 (skb,MPTCP_PM_ADDR_ATTR_FAMILY , addr->family)) goto nla_put_failure; +if (nla_put_u16 (skb,MPTCP_PM_ADDR_ATTR_PORT ,ntohs (addr->port))) + goto nla_put_failure;if (nla_put_u8 (skb,MPTCP_PM_ADDR_ATTR_ID , addr->id)) goto nla_put_failure;if (nla_put_u32 (skb,MPTCP_PM_ADDR_ATTR_FLAGS , entry->addr.flags))
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 11/13 selftests: mptcp: add port argument for pm_nl_ctl
This patch added a new argument for pm_nl_ctl tool. We can use it like this:
id 1 flags signal 10.0.2.1 10100
--- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/pm_nl_ctl.c +22 -2
@@ -176,8 +176,8 @@ int add_addr(int fd, int pm_family, int argc, char *argv[]) 1024];struct rtattr *rta, *nest;struct nlmsghdr *nh; +u_int32_t flags =0 ;u_int16_t family; -u_int32_t flags;int nest_start;u_int8_t id;int off =0 ;
@@ -223,7 +223,6 @@ int add_addr(int fd, int pm_family, int argc, char *argv[])char *tok, *str;/* flags */ - flags =0 ;if (++arg >= argc)error (1 ,0 ," missing flags value" );
@@ -271,6 +270,20 @@ int add_addr(int fd, int pm_family, int argc, char *argv[]) rta->rta_len =RTA_LENGTH (4 );memcpy (RTA_DATA (rta), &ifindex,4 ); off +=NLMSG_ALIGN (rta->rta_len); + }else if (!strcmp (argv[arg],"port" )) { +u_int16_t port; + +if (++arg >= argc) +error (1 ,0 ," missing port value" ); +if (!(flags &MPTCP_PM_ADDR_FLAG_SIGNAL )) +error (1 ,0 ," flags must be signal when using port" ); + + port =atoi (argv[arg]); + rta = (void *)(data + off); + rta->rta_type =MPTCP_PM_ADDR_ATTR_PORT ; + rta->rta_len =RTA_LENGTH (2 ); +memcpy (RTA_DATA (rta), &port,2 ); + off +=NLMSG_ALIGN (rta->rta_len); }else error (1 ,0 ,"unknown keyword %s" , argv[arg]); }
@@ -323,6 +336,7 @@ int del_addr(int fd, int pm_family, int argc, char *argv[])static void print_addr (struct rtattr *attrs,int len) {uint16_t family =0 ; +uint16_t port =0 ;char str[1024 ];uint32_t flags;uint8_t id;
@@ -330,12 +344,16 @@ static void print_addr(struct rtattr *attrs, int len)while (RTA_OK (attrs, len)) {if (attrs->rta_type ==MPTCP_PM_ADDR_ATTR_FAMILY )memcpy (&family,RTA_DATA (attrs),2 ); +if (attrs->rta_type ==MPTCP_PM_ADDR_ATTR_PORT ) +memcpy (&port,RTA_DATA (attrs),2 );if (attrs->rta_type ==MPTCP_PM_ADDR_ATTR_ADDR4 ) {if (family !=AF_INET )error (1 , errno,"wrong IP (v4) for family %d" , family);inet_ntop (AF_INET ,RTA_DATA (attrs), str,sizeof (str));printf ("%s" , str); +if (port) +printf (" %d" , port); }if (attrs->rta_type ==MPTCP_PM_ADDR_ATTR_ADDR6 ) {if (family !=AF_INET6 )
@@ -343,6 +361,8 @@ static void print_addr(struct rtattr *attrs, int len) family);inet_ntop (AF_INET6 ,RTA_DATA (attrs), str,sizeof (str));printf ("%s" , str); +if (port) +printf (" %d" , port); }if (attrs->rta_type ==MPTCP_PM_ADDR_ATTR_ID ) {memcpy (&id,RTA_DATA (attrs),1 );
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 12/13 mptcp: add the mibs for ADD_ADDR with port
This patch added the mibs for ADD_ADDR with port:
MPTCP_MIB_PORTADD for receiving of the ADD_ADDR suboption with a port number. MPTCP_MIB_PORTSYNRX, MPTCP_MIB_PORTSYNACKRX, MPTCP_MIB_PORTACKRX, for receiving of the MP_JOIN's SYN or SYN/ACK or ACK with a port number which is different from the msk's port number.
--- net/mptcp/mib.c | 4 ++++ net/mptcp/mib.h | 4 ++++ net/mptcp/options.c | 4 ++++ net/mptcp/subflow.c | 3 +++ 4 files changed, 15 insertions(+)
net/mptcp/mib.c +4 -0
@@ -29,6 +29,10 @@ static const struct snmp_mib mptcp_snmp_list[] = {SNMP_MIB_ITEM ("DuplicateData" ,MPTCP_MIB_DUPDATA ),SNMP_MIB_ITEM ("AddAddr" ,MPTCP_MIB_ADDADDR ),SNMP_MIB_ITEM ("EchoAdd" ,MPTCP_MIB_ECHOADD ), +SNMP_MIB_ITEM ("PortAdd" ,MPTCP_MIB_PORTADD ), +SNMP_MIB_ITEM ("PortSynRx" ,MPTCP_MIB_PORTSYNRX ), +SNMP_MIB_ITEM ("PortSynAckRx" ,MPTCP_MIB_PORTSYNACKRX ), +SNMP_MIB_ITEM ("PortAckRx" ,MPTCP_MIB_PORTACKRX ),SNMP_MIB_ITEM ("RmAddr" ,MPTCP_MIB_RMADDR ),SNMP_MIB_ITEM ("RmSubflow" ,MPTCP_MIB_RMSUBFLOW ),SNMP_MIB_SENTINEL
net/mptcp/mib.h +4 -0
@@ -22,6 +22,10 @@ enum linux_mptcp_mib_field {MPTCP_MIB_DUPDATA ,/* Segments discarded due to duplicate DSS */ MPTCP_MIB_ADDADDR ,/* Received ADD_ADDR with echo-flag=0 */ MPTCP_MIB_ECHOADD ,/* Received ADD_ADDR with echo-flag=1 */ +MPTCP_MIB_PORTADD ,/* Received ADD_ADDR with port */ +MPTCP_MIB_PORTSYNRX ,/* Received a SYN + MP_JOIN with port */ +MPTCP_MIB_PORTSYNACKRX ,/* Received a SYN/ACK + MP_JOIN with port */ +MPTCP_MIB_PORTACKRX ,/* Received an ACK + MP_JOIN with port */ MPTCP_MIB_RMADDR ,/* Received RM_ADDR */ MPTCP_MIB_RMSUBFLOW ,/* Remove a subflow */ __MPTCP_MIB_MAX
net/mptcp/options.c +4 -0
@@ -955,6 +955,10 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb)mptcp_pm_del_add_timer (msk, &addr);MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_ECHOADD ); } + +if (mp_opt.port) +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_PORTADD ); + mp_opt.add_addr =0 ; }
net/mptcp/subflow.c +3 -0
@@ -196,6 +196,7 @@ static void subflow_init_req(struct request_sock *req, subflow_req->mp_join =0 ;return ; } +SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_PORTSYNRX ); } } }
@@ -374,6 +375,7 @@ static void subflow_finish_connect(struct sock *sk, const struct sk_buff *skb)pr_debug ("synack inet_dport=%d %d" ,ntohs (inet_sk (sk)->inet_dport),ntohs (inet_sk (parent)->inet_dport)); +MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_PORTSYNACKRX ); } }else if (mptcp_check_fallback (sk)) { fallback:
@@ -644,6 +646,7 @@ static struct sock *subflow_syn_recv_sock(const struct sock *sk, ntohs(inet_sk((struct sock *)owner)->inet_sport));if (!mptcp_pm_sport_in_anno_list (owner, sk)) goto out; +SUBFLOW_REQ_INC_STATS (req,MPTCP_MIB_PORTACKRX ); } } }
Signature · 1 line
2.26.2
Geliang Tang
PATCH v4 13/13 selftests: mptcp: add testcases for ADD_ADDR with port
This patch added a new argument for run_tests. When an address with a port number has been added, the new port number will be passed to this with_port argument, and then passed to do_transfer.
In do_transfer, if the with_port argument is set, we need to establish a new connection to listen for the new port. To make sure the peer can connect with it using the new port.
It checked the ADD_ADDR port related MIB counters in chk_add_nr, and added the testcases for ADD_ADDR with port.
The output looks like this:
24 signal address with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
25 subflow and signal with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
26 remove single address with port syn[ ok ] - synack[ ok ] - ack[ ok ]
add[ ok ] - echo [ ok ] - pt [ ok ] syn[ ok ] - synack[ ok ] - ack[ ok ]
rm [ ok ] - sf [ ok ]
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 103 +++++++++++++++++- 1 file changed, 101 insertions(+), 2 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_join.sh +101 -2
@@ -212,6 +212,7 @@ do_transfer() rm_nr_ns1="$7" rm_nr_ns2="$8" speed="$9" + with_port="${10}" port=$((10000+$TEST_COUNT)) TEST_COUNT=$((TEST_COUNT+1))
@@ -253,6 +254,11 @@ do_transfer() -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & spid=$! + if [ "$with_port" -gt 0 ];then + ip netns exec ${listener_ns} $mptcp_connect -t $timeout -l -p $with_port \ + -s ${srv_proto} ${local_addr} < "$sin" > "$sout" & + fi + sleep 1 if [ "$test_link_fail" -eq 0 ];then
@@ -348,6 +354,7 @@ run_tests() rm_nr_ns1="${5:-0}" rm_nr_ns2="${6:-0}" speed="${7:-fast}" + with_port="${8:-0}" lret=0 oldin=""
@@ -362,7 +369,7 @@ run_tests() fi do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \ - ${test_linkfail} ${rm_nr_ns1} ${rm_nr_ns2} ${speed} + ${test_linkfail} ${rm_nr_ns1} ${rm_nr_ns2} ${speed} ${with_port} lret=$? if [ "$test_linkfail" -eq 1 ];then
@@ -429,6 +436,10 @@ chk_add_nr() { local add_nr=$1 local echo_nr=$2 + local port_nr=${3:-0} + local syn_nr=$port_nr + local syn_ack_nr=$port_nr + local ack_nr=$port_nr local count local dump_stats
@@ -451,7 +462,55 @@ chk_add_nr() ret=1 dump_stats=1 else - echo "[ ok ]" + echo -n "[ ok ]" + fi + + if [ $port_nr -gt 0 ]; then + echo -n " - pt " + count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortAdd | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$port_nr" ]; then + echo "[fail] got $count ADD_ADDR[s] with port expected $port_nr" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + + printf "%-39s %s" " " "syn" + count=`ip netns exec $ns1 nstat -as | grep MPTcpExtPortSynRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$syn_nr" ]; then + echo "[fail] got $count JOIN[s] syn with port expected $syn_nr" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - synack" + count=`ip netns exec $ns2 nstat -as | grep MPTcpExtPortSynAckRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$syn_ack_nr" ]; then + echo "[fail] got $count JOIN[s] synack with port expected $syn_ack_nr" + ret=1 + dump_stats=1 + else + echo -n "[ ok ]" + fi + + echo -n " - ack" + count=`ip netns exec $ns1 nstat -as | grep MPTcpExtPortAckRx | awk '{print $2}'` + [ -z "$count" ] && count=0 + if [ "$count" != "$ack_nr" ]; then + echo "[fail] got $count JOIN[s] ack with port expected $ack_nr" + ret=1 + dump_stats=1 + else + echo "[ ok ]" + fi + else + echo "" fi if [ "${dump_stats}" = 1 ]; then
@@ -717,6 +776,46 @@ chk_join_nr "remove subflow and signal IPv6" 2 2 2 chk_add_nr 1 1 chk_rm_nr 1 1 +# signal address with port +reset +ip netns exec $ns1 ./pm_nl_ctl limits 0 1 +ip netns exec $ns2 ./pm_nl_ctl limits 1 1 +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 +run_tests $ns1 $ns2 10.0.1.1 0 0 0 fast 10100 +chk_join_nr "signal address with port" 1 1 1 +chk_add_nr 1 1 1 + +# subflow and signal with port +reset +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 +ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +ip netns exec $ns2 ./pm_nl_ctl limits 1 2 +ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +run_tests $ns1 $ns2 10.0.1.1 0 0 0 fast 10100 +chk_join_nr "subflow and signal with port" 2 2 2 +chk_add_nr 1 1 1 + +# single address with port, remove +reset +ip netns exec $ns1 ./pm_nl_ctl limits 0 1 +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 +ip netns exec $ns2 ./pm_nl_ctl limits 1 1 +run_tests $ns1 $ns2 10.0.1.1 0 1 0 slow 10100 +chk_join_nr "remove single address with port" 1 1 1 +chk_add_nr 1 1 1 +chk_rm_nr 0 0 + +# subflow and signal with port, remove +reset +ip netns exec $ns1 ./pm_nl_ctl limits 0 2 +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal port 10100 +ip netns exec $ns2 ./pm_nl_ctl limits 1 2 +ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow +run_tests $ns1 $ns2 10.0.1.1 0 1 1 slow 10100 +chk_join_nr "remove subflow and signal with port" 2 2 2 +chk_add_nr 1 1 1 +chk_rm_nr 1 1 + # single subflow, syncookies reset_with_cookies ip netns exec $ns1 ./pm_nl_ctl limits 0 1
Signature · 1 line
2.26.2
Mat Martineau
Quoted 3 lines · Geliang Tang
v4:
- holdmsk->pm.lockinmptcp_pm_sport_in_anno_list.
- Merge the patchset 'Squash to "ADD_ADDR: ports support v3"' into v4.
Thanks for the fixes in v4. In last week's meeting there was a conversation about this patch series and the best way to handle additional ports. I think it will be good to talk about that some more this week and how to coordinate that with merging the series to the export branch and (later) net-next.
Mat
Quoted 38 lines
v3:
- add two new patches, 8 and 11
- add moreIS_ENABLED(CONFIG_MPTCP_IPV6)in patch 2
- defineTCPOLEN_MPTCP_ADD_ADDR_HMACin patch 4
- add flags check in patch 10
- update the testcasesv2:
- change mptcp_out_options's port field in CPU bype order.
- keep mptcp_options_received's port field in CPU bype order.
- add two new patches to simplifyADD_ADDRsuboption writing.
- updatemptcp_add_addr_lenhelper use adding up size.
- add more commit messages.v1:
This series is the first version ofADD_ADDRports support. I have solved the listener problem which I mentioned at the meeting on 15th of October by adding a new listening socket from the userspace (see patch 8). Up to now this patchset works well.Geliang Tang (13):
mptcp: unifyADD_ADDRand echo suboptions writing
mptcp: unifyADD_ADDRandADD_ADDR6suboptions writing
mptcp: add port support forADD_ADDRsuboption writing
mptcp: use adding up size to getADD_ADDRlength
mptcp: add the outgoingADD_ADDRport support
mptcp: send out dedicated packet forADD_ADDRusing port
mptcp: add port parameter formptcp_pm_announce_addr
mptcp: print out port and ahmac when receivingADD_ADDR
mptcp: add port number check forMP_JOIN
mptcp: deal withMPTCP_PM_ADDR_ATTR_PORTin PM netlink
selftests: mptcp: add port argument forpm_nl_ctl
mptcp: add the mibs forADD_ADDRwith port
selftests: mptcp: add testcases forADD_ADDRwith port
Quoted 18 lines
include/net/mptcp.h | 1 + net/mptcp/mib.c | 4 + net/mptcp/mib.h | 4 + net/mptcp/options.c | 107 +++++++++++------- net/mptcp/pm.c | 14 ++- net/mptcp/pm_netlink.c | 46 +++++++- net/mptcp/protocol.h | 38 +++++-- net/mptcp/subflow.c | 37 ++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 103 ++++++++++++++++- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +++- 10 files changed, 313 insertions(+), 65 deletions(-)Signature · 4 lines
2.26.2 _______________________________________________ mptcp mailing list -- mptcp(a)lists.01.org To unsubscribe send an email to mptcp-leave(a)lists.01.org
--
Mat Martineau
Intel
Geliang Tang
Hi Mat & Matt,
Quoted 8 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2020年11月12日周四 上午9:49写道:
Quoted 3 lines · Geliang Tang
v4:
- holdmsk->pm.lockinmptcp_pm_sport_in_anno_list.
- Merge the patchset 'Squash to "ADD_ADDR: ports support v3"' into v4.
Quoted 6 lines
Thanks for the fixes in v4. In last week's meeting there was a conversation about this patch series and the best way to handle additional ports. I think it will be good to talk about that some more this week and how to coordinate that with merging the series to the export branch and (later) net-next.
Hi Mat & Matt,
I want to split this patchset into two parts.
Part 1, includes patch 1 to patch 8, is the basic for ADD_ADDR ports support. This part is ready for upstreaming. So please apply them into the export branch.
Part 2, includes patch 9 to patch 13, is for the testcases of ADD_ADDR ports support. This part still needs to be improved, like adding the listening socket in the kernel space. I'll send out the new iteration of part 2 recently.
Thanks.
-Geliang
Quoted 64 lines
Mat
Quoted 50 lines
v3:
- add two new patches, 8 and 11
- add moreIS_ENABLED(CONFIG_MPTCP_IPV6)in patch 2
- defineTCPOLEN_MPTCP_ADD_ADDR_HMACin patch 4
- add flags check in patch 10
- update the testcasesv2:
- change mptcp_out_options's port field in CPU bype order.
- keep mptcp_options_received's port field in CPU bype order.
- add two new patches to simplifyADD_ADDRsuboption writing.
- updatemptcp_add_addr_lenhelper use adding up size.
- add more commit messages.v1:
This series is the first version ofADD_ADDRports support. I have solved the listener problem which I mentioned at the meeting on 15th of October by adding a new listening socket from the userspace (see patch 8). Up to now this patchset works well.Geliang Tang (13):
mptcp: unifyADD_ADDRand echo suboptions writing
mptcp: unifyADD_ADDRandADD_ADDR6suboptions writing
mptcp: add port support forADD_ADDRsuboption writing
mptcp: use adding up size to getADD_ADDRlength
mptcp: add the outgoingADD_ADDRport support
mptcp: send out dedicated packet forADD_ADDRusing port
mptcp: add port parameter formptcp_pm_announce_addr
mptcp: print out port and ahmac when receivingADD_ADDR
mptcp: add port number check forMP_JOIN
mptcp: deal withMPTCP_PM_ADDR_ATTR_PORTin PM netlink
selftests: mptcp: add port argument forpm_nl_ctl
mptcp: add the mibs forADD_ADDRwith port
selftests: mptcp: add testcases forADD_ADDRwith portinclude/net/mptcp.h | 1 + net/mptcp/mib.c | 4 + net/mptcp/mib.h | 4 + net/mptcp/options.c | 107 +++++++++++------- net/mptcp/pm.c | 14 ++- net/mptcp/pm_netlink.c | 46 +++++++- net/mptcp/protocol.h | 38 +++++-- net/mptcp/subflow.c | 37 ++++++ .../testing/selftests/net/mptcp/mptcp_join.sh | 103 ++++++++++++++++- tools/testing/selftests/net/mptcp/pm_nl_ctl.c | 24 +++- 10 files changed, 313 insertions(+), 65 deletions(-)Quoted 6 lines
--
2.26.2
_______________________________________________
mptcp mailing list -- mptcp(a)lists.01.org
To unsubscribe send an email to mptcp-leave(a)lists.01.org--
Mat Martineau
Intel
Matthieu Baerts
Hi Geliang,
Quoted 17 lines · Geliang Tang
Hi Mat & Matt,
Quoted 6 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2020年11月12日周四 上午9:49写道:
Quoted 3 lines · Geliang Tang
v4:
- holdmsk->pm.lockinmptcp_pm_sport_in_anno_list.
- Merge the patchset 'Squash to "ADD_ADDR: ports support v3"' into v4.Quoted 6 lines
Thanks for the fixes in v4. In last week's meeting there was a conversation about this patch series and the best way to handle additional ports. I think it will be good to talk about that some more this week and how to coordinate that with merging the series to the export branch and (later) net-next.
Quoted 7 lines
Hi Mat & Matt,
I want to split this patchset into two parts.
Part 1, includes patch 1 to patch 8, is the basic for
ADD_ADDRports support. This part is ready for upstreaming. So please apply them into the export branch.
Sounds good to me!
Thanks for these patches and the reviews!
I just applied them and add Mat's Reviewed-by tag (I hope I understood that correctly!).
- 931436e108bf: mptcp: unify ADD_ADDR and echo suboptions writing
- 67250a067f8f: mptcp: unify ADD_ADDR and ADD_ADDR6 suboptions writing
- 11881df9755f: mptcp: add port support for ADD_ADDR suboption writing
- 883c4aba78f1: mptcp: use adding up size to get ADD_ADDR length
- 5e04f8ac0a3d: mptcp: add the outgoing ADD_ADDR port support
- e58558aaa818: mptcp: send out dedicated packet for ADD_ADDR using port
- 79a30ba7de53: mptcp: add port parameter for mptcp_pm_announce_addr
- 485ad0ee9ca9: mptcp: print out port and ahmac when receiving ADD_ADDR
- Results: 9d1f3055c580..3c06d194dc8b
Tests + export are in progress!
Quoted 4 lines
Part 2, includes patch 9 to patch 13, is for the testcases of
ADD_ADDRports support. This part still needs to be improved, like adding the listening socket in the kernel space. I'll send out the new iteration of part 2 recently.
Thanks for that!
Cheers,
Matt
Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions www.tessares.net