From b6157d8e03e1e780660a328f7183bcbfa4a93a19 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Wed, 24 Oct 2007 15:59:16 -0400 Subject: SCTP: Fix difference cases of retransmit. Commit d0ce92910bc04e107b2f3f2048f07e94f570035d broke several retransmit cases including fast retransmit. The reason is that we should only delay by rto while doing retranmists as a result of a timeout. Retransmit as a result of path mtu discover, fast retransmit, or other evernts that should trigger immidiate retransmissions got broken. Also, since rto is doubled prior to marking of packets elegable for retransmission, we never marked correct chunks anyway. The fix is provide a reason for a given retransmission so that we can mark chunks appropriately and to save the old rto value to do comparisons against. All regressions tests passed with this code. Spotted by Wei Yongjun Signed-off-by: Vlad Yasevich --- include/net/sctp/command.h | 1 + include/net/sctp/constants.h | 1 + include/net/sctp/sctp.h | 1 + include/net/sctp/structs.h | 5 +++-- 4 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include/net') diff --git a/include/net/sctp/command.h b/include/net/sctp/command.h index b8733364557..c1f79767357 100644 --- a/include/net/sctp/command.h +++ b/include/net/sctp/command.h @@ -103,6 +103,7 @@ typedef enum { SCTP_CMD_ASSOC_CHANGE, /* generate and send assoc_change event */ SCTP_CMD_ADAPTATION_IND, /* generate and send adaptation event */ SCTP_CMD_ASSOC_SHKEY, /* generate the association shared keys */ + SCTP_CMD_T1_RETRAN, /* Mark for retransmission after T1 timeout */ SCTP_CMD_LAST } sctp_verb_t; diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index da8354e8e33..73fbdf6a24f 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h @@ -407,6 +407,7 @@ typedef enum { SCTP_RTXR_T3_RTX, SCTP_RTXR_FAST_RTX, SCTP_RTXR_PMTUD, + SCTP_RTXR_T1_RTX, } sctp_retransmit_reason_t; /* Reasons to lower cwnd. */ diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 93eb708609e..70827305f50 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -267,6 +267,7 @@ enum SCTP_MIB_T5_SHUTDOWN_GUARD_EXPIREDS, SCTP_MIB_DELAY_SACK_EXPIREDS, SCTP_MIB_AUTOCLOSE_EXPIREDS, + SCTP_MIB_T1_RETRANSMITS, SCTP_MIB_T3_RETRANSMITS, SCTP_MIB_PMTUD_RETRANSMITS, SCTP_MIB_FAST_RETRANSMITS, diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index ef892e00c83..482c2aab3d6 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -873,10 +873,11 @@ struct sctp_transport { * address list derived from the INIT or INIT ACK chunk, a * number of data elements needs to be maintained including: */ - __u32 rtt; /* This is the most recent RTT. */ - /* RTO : The current retransmission timeout value. */ unsigned long rto; + unsigned long last_rto; + + __u32 rtt; /* This is the most recent RTT. */ /* RTTVAR : The current RTT variation. */ __u32 rttvar; -- cgit v1.2.3 From 0ed90fb0f668fd07f14ae2007a809e8b26cd27a6 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Wed, 24 Oct 2007 16:10:00 -0400 Subject: SCTP: Update RCU handling during the ADD-IP case After learning more about rcu, it looks like the ADD-IP hadling doesn't need to call call_rcu_bh. All the rcu critical sections use rcu_read_lock, so using call_rcu_bh is wrong here. Now, restore the local_bh_disable() code blocks and use normal call_rcu() calls. Also restore the missing return statement. Signed-off-by: Vlad Yasevich --- include/net/sctp/structs.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'include/net') diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 482c2aab3d6..a1770174062 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1185,9 +1185,7 @@ int sctp_bind_addr_copy(struct sctp_bind_addr *dest, int flags); int sctp_add_bind_addr(struct sctp_bind_addr *, union sctp_addr *, __u8 use_as_src, gfp_t gfp); -int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *, - void fastcall (*rcu_call)(struct rcu_head *, - void (*func)(struct rcu_head *))); +int sctp_del_bind_addr(struct sctp_bind_addr *, union sctp_addr *); int sctp_bind_addr_match(struct sctp_bind_addr *, const union sctp_addr *, struct sctp_sock *); union sctp_addr *sctp_find_unmatch_addr(struct sctp_bind_addr *bp, -- cgit v1.2.3 From 88799fe5ec65fad1d5cb1d4dc5d8f78edb949f1c Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Wed, 24 Oct 2007 17:24:23 -0400 Subject: SCTP: Correctly disable ADD-IP when AUTH is not supported. Signed-off-by: Vlad Yasevich --- include/net/sctp/structs.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net') diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index a1770174062..41f1039186d 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -1540,7 +1540,6 @@ struct sctp_association { __u8 asconf_capable; /* Does peer support ADDIP? */ __u8 prsctp_capable; /* Can peer do PR-SCTP? */ __u8 auth_capable; /* Is peer doing SCTP-AUTH? */ - __u8 addip_capable; /* Can peer do ADD-IP */ __u32 adaptation_ind; /* Adaptation Code point. */ -- cgit v1.2.3 From 73d9c4fd1a6ec4950b2eac8135d35506bf400d6c Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Wed, 24 Oct 2007 17:24:26 -0400 Subject: SCTP: Allow ADD_IP to work with AUTH for backward compatibility. This patch adds a tunable that will allow ADD_IP to work without AUTH for backward compatibility. The default value is off since the default value for ADD_IP is off as well. People who need to use ADD-IP with older implementations take risks of connection hijacking and should consider upgrading or turning this tunable on. Signed-off-by: Vlad Yasevich --- include/net/sctp/structs.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/net') diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 41f1039186d..44f2672859e 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -212,6 +212,7 @@ extern struct sctp_globals { /* Flag to indicate if addip is enabled. */ int addip_enable; + int addip_noauth_enable; /* Flag to indicate if PR-SCTP is enabled. */ int prsctp_enable; @@ -249,6 +250,7 @@ extern struct sctp_globals { #define sctp_local_addr_list (sctp_globals.local_addr_list) #define sctp_local_addr_lock (sctp_globals.addr_list_lock) #define sctp_addip_enable (sctp_globals.addip_enable) +#define sctp_addip_noauth (sctp_globals.addip_noauth_enable) #define sctp_prsctp_enable (sctp_globals.prsctp_enable) #define sctp_auth_enable (sctp_globals.auth_enable) -- cgit v1.2.3 From d970dbf8455eb1b8cebd3cde6e18f73dd1b3ce38 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Fri, 9 Nov 2007 11:43:40 -0500 Subject: SCTP: Convert custom hash lists to use hlist. Convert the custom hash list traversals to use hlist functions. Signed-off-by: Vlad Yasevich --- include/net/sctp/sctp.h | 3 +++ include/net/sctp/structs.h | 10 ++++------ 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'include/net') diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 70827305f50..67c997cecf5 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -665,6 +665,9 @@ static inline int sctp_vtag_hashfn(__u16 lport, __u16 rport, __u32 vtag) return (h & (sctp_assoc_hashsize-1)); } +#define sctp_for_each_hentry(epb, node, head) \ + hlist_for_each_entry(epb, node, head, node) + /* Is a socket of this style? */ #define sctp_style(sk, style) __sctp_style((sk), (SCTP_SOCKET_##style)) static inline int __sctp_style(const struct sock *sk, sctp_socket_type_t style) diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 44f2672859e..eb3113c38a9 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h @@ -100,20 +100,19 @@ struct crypto_hash; struct sctp_bind_bucket { unsigned short port; unsigned short fastreuse; - struct sctp_bind_bucket *next; - struct sctp_bind_bucket **pprev; + struct hlist_node node; struct hlist_head owner; }; struct sctp_bind_hashbucket { spinlock_t lock; - struct sctp_bind_bucket *chain; + struct hlist_head chain; }; /* Used for hashing all associations. */ struct sctp_hashbucket { rwlock_t lock; - struct sctp_ep_common *chain; + struct hlist_head chain; } __attribute__((__aligned__(8))); @@ -1230,8 +1229,7 @@ typedef enum { struct sctp_ep_common { /* Fields to help us manage our entries in the hash tables. */ - struct sctp_ep_common *next; - struct sctp_ep_common **pprev; + struct hlist_node node; int hashent; /* Runtime type information. What kind of endpoint is this? */ -- cgit v1.2.3 From 7ab9080467040054e27ae54d67cc185f24d881ae Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Fri, 9 Nov 2007 11:43:41 -0500 Subject: SCTP: Make sctp_verify_param return multiple indications. SCTP-AUTH and future ADD-IP updates have a requirement to do additional verification of parameters and an ability to ABORT the association if verification fails. So, introduce additional return code so that we can clear signal a required action. Signed-off-by: Vlad Yasevich --- include/net/sctp/constants.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/net') diff --git a/include/net/sctp/constants.h b/include/net/sctp/constants.h index 73fbdf6a24f..f30b537d695 100644 --- a/include/net/sctp/constants.h +++ b/include/net/sctp/constants.h @@ -186,6 +186,8 @@ typedef enum { SCTP_IERROR_AUTH_BAD_HMAC, SCTP_IERROR_AUTH_BAD_KEYID, SCTP_IERROR_PROTO_VIOLATION, + SCTP_IERROR_ERROR, + SCTP_IERROR_ABORT, } sctp_ierror_t; -- cgit v1.2.3 From fa7ff654e14ccacd4e758c9878ff4884f816c877 Mon Sep 17 00:00:00 2001 From: Vlad Yasevich Date: Fri, 9 Nov 2007 11:43:41 -0500 Subject: SCTP: Clean-up some defines for regressions tests. Signed-off-by: Vlad Yasevich --- include/net/sctp/sctp.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include/net') diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h index 67c997cecf5..34318a33a94 100644 --- a/include/net/sctp/sctp.h +++ b/include/net/sctp/sctp.h @@ -65,7 +65,6 @@ #ifdef TEST_FRAME -#undef CONFIG_PROC_FS #undef CONFIG_SCTP_DBG_OBJCNT #undef CONFIG_SYSCTL #endif /* TEST_FRAME */ -- cgit v1.2.3