netfilter: Convert print_tuple functions to return void
authorJoe Perches <joe@perches.com>
Mon, 29 Sep 2014 23:08:22 +0000 (16:08 -0700)
committerSteven Rostedt <rostedt@goodmis.org>
Wed, 5 Nov 2014 19:10:33 +0000 (14:10 -0500)
Since adding a new function to seq_file (seq_has_overflowed())
there isn't any value for functions called from seq_show to
return anything.   Remove the int returns of the various
print_tuple/<foo>_print_tuple functions.

Link: http://lkml.kernel.org/p/f2e8cf8df433a197daa62cbaf124c900c708edc7.1412031505.git.joe@perches.com
Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: netfilter-devel@vger.kernel.org
Cc: coreteam@netfilter.org
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
17 files changed:
include/net/netfilter/nf_conntrack_core.h
include/net/netfilter/nf_conntrack_l3proto.h
include/net/netfilter/nf_conntrack_l4proto.h
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/ipv4/netfilter/nf_conntrack_proto_icmp.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
net/netfilter/nf_conntrack_l3proto_generic.c
net/netfilter/nf_conntrack_proto_dccp.c
net/netfilter/nf_conntrack_proto_generic.c
net/netfilter/nf_conntrack_proto_gre.c
net/netfilter/nf_conntrack_proto_sctp.c
net/netfilter/nf_conntrack_proto_tcp.c
net/netfilter/nf_conntrack_proto_udp.c
net/netfilter/nf_conntrack_proto_udplite.c
net/netfilter/nf_conntrack_standalone.c

index cc0c1882760270f21bd1cc7080cece06afd518d8..f2f0fa3bb15073edeb0af54087087539842e17f1 100644 (file)
@@ -72,7 +72,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
        return ret;
 }
 
-int
+void
 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
             const struct nf_conntrack_l3proto *l3proto,
             const struct nf_conntrack_l4proto *proto);
index adc1fa3dd7ab8a7c69bc6b61bd19357d6332f120..cdc920b4c4c2a3e9d770409d10384d5ec80e8705 100644 (file)
@@ -38,8 +38,8 @@ struct nf_conntrack_l3proto {
                             const struct nf_conntrack_tuple *orig);
 
        /* Print out the per-protocol part of the tuple. */
-       int (*print_tuple)(struct seq_file *s,
-                          const struct nf_conntrack_tuple *);
+       void (*print_tuple)(struct seq_file *s,
+                           const struct nf_conntrack_tuple *);
 
        /*
         * Called before tracking. 
index 82e4ec002a39187cc2a7ccad421a93a7efd9598a..1f7061313d54620d11c1fb2f4e08d99be961989c 100644 (file)
@@ -56,8 +56,8 @@ struct nf_conntrack_l4proto {
                     u_int8_t pf, unsigned int hooknum);
 
        /* Print out the per-protocol part of the tuple. Return like seq_* */
-       int (*print_tuple)(struct seq_file *s,
-                          const struct nf_conntrack_tuple *);
+       void (*print_tuple)(struct seq_file *s,
+                           const struct nf_conntrack_tuple *);
 
        /* Print out the private part of the conntrack. */
        void (*print_conntrack)(struct seq_file *s, struct nf_conn *);
index a054fe083431c35e5434402003677517443c7e23..5c61328b7704bc56001b5f65a4e9a8ade8ef3387 100644 (file)
@@ -56,11 +56,11 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple,
        return true;
 }
 
-static int ipv4_print_tuple(struct seq_file *s,
+static void ipv4_print_tuple(struct seq_file *s,
                            const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "src=%pI4 dst=%pI4 ",
-                         &tuple->src.u3.ip, &tuple->dst.u3.ip);
+       seq_printf(s, "src=%pI4 dst=%pI4 ",
+                  &tuple->src.u3.ip, &tuple->dst.u3.ip);
 }
 
 static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
index 91f207c2cb69207506152e99fdcba5f345789c3e..d927f9e72130da7a14559482f52a1c6440f534ed 100644 (file)
@@ -153,8 +153,10 @@ static int ct_seq_show(struct seq_file *s, void *v)
        if (seq_has_overflowed(s))
                goto release;
 
-       if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
-                       l3proto, l4proto))
+       print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
+                   l3proto, l4proto);
+
+       if (seq_has_overflowed(s))
                goto release;
 
        if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL))
@@ -164,8 +166,10 @@ static int ct_seq_show(struct seq_file *s, void *v)
                if (seq_printf(s, "[UNREPLIED] "))
                        goto release;
 
-       if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
-                       l3proto, l4proto))
+       print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
+                   l3proto, l4proto);
+
+       if (seq_has_overflowed(s))
                goto release;
 
        if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
