ipvs: drop SCTP connections depending on state
authorJulian Anastasov <ja@ssi.bg>
Tue, 18 Jun 2013 07:08:08 +0000 (10:08 +0300)
committerSimon Horman <horms@verge.net.au>
Wed, 26 Jun 2013 09:01:46 +0000 (18:01 +0900)
Drop SCTP connections under load (dropentry context) depending
on the protocol state, just like for TCP: INIT conns are
dropped immediately, established are dropped randomly while
connections in progress or shutdown are skipped.

Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
net/netfilter/ipvs/ip_vs_conn.c

index c8c52a98590ba43ffd97f26a7689650384fd95ca..4c8e5c0aa1aba96b03fae69ce153056a10bb7b95 100644 (file)
@@ -1231,6 +1231,18 @@ void ip_vs_random_dropentry(struct net *net)
                                default:
                                        continue;
                                }
+                       } else if (cp->protocol == IPPROTO_SCTP) {
+                               switch (cp->state) {
+                               case IP_VS_SCTP_S_INIT1:
+                               case IP_VS_SCTP_S_INIT:
+                                       break;
+                               case IP_VS_SCTP_S_ESTABLISHED:
+                                       if (todrop_entry(cp))
+                                               break;
+                                       continue;
+                               default:
+                                       continue;
+                               }
                        } else {
                                if (!todrop_entry(cp))
                                        continue;