{"id":809426,"url":"http://patchwork.ozlabs.org/api/1.2/patches/809426/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504478516-13224-1-git-send-email-pablo@netfilter.org/","project":{"id":26,"url":"http://patchwork.ozlabs.org/api/1.2/projects/26/?format=json","name":"Netfilter Development","link_name":"netfilter-devel","list_id":"netfilter-devel.vger.kernel.org","list_email":"netfilter-devel@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1504478516-13224-1-git-send-email-pablo@netfilter.org>","list_archive_url":null,"date":"2017-09-03T22:41:42","name":"[33/47] netfilter: conntrack: remove protocol name from l3proto struct","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"52ad4fc2f02f002a585d7f5ff577695c6643fe37","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":6139,"url":"http://patchwork.ozlabs.org/api/1.2/users/6139/?format=json","username":"pablo","first_name":"Pablo","last_name":"Neira","email":"pablo@netfilter.org"},"mbox":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/1504478516-13224-1-git-send-email-pablo@netfilter.org/mbox/","series":[{"id":1282,"url":"http://patchwork.ozlabs.org/api/1.2/series/1282/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=1282","date":"2017-09-03T22:40:11","name":null,"version":1,"mbox":"http://patchwork.ozlabs.org/series/1282/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/809426/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/809426/checks/","tags":{},"related":[],"headers":{"Return-Path":"<netfilter-devel-owner@vger.kernel.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.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=netfilter-devel-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 3xlnzY1Rbxz9s06\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon,  4 Sep 2017 08:42:17 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1753449AbdICWmM (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tSun, 3 Sep 2017 18:42:12 -0400","from mail.us.es ([193.147.175.20]:52888 \"EHLO mail.us.es\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1753335AbdICWmK (ORCPT <rfc822; netfilter-devel@vger.kernel.org>);\n\tSun, 3 Sep 2017 18:42:10 -0400","from antivirus1-rhel7.int (unknown [192.168.2.11])\n\tby mail.us.es (Postfix) with ESMTP id 92478190F62\n\tfor <netfilter-devel@vger.kernel.org>;\n\tMon,  4 Sep 2017 00:41:43 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 8233DB502D\n\tfor <netfilter-devel@vger.kernel.org>;\n\tMon,  4 Sep 2017 00:41:43 +0200 (CEST)","by antivirus1-rhel7.int (Postfix, from userid 99)\n\tid 77FFFB5028; Mon,  4 Sep 2017 00:41:43 +0200 (CEST)","from antivirus1-rhel7.int (localhost [127.0.0.1])\n\tby antivirus1-rhel7.int (Postfix) with ESMTP id 5D2062DC84;\n\tMon,  4 Sep 2017 00:41:41 +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:41:41 +0200 (CEST)","from salvia.here (unknown [31.4.193.113])\n\t(Authenticated sender: 1984lsi)\n\tby entrada.int (Postfix) with ESMTPA id 075F04265A20;\n\tMon,  4 Sep 2017 00:41:38 +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 33/47] netfilter: conntrack: remove protocol name from\n\tl3proto struct","Date":"Mon,  4 Sep 2017 00:41:42 +0200","Message-Id":"<1504478516-13224-1-git-send-email-pablo@netfilter.org>","X-Mailer":"git-send-email 2.1.4","X-Virus-Scanned":"ClamAV using ClamSMTP","Sender":"netfilter-devel-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netfilter-devel.vger.kernel.org>","X-Mailing-List":"netfilter-devel@vger.kernel.org"},"content":"From: Florian Westphal <fw@strlen.de>\n\nno need to waste storage for something that is only needed\nin one place and can be deduced from protocol number.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>\n---\n include/net/netfilter/nf_conntrack_l3proto.h   |  3 ---\n net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c |  1 -\n net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c |  1 -\n net/netfilter/nf_conntrack_l3proto_generic.c   |  1 -\n net/netfilter/nf_conntrack_standalone.c        | 12 +++++++++++-\n 5 files changed, 11 insertions(+), 7 deletions(-)","diff":"diff --git a/include/net/netfilter/nf_conntrack_l3proto.h b/include/net/netfilter/nf_conntrack_l3proto.h\nindex 6a27ffea7480..e31861e4fa6a 100644\n--- a/include/net/netfilter/nf_conntrack_l3proto.h\n+++ b/include/net/netfilter/nf_conntrack_l3proto.h\n@@ -23,9 +23,6 @@ struct nf_conntrack_l3proto {\n \t/* size of tuple nlattr, fills a hole */\n \tu16 nla_size;\n \n-\t/* Protocol name */\n-\tconst char *name;\n-\n \t/*\n \t * Try to fill in the third arg: nhoff is offset of l3 proto\n          * hdr.  Return true if possible.\ndiff --git a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c\nindex 9fb8cb033d80..9f7ea862068c 100644\n--- a/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c\n+++ b/net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c\n@@ -353,7 +353,6 @@ static void ipv4_hooks_unregister(struct net *net)\n \n struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv4 __read_mostly = {\n \t.l3proto\t = PF_INET,\n-\t.name\t\t = \"ipv4\",\n \t.pkt_to_tuple\t = ipv4_pkt_to_tuple,\n \t.invert_tuple\t = ipv4_invert_tuple,\n \t.print_tuple\t = ipv4_print_tuple,\ndiff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c\nindex 6b4d59fd0214..91d37fbe28de 100644\n--- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c\n+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c\n@@ -348,7 +348,6 @@ static void ipv6_hooks_unregister(struct net *net)\n \n struct nf_conntrack_l3proto nf_conntrack_l3proto_ipv6 __read_mostly = {\n \t.l3proto\t\t= PF_INET6,\n-\t.name\t\t\t= \"ipv6\",\n \t.pkt_to_tuple\t\t= ipv6_pkt_to_tuple,\n \t.invert_tuple\t\t= ipv6_invert_tuple,\n \t.print_tuple\t\t= ipv6_print_tuple,\ndiff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c\nindex cf9ace70bece..0387971582bc 100644\n--- a/net/netfilter/nf_conntrack_l3proto_generic.c\n+++ b/net/netfilter/nf_conntrack_l3proto_generic.c\n@@ -64,7 +64,6 @@ static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,\n \n struct nf_conntrack_l3proto nf_conntrack_l3proto_generic __read_mostly = {\n \t.l3proto\t = PF_UNSPEC,\n-\t.name\t\t = \"unknown\",\n \t.pkt_to_tuple\t = generic_pkt_to_tuple,\n \t.invert_tuple\t = generic_invert_tuple,\n \t.print_tuple\t = generic_print_tuple,\ndiff --git a/net/netfilter/nf_conntrack_standalone.c b/net/netfilter/nf_conntrack_standalone.c\nindex 5b6c675d55b1..359d7e6a4503 100644\n--- a/net/netfilter/nf_conntrack_standalone.c\n+++ b/net/netfilter/nf_conntrack_standalone.c\n@@ -198,6 +198,16 @@ ct_show_delta_time(struct seq_file *s, const struct nf_conn *ct)\n }\n #endif\n \n+static const char* l3proto_name(u16 proto)\n+{\n+\tswitch (proto) {\n+\tcase AF_INET: return \"ipv4\";\n+\tcase AF_INET6: return \"ipv6\";\n+\t}\n+\n+\treturn \"unknown\";\n+}\n+\n /* return 0 on success, 1 in case of error */\n static int ct_seq_show(struct seq_file *s, void *v)\n {\n@@ -231,7 +241,7 @@ static int ct_seq_show(struct seq_file *s, void *v)\n \n \tret = -ENOSPC;\n \tseq_printf(s, \"%-8s %u %-8s %u %ld \",\n-\t\t   l3proto->name, nf_ct_l3num(ct),\n+\t\t   l3proto_name(l3proto->l3proto), nf_ct_l3num(ct),\n \t\t   l4proto->name, nf_ct_protonum(ct),\n \t\t   nf_ct_expires(ct)  / HZ);\n \n","prefixes":["33/47"]}