提交 824f1fbe 编写于 作者: J Joe Perches 提交者: Steven Rostedt

netfilter: Convert print_tuple functions to return void

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: NJoe Perches <joe@perches.com>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
上级 37246a58
...@@ -72,7 +72,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb) ...@@ -72,7 +72,7 @@ static inline int nf_conntrack_confirm(struct sk_buff *skb)
return ret; return ret;
} }
int void
print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
const struct nf_conntrack_l3proto *l3proto, const struct nf_conntrack_l3proto *l3proto,
const struct nf_conntrack_l4proto *proto); const struct nf_conntrack_l4proto *proto);
......
...@@ -38,7 +38,7 @@ struct nf_conntrack_l3proto { ...@@ -38,7 +38,7 @@ struct nf_conntrack_l3proto {
const struct nf_conntrack_tuple *orig); const struct nf_conntrack_tuple *orig);
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
int (*print_tuple)(struct seq_file *s, void (*print_tuple)(struct seq_file *s,
const struct nf_conntrack_tuple *); const struct nf_conntrack_tuple *);
/* /*
......
...@@ -56,7 +56,7 @@ struct nf_conntrack_l4proto { ...@@ -56,7 +56,7 @@ struct nf_conntrack_l4proto {
u_int8_t pf, unsigned int hooknum); u_int8_t pf, unsigned int hooknum);
/* Print out the per-protocol part of the tuple. Return like seq_* */ /* Print out the per-protocol part of the tuple. Return like seq_* */
int (*print_tuple)(struct seq_file *s, void (*print_tuple)(struct seq_file *s,
const struct nf_conntrack_tuple *); const struct nf_conntrack_tuple *);
/* Print out the private part of the conntrack. */ /* Print out the private part of the conntrack. */
......
...@@ -56,10 +56,10 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -56,10 +56,10 @@ static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple,
return true; 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) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "src=%pI4 dst=%pI4 ", seq_printf(s, "src=%pI4 dst=%pI4 ",
&tuple->src.u3.ip, &tuple->dst.u3.ip); &tuple->src.u3.ip, &tuple->dst.u3.ip);
} }
......
...@@ -153,8 +153,10 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -153,8 +153,10 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (seq_has_overflowed(s)) if (seq_has_overflowed(s))
goto release; goto release;
if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
l3proto, l4proto)) l3proto, l4proto);
if (seq_has_overflowed(s))
goto release; goto release;
if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) 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) ...@@ -164,8 +166,10 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (seq_printf(s, "[UNREPLIED] ")) if (seq_printf(s, "[UNREPLIED] "))
goto release; goto release;
if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
l3proto, l4proto)) l3proto, l4proto);
if (seq_has_overflowed(s))
goto release; goto release;
if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
......
...@@ -72,10 +72,10 @@ static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -72,10 +72,10 @@ static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the 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) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "type=%u code=%u id=%u ", seq_printf(s, "type=%u code=%u id=%u ",
tuple->dst.u.icmp.type, tuple->dst.u.icmp.type,
tuple->dst.u.icmp.code, tuple->dst.u.icmp.code,
ntohs(tuple->src.u.icmp.id)); ntohs(tuple->src.u.icmp.id));
......
...@@ -60,10 +60,10 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -60,10 +60,10 @@ static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple,
return true; 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) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "src=%pI6 dst=%pI6 ", seq_printf(s, "src=%pI6 dst=%pI6 ",
tuple->src.u3.ip6, tuple->dst.u3.ip6); tuple->src.u3.ip6, tuple->dst.u3.ip6);
} }
......
...@@ -84,10 +84,10 @@ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -84,10 +84,10 @@ static bool icmpv6_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the 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) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "type=%u code=%u id=%u ", seq_printf(s, "type=%u code=%u id=%u ",
tuple->dst.u.icmp.type, tuple->dst.u.icmp.type,
tuple->dst.u.icmp.code, tuple->dst.u.icmp.code,
ntohs(tuple->src.u.icmp.id)); ntohs(tuple->src.u.icmp.id));
......
...@@ -49,10 +49,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -49,10 +49,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple,
return true; return true;
} }
static int generic_print_tuple(struct seq_file *s, static void generic_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return 0;
} }
static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff, static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
......
...@@ -618,10 +618,10 @@ static int dccp_error(struct net *net, struct nf_conn *tmpl, ...@@ -618,10 +618,10 @@ static int dccp_error(struct net *net, struct nf_conn *tmpl,
return -NF_ACCEPT; return -NF_ACCEPT;
} }
static int dccp_print_tuple(struct seq_file *s, static void dccp_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "sport=%hu dport=%hu ", seq_printf(s, "sport=%hu dport=%hu ",
ntohs(tuple->src.u.dccp.port), ntohs(tuple->src.u.dccp.port),
ntohs(tuple->dst.u.dccp.port)); ntohs(tuple->dst.u.dccp.port));
} }
......
...@@ -63,10 +63,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -63,10 +63,9 @@ static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
static int generic_print_tuple(struct seq_file *s, static void generic_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return 0;
} }
static unsigned int *generic_get_timeouts(struct net *net) static unsigned int *generic_get_timeouts(struct net *net)
......
...@@ -226,10 +226,10 @@ static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, ...@@ -226,10 +226,10 @@ static bool gre_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff,
} }
/* print gre part of tuple */ /* print gre part of tuple */
static int gre_print_tuple(struct seq_file *s, static void gre_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "srckey=0x%x dstkey=0x%x ", seq_printf(s, "srckey=0x%x dstkey=0x%x ",
ntohs(tuple->src.u.gre.key), ntohs(tuple->src.u.gre.key),
ntohs(tuple->dst.u.gre.key)); ntohs(tuple->dst.u.gre.key));
} }
......
...@@ -166,10 +166,10 @@ static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -166,10 +166,10 @@ static bool sctp_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
static int sctp_print_tuple(struct seq_file *s, static void sctp_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "sport=%hu dport=%hu ", seq_printf(s, "sport=%hu dport=%hu ",
ntohs(tuple->src.u.sctp.port), ntohs(tuple->src.u.sctp.port),
ntohs(tuple->dst.u.sctp.port)); ntohs(tuple->dst.u.sctp.port));
} }
......
...@@ -302,10 +302,10 @@ static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -302,10 +302,10 @@ static bool tcp_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
static int tcp_print_tuple(struct seq_file *s, static void tcp_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "sport=%hu dport=%hu ", seq_printf(s, "sport=%hu dport=%hu ",
ntohs(tuple->src.u.tcp.port), ntohs(tuple->src.u.tcp.port),
ntohs(tuple->dst.u.tcp.port)); ntohs(tuple->dst.u.tcp.port));
} }
......
...@@ -63,10 +63,10 @@ static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -63,10 +63,10 @@ static bool udp_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
static int udp_print_tuple(struct seq_file *s, static void udp_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "sport=%hu dport=%hu ", seq_printf(s, "sport=%hu dport=%hu ",
ntohs(tuple->src.u.udp.port), ntohs(tuple->src.u.udp.port),
ntohs(tuple->dst.u.udp.port)); ntohs(tuple->dst.u.udp.port));
} }
......
...@@ -71,10 +71,10 @@ static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple, ...@@ -71,10 +71,10 @@ static bool udplite_invert_tuple(struct nf_conntrack_tuple *tuple,
} }
/* Print out the per-protocol part of the tuple. */ /* Print out the per-protocol part of the tuple. */
static int udplite_print_tuple(struct seq_file *s, static void udplite_print_tuple(struct seq_file *s,
const struct nf_conntrack_tuple *tuple) const struct nf_conntrack_tuple *tuple)
{ {
return seq_printf(s, "sport=%hu dport=%hu ", seq_printf(s, "sport=%hu dport=%hu ",
ntohs(tuple->src.u.udp.port), ntohs(tuple->src.u.udp.port),
ntohs(tuple->dst.u.udp.port)); ntohs(tuple->dst.u.udp.port));
} }
......
...@@ -36,12 +36,13 @@ ...@@ -36,12 +36,13 @@
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifdef CONFIG_NF_CONNTRACK_PROCFS #ifdef CONFIG_NF_CONNTRACK_PROCFS
int void
print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple,
const struct nf_conntrack_l3proto *l3proto, const struct nf_conntrack_l3proto *l3proto,
const struct nf_conntrack_l4proto *l4proto) 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); EXPORT_SYMBOL_GPL(print_tuple);
...@@ -202,9 +203,8 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -202,9 +203,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (l4proto->print_conntrack) if (l4proto->print_conntrack)
l4proto->print_conntrack(s, ct); l4proto->print_conntrack(s, ct);
if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple,
l3proto, l4proto)) l3proto, l4proto);
goto release;
if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL))
goto release; goto release;
...@@ -213,9 +213,8 @@ static int ct_seq_show(struct seq_file *s, void *v) ...@@ -213,9 +213,8 @@ static int ct_seq_show(struct seq_file *s, void *v)
if (seq_printf(s, "[UNREPLIED] ")) if (seq_printf(s, "[UNREPLIED] "))
goto release; goto release;
if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple,
l3proto, l4proto)) l3proto, l4proto);
goto release;
if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
goto release; goto release;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册