RM_ADDR: remove a list of addrs
Subsystems (3)
Geliang Tang
v5 cover RM_ADDR: remove a list of addrs
v5:
- use struct mptcp_rm_list instead of the ids array.
- simplify mptcp_pm_remove_addrs_and_subflows.
- apply: tag export/20210207T062839 + patchset "move to next addr and
testcases".
v4:
- use MAX_ADDR_ID as the default value in the rm_ids array.
- keep the free_list and pass it to mptcp_nl_remove_addrs_list.
- handle remove anno_addrs and subflows in one function.
v3:
- avoid looping twice in mptcp_write_options
- drop nr in mptcp_get_rm_ids_nr
- use rm_ids[0] in patch 1 and patch 3
- separate pm.rm_ids for incoming and outgoing
- tag: export/20210131T062218
v2:
- use an array of ids instead of a u64 map
- drop "mptcp: update the netlink event for rm_addr" in v1
- tag: export/20210131T062218
This patchset added the removing a list of addresses support for RM_ADDR. It addressed issue #140.
Geliang Tang (9):
mptcp: add rm_list in mptcp_out_options
mptcp: add rm_list_tx in mptcp_pm_data
mptcp: add rm_list in mptcp_options_received
mptcp: add rm_list_rx in mptcp_pm_data
mptcp: remove multi addresses in PM
mptcp: remove multi subflows in PM
mptcp: remove multi addresses and subflows in PM
mptcp: remove a list of addrs when flushing
selftests: mptcp: add testcases for removing addrs
include/net/mptcp.h | 9 +- net/mptcp/options.c | 49 +++++-- net/mptcp/pm.c | 29 ++-- net/mptcp/pm_netlink.c | 138 +++++++++++++----- net/mptcp/protocol.h | 17 ++- .../testing/selftests/net/mptcp/mptcp_join.sh | 35 +++++ 6 files changed, 205 insertions(+), 72 deletions(-)
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 1/9 mptcp: add rm_list in mptcp_out_options
This patch defined a new struct mptcp_rm_list, the ids field was an array of the removing address ids, the nr field was the valid number of removing address ids in the array. The array size was definced as a new macro MPTCP_RM_IDS_MAX. Changed the member rm_id of struct mptcp_out_options to rm_list.
In mptcp_established_options_rm_addr, invoked mptcp_pm_rm_addr_signal to get the rm_list. According the number of addresses in it, calculated the padded RM_ADDR suboption length. And saved the ids array in struct mptcp_out_options's rm_list member.
In mptcp_write_options, iterated each address id from struct mptcp_out_options's rm_list member, set the invalid ones as TCPOPT_NOP, then filled them into the RM_ADDR suboption.
Changed TCPOLEN_MPTCP_RM_ADDR_BASE from 4 to 3.
--- include/net/mptcp.h | 9 ++++++++- net/mptcp/options.c | 37 +++++++++++++++++++++++++++++-------- net/mptcp/pm.c | 4 ++-- net/mptcp/protocol.h | 4 ++-- 4 files changed, 41 insertions(+), 13 deletions(-)
include/net/mptcp.h +8 -1
@@ -34,6 +34,13 @@ struct mptcp_ext {/* one byte hole */ }; +#define MPTCP_RM_IDS_MAX 8 + +struct mptcp_rm_list { +u8 ids[MPTCP_RM_IDS_MAX ]; +u8 nr; +}; +struct mptcp_out_options {#if IS_ENABLED (CONFIG_MPTCP )u16 suboptions;
@@ -48,7 +55,7 @@ struct mptcp_out_options {u8 addr_id;u16 port;u64 ahmac; -u8 rm_id; +struct mptcp_rm_list rm_list;u8 join_id;u8 backup;u32 nonce;
net/mptcp/options.c +29 -8
@@ -671,20 +671,27 @@ static bool mptcp_established_options_rm_addr(struct sock *sk, {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);struct mptcp_sock *msk =mptcp_sk (subflow->conn); -u8 rm_id; +struct mptcp_rm_list rm_list; +u8 i, align;if (!mptcp_pm_should_rm_signal (msk) || - !(mptcp_pm_rm_addr_signal (msk, remaining, &rm_id))) + !(mptcp_pm_rm_addr_signal (msk, remaining, &rm_list)))return false; -if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE ) +if (rm_list.nr >1 ) + align =5 ; +if (rm_list.nr >5 ) + align =9 ; + +if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE + align)return false; - *size =TCPOLEN_MPTCP_RM_ADDR_BASE ; + *size =TCPOLEN_MPTCP_RM_ADDR_BASE + align; opts->suboptions |=OPTION_MPTCP_RM_ADDR ; - opts->rm_id = rm_id; + opts->rm_list = rm_list; -pr_debug ("rm_id=%d" , opts->rm_id); +for (i =0 ; i < opts->rm_list.nr; i++) +pr_debug ("rm_list_ids[%d]=%d" , i, opts->rm_list.ids[i]);return true; }
@@ -1213,9 +1220,23 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, }if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { +u8 i; + +for (i = opts->rm_list.nr; i <MPTCP_RM_IDS_MAX ; i++) + opts->rm_list.ids[i] =TCPOPT_NOP ; *ptr++ =mptcp_option (MPTCPOPT_RM_ADDR , -TCPOLEN_MPTCP_RM_ADDR_BASE , -0 , opts->rm_id); +TCPOLEN_MPTCP_RM_ADDR_BASE + opts->rm_list.nr, +0 , opts->rm_list.ids[0 ]); +if (opts->rm_list.nr >1 ) { +put_unaligned_be32 (opts->rm_list.ids[1 ] <<24 | opts->rm_list.ids[2 ] <<16 | + opts->rm_list.ids[3 ] <<8 | opts->rm_list.ids[4 ], ptr); + ptr +=1 ; + } +if (opts->rm_list.nr >5 ) { +put_unaligned_be32 (opts->rm_list.ids[5 ] <<24 | opts->rm_list.ids[6 ] <<16 | + opts->rm_list.ids[7 ] <<8 |TCPOPT_NOP , ptr); + ptr +=1 ; + } }if (OPTION_MPTCP_PRIO & opts->suboptions) {
net/mptcp/pm.c +2 -2
@@ -273,7 +273,7 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, }bool mptcp_pm_rm_addr_signal (struct mptcp_sock *msk,unsigned int remaining, -u8 *rm_id) +struct mptcp_rm_list *rm_list) {int ret = false;
@@ -286,7 +286,7 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE ) goto out_unlock; - *rm_id = msk->pm.rm_id; + rm_list->ids[0 ] = msk->pm.rm_id;WRITE_ONCE (msk->pm.addr_signal,0 ); ret = true;
net/mptcp/protocol.h +2 -2
@@ -60,7 +60,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_RM_ADDR_BASE 4 +#define TCPOLEN_MPTCP_RM_ADDR_BASE 3#define TCPOLEN_MPTCP_PRIO 3#define TCPOLEN_MPTCP_PRIO_ALIGN 4#define TCPOLEN_MPTCP_FASTCLOSE 12
@@ -722,7 +722,7 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)bool mptcp_pm_add_addr_signal (struct mptcp_sock *msk,unsigned int remaining,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); +struct mptcp_rm_list *rm_list);int mptcp_pm_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);void __init mptcp_pm_nl_init (void );
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 2/9 mptcp: add rm_list_tx in mptcp_pm_data
This patch added a new member rm_list_tx for struct mptcp_pm_data as the removing address list on the outgoing direction. Initialize its nr field to zero in mptcp_pm_data_init.
In mptcp_pm_remove_anno_addr, put the single address id into an removing list, and passed it to mptcp_pm_remove_addr.
In mptcp_pm_remove_addr, save the input rm_list to rm_list_tx in struct mptcp_pm_data.
--- net/mptcp/pm.c | 10 +++++----- net/mptcp/pm_netlink.c | 5 ++++- net/mptcp/protocol.h | 3 ++- 3 files changed, 11 insertions(+), 7 deletions(-)
net/mptcp/pm.c +5 -5
@@ -39,18 +39,18 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,return 0 ; } -int mptcp_pm_remove_addr (struct mptcp_sock *msk,u8 local_id) +int mptcp_pm_remove_addr (struct mptcp_sock *msk,struct mptcp_rm_list rm_list) {u8 rm_addr =READ_ONCE (msk->pm.addr_signal); -pr_debug ("msk=%p, local_id=%d" , msk, local_id); +pr_debug ("msk=%p, rm_list_nr=%d" , msk, rm_list.nr);if (rm_addr) {pr_warn ("addr_signal error, rm_addr=%d" , rm_addr);return -EINVAL ; } - msk->pm.rm_id = local_id; + msk->pm.rm_list_tx = rm_list; rm_addr |=BIT (MPTCP_RM_ADDR_SIGNAL );WRITE_ONCE (msk->pm.addr_signal, rm_addr);return 0 ;
@@ -286,7 +286,7 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE ) goto out_unlock; - rm_list->ids[0 ] = msk->pm.rm_id; + *rm_list = msk->pm.rm_list_tx;WRITE_ONCE (msk->pm.addr_signal,0 ); ret = true;
@@ -306,7 +306,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk) msk->pm.add_addr_accepted =0 ; msk->pm.local_addr_used =0 ; msk->pm.subflows =0 ; - msk->pm.rm_id =0 ; + msk->pm.rm_list_tx.nr =0 ;WRITE_ONCE (msk->pm.work_pending, false);WRITE_ONCE (msk->pm.addr_signal,0 );WRITE_ONCE (msk->pm.accept_addr, false);
net/mptcp/pm_netlink.c +4 -1
@@ -1080,12 +1080,15 @@ static bool mptcp_pm_remove_anno_addr(struct mptcp_sock *msk, struct mptcp_addr_info *addr, bool force) { +struct mptcp_rm_list list = { .nr =0 };bool ret; + list.ids[list.nr++] = addr->id; + ret =remove_anno_list_by_saddr (msk, addr);if (ret || force) {spin_lock_bh (&msk->pm.lock); -mptcp_pm_remove_addr (msk, addr->id); +mptcp_pm_remove_addr (msk, list);spin_unlock_bh (&msk->pm.lock); }return ret;
net/mptcp/protocol.h +2 -1
@@ -207,6 +207,7 @@ struct mptcp_pm_data {u8 local_addr_used;u8 subflows;u8 status; +struct mptcp_rm_list rm_list_tx;u8 rm_id; };
@@ -672,7 +673,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 port); -int mptcp_pm_remove_addr (struct mptcp_sock *msk,u8 local_id); +int mptcp_pm_remove_addr (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);int mptcp_pm_remove_subflow (struct mptcp_sock *msk,u8 local_id); void mptcp_event(enum mptcp_event_type type, const struct mptcp_sock *msk,
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 3/9 mptcp: add rm_list in mptcp_options_received
This patch changed the member rm_id in struct mptcp_options_received as a list of the removing address ids, and renamed it to rm_list.
In mptcp_parse_option, parsed the RM_ADDR suboption and filled them into the rm_list in struct mptcp_options_received.
In mptcp_incoming_options, passed this rm_list to the function mptcp_pm_rm_addr_received.
It alse changed the parameter type of mptcp_pm_rm_addr_received.
--- net/mptcp/options.c | 12 ++++++++---- net/mptcp/pm.c | 10 ++++++---- net/mptcp/protocol.h | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-)
net/mptcp/options.c +8 -4
@@ -26,6 +26,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,int expected_opsize;u8 version;u8 flags; +u8 i;switch (subtype) {case MPTCPOPT_MP_CAPABLE :
@@ -272,14 +273,17 @@ static void mptcp_parse_option(const struct sk_buff *skb,break ;case MPTCPOPT_RM_ADDR : -if (opsize !=TCPOLEN_MPTCP_RM_ADDR_BASE ) +if (opsize <TCPOLEN_MPTCP_RM_ADDR_BASE +1 || + opsize >TCPOLEN_MPTCP_RM_ADDR_BASE +MPTCP_RM_IDS_MAX )break ; ptr++; mp_opt->rm_addr =1 ; - mp_opt->rm_id = *ptr++; -pr_debug ("RM_ADDR: id=%d" , mp_opt->rm_id); + mp_opt->rm_list.nr = opsize -TCPOLEN_MPTCP_RM_ADDR_BASE ; +for (i =0 ; i < mp_opt->rm_list.nr; i++) + mp_opt->rm_list.ids[i] = *ptr++; +pr_debug ("RM_ADDR: rm_list_nr=%d" , mp_opt->rm_list.nr);break ;case MPTCPOPT_MP_PRIO :
@@ -1041,7 +1045,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) }if (mp_opt.rm_addr) { -mptcp_pm_rm_addr_received (msk, mp_opt.rm_id); +mptcp_pm_rm_addr_received (msk, mp_opt.rm_list); mp_opt.rm_addr =0 ; }
net/mptcp/pm.c +6 -4
@@ -220,17 +220,19 @@ void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_SEND_ACK ); } -void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,u8 rm_id) +void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list) {struct mptcp_pm_data *pm = &msk->pm; +u8 i; -pr_debug ("msk=%p remote_id=%d" , msk, rm_id); +pr_debug ("msk=%p remote_ids_nr=%d" , msk, rm_list.nr); -mptcp_event_addr_removed (msk, rm_id); +for (i =0 ; i < rm_list.nr; i++) +mptcp_event_addr_removed (msk, rm_list.ids[i]);spin_lock_bh (&pm->lock);mptcp_pm_schedule_work (msk,MPTCP_PM_RM_ADDR_RECEIVED ); - pm->rm_id = rm_id; + pm->rm_id = rm_list.ids[0 ];spin_unlock_bh (&pm->lock); }
net/mptcp/protocol.h +2 -2
@@ -141,7 +141,7 @@ struct mptcp_options_received { mpc_map:1 , __unused:2;u8 addr_id; -u8 rm_id; +struct mptcp_rm_list rm_list;union {struct in_addr addr;#if IS_ENABLED (CONFIG_MPTCP_IPV6 )
@@ -656,7 +656,7 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);void mptcp_pm_add_addr_received (struct mptcp_sock *msk,const struct mptcp_addr_info *addr);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_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup); int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, struct mptcp_addr_info *addr,
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 4/9 mptcp: add rm_list_rx in mptcp_pm_data
This patch added a new member rm_list_rx for struct mptcp_pm_data as an list of the removing address ids on the incoming direction. Initialized its nr field to zero in mptcp_pm_data_init.
In mptcp_pm_rm_addr_received, set it as the input rm_list.
--- net/mptcp/pm.c | 3 ++- net/mptcp/protocol.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
net/mptcp/pm.c +2 -1
@@ -232,7 +232,7 @@ void mptcp_pm_rm_addr_received(struct mptcp_sock *msk, struct mptcp_rm_list rm_lspin_lock_bh (&pm->lock);mptcp_pm_schedule_work (msk,MPTCP_PM_RM_ADDR_RECEIVED ); - pm->rm_id = rm_list.ids[0 ]; + pm->rm_list_rx = rm_list;spin_unlock_bh (&pm->lock); }
@@ -309,6 +309,7 @@ void mptcp_pm_data_init(struct mptcp_sock *msk) msk->pm.local_addr_used =0 ; msk->pm.subflows =0 ; msk->pm.rm_list_tx.nr =0 ; + msk->pm.rm_list_rx.nr =0 ;WRITE_ONCE (msk->pm.work_pending, false);WRITE_ONCE (msk->pm.addr_signal,0 );WRITE_ONCE (msk->pm.accept_addr, false);
net/mptcp/protocol.h +1 -0
@@ -208,6 +208,7 @@ struct mptcp_pm_data {u8 subflows;u8 status;struct mptcp_rm_list rm_list_tx; +struct mptcp_rm_list rm_list_rx;u8 rm_id; };
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 5/9 mptcp: remove multi addresses in PM
This patch dropped the member rm_id of struct mptcp_pm_data. Use rm_list_rx in mptcp_pm_nl_rm_addr_received instead of using rm_id.
In mptcp_pm_nl_rm_addr_received, iterated each address id from pm.rm_list_rx, then shut down and closed each address id's subsocket.
--- net/mptcp/pm_netlink.c | 36 ++++++++++++++++++++---------------- net/mptcp/protocol.h | 1 - 2 files changed, 20 insertions(+), 17 deletions(-)
net/mptcp/pm_netlink.c +20 -16
@@ -575,36 +575,40 @@ static void mptcp_pm_nl_rm_addr_received(struct mptcp_sock *msk) {struct mptcp_subflow_context *subflow, *tmp;struct sock *sk = (struct sock *)msk; +u8 i; -pr_debug ("address rm_id %d" , msk->pm.rm_id); +pr_debug ("address rm_list_nr %d" , msk->pm.rm_list_rx.nr);msk_owned_by_me (msk); -if (!msk->pm.rm_id) +if (!msk->pm.rm_list_rx.nr)return ;if (list_empty (&msk->conn_list))return ; -list_for_each_entry_safe (subflow, tmp, &msk->conn_list, node) { -struct sock *ssk =mptcp_subflow_tcp_sock (subflow); -int how =RCV_SHUTDOWN |SEND_SHUTDOWN ; +for (i =0 ; i < msk->pm.rm_list_rx.nr; i++) { +list_for_each_entry_safe (subflow, tmp, &msk->conn_list, node) { +struct sock *ssk =mptcp_subflow_tcp_sock (subflow); +int how =RCV_SHUTDOWN |SEND_SHUTDOWN ; -if (msk->pm.rm_id != subflow->remote_id) -continue ; +if (msk->pm.rm_list_rx.ids[i] != subflow->remote_id) +continue ; -spin_unlock_bh (&msk->pm.lock); -mptcp_subflow_shutdown (sk, ssk, how); -mptcp_close_ssk (sk, ssk, subflow); -spin_lock_bh (&msk->pm.lock); +pr_debug (" -> address rm_list_ids[%d]=%u" , i, msk->pm.rm_list_rx.ids[i]); +spin_unlock_bh (&msk->pm.lock); +mptcp_subflow_shutdown (sk, ssk, how); +mptcp_close_ssk (sk, ssk, subflow); +spin_lock_bh (&msk->pm.lock); - msk->pm.add_addr_accepted--; - msk->pm.subflows--; -WRITE_ONCE (msk->pm.accept_addr, true); + msk->pm.add_addr_accepted--; + msk->pm.subflows--; +WRITE_ONCE (msk->pm.accept_addr, true); -__MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_RMADDR ); +__MPTCP_INC_STATS (sock_net (sk),MPTCP_MIB_RMADDR ); -break ; +break ; + } } }
net/mptcp/protocol.h +0 -1
@@ -209,7 +209,6 @@ struct mptcp_pm_data {u8 status;struct mptcp_rm_list rm_list_tx;struct mptcp_rm_list rm_list_rx; -u8 rm_id; };struct mptcp_data_frag {
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 6/9 mptcp: remove multi subflows in PM
This patch dealt with removing multi subflows in PM:
In mptcp_pm_remove_subflow, changed the input parameter local_id as an list of removing address ids, and passed the list to mptcp_pm_nl_rm_subflow_received.
In mptcp_pm_nl_rm_subflow_received, iterated each address id from the received ids list. Then shut down and closed each address id's subsocket.
In mptcp_nl_remove_subflow_and_signal_addr, put the single address id into an ids list, and passed it to mptcp_pm_remove_subflow.
--- net/mptcp/pm.c | 6 +++--- net/mptcp/pm_netlink.c | 41 ++++++++++++++++++++++++----------------- net/mptcp/protocol.h | 4 ++-- 3 files changed, 29 insertions(+), 22 deletions(-)
net/mptcp/pm.c +3 -3
@@ -56,12 +56,12 @@ int mptcp_pm_remove_addr(struct mptcp_sock *msk, struct mptcp_rm_list rm_list)return 0 ; } -int mptcp_pm_remove_subflow (struct mptcp_sock *msk,u8 local_id) +int mptcp_pm_remove_subflow (struct mptcp_sock *msk,struct mptcp_rm_list rm_list) { -pr_debug ("msk=%p, local_id=%d" , msk, local_id); +pr_debug ("msk=%p, rm_list_nr=%d" , msk, rm_list.nr);spin_lock_bh (&msk->pm.lock); -mptcp_pm_nl_rm_subflow_received (msk, local_id); +mptcp_pm_nl_rm_subflow_received (msk, rm_list);spin_unlock_bh (&msk->pm.lock);return 0 ; }
net/mptcp/pm_netlink.c +24 -17
79 lines not on this page · raw message
net/mptcp/protocol.h +2 -2
@@ -674,7 +674,7 @@ int mptcp_pm_announce_addr(struct mptcp_sock *msk,const struct mptcp_addr_info *addr, bool echo, bool port);int mptcp_pm_remove_addr (struct mptcp_sock *msk,struct mptcp_rm_list rm_list); -int mptcp_pm_remove_subflow (struct mptcp_sock *msk,u8 local_id); +int mptcp_pm_remove_subflow (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);void mptcp_event (enum mptcp_event_type type,const struct mptcp_sock *msk,const struct sock *ssk,gfp_t gfp);
@@ -729,7 +729,7 @@ int mptcp_pm_get_local_id(struct mptcp_sock *msk, struct sock_common *skc);void __init mptcp_pm_nl_init (void );void mptcp_pm_nl_data_init (struct mptcp_sock *msk);void mptcp_pm_nl_work (struct mptcp_sock *msk); -void mptcp_pm_nl_rm_subflow_received (struct mptcp_sock *msk,u8 rm_id); +void mptcp_pm_nl_rm_subflow_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);int mptcp_pm_nl_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);unsigned int mptcp_pm_get_add_addr_signal_max (struct mptcp_sock *msk);unsigned int mptcp_pm_get_add_addr_accept_max (struct mptcp_sock *msk);
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 7/9 mptcp: remove multi addresses and subflows in PM
This patch implemented the function to remove a list of addresses and subflows, named mptcp_nl_remove_addrs_list, which had a input parameter rm_list as the removing addresses list.
In mptcp_nl_remove_addrs_list, traverse all the existing msk sockets to invoke mptcp_pm_remove_addrs_and_subflows to remove a list of addresses for each msk socket.
In mptcp_pm_remove_addrs_and_subflows, traverse all the addresses in the removing addresses list, to find whether this address is in the conn_list or anno_list. If it is, put the address ID into the removing address list or the removing subflow list, and pass the two lists to mptcp_pm_remove_addr and mptcp_pm_remove_subflow.
--- net/mptcp/pm_netlink.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
net/mptcp/pm_netlink.c +48 -0
@@ -1208,6 +1208,54 @@ static int mptcp_nl_cmd_del_addr(struct sk_buff *skb, struct genl_info *info)return ret; } +static void mptcp_pm_remove_addrs_and_subflows (struct mptcp_sock *msk, +struct list_head *rm_list) +{ +struct mptcp_rm_list alist = { .nr =0 }, slist = { .nr =0 }; +struct mptcp_pm_addr_entry *entry; + +list_for_each_entry (entry, rm_list, list) { +if (lookup_subflow_by_saddr (&msk->conn_list, &entry->addr) && + alist.nr <MPTCP_RM_IDS_MAX && + slist.nr <MPTCP_RM_IDS_MAX ) { + alist.ids[alist.nr++] = entry->addr.id; + slist.ids[slist.nr++] = entry->addr.id; + }else if (remove_anno_list_by_saddr (msk, &entry->addr) && + alist.nr <MPTCP_RM_IDS_MAX ) { + alist.ids[alist.nr++] = entry->addr.id; + } + } + +if (alist.nr) { +spin_lock_bh (&msk->pm.lock); +mptcp_pm_remove_addr (msk, alist); +spin_unlock_bh (&msk->pm.lock); + } +if (slist.nr) +mptcp_pm_remove_subflow (msk, slist); +} + +static void mptcp_nl_remove_addrs_list (struct net *net, +struct list_head *rm_list) +{ +long s_slot =0 , s_num =0 ; +struct mptcp_sock *msk; + +if (list_empty (rm_list)) +return ; + +while ((msk =mptcp_token_iter_next (net, &s_slot, &s_num)) !=NULL ) { +struct sock *sk = (struct sock *)msk; + +lock_sock (sk); +mptcp_pm_remove_addrs_and_subflows (msk, rm_list); +release_sock (sk); + +sock_put (sk); +cond_resched (); + } +} +static void __flush_addrs (struct net *net,struct list_head *list) {while (!list_empty (list)) {
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 8/9 mptcp: remove a list of addrs when flushing
This patch invoked mptcp_nl_remove_addrs_list to remove a list of addresses when the netlink flushes addresses, instead of using mptcp_nl_remove_subflow_and_signal_addr to remove them one by one.
And dropped the unused parameter net in __flush_addrs too.
--- net/mptcp/pm_netlink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
net/mptcp/pm_netlink.c +4 -4
@@ -1256,14 +1256,13 @@ static void mptcp_nl_remove_addrs_list(struct net *net, } } -static void __flush_addrs (struct net *net,struct list_head *list) +static void __flush_addrs (struct list_head *list) {while (!list_empty (list)) {struct mptcp_pm_addr_entry *cur; cur =list_entry (list->next, struct mptcp_pm_addr_entry, list); -mptcp_nl_remove_subflow_and_signal_addr (net, &cur->addr);list_del_rcu (&cur->list);mptcp_pm_free_addr_entry (cur); }
@@ -1288,7 +1287,8 @@ static int mptcp_nl_cmd_flush_addrs(struct sk_buff *skb, struct genl_info *info) pernet->next_id =1 ;bitmap_zero (pernet->id_bitmap,MAX_ADDR_ID +1 );spin_unlock_bh (&pernet->lock); -__flush_addrs (sock_net (skb->sk), &free_list); +mptcp_nl_remove_addrs_list (sock_net (skb->sk), &free_list); +__flush_addrs (&free_list);return 0 ; }
@@ -1885,7 +1885,7 @@ static void __net_exit pm_nl_exit_net(struct list_head *net_list)/* net is removed from namespace list, can't race with * other modifiers */ -__flush_addrs (net, &pernet->local_addr_list); +__flush_addrs (&pernet->local_addr_list); } }
Signature · 1 line
2.29.2
Geliang Tang
PATCH v5 9/9 selftests: mptcp: add testcases for removing addrs
This patch added the testcases for removing a list of addresses. Used the netlink to flush the addresses in the testcases.
--- .../testing/selftests/net/mptcp/mptcp_join.sh | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+)
tools/testing/selftests/net/mptcp/mptcp_join.sh +35 -0
@@ -936,6 +936,41 @@ remove_tests() chk_join_nr "flush subflows and signal" 3 3 3 chk_add_nr 1 1 chk_rm_nr 2 2 + + # subflows flush + reset + ip netns exec $ns1 ./pm_nl_ctl limits 3 3 + ip netns exec $ns2 ./pm_nl_ctl limits 3 3 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow id 150 + ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow + ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow + run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow + chk_join_nr "flush subflows" 3 3 3 + chk_rm_nr 3 3 + + # addresses flush + reset + ip netns exec $ns1 ./pm_nl_ctl limits 3 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal id 250 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal + ip netns exec $ns1 ./pm_nl_ctl add 10.0.4.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 3 3 + run_tests $ns1 $ns2 10.0.1.1 0 -8 -8 slow + chk_join_nr "flush addresses" 3 3 3 + chk_add_nr 3 3 + chk_rm_nr 3 3 invert + + # invalid addresses flush + reset + ip netns exec $ns1 ./pm_nl_ctl limits 3 3 + ip netns exec $ns1 ./pm_nl_ctl add 10.0.12.1 flags signal + ip netns exec $ns1 ./pm_nl_ctl add 10.0.3.1 flags signal + ip netns exec $ns1 ./pm_nl_ctl add 10.0.14.1 flags signal + ip netns exec $ns2 ./pm_nl_ctl limits 3 3 + run_tests $ns1 $ns2 10.0.1.1 0 -8 0 slow + chk_join_nr "flush invalid addresses" 1 1 1 + chk_add_nr 3 3 + chk_rm_nr 3 1 invert } add_tests()
Signature · 1 line
2.29.2
Mat Martineau
[MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 3/9] mptcp: add rm_list in mptcp_options_received
In reply to Geliang TangQuoted 75 lines · Geliang Tang
This patch changed the member
rm_idin structmptcp_options_receivedas a list of the removing address ids, and renamed it torm_list.In
mptcp_parse_option, parsed theRM_ADDRsuboption and filled them into therm_listin structmptcp_options_received.In
mptcp_incoming_options, passed thisrm_listto the functionmptcp_pm_rm_addr_received.It alse changed the parameter type of
mptcp_pm_rm_addr_received.Signed-off-by Geliang Tang <geliangtang(a)gmail.com>---
net/mptcp/options.c | 12 ++++++++---- net/mptcp/pm.c | 10 ++++++---- net/mptcp/protocol.h | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-)net/mptcp/options.c +8
-4@@ -26,6 +26,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,int expected_opsize;u8 version;u8 flags; +u8 i;switch (subtype) {case MPTCPOPT_MP_CAPABLE :@@ -272,14 +273,17 @@ static void mptcp_parse_option(const struct sk_buff *skb,break ;case MPTCPOPT_RM_ADDR : -if (opsize !=TCPOLEN_MPTCP_RM_ADDR_BASE ) +if (opsize <TCPOLEN_MPTCP_RM_ADDR_BASE +1 || + opsize >TCPOLEN_MPTCP_RM_ADDR_BASE +MPTCP_RM_IDS_MAX )break ; ptr++; mp_opt->rm_addr =1 ; - mp_opt->rm_id = *ptr++; -pr_debug ("RM_ADDR: id=%d" , mp_opt->rm_id); + mp_opt->rm_list.nr = opsize -TCPOLEN_MPTCP_RM_ADDR_BASE ; +for (i =0 ; i < mp_opt->rm_list.nr; i++) + mp_opt->rm_list.ids[i] = *ptr++; +pr_debug ("RM_ADDR: rm_list_nr=%d" , mp_opt->rm_list.nr);break ;case MPTCPOPT_MP_PRIO :@@ -1041,7 +1045,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) }if (mp_opt.rm_addr) { -mptcp_pm_rm_addr_received (msk, mp_opt.rm_id); +mptcp_pm_rm_addr_received (msk, mp_opt.rm_list); mp_opt.rm_addr =0 ; }net/mptcp/pm.c +2
-2@@ -220,17 +220,19 @@ void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_SEND_ACK ); } -void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,u8 rm_id) +void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list) {struct mptcp_pm_data *pm = &msk->pm; +u8 i; -pr_debug ("msk=%p remote_id=%d" , msk, rm_id);
net/mptcp/pm.c void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk) · line 235
Quoted 10 lines
net/mptcp/pm.c +4
-2+pr_debug ("msk=%p remote_ids_nr=%d" , msk, rm_list.nr); -mptcp_event_addr_removed (msk, rm_id); +for (i =0 ; i < rm_list.nr; i++) +mptcp_event_addr_removed (msk, rm_list.ids[i]);spin_lock_bh (&pm->lock);mptcp_pm_schedule_work (msk,MPTCP_PM_RM_ADDR_RECEIVED ); - pm->rm_id = rm_id; + pm->rm_id = rm_list.ids[0 ];
Need to set rm_list.nr here too.
Quoted 27 lines
net/mptcp/pm.c +0
-0spin_unlock_bh (&pm->lock); }net/mptcp/protocol.h +2
-2@@ -141,7 +141,7 @@ struct mptcp_options_received { mpc_map:1 , __unused:2;u8 addr_id; -u8 rm_id; +struct mptcp_rm_list rm_list;union {struct in_addr addr;#if IS_ENABLED (CONFIG_MPTCP_IPV6 )@@ -656,7 +656,7 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);void mptcp_pm_add_addr_received (struct mptcp_sock *msk,const struct mptcp_addr_info *addr);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_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup); int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, struct mptcp_addr_info *addr,Signature · 1 line
2.29.2
--
Mat Martineau
Intel
Geliang Tang
[MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 3/9] mptcp: add rm_list in mptcp_options_received
Hi Mat,
Thanks for your reviews.
Quoted 84 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年2月9日周二 上午9:51写道:
Quoted 81 lines · Geliang Tang
This patch changed the member
rm_idin structmptcp_options_receivedas a list of the removing address ids, and renamed it torm_list.In
mptcp_parse_option, parsed theRM_ADDRsuboption and filled them into therm_listin structmptcp_options_received.In
mptcp_incoming_options, passed thisrm_listto the functionmptcp_pm_rm_addr_received.It alse changed the parameter type of
mptcp_pm_rm_addr_received.Signed-off-by Geliang Tang <geliangtang(a)gmail.com>---
net/mptcp/options.c | 12 ++++++++---- net/mptcp/pm.c | 10 ++++++---- net/mptcp/protocol.h | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-)net/mptcp/options.c +8
-4@@ -26,6 +26,7 @@ static void mptcp_parse_option(const struct sk_buff *skb,int expected_opsize;u8 version;u8 flags; +u8 i;switch (subtype) {case MPTCPOPT_MP_CAPABLE :@@ -272,14 +273,17 @@ static void mptcp_parse_option(const struct sk_buff *skb,break ;case MPTCPOPT_RM_ADDR : -if (opsize !=TCPOLEN_MPTCP_RM_ADDR_BASE ) +if (opsize <TCPOLEN_MPTCP_RM_ADDR_BASE +1 || + opsize >TCPOLEN_MPTCP_RM_ADDR_BASE +MPTCP_RM_IDS_MAX )break ; ptr++; mp_opt->rm_addr =1 ; - mp_opt->rm_id = *ptr++; -pr_debug ("RM_ADDR: id=%d" , mp_opt->rm_id); + mp_opt->rm_list.nr = opsize -TCPOLEN_MPTCP_RM_ADDR_BASE ; +for (i =0 ; i < mp_opt->rm_list.nr; i++) + mp_opt->rm_list.ids[i] = *ptr++; +pr_debug ("RM_ADDR: rm_list_nr=%d" , mp_opt->rm_list.nr);break ;case MPTCPOPT_MP_PRIO :@@ -1041,7 +1045,7 @@ void mptcp_incoming_options(struct sock *sk, struct sk_buff *skb) }if (mp_opt.rm_addr) { -mptcp_pm_rm_addr_received (msk, mp_opt.rm_id); +mptcp_pm_rm_addr_received (msk, mp_opt.rm_list); mp_opt.rm_addr =0 ; }net/mptcp/pm.c +5
-3@@ -220,17 +220,19 @@ void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk)mptcp_pm_schedule_work (msk,MPTCP_PM_ADD_ADDR_SEND_ACK ); } -void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,u8 rm_id) +void mptcp_pm_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list) {struct mptcp_pm_data *pm = &msk->pm; +u8 i; -pr_debug ("msk=%p remote_id=%d" , msk, rm_id); +pr_debug ("msk=%p remote_ids_nr=%d" , msk, rm_list.nr); -mptcp_event_addr_removed (msk, rm_id); +for (i =0 ; i < rm_list.nr; i++) +mptcp_event_addr_removed (msk, rm_list.ids[i]);
Quoted 7 lines
net/mptcp/pm.c void mptcp_pm_add_addr_send_ack(struct mptcp_sock *msk) · line 235
Quoted 4 lines
net/mptcp/pm.c +1
-1spin_lock_bh (&pm->lock);mptcp_pm_schedule_work (msk,MPTCP_PM_RM_ADDR_RECEIVED ); - pm->rm_id = rm_id; + pm->rm_id = rm_list.ids[0 ];Need to set rm_list.nr here too.
I think no need to set rm_list.nr here, I only set it in patch 1 in v6.
-Geliang
Quoted 31 lines
Quoted 26 lines
net/mptcp/pm.c +0
-0spin_unlock_bh (&pm->lock); }net/mptcp/protocol.h +2
-3@@ -141,7 +141,7 @@ struct mptcp_options_received { mpc_map:1 , __unused:2;u8 addr_id; -u8 rm_id; +struct mptcp_rm_list rm_list;union {struct in_addr addr;#if IS_ENABLED (CONFIG_MPTCP_IPV6 )@@ -656,7 +656,7 @@ void mptcp_pm_subflow_closed(struct mptcp_sock *msk, u8 id);void mptcp_pm_add_addr_received (struct mptcp_sock *msk,const struct mptcp_addr_info *addr);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_rm_addr_received (struct mptcp_sock *msk,struct mptcp_rm_list rm_list);void mptcp_pm_mp_prio_received (struct sock *sk,u8 bkup); int mptcp_pm_nl_mp_prio_send_ack(struct mptcp_sock *msk, struct mptcp_addr_info *addr, --Quoted 1 line
2.29.2
--
Mat Martineau
Intel
Mat Martineau
[MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 1/9] mptcp: add rm_list in mptcp_out_options
In reply to Geliang TangQuoted 130 lines · Geliang Tang
This patch defined a new struct
mptcp_rm_list, the ids field was an array of the removing address ids, the nr field was the valid number of removing address ids in the array. The array size was definced as a new macroMPTCP_RM_IDS_MAX. Changed the memberrm_idof structmptcp_out_optionstorm_list.In
mptcp_established_options_rm_addr, invokedmptcp_pm_rm_addr_signalto get therm_list. According the number of addresses in it, calculated the paddedRM_ADDRsuboption length. And saved the ids array in struct mptcp_out_options'srm_listmember.In
mptcp_write_options, iterated each address id from struct mptcp_out_options'srm_listmember, set the invalid ones asTCPOPT_NOP, then filled them into theRM_ADDRsuboption.Changed
TCPOLEN_MPTCP_RM_ADDR_BASEfrom 4 to 3.Signed-off-by Geliang Tang <geliangtang(a)gmail.com>---
include/net/mptcp.h | 9 ++++++++- net/mptcp/options.c | 37 +++++++++++++++++++++++++++++-------- net/mptcp/pm.c | 4 ++-- net/mptcp/protocol.h | 4 ++-- 4 files changed, 41 insertions(+), 13 deletions(-)include/net/mptcp.h +8
-1@@ -34,6 +34,13 @@ struct mptcp_ext {/* one byte hole */ }; +#define MPTCP_RM_IDS_MAX 8 + +struct mptcp_rm_list { +u8 ids[MPTCP_RM_IDS_MAX ]; +u8 nr; +}; +struct mptcp_out_options {#if IS_ENABLED (CONFIG_MPTCP )u16 suboptions;@@ -48,7 +55,7 @@ struct mptcp_out_options {u8 addr_id;u16 port;u64 ahmac; -u8 rm_id; +struct mptcp_rm_list rm_list;u8 join_id;u8 backup;u32 nonce;net/mptcp/options.c +29
-8@@ -671,20 +671,27 @@ static bool mptcp_established_options_rm_addr(struct sock *sk, {struct mptcp_subflow_context *subflow =mptcp_subflow_ctx (sk);struct mptcp_sock *msk =mptcp_sk (subflow->conn); -u8 rm_id; +struct mptcp_rm_list rm_list; +u8 i, align;if (!mptcp_pm_should_rm_signal (msk) || - !(mptcp_pm_rm_addr_signal (msk, remaining, &rm_id))) + !(mptcp_pm_rm_addr_signal (msk, remaining, &rm_list)))return false; -if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE ) +if (rm_list.nr >1 ) + align =5 ; +if (rm_list.nr >5 ) + align =9 ; + +if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE + align)return false; - *size =TCPOLEN_MPTCP_RM_ADDR_BASE ; + *size =TCPOLEN_MPTCP_RM_ADDR_BASE + align; opts->suboptions |=OPTION_MPTCP_RM_ADDR ; - opts->rm_id = rm_id; + opts->rm_list = rm_list; -pr_debug ("rm_id=%d" , opts->rm_id); +for (i =0 ; i < opts->rm_list.nr; i++) +pr_debug ("rm_list_ids[%d]=%d" , i, opts->rm_list.ids[i]);return true; }@@ -1213,9 +1220,23 @@ void mptcp_write_options(__be32 *ptr, const struct tcp_sock *tp, }if (OPTION_MPTCP_RM_ADDR & opts->suboptions) { +u8 i; + +for (i = opts->rm_list.nr; i <MPTCP_RM_IDS_MAX ; i++) + opts->rm_list.ids[i] =TCPOPT_NOP ; *ptr++ =mptcp_option (MPTCPOPT_RM_ADDR , -TCPOLEN_MPTCP_RM_ADDR_BASE , -0 , opts->rm_id); +TCPOLEN_MPTCP_RM_ADDR_BASE + opts->rm_list.nr, +0 , opts->rm_list.ids[0 ]); +if (opts->rm_list.nr >1 ) { +put_unaligned_be32 (opts->rm_list.ids[1 ] <<24 | opts->rm_list.ids[2 ] <<16 | + opts->rm_list.ids[3 ] <<8 | opts->rm_list.ids[4 ], ptr); + ptr +=1 ; + } +if (opts->rm_list.nr >5 ) { +put_unaligned_be32 (opts->rm_list.ids[5 ] <<24 | opts->rm_list.ids[6 ] <<16 | + opts->rm_list.ids[7 ] <<8 |TCPOPT_NOP , ptr); + ptr +=1 ; + } }if (OPTION_MPTCP_PRIO & opts->suboptions) {net/mptcp/pm.c +1
-1@@ -273,7 +273,7 @@ bool mptcp_pm_add_addr_signal(struct mptcp_sock *msk, unsigned int remaining, }bool mptcp_pm_rm_addr_signal (struct mptcp_sock *msk,unsigned int remaining, -u8 *rm_id) +struct mptcp_rm_list *rm_list) {int ret = false;
net/mptcp/pm.c bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining, · line 289
Quoted 5 lines
net/mptcp/pm.c +1
-1@@ -286,7 +286,7 @@ bool mptcp_pm_rm_addr_signal(struct mptcp_sock *msk, unsigned int remaining,if (remaining <TCPOLEN_MPTCP_RM_ADDR_BASE ) goto out_unlock; - *rm_id = msk->pm.rm_id; + rm_list->ids[0 ] = msk->pm.rm_id;
Also need:
rm_list->nr = 1;
Quoted 27 lines
net/mptcp/pm.c +0
-0WRITE_ONCE (msk->pm.addr_signal,0 ); ret = true;net/mptcp/protocol.h +2
-2@@ -60,7 +60,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_RM_ADDR_BASE 4 +#define TCPOLEN_MPTCP_RM_ADDR_BASE 3#define TCPOLEN_MPTCP_PRIO 3#define TCPOLEN_MPTCP_PRIO_ALIGN 4#define TCPOLEN_MPTCP_FASTCLOSE 12@@ -722,7 +722,7 @@ static inline unsigned int mptcp_add_addr_len(int family, bool echo, bool port)bool mptcp_pm_add_addr_signal (struct mptcp_sock *msk,unsigned int remaining,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); +struct mptcp_rm_list *rm_list);int mptcp_pm_get_local_id (struct mptcp_sock *msk,struct sock_common *skc);void __init mptcp_pm_nl_init (void );Signature · 1 line
2.29.2
--
Mat Martineau
Intel
Mat Martineau
Quoted 6 lines · Geliang Tang
v5:
- use structmptcp_rm_listinstead of the ids array.
- simplifymptcp_pm_remove_addrs_and_subflows.
- apply: tag export/20210207T062839 + patchset "move to next addr and testcases".
Thanks Geliang!
I only had a couple of minor comments doing visual code review, they affect individual patches but not the final code. That's all I saw in visual code review, I will look at the test output and pcaps tomorrow.
Have you tested what happens if there's an incoming rm_addr with id 0, since we never send an ADD_ADDR for the initial subflow?
--
Mat Martineau
Intel
Geliang Tang
Hi Mat,
Thanks for your reviews.
Quoted 11 lines · Mat Martineau <mathew.j.martineau(a)linux.intel.com> 于2021年2月9日周二 上午9:57写道:
Quoted 6 lines · Geliang Tang
v5:
- use structmptcp_rm_listinstead of the ids array.
- simplifymptcp_pm_remove_addrs_and_subflows.
- apply: tag export/20210207T062839 + patchset "move to next addr and testcases".
Quoted 8 lines
Thanks Geliang!
I only had a couple of minor comments doing visual code review, they affect individual patches but not the final code. That's all I saw in visual code review, I will look at the test output and pcaps tomorrow.
Have you tested what happens if there's an incoming
rm_addrwith id 0, since we never send anADD_ADDRfor the initial subflow?
Id 0 is still not support in this removing address version, since we only use this code to shutdown and close the subsocket in mptcp_pm_nl_rm_addr_received/mptcp_pm_nl_rm_subflow_received:
mptcp_subflow_shutdown(sk, ssk, how);
mptcp_close_ssk(sk, ssk, subflow);It's problematic to use them to shutdown and close the initial subflow.
I think we need to use something like:
mptcp_shutdown(sk, how);
mptcp_close(sk, timeout);to deal with the initial subflow, but it doesn't work too. It will take me some time to solve it.
-Geliang
Quoted 4 lines
--
Mat Martineau
Intel