sctp: some cleanup and tiny fix for add/del ip
Subsystems (3)
cover sctp: some cleanup and tiny fix for add/del ip
Series of 8 patches against net-next-2.6, include some cleanup and tiny fix for add/del ip, which have been waiting on vlad's lksctp-dev tree for long times.
Shan Wei (5):
sctp: delete unused macro definition of sctp_chunk_is_control
sctp: fix the comment of sctp_sf_violation_paramlen()
sctp: use common head of addr parameter to access member in addr-unrelated code
sctp: kill abandoned SCTP_CMD_TRANSMIT command
sctp: use memdup_user to copy data from userspace
Vlad Yasevich (3):
sctp: teach CACC algorithm about removed transports
sctp: Allow bindx_del to accept 0 port.
sctp: Release all routes when processing acks ADD_IP or DEL_IP
include/net/sctp/command.h | 1 - include/net/sctp/constants.h | 1 - net/sctp/input.c | 2 +- net/sctp/outqueue.c | 11 ++++++++--- net/sctp/sm_make_chunk.c | 18 +++++++----------- net/sctp/sm_sideeffect.c | 6 ------ net/sctp/sm_statefuns.c | 5 +++-- net/sctp/socket.c | 28 +++++++++++----------------- 8 files changed, 30 insertions(+), 42 deletions(-)
PATCH 1/8 sctp: delete unused macro definition of sctp_chunk_is_control
The macro never be used.
And if needed, can use !sctp_chunk_is_data instead of.
--- include/net/sctp/constants.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/net/sctp/constants.h +0 -1
@@ -150,7 +150,6 @@ SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) -#define sctp_chunk_is_control (a) (a->chunk_hdr->type != SCTP_CID_DATA)#define sctp_chunk_is_data (a) (a->chunk_hdr->type = SCTP_CID_DATA)/* Calculate the actual data size in a data chunk */
Signature · 1 line
1.6.5.2
PATCH v2 1/8 sctp: delete unused macro definition of sctp_chunk_is_control
From: Shan Wei <[email protected]>
The macro never be used.
And if needed, can use !sctp_chunk_is_data instead of.
---
Sorry for missing 'From ...' in the first version
--- include/net/sctp/constants.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/net/sctp/constants.h +0 -1
@@ -150,7 +150,6 @@ SCTP_SUBTYPE_CONSTRUCTOR(OTHER, sctp_event_other_t, other) SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE, sctp_event_primitive_t, primitive) -#define sctp_chunk_is_control (a) (a->chunk_hdr->type != SCTP_CID_DATA)#define sctp_chunk_is_data (a) (a->chunk_hdr->type == SCTP_CID_DATA)/* Calculate the actual data size in a data chunk */
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 1/8 v2] sctp: delete unused macro definition of sctp_chunk_is_control
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:19:29 +0800
Quoted 8 lines
From: Shan Wei <[email protected]>
The macro never be used.
And if needed, can use !sctp_chunk_is_data instead of.Signed-off-by Shan Wei <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 2/8 sctp: fix the comment of sctp_sf_violation_paramlen()
In reply to Wei YongjunFrom: Shan Wei <[email protected]>
Update the comment about sctp_sf_violation_paramlen() to be more precise.
--- net/sctp/sm_statefuns.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
net/sctp/sm_statefuns.c +3 -2
@@ -4343,8 +4343,9 @@ static sctp_disposition_t sctp_sf_violation_chunklen(/* * Handle a protocol violation when the parameter length is invalid. -* "Invalid" length is identified as smaller than the minimal length a -* given parameter can be. +* If the length is smaller than the minimum length of a given parameter, +* or accumulated length in multi parameters exceeds the end of the chunk, +* the length is considered as invalid. */ static sctp_disposition_t sctp_sf_violation_paramlen( const struct sctp_endpoint *ep,
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 2/8] sctp: fix the comment of sctp_sf_violation_paramlen()
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:11:01 +0800
Quoted 8 lines
From: Shan Wei <[email protected]>
Update the comment about
sctp_sf_violation_paramlen()to be more precise.Signed-off-by Shan Wei <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 3/8 sctp: use common head of addr parameter to access member in addr-unrelated code
In reply to Wei YongjunFrom: Shan Wei <[email protected]>
The 'p' member of struct sctp_paramhdr is common part for IPv4 addr parameter and IPv6 addr parameter in union sctp_addr_param.
For addr-related code, use specified addr parameter. Otherwise, use common header to access type/length member.
--- net/sctp/input.c | 2 +- net/sctp/sm_make_chunk.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
net/sctp/input.c +1 -1
@@ -1017,7 +1017,7 @@ static struct sctp_association *__sctp_rcv_asconf_lookup(/* Skip over the ADDIP header and find the Address parameter */ param = (union sctp_addr_param *)(asconf +1 ); - af =sctp_get_af_specific (param_type2af (param->v4.param_hdr.type)); + af =sctp_get_af_specific (param_type2af (param->p.type));if (unlikely (!af))return NULL ;
net/sctp/sm_make_chunk.c +5 -5
@@ -2923,7 +2923,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc, asconf_param->param_hdr.type != SCTP_PARAM_SET_PRIMARY)return SCTP_ERROR_UNKNOWN_PARAM ; -switch (addr_param->v4.param_hdr.type) { +switch (addr_param->p.type) {case SCTP_PARAM_IPV6_ADDRESS :if (!asoc->peer.ipv6_address)return SCTP_ERROR_DNS_FAILED ;
@@ -2936,7 +2936,7 @@ static __be16 sctp_process_asconf_param(struct sctp_association *asoc,return SCTP_ERROR_DNS_FAILED ; } - af =sctp_get_af_specific (param_type2af (addr_param->v4.param_hdr.type)); + af =sctp_get_af_specific (param_type2af (addr_param->p.type));if (unlikely (!af))return SCTP_ERROR_DNS_FAILED ;
@@ -3100,7 +3100,7 @@ struct sctp_chunk *sctp_process_asconf(struct sctp_association *asoc,/* Skip the address parameter and store a pointer to the first * asconf parameter. */ - length =ntohs (addr_param->v4.param_hdr.length); + length =ntohs (addr_param->p.length); asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); chunk_len -= length;
@@ -3177,7 +3177,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc, ((void *)asconf_param +sizeof (sctp_addip_param_t));/* We have checked the packet before, so we do not check again. */ - af =sctp_get_af_specific (param_type2af (addr_param->v4.param_hdr.type)); + af =sctp_get_af_specific (param_type2af (addr_param->p.type)); af->from_addr_param (&addr, addr_param,htons (bp->port),0 );switch (asconf_param->param_hdr.type) {
@@ -3304,7 +3304,7 @@ int sctp_process_asconf_ack(struct sctp_association *asoc,/* Skip the address parameter in the last asconf sent and store a * pointer to the first asconf parameter. */ - length =ntohs (addr_param->v4.param_hdr.length); + length =ntohs (addr_param->p.length); asconf_param = (sctp_addip_param_t *)((void *)addr_param + length); asconf_len -= length;
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 3/8] sctp: use common head of addr parameter to access member in addr-unrelated code
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:11:47 +0800
Quoted 11 lines
From: Shan Wei <[email protected]>
The 'p' member of struct
sctp_paramhdris common part for IPv4 addr parameter and IPv6 addr parameter in unionsctp_addr_param.For addr-related code, use specified addr parameter. Otherwise, use common header to access type/length member.
Signed-off-by Shan Wei <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 4/8 sctp: kill abandoned SCTP_CMD_TRANSMIT command
In reply to Wei YongjunFrom: Shan Wei <[email protected]>
Remove SCTP_CMD_TRANSMIT command as it never be used.
--- include/net/sctp/command.h | 1 - net/sctp/sm_sideeffect.c | 6 ------ 2 files changed, 0 insertions(+), 7 deletions(-)
include/net/sctp/command.h +0 -1
@@ -73,7 +73,6 @@ typedef enum {SCTP_CMD_INIT_FAILED ,/* High level, do init failure work. */ SCTP_CMD_REPORT_DUP ,/* Report a duplicate TSN. */ SCTP_CMD_STRIKE ,/* Mark a strike against a transport. */ -SCTP_CMD_TRANSMIT ,/* Transmit the outqueue. */ SCTP_CMD_HB_TIMERS_START ,/* Start the heartbeat timers. */ SCTP_CMD_HB_TIMER_UPDATE ,/* Update a heartbeat timers. */ SCTP_CMD_HB_TIMERS_STOP, /* Stop the heartbeat timers. */
net/sctp/sm_sideeffect.c +0 -6
@@ -1415,12 +1415,6 @@ static int sctp_cmd_interpreter(sctp_event_t event_type, SCTP_RTXR_T3_RTX);break ; -case SCTP_CMD_TRANSMIT : -/* Kick start transmission. */ - error =sctp_outq_uncork (&asoc->outqueue); - local_cork =0 ; -break ; -case SCTP_CMD_ECN_CE :/* Do delayed CE processing. */ sctp_do_ecn_ce_work (asoc, cmd->obj.u32);
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 4/8] sctp: kill abandoned SCTP_CMD_TRANSMIT command
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:12:40 +0800
Quoted 7 lines
From: Shan Wei <[email protected]>
Remove
SCTP_CMD_TRANSMITcommand as it never be used.Signed-off-by Shan Wei <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 5/8 sctp: use memdup_user to copy data from userspace
In reply to Wei YongjunFrom: Shan Wei <[email protected]>
Use common function to simply code.
--- net/sctp/socket.c | 22 ++++++---------------- 1 files changed, 6 insertions(+), 16 deletions(-)
net/sctp/socket.c +6 -16
@@ -3215,14 +3215,9 @@ static int sctp_setsockopt_hmac_ident(struct sock *sk,if (optlen <sizeof (struct sctp_hmacalgo ))return -EINVAL ; - hmacs =kmalloc (optlen,GFP_KERNEL ); -if (!hmacs) -return -ENOMEM ; - -if (copy_from_user (hmacs, optval, optlen)) { - err = -EFAULT ; - goto out; - } + hmacs=memdup_user (optval, optlen); +if (IS_ERR (hmacs)) +return PTR_ERR (hmacs); idents = hmacs->shmac_num_idents; if (idents = 0 || idents > SCTP_AUTH_NUM_HMACS ||
@@ -3257,14 +3252,9 @@ static int sctp_setsockopt_auth_key(struct sock *sk,if (optlen <=sizeof (struct sctp_authkey ))return -EINVAL ; - authkey =kmalloc (optlen,GFP_KERNEL ); -if (!authkey) -return -ENOMEM ; - -if (copy_from_user (authkey, optval, optlen)) { - ret = -EFAULT ; - goto out; - } + authkey=memdup_user (optval, optlen); +if (IS_ERR (authkey)) +return PTR_ERR (authkey);if (authkey->sca_keylength > optlen -sizeof (struct sctp_authkey )) { ret = -EINVAL ;
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 5/8] sctp: use memdup_user to copy data from userspace
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:13:18 +0800
Quoted 7 lines
From: Shan Wei <[email protected]>
Use common function to simply code.
Signed-off-by Shan Wei <[email protected]>Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 6/8 sctp: teach CACC algorithm about removed transports
In reply to Wei YongjunFrom: Vlad Yasevich <[email protected]>
When we have have to remove a transport due to ASCONF, we move the data to a new active path. This can trigger CACC algorithm to not mark that data as missing when SACKs arrive. This is because the transport passed to the CACC algorithm is the one this data is sitting on, not the one it was sent on (that one may be gone). So, by sending the original transport (even if it's NULL), we may start marking data as missing.
--- net/sctp/outqueue.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-)
net/sctp/outqueue.c +8 -3
@@ -131,7 +131,8 @@ static inline int sctp_cacc_skip_3_1_d(struct sctp_transport *primary,static inline int sctp_cacc_skip_3_1_f (struct sctp_transport *transport,int count_of_newacks) { -if (count_of_newacks <2 && !transport->cacc.cacc_saw_newack) +if (count_of_newacks <2 && + (transport && !transport->cacc.cacc_saw_newack))return 1 ;return 0 ; }
@@ -618,9 +619,12 @@ redo:/* If we are retransmitting, we should only * send a single packet. +* Otherwise, try appending this chunk again. */ if (rtx_timeout || fast_rtx) done =1 ; +else + goto redo;/* Bundle next chunk in the next round. */ break ;
@@ -1683,8 +1687,9 @@ static void sctp_mark_missing(struct sctp_outq *q,/* SFR-CACC may require us to skip marking * this chunk as missing. */ -if (!transport || !sctp_cacc_skip (primary, transport, - count_of_newacks, tsn)) { +if (!transport || !sctp_cacc_skip (primary, + chunk->transport, + count_of_newacks, tsn)) { chunk->tsn_missing_report++; SCTP_DEBUG_PRINTK(
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 6/8] sctp: teach CACC algorithm about removed transports
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:13:56 +0800
Quoted 10 lines
From: Vlad Yasevich <[email protected]>
When we have have to remove a transport due to ASCONF, we move the data to a new active path. This can trigger CACC algorithm to not mark that data as missing when SACKs arrive. This is because the transport passed to the CACC algorithm is the one this data is sitting on, not the one it was sent on (that one may be gone). So, by sending the original transport (even if it's NULL), we may start marking data as missing.
Quoted 2 lines
Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 7/8 sctp: Allow bindx_del to accept 0 port
In reply to Wei YongjunFrom: Vlad Yasevich <[email protected]>
We allow 0 port when adding new addresses. It only makes sence to allow 0 port when removing addresses. When removing the currently bound port will be used when the port in the address is set to 0.
--- net/sctp/socket.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)
net/sctp/socket.c +5 -1
@@ -658,11 +658,15 @@ static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) goto err_bindx_rem; } -if (sa_addr->v4.sin_port !=htons (bp->port)) { +if (sa_addr->v4.sin_port && + sa_addr->v4.sin_port !=htons (bp->port)) { retval = -EINVAL ; goto err_bindx_rem; } +if (!sa_addr->v4.sin_port) + sa_addr->v4.sin_port =htons (bp->port); +/* FIXME - There is probably a need to check if sk->sk_saddr and * sk->sk_rcv_addr are currently set to one of the addresses to * be removed. This is something which needs to be looked into
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 7/8] sctp: Allow bindx_del to accept 0 port
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:14:47 +0800
Quoted 9 lines
From: Vlad Yasevich <[email protected]>
We allow 0 port when adding new addresses. It only makes sence to allow 0 port when removing addresses. When removing the currently bound port will be used when the port in the address is set to 0.
Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
PATCH 8/8 sctp: Release all routes when processing acks ADD_IP or DEL_IP
In reply to Wei YongjunFrom: Vlad Yasevich <[email protected]>
When processing an ACK for ADD_IP parameter, we only release the routes on non-active transports. This can cause a wrong source address to be used. We can release the routes and cause new route lookups and source address selection so that new addresses can be used as source. Additionally, we don't need to lookup routes for all transports at the same time. We can let the transmit code path update the cached route when the transport actually sends something.
--- net/sctp/sm_make_chunk.c | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-)
net/sctp/sm_make_chunk.c +2 -6
@@ -3193,11 +3193,8 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,local_bh_enable ();list_for_each_entry (transport, &asoc->peer.transport_addr_list, transports) { -if (transport->state =SCTP_ACTIVE ) -continue ;dst_release (transport->dst); -sctp_transport_route (transport,NULL , -sctp_sk (asoc->base.sk)); + transport->dst =NULL ; }break ;case SCTP_PARAM_DEL_IP :
@@ -3207,8 +3204,7 @@ static void sctp_asconf_param_success(struct sctp_association *asoc,list_for_each_entry (transport, &asoc->peer.transport_addr_list, transports) {dst_release (transport->dst); -sctp_transport_route (transport,NULL , -sctp_sk (asoc->base.sk)); + transport->dst =NULL ; }break ;default :
Signature · 1 line
1.6.5.2
Re: [PATCH net-next-2.6 8/8] sctp: Release all routes when processing acks ADD_IP or DEL_IP
From: Wei Yongjun <[email protected]>
Date: Tue, 19 Apr 2011 13:15:22 +0800
Quoted 11 lines
From: Vlad Yasevich <[email protected]>
When processing an ACK for
ADD_IPparameter, we only release the routes on non-active transports. This can cause a wrong source address to be used. We can release the routes and cause new route lookups and source address selection so that new addresses can be used as source. Additionally, we don't need to lookup routes for all transports at the same time. We can let the transmit code path update the cached route when the transport actually sends something.
Quoted 2 lines
Signed-off-by Vlad Yasevich <[email protected]>Signed-off-by Wei Yongjun <[email protected]>
Applied.
Wei Yongjun wrote, at 04/19/2011 01:07 PM:
Quoted 3 lines
Series of 8 patches against net-next-2.6, include some cleanup and tiny fix for add/del ip, which have been waiting on vlad's lksctp-dev tree for long times.
Thanks for your job, and expect others.
Quoted 23 lines
Shan Wei (5):
sctp: delete unused macro definition ofsctp_chunk_is_control
sctp: fix the comment ofsctp_sf_violation_paramlen()
sctp: use common head of addr parameter to access member in addr-unrelated code
sctp: kill abandonedSCTP_CMD_TRANSMITcommand
sctp: usememdup_userto copy data from userspaceVlad Yasevich (3):
sctp: teach CACC algorithm about removed transports
sctp: Allowbindx_delto accept 0 port.
sctp: Release all routes when processing acksADD_IPorDEL_IPinclude/net/sctp/command.h | 1 - include/net/sctp/constants.h | 1 - net/sctp/input.c | 2 +- net/sctp/outqueue.c | 11 ++++++++--- net/sctp/sm_make_chunk.c | 18 +++++++----------- net/sctp/sm_sideeffect.c | 6 ------ net/sctp/sm_statefuns.c | 5 +++-- net/sctp/socket.c | 28 +++++++++++----------------- 8 files changed, 30 insertions(+), 42 deletions(-)
Signature · 3 lines
Best Regards ----- Shan Wei
Hi Wei Yongjun,
do you plan to send other patches, like "sctp: make sctp over IPv6 work with IPsec.", too?
Regards,
Nicolas
Le 19/04/2011 07:07, Wei Yongjun a écrit :
Quoted 31 lines
Series of 8 patches against net-next-2.6, include some cleanup and tiny fix for add/del ip, which have been waiting on vlad's lksctp-dev tree for long times.
Shan Wei (5):
sctp: delete unused macro definition ofsctp_chunk_is_control
sctp: fix the comment ofsctp_sf_violation_paramlen()
sctp: use common head of addr parameter to access member in addr-unrelated code
sctp: kill abandonedSCTP_CMD_TRANSMITcommand
sctp: usememdup_userto copy data from userspaceVlad Yasevich (3):
sctp: teach CACC algorithm about removed transports
sctp: Allowbindx_delto accept 0 port.
sctp: Release all routes when processing acksADD_IPorDEL_IPinclude/net/sctp/command.h | 1 - include/net/sctp/constants.h | 1 - net/sctp/input.c | 2 +- net/sctp/outqueue.c | 11 ++++++++--- net/sctp/sm_make_chunk.c | 18 +++++++----------- net/sctp/sm_sideeffect.c | 6 ------ net/sctp/sm_statefuns.c | 5 +++-- net/sctp/socket.c | 28 +++++++++++----------------- 8 files changed, 30 insertions(+), 42 deletions(-)--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 5 lines
Hi Wei Yongjun,
do you plan to send other patches, like "sctp: make sctp over IPv6 work with IPsec.", too?
Yes, I am doing this work now. And will commit those patch after backport to net-next-2.6 tree and testing.
Quoted 42 lines
Regards,
NicolasQuoted 31 lines · Wei Yongjun
Series of 8 patches against net-next-2.6, include some cleanup and tiny fix for add/del ip, which have been waiting on vlad's lksctp-dev tree for long times.
Shan Wei (5):
sctp: delete unused macro definition ofsctp_chunk_is_control
sctp: fix the comment ofsctp_sf_violation_paramlen()
sctp: use common head of addr parameter to access member in addr-unrelated code
sctp: kill abandonedSCTP_CMD_TRANSMITcommand
sctp: usememdup_userto copy data from userspaceVlad Yasevich (3):
sctp: teach CACC algorithm about removed transports
sctp: Allowbindx_delto accept 0 port.
sctp: Release all routes when processing acksADD_IPorDEL_IPinclude/net/sctp/command.h | 1 - include/net/sctp/constants.h | 1 - net/sctp/input.c | 2 +- net/sctp/outqueue.c | 11 ++++++++--- net/sctp/sm_make_chunk.c | 18 +++++++----------- net/sctp/sm_sideeffect.c | 6 ------ net/sctp/sm_statefuns.c | 5 +++-- net/sctp/socket.c | 28 +++++++++++----------------- 8 files changed, 30 insertions(+), 42 deletions(-)Signature · 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.htmlSignature · 3 lines
To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html