index b91b2641adda6b2f35768f307ef6c13c10a8d351..80d5554b9a88da301a69db2df7d98f8a3a0a0348 100644 (file)
@@ -72,13 +72,13 @@ static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int icmp_print_tuple(struct seq_file *s,
+static void icmp_print_tuple(struct seq_file *s,
                            const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "type=%u code=%u id=%u ",
-                         tuple->dst.u.icmp.type,
-                         tuple->dst.u.icmp.code,
-                         ntohs(tuple->src.u.icmp.id));
+       seq_printf(s, "type=%u code=%u id=%u ",
+                  tuple->dst.u.icmp.type,
+                  tuple->dst.u.icmp.code,
+                  ntohs(tuple->src.u.icmp.id));
 }
 
 static unsigned int *icmp_get_timeouts(struct net *net)
index 4cbc6b290dd5f324254e99fe633596789160a2af..b68d0e59c1f8bfec0894caff3f53c86a1dca79e9 100644 (file)
@@ -60,11 +60,11 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
        return true;
 }
 
-static int ipv6_print_tuple(struct seq_file *s,
+static void ipv6_print_tuple(struct seq_file *s,
                            const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "src=%pI6 dst=%pI6 ",
-                         tuple->src.u3.ip6, tuple->dst.u3.ip6);
+       seq_printf(s, "src=%pI6 dst=%pI6 ",
+                  tuple->src.u3.ip6, tuple->dst.u3.ip6);
 }
 
 static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
index b3807c5cb888736f2d7d46d332722ead3e5a6801..90388d606483cbbd15e421b3e51f6d757cd05883 100644 (file)
@@ -84,13 +84,13 @@ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int icmpv6_print_tuple(struct seq_file *s,
+static void icmpv6_print_tuple(struct seq_file *s,
                              const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "type=%u code=%u id=%u ",
-                         tuple->dst.u.icmp.type,
-                         tuple->dst.u.icmp.code,
-                         ntohs(tuple->src.u.icmp.id));
+       seq_printf(s, "type=%u code=%u id=%u ",
+                  tuple->dst.u.icmp.type,
+                  tuple->dst.u.icmp.code,
+                  ntohs(tuple->src.u.icmp.id));
 }
 
 static unsigned int *icmpv6_get_timeouts(struct net *net)
index e7eb807fe07d0950d21342113fa9d8a326b97fcf..cf9ace70bececf1573d8ef2d6d75387155dc6258 100644 (file)
@@ -49,10 +49,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple,
        return true;
 }
 
-static int generic_print_tuple(struct seq_file *s,
-                           const struct nf_conntrack_tuple *tuple)
+static void generic_print_tuple(struct seq_file *s,
+                               const struct nf_conntrack_tuple *tuple)
 {
-       return 0;
 }
 
 static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
index 15971177470a5c503427f7a2319584d6b6fa636e..6dd995c7c72b4400cdbd23da703467690f2e8cb4 100644 (file)
@@ -618,12 +618,12 @@ out_invalid:
        return -NF_ACCEPT;
 }
 
-static int dccp_print_tuple(struct seq_file *s,
-                           const struct nf_conntrack_tuple *tuple)
+static void dccp_print_tuple(struct seq_file *s,
+                            const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "sport=%hu dport=%hu ",
-                         ntohs(tuple->src.u.dccp.port),
-                         ntohs(tuple->dst.u.dccp.port));
+       seq_printf(s, "sport=%hu dport=%hu ",
+                  ntohs(tuple->src.u.dccp.port),
+                  ntohs(tuple->dst.u.dccp.port));
 }
 
 static void dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct)
index 957c1db6665254645f43d0c04456015a1d4df65c..60865f1103099383c4263a1a56e691b3c86c3720 100644 (file)
@@ -63,10 +63,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int generic_print_tuple(struct seq_file *s,
-                              const struct nf_conntrack_tuple *tuple)
+static void generic_print_tuple(struct seq_file *s,
+                               const struct nf_conntrack_tuple *tuple)
 {
-       return 0;
 }
 
 static unsigned int *generic_get_timeouts(struct net *net)
index cba607ada0693f1b1a0d1d64acad7f2f72e56f5b..7648674f29c3be28c1d3b3f91c5eab7400cedb51 100644 (file)
@@ -226,12 +226,12 @@ static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
 }
 
 /* print gre part of tuple */
-static int gre_print_tuple(struct seq_file *s,
-                          const struct nf_conntrack_tuple *tuple)
+static void gre_print_tuple(struct seq_file *s,
+                           const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "srckey=0x%x dstkey=0x%x ",
-                         ntohs(tuple->src.u.gre.key),
-                         ntohs(tuple->dst.u.gre.key));
+       seq_printf(s, "srckey=0x%x dstkey=0x%x ",
+                  ntohs(tuple->src.u.gre.key),
+                  ntohs(tuple->dst.u.gre.key));
 }
 
 /* print private data for conntrack */
