Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Joe Perches <joe@perches.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

authored by

Joe Perches and committed by
Steven Rostedt
824f1fbe 37246a58

+70 -69
+1 -1
include/net/netfilter/nf_conntrack_core.h
··· 72 72 return ret; 73 73 } 74 74 75 - int 75 + void 76 76 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 77 77 const struct nf_conntrack_l3proto *l3proto, 78 78 const struct nf_conntrack_l4proto *proto);
+2 -2
include/net/netfilter/nf_conntrack_l3proto.h
··· 38 38 const struct nf_conntrack_tuple *orig); 39 39 40 40 /* Print out the per-protocol part of the tuple. */ 41 - int (*print_tuple)(struct seq_file *s, 42 - const struct nf_conntrack_tuple *); 41 + void (*print_tuple)(struct seq_file *s, 42 + const struct nf_conntrack_tuple *); 43 43 44 44 /* 45 45 * Called before tracking.
+2 -2
include/net/netfilter/nf_conntrack_l4proto.h
··· 56 56 u_int8_t pf, unsigned int hooknum); 57 57 58 58 /* Print out the per-protocol part of the tuple. Return like seq_* */ 59 - int (*print_tuple)(struct seq_file *s, 60 - const struct nf_conntrack_tuple *); 59 + void (*print_tuple)(struct seq_file *s, 60 + const struct nf_conntrack_tuple *); 61 61 62 62 /* Print out the private part of the conntrack. */ 63 63 void (*print_conntrack)(struct seq_file *s, struct nf_conn *);
+3 -3
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
··· 56 56 return true; 57 57 } 58 58 59 - static int ipv4_print_tuple(struct seq_file *s, 59 + static void ipv4_print_tuple(struct seq_file *s, 60 60 const struct nf_conntrack_tuple *tuple) 61 61 { 62 - return seq_printf(s, "src=%pI4 dst=%pI4 ", 63 - &tuple->src.u3.ip, &tuple->dst.u3.ip); 62 + seq_printf(s, "src=%pI4 dst=%pI4 ", 63 + &tuple->src.u3.ip, &tuple->dst.u3.ip); 64 64 } 65 65 66 66 static int ipv4_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+8 -4
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
··· 153 153 if (seq_has_overflowed(s)) 154 154 goto release; 155 155 156 - if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 157 - l3proto, l4proto)) 156 + print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 157 + l3proto, l4proto); 158 + 159 + if (seq_has_overflowed(s)) 158 160 goto release; 159 161 160 162 if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) ··· 166 164 if (seq_printf(s, "[UNREPLIED] ")) 167 165 goto release; 168 166 169 - if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, 170 - l3proto, l4proto)) 167 + print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, 168 + l3proto, l4proto); 169 + 170 + if (seq_has_overflowed(s)) 171 171 goto release; 172 172 173 173 if (seq_print_acct(s, ct, IP_CT_DIR_REPLY))
+5 -5
net/ipv4/netfilter/nf_conntrack_proto_icmp.c
··· 72 72 } 73 73 74 74 /* Print out the per-protocol part of the tuple. */ 75 - static int icmp_print_tuple(struct seq_file *s, 75 + static void icmp_print_tuple(struct seq_file *s, 76 76 const struct nf_conntrack_tuple *tuple) 77 77 { 78 - return seq_printf(s, "type=%u code=%u id=%u ", 79 - tuple->dst.u.icmp.type, 80 - tuple->dst.u.icmp.code, 81 - ntohs(tuple->src.u.icmp.id)); 78 + seq_printf(s, "type=%u code=%u id=%u ", 79 + tuple->dst.u.icmp.type, 80 + tuple->dst.u.icmp.code, 81 + ntohs(tuple->src.u.icmp.id)); 82 82 } 83 83 84 84 static unsigned int *icmp_get_timeouts(struct net *net)
+3 -3
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
··· 60 60 return true; 61 61 } 62 62 63 - static int ipv6_print_tuple(struct seq_file *s, 63 + static void ipv6_print_tuple(struct seq_file *s, 64 64 const struct nf_conntrack_tuple *tuple) 65 65 { 66 - return seq_printf(s, "src=%pI6 dst=%pI6 ", 67 - tuple->src.u3.ip6, tuple->dst.u3.ip6); 66 + seq_printf(s, "src=%pI6 dst=%pI6 ", 67 + tuple->src.u3.ip6, tuple->dst.u3.ip6); 68 68 } 69 69 70 70 static int ipv6_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+5 -5
net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
··· 84 84 } 85 85 86 86 /* Print out the per-protocol part of the tuple. */ 87 - static int icmpv6_print_tuple(struct seq_file *s, 87 + static void icmpv6_print_tuple(struct seq_file *s, 88 88 const struct nf_conntrack_tuple *tuple) 89 89 { 90 - return seq_printf(s, "type=%u code=%u id=%u ", 91 - tuple->dst.u.icmp.type, 92 - tuple->dst.u.icmp.code, 93 - ntohs(tuple->src.u.icmp.id)); 90 + seq_printf(s, "type=%u code=%u id=%u ", 91 + tuple->dst.u.icmp.type, 92 + tuple->dst.u.icmp.code, 93 + ntohs(tuple->src.u.icmp.id)); 94 94 } 95 95 96 96 static unsigned int *icmpv6_get_timeouts(struct net *net)
+2 -3
net/netfilter/nf_conntrack_l3proto_generic.c
··· 49 49 return true; 50 50 } 51 51 52 - static int generic_print_tuple(struct seq_file *s, 53 - const struct nf_conntrack_tuple *tuple) 52 + static void generic_print_tuple(struct seq_file *s, 53 + const struct nf_conntrack_tuple *tuple) 54 54 { 55 - return 0; 56 55 } 57 56 58 57 static int generic_get_l4proto(const struct sk_buff *skb, unsigned int nhoff,
+5 -5
net/netfilter/nf_conntrack_proto_dccp.c
··· 618 618 return -NF_ACCEPT; 619 619 } 620 620 621 - static int dccp_print_tuple(struct seq_file *s, 622 - const struct nf_conntrack_tuple *tuple) 621 + static void dccp_print_tuple(struct seq_file *s, 622 + const struct nf_conntrack_tuple *tuple) 623 623 { 624 - return seq_printf(s, "sport=%hu dport=%hu ", 625 - ntohs(tuple->src.u.dccp.port), 626 - ntohs(tuple->dst.u.dccp.port)); 624 + seq_printf(s, "sport=%hu dport=%hu ", 625 + ntohs(tuple->src.u.dccp.port), 626 + ntohs(tuple->dst.u.dccp.port)); 627 627 } 628 628 629 629 static void dccp_print_conntrack(struct seq_file *s, struct nf_conn *ct)
+2 -3
net/netfilter/nf_conntrack_proto_generic.c
··· 63 63 } 64 64 65 65 /* Print out the per-protocol part of the tuple. */ 66 - static int generic_print_tuple(struct seq_file *s, 67 - const struct nf_conntrack_tuple *tuple) 66 + static void generic_print_tuple(struct seq_file *s, 67 + const struct nf_conntrack_tuple *tuple) 68 68 { 69 - return 0; 70 69 } 71 70 72 71 static unsigned int *generic_get_timeouts(struct net *net)
+5 -5
net/netfilter/nf_conntrack_proto_gre.c
··· 226 226 } 227 227 228 228 /* print gre part of tuple */ 229 - static int gre_print_tuple(struct seq_file *s, 230 - const struct nf_conntrack_tuple *tuple) 229 + static void gre_print_tuple(struct seq_file *s, 230 + const struct nf_conntrack_tuple *tuple) 231 231 { 232 - return seq_printf(s, "srckey=0x%x dstkey=0x%x ", 233 - ntohs(tuple->src.u.gre.key), 234 - ntohs(tuple->dst.u.gre.key)); 232 + seq_printf(s, "srckey=0x%x dstkey=0x%x ", 233 + ntohs(tuple->src.u.gre.key), 234 + ntohs(tuple->dst.u.gre.key)); 235 235 } 236 236 237 237 /* print private data for conntrack */
+5 -5
net/netfilter/nf_conntrack_proto_sctp.c
··· 166 166 } 167 167 168 168 /* Print out the per-protocol part of the tuple. */ 169 - static int sctp_print_tuple(struct seq_file *s, 170 - const struct nf_conntrack_tuple *tuple) 169 + static void sctp_print_tuple(struct seq_file *s, 170 + const struct nf_conntrack_tuple *tuple) 171 171 { 172 - return seq_printf(s, "sport=%hu dport=%hu ", 173 - ntohs(tuple->src.u.sctp.port), 174 - ntohs(tuple->dst.u.sctp.port)); 172 + seq_printf(s, "sport=%hu dport=%hu ", 173 + ntohs(tuple->src.u.sctp.port), 174 + ntohs(tuple->dst.u.sctp.port)); 175 175 } 176 176 177 177 /* Print out the private part of the conntrack. */
+5 -5
net/netfilter/nf_conntrack_proto_tcp.c
··· 302 302 } 303 303 304 304 /* Print out the per-protocol part of the tuple. */ 305 - static int tcp_print_tuple(struct seq_file *s, 306 - const struct nf_conntrack_tuple *tuple) 305 + static void tcp_print_tuple(struct seq_file *s, 306 + const struct nf_conntrack_tuple *tuple) 307 307 { 308 - return seq_printf(s, "sport=%hu dport=%hu ", 309 - ntohs(tuple->src.u.tcp.port), 310 - ntohs(tuple->dst.u.tcp.port)); 308 + seq_printf(s, "sport=%hu dport=%hu ", 309 + ntohs(tuple->src.u.tcp.port), 310 + ntohs(tuple->dst.u.tcp.port)); 311 311 } 312 312 313 313 /* Print out the private part of the conntrack. */
+5 -5
net/netfilter/nf_conntrack_proto_udp.c
··· 63 63 } 64 64 65 65 /* Print out the per-protocol part of the tuple. */ 66 - static int udp_print_tuple(struct seq_file *s, 67 - const struct nf_conntrack_tuple *tuple) 66 + static void udp_print_tuple(struct seq_file *s, 67 + const struct nf_conntrack_tuple *tuple) 68 68 { 69 - return seq_printf(s, "sport=%hu dport=%hu ", 70 - ntohs(tuple->src.u.udp.port), 71 - ntohs(tuple->dst.u.udp.port)); 69 + seq_printf(s, "sport=%hu dport=%hu ", 70 + ntohs(tuple->src.u.udp.port), 71 + ntohs(tuple->dst.u.udp.port)); 72 72 } 73 73 74 74 static unsigned int *udp_get_timeouts(struct net *net)
+5 -5
net/netfilter/nf_conntrack_proto_udplite.c
··· 71 71 } 72 72 73 73 /* Print out the per-protocol part of the tuple. */ 74 - static int udplite_print_tuple(struct seq_file *s, 75 - const struct nf_conntrack_tuple *tuple) 74 + static void udplite_print_tuple(struct seq_file *s, 75 + const struct nf_conntrack_tuple *tuple) 76 76 { 77 - return seq_printf(s, "sport=%hu dport=%hu ", 78 - ntohs(tuple->src.u.udp.port), 79 - ntohs(tuple->dst.u.udp.port)); 77 + seq_printf(s, "sport=%hu dport=%hu ", 78 + ntohs(tuple->src.u.udp.port), 79 + ntohs(tuple->dst.u.udp.port)); 80 80 } 81 81 82 82 static unsigned int *udplite_get_timeouts(struct net *net)
+7 -8
net/netfilter/nf_conntrack_standalone.c
··· 36 36 MODULE_LICENSE("GPL"); 37 37 38 38 #ifdef CONFIG_NF_CONNTRACK_PROCFS 39 - int 39 + void 40 40 print_tuple(struct seq_file *s, const struct nf_conntrack_tuple *tuple, 41 41 const struct nf_conntrack_l3proto *l3proto, 42 42 const struct nf_conntrack_l4proto *l4proto) 43 43 { 44 - return l3proto->print_tuple(s, tuple) || l4proto->print_tuple(s, tuple); 44 + l3proto->print_tuple(s, tuple); 45 + l4proto->print_tuple(s, tuple); 45 46 } 46 47 EXPORT_SYMBOL_GPL(print_tuple); 47 48 ··· 203 202 if (l4proto->print_conntrack) 204 203 l4proto->print_conntrack(s, ct); 205 204 206 - if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 207 - l3proto, l4proto)) 208 - goto release; 205 + print_tuple(s, &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple, 206 + l3proto, l4proto); 209 207 210 208 if (seq_print_acct(s, ct, IP_CT_DIR_ORIGINAL)) 211 209 goto release; ··· 213 213 if (seq_printf(s, "[UNREPLIED] ")) 214 214 goto release; 215 215 216 - if (print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, 217 - l3proto, l4proto)) 218 - goto release; 216 + print_tuple(s, &ct->tuplehash[IP_CT_DIR_REPLY].tuple, 217 + l3proto, l4proto); 219 218 220 219 if (seq_print_acct(s, ct, IP_CT_DIR_REPLY)) 221 220 goto release;