From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7529DC3A5A0 for ; Mon, 19 Aug 2019 14:04:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 458F8204EC for ; Mon, 19 Aug 2019 14:04:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rLUCyVzS" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726901AbfHSOEG (ORCPT ); Mon, 19 Aug 2019 10:04:06 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:34464 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726828AbfHSOEG (ORCPT ); Mon, 19 Aug 2019 10:04:06 -0400 Received: by mail-pl1-f193.google.com with SMTP id d3so1026877plr.1; Mon, 19 Aug 2019 07:04:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=ps39WlYvmdpvuYvHQVHohCHXUeQ1Cte8oiy7konFYFA=; b=rLUCyVzSdDWGS6fh7m3KOtsKXZew61vtd9PbRIRRP9lCYRMUZOa1jpNGeqNzqQFA+k cP1/Crv0DJMr5LWXKGkeY6GryYtDdJPtftbdsUfv3/e97hMDCHdRUoOIFAWzLdI4nonD CRPX+i9SAecBwUQFnBJpfwO707bkUnqzCSvP8jTniEV9JDesAZGauYbK9xD7LTNbQ+ps pB3hMV7Hcw5fHX5I7bCMyaNkv7oEEaciUz4PnLpFpJsN8601SBWyui1JZSi7O8GKI1Ir WfwMqun+RHxYpYn7Xe1M/f0z3ko0HrpqYQrdJsSoCGQZ1JaCTljnAUZLegsszmKza6/y daEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ps39WlYvmdpvuYvHQVHohCHXUeQ1Cte8oiy7konFYFA=; b=s5CbrSrqoZUb+yIO6i0y0xPOV9CEHPehE7lkQcQwhf/kgadb0jlBlR26XD7KKGnhFz dhHC1ejzNuk5XdLDA6L8KCWyzQSk40+VX1zGIznzFXh4uhw+i8e+nplAKR4oUTFq5xxe 77l+zdJSLZ7DBNh6MDRbqgTcS2oiQLBGRg/VvbB1vds6uO2EJGzWxvZD5Owwu/giEzLB 7EOyD17Dadm0nUVcKCPTLUTNsR18vUI2wsiTY8X9CkwixDm3/YLANCzs65J6EUWm0Fdg xxGDpJ7Y5L9HhhUG/T9NWqwaSsWooQMzIzyCCI1YpKkzkF9If1QvobunMbxcT2DEt5KL 5qCA== X-Gm-Message-State: APjAAAW+RslTIIAV56kXrEHZAi+xkTZUOjFzB6Gs28pfdtpbZDRbGt0F PBOinsh8U2BiOgxqa/AryBzo7uGcIhk= X-Google-Smtp-Source: APXvYqwbIfVUSaZRElaoHz7wNk0I3Q4kxUIt/nRwdyd5Sh2rR99cgSMmNGbReha1gDZAX8FnSyc2Wg== X-Received: by 2002:a17:902:b702:: with SMTP id d2mr23380367pls.259.1566223445660; Mon, 19 Aug 2019 07:04:05 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id s6sm15588524pfs.122.2019.08.19.07.04.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Aug 2019 07:04:05 -0700 (PDT) From: Xin Long To: network dev , linux-sctp@vger.kernel.org Cc: Marcelo Ricardo Leitner , Neil Horman , davem@davemloft.net Subject: [PATCH net-next 8/8] sctp: remove net sctp.x_enable working as a global switch Date: Mon, 19 Aug 2019 22:02:50 +0800 Message-Id: <37fe4fef4061a07a201684eef6377c9a2d5641e4.1566223325.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: References: <4c4682aab70fc11be7a505b11939dd998b9b21f5.1566223325.git.lucien.xin@gmail.com> <04b2de14df6de243e9faacc3a3de091adff45d52.1566223325.git.lucien.xin@gmail.com> In-Reply-To: References: Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The netns sctp feature flags shouldn't work as a global switch, which is mostly like a firewall/netfilter's job. Also, it will break asoc as it discard or accept chunks incorrectly when net sctp.x_enable is changed after the asoc is created. Since each type of chunk's processing function will check the corresp asoc's feature flag, this 'global switch' should be removed, and net sctp.x_enable will only work as the default feature flags for the future sctp sockets/endpoints. Signed-off-by: Xin Long --- net/sctp/sm_statetable.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 61ed9c6..88ea87f 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c @@ -976,26 +976,22 @@ static const struct sctp_sm_table_entry *sctp_chunk_event_lookup( if (cid <= SCTP_CID_BASE_MAX) return &chunk_event_table[cid][state]; - if (net->sctp.prsctp_enable) { - if (cid == SCTP_CID_FWD_TSN || cid == SCTP_CID_I_FWD_TSN) - return &prsctp_chunk_event_table[0][state]; - } + switch ((u16)cid) { + case SCTP_CID_FWD_TSN: + case SCTP_CID_I_FWD_TSN: + return &prsctp_chunk_event_table[0][state]; - if (net->sctp.addip_enable) { - if (cid == SCTP_CID_ASCONF) - return &addip_chunk_event_table[0][state]; + case SCTP_CID_ASCONF: + return &addip_chunk_event_table[0][state]; - if (cid == SCTP_CID_ASCONF_ACK) - return &addip_chunk_event_table[1][state]; - } + case SCTP_CID_ASCONF_ACK: + return &addip_chunk_event_table[1][state]; - if (net->sctp.reconf_enable) - if (cid == SCTP_CID_RECONF) - return &reconf_chunk_event_table[0][state]; + case SCTP_CID_RECONF: + return &reconf_chunk_event_table[0][state]; - if (net->sctp.auth_enable) { - if (cid == SCTP_CID_AUTH) - return &auth_chunk_event_table[0][state]; + case SCTP_CID_AUTH: + return &auth_chunk_event_table[0][state]; } return &chunk_event_table_unknown[state]; -- 2.1.0