index c61f4cd6407ddaf8a77b8fa8654d1c87593b2484..b45da90fad329d9605b839a709b10d400e682a7e 100644 (file)
@@ -166,12 +166,12 @@ static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int sctp_print_tuple(struct seq_file *s,
-                           const struct nf_conntrack_tuple *tuple)
+static void sctp_print_tuple(struct seq_file *s,
+                            const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "sport=%hu dport=%hu ",
-                         ntohs(tuple->src.u.sctp.port),
-                         ntohs(tuple->dst.u.sctp.port));
+       seq_printf(s, "sport=%hu dport=%hu ",
+                  ntohs(tuple->src.u.sctp.port),
+                  ntohs(tuple->dst.u.sctp.port));
 }
 
 /* Print out the private part of the conntrack. */
index 79668fd3db9657ac73429f583e5cb91720845e37..36a3ac8ee9f5b887b8edde6c59cf2a2be2c43a10 100644 (file)
@@ -302,12 +302,12 @@ static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int tcp_print_tuple(struct seq_file *s,
-                          const struct nf_conntrack_tuple *tuple)
+static void tcp_print_tuple(struct seq_file *s,
+                           const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "sport=%hu dport=%hu ",
-                         ntohs(tuple->src.u.tcp.port),
-                         ntohs(tuple->dst.u.tcp.port));
+       seq_printf(s, "sport=%hu dport=%hu ",
+                  ntohs(tuple->src.u.tcp.port),
+                  ntohs(tuple->dst.u.tcp.port));
 }
 
 /* Print out the private part of the conntrack. */
index 9d7721cbce4bffbf56058a71b8eec807cb8ff289..6957281ffee54fe43f22a73772b1f88a2e758a50 100644 (file)
@@ -63,12 +63,12 @@ static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int udp_print_tuple(struct seq_file *s,
-                          const struct nf_conntrack_tuple *tuple)
+static void udp_print_tuple(struct seq_file *s,
+                           const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "sport=%hu dport=%hu ",
-                         ntohs(tuple->src.u.udp.port),
-                         ntohs(tuple->dst.u.udp.port));
+       seq_printf(s, "sport=%hu dport=%hu ",
+                  ntohs(tuple->src.u.udp.port),
+                  ntohs(tuple->dst.u.udp.port));
 }
 
 static unsigned int *udp_get_timeouts(struct net *net)
index 2750e6c69f825e01c848e26873785e2c81099370..c5903d1649f9a02ab1d59615a458be578e0a5f6d 100644 (file)
@@ -71,12 +71,12 @@ static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple,
 }
 
 /* Print out the per-protocol part of the tuple. */
-static int udplite_print_tuple(struct seq_file *s,
-                              const struct nf_conntrack_tuple *tuple)
+static void udplite_print_tuple(struct seq_file *s,
+                               const struct nf_conntrack_tuple *tuple)
 {
-       return seq_printf(s, "sport=%hu dport=%hu ",
-                         ntohs(tuple->src.u.udp.port),
-                         ntohs(tuple->dst.u.udp.port));
+       seq_printf(s, "sport=%hu dport=%hu ",
+                  ntohs(tuple->src.u.udp.port),
+                  ntohs(tuple->dst.u.udp.port));
 }
 
 static unsigned int *udplite_get_timeouts(struct net *net)
index 348aa36027870a32ab66affb5ae7a5358ff103e7..23a0dcab21d4d828acca256f3c0e0d6ed2d52006 100644 (file)
 MODULE_LICENSE("GPL");
 
 #ifdef CONFIG_NF_CONNTRACK_PROCFS
-int
+void
 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
             const struct nf_conntrack_l3proto *l3proto,
             const struct nf_conntrack_l4proto *l4proto)
 {
-       return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple);
+       l3proto->print_tuple(s, tuple);
+       l4proto->print_tuple(s, tuple);
 }
 EXPORT_SYMBOL_GPL(print_tuple);
 
@@ -202,9 +203,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
        if (l4proto->print_conntrack)
                l4proto->print_conntrack(s, ct);
 
-       if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
-                       l3proto, l4proto))
-               goto release;
+       print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
+                   l3proto, l4proto);
 
        if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL))
                goto release;
@@ -213,9 +213,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
                if (seq_printf(s, "[UNREPLIED] "))
                        goto release;
 
-       if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
-                       l3proto, l4proto))
-               goto release;
+       print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
+                   l3proto, l4proto);
 
        if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
                goto release;