{"id":809418,"url":"http://patchwork.ozlabs.org/api/1.2/patches/809418/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/1504478435-13160-2-git-send-email-pablo@netfilter.org/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","name":"Linux network development","link_name":"netdev","list_id":"netdev.vger.kernel.org","list_email":"netdev@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504478435-13160-2-git-send-email-pablo@netfilter.org>","list_archive_url":null,"date":"2017-09-03T22:40:12","name":"[24/47] netfilter: connlimit: merge root4 and root6.","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"283b93f03beb92c8b1e3e43a0fe1c119012527d3","submitter":{"id":1315,"url":"http://patchwork.ozlabs.org/api/1.2/people/1315/?format=json","name":"Pablo Neira Ayuso","email":"pablo@netfilter.org"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/1504478435-13160-2-git-send-email-pablo@netfilter.org/mbox/","series":[{"id":1283,"url":"http://patchwork.ozlabs.org/api/1.2/series/1283/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=1283","date":"2017-09-03T22:40:11","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/1283/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809418/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809418/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netdev-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":"ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xlny115dTz9s06\n\tfor <patchwork-incoming@ozlabs.org>;\n\tMon,  4 Sep 2017 08:40:57 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753257AbdICWkw (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tSun, 3 Sep 2017 18:40:52 -0400","from mail.us.es ([193.147.175.20]:52688 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1753168AbdICWku (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tSun, 3 Sep 2017 18:40:50 -0400","from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id C611B190F64\n\tfor <netdev@vger.kernel.org>; Mon,  4 Sep 2017 00:40:23 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id B58222DC87\n\tfor <netdev@vger.kernel.org>; Mon,  4 Sep 2017 00:40:23 +0200 (CEST)","by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid AB0B72DC84; Mon,  4 Sep 2017 00:40:23 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id B1FFEB5026;\n\tMon,  4 Sep 2017 00:40:21 +0200 (CEST)","from 192.168.1.97 (192.168.1.97) by antivirus1-rhel7.int\n\t(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int); \n\tMon, 04 Sep 2017 00:40:21 +0200 (CEST)","from salvia.here (unknown [31.4.193.113])\n\t(Authenticated sender: 1984lsi)\n\tby entrada.int (Postfix) with ESMTPA id 526804265A20;\n\tMon,  4 Sep 2017 00:40:21 +0200 (CEST)"],"X-Spam-Checker-Version":"SpamAssassin 3.4.1 (2015-04-28) on\n\tantivirus1-rhel7.int","X-Spam-Level":"","X-Spam-Status":"No, score=-108.2 required=7.5 tests=ALL_TRUSTED,BAYES_50,\n\tSMTPAUTH_US2,USER_IN_WHITELIST autolearn=disabled version=3.4.1","X-Virus-Status":"clean(F-Secure/fsigk_smtp/550/antivirus1-rhel7.int)","X-SMTPAUTHUS":"auth mail.us.es","From":"Pablo Neira Ayuso <pablo@netfilter.org>","To":"netfilter-devel@vger.kernel.org","Cc":"davem@davemloft.net, netdev@vger.kernel.org","Subject":"[PATCH 24/47] netfilter: connlimit: merge root4 and root6.","Date":"Mon,  4 Sep 2017 00:40:12 +0200","Message-Id":"<1504478435-13160-2-git-send-email-pablo@netfilter.org>","X-Mailer":"git-send-email 2.1.4","In-Reply-To":"<1504478435-13160-1-git-send-email-pablo@netfilter.org>","References":"<1504478435-13160-1-git-send-email-pablo@netfilter.org>","X-Virus-Scanned":"ClamAV using ClamSMTP","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"From: Taehee Yoo <ap420073@gmail.com>\n\nThe root4 variable is used only when connlimit extension module has been\nstored by the iptables command. and the roo6 variable is used only when\nconnlimit extension module has been stored by the ip6tables command.\nSo the root4 and roo6 variable does not be used at the same time.\n\nSigned-off-by: Taehee Yoo <ap420073@gmail.com>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n net/netfilter/xt_connlimit.c | 23 ++++++++---------------\n 1 file changed, 8 insertions(+), 15 deletions(-)","diff":"diff --git a/net/netfilter/xt_connlimit.c b/net/netfilter/xt_connlimit.c\nindex 97589b8a2a40..ffa8eec980e9 100644\n--- a/net/netfilter/xt_connlimit.c\n+++ b/net/netfilter/xt_connlimit.c\n@@ -58,8 +58,7 @@ struct xt_connlimit_rb {\n static spinlock_t xt_connlimit_locks[CONNLIMIT_LOCK_SLOTS] __cacheline_aligned_in_smp;\n \n struct xt_connlimit_data {\n-\tstruct rb_root climit_root4[CONNLIMIT_SLOTS];\n-\tstruct rb_root climit_root6[CONNLIMIT_SLOTS];\n+\tstruct rb_root climit_root[CONNLIMIT_SLOTS];\n };\n \n static u_int32_t connlimit_rnd __read_mostly;\n@@ -294,13 +293,11 @@ static int count_them(struct net *net,\n \tint count;\n \tu32 hash;\n \n-\tif (family == NFPROTO_IPV6) {\n+\tif (family == NFPROTO_IPV6)\n \t\thash = connlimit_iphash6(addr, mask);\n-\t\troot = &data->climit_root6[hash];\n-\t} else {\n+\telse\n \t\thash = connlimit_iphash(addr->ip & mask->ip);\n-\t\troot = &data->climit_root4[hash];\n-\t}\n+\troot = &data->climit_root[hash];\n \n \tspin_lock_bh(&xt_connlimit_locks[hash % CONNLIMIT_LOCK_SLOTS]);\n \n@@ -379,10 +376,8 @@ static int connlimit_mt_check(const struct xt_mtchk_param *par)\n \t\treturn -ENOMEM;\n \t}\n \n-\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root4); ++i)\n-\t\tinfo->data->climit_root4[i] = RB_ROOT;\n-\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root6); ++i)\n-\t\tinfo->data->climit_root6[i] = RB_ROOT;\n+\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root); ++i)\n+\t\tinfo->data->climit_root[i] = RB_ROOT;\n \n \treturn 0;\n }\n@@ -413,10 +408,8 @@ static void connlimit_mt_destroy(const struct xt_mtdtor_param *par)\n \n \tnf_ct_netns_put(par->net, par->family);\n \n-\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root4); ++i)\n-\t\tdestroy_tree(&info->data->climit_root4[i]);\n-\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root6); ++i)\n-\t\tdestroy_tree(&info->data->climit_root6[i]);\n+\tfor (i = 0; i < ARRAY_SIZE(info->data->climit_root); ++i)\n+\t\tdestroy_tree(&info->data->climit_root[i]);\n \n \tkfree(info->data);\n }\n","prefixes":["24/47"]}