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

[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l3proto

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>

authored by

Jan Engelhardt and committed by
Patrick McHardy
8ce8439a 9dbae791

+24 -24
+4 -4
include/net/netfilter/nf_conntrack_l3proto.h
··· 28 28 * Try to fill in the third arg: nhoff is offset of l3 proto 29 29 * hdr. Return true if possible. 30 30 */ 31 - int (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, 32 - struct nf_conntrack_tuple *tuple); 31 + bool (*pkt_to_tuple)(const struct sk_buff *skb, unsigned int nhoff, 32 + struct nf_conntrack_tuple *tuple); 33 33 34 34 /* 35 35 * Invert the per-proto part of the tuple: ie. turn xmit into reply. 36 36 * Some packets can't be inverted: return 0 in that case. 37 37 */ 38 - int (*invert_tuple)(struct nf_conntrack_tuple *inverse, 39 - const struct nf_conntrack_tuple *orig); 38 + bool (*invert_tuple)(struct nf_conntrack_tuple *inverse, 39 + const struct nf_conntrack_tuple *orig); 40 40 41 41 /* Print out the per-protocol part of the tuple. */ 42 42 int (*print_tuple)(struct seq_file *s,
+7 -7
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
··· 30 30 enum ip_conntrack_info ctinfo); 31 31 EXPORT_SYMBOL_GPL(nf_nat_seq_adjust_hook); 32 32 33 - static int ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 34 - struct nf_conntrack_tuple *tuple) 33 + static bool ipv4_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 34 + struct nf_conntrack_tuple *tuple) 35 35 { 36 36 const __be32 *ap; 37 37 __be32 _addrs[2]; 38 38 ap = skb_header_pointer(skb, nhoff + offsetof(struct iphdr, saddr), 39 39 sizeof(u_int32_t) * 2, _addrs); 40 40 if (ap == NULL) 41 - return 0; 41 + return false; 42 42 43 43 tuple->src.u3.ip = ap[0]; 44 44 tuple->dst.u3.ip = ap[1]; 45 45 46 - return 1; 46 + return true; 47 47 } 48 48 49 - static int ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, 50 - const struct nf_conntrack_tuple *orig) 49 + static bool ipv4_invert_tuple(struct nf_conntrack_tuple *tuple, 50 + const struct nf_conntrack_tuple *orig) 51 51 { 52 52 tuple->src.u3.ip = orig->dst.u3.ip; 53 53 tuple->dst.u3.ip = orig->src.u3.ip; 54 54 55 - return 1; 55 + return true; 56 56 } 57 57 58 58 static int ipv4_print_tuple(struct seq_file *s,
+7 -7
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
··· 27 27 #include <net/netfilter/nf_conntrack_l3proto.h> 28 28 #include <net/netfilter/nf_conntrack_core.h> 29 29 30 - static int ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 31 - struct nf_conntrack_tuple *tuple) 30 + static bool ipv6_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 31 + struct nf_conntrack_tuple *tuple) 32 32 { 33 33 const u_int32_t *ap; 34 34 u_int32_t _addrs[8]; ··· 36 36 ap = skb_header_pointer(skb, nhoff + offsetof(struct ipv6hdr, saddr), 37 37 sizeof(_addrs), _addrs); 38 38 if (ap == NULL) 39 - return 0; 39 + return false; 40 40 41 41 memcpy(tuple->src.u3.ip6, ap, sizeof(tuple->src.u3.ip6)); 42 42 memcpy(tuple->dst.u3.ip6, ap + 4, sizeof(tuple->dst.u3.ip6)); 43 43 44 - return 1; 44 + return true; 45 45 } 46 46 47 - static int ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, 48 - const struct nf_conntrack_tuple *orig) 47 + static bool ipv6_invert_tuple(struct nf_conntrack_tuple *tuple, 48 + const struct nf_conntrack_tuple *orig) 49 49 { 50 50 memcpy(tuple->src.u3.ip6, orig->dst.u3.ip6, sizeof(tuple->src.u3.ip6)); 51 51 memcpy(tuple->dst.u3.ip6, orig->src.u3.ip6, sizeof(tuple->dst.u3.ip6)); 52 52 53 - return 1; 53 + return true; 54 54 } 55 55 56 56 static int ipv6_print_tuple(struct seq_file *s,
+6 -6
net/netfilter/nf_conntrack_l3proto_generic.c
··· 31 31 #include <net/netfilter/nf_conntrack_core.h> 32 32 #include <net/netfilter/ipv4/nf_conntrack_ipv4.h> 33 33 34 - static int generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 35 - struct nf_conntrack_tuple *tuple) 34 + static bool generic_pkt_to_tuple(const struct sk_buff *skb, unsigned int nhoff, 35 + struct nf_conntrack_tuple *tuple) 36 36 { 37 37 memset(&tuple->src.u3, 0, sizeof(tuple->src.u3)); 38 38 memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3)); 39 39 40 - return 1; 40 + return true; 41 41 } 42 42 43 - static int generic_invert_tuple(struct nf_conntrack_tuple *tuple, 44 - const struct nf_conntrack_tuple *orig) 43 + static bool generic_invert_tuple(struct nf_conntrack_tuple *tuple, 44 + const struct nf_conntrack_tuple *orig) 45 45 { 46 46 memset(&tuple->src.u3, 0, sizeof(tuple->src.u3)); 47 47 memset(&tuple->dst.u3, 0, sizeof(tuple->dst.u3)); 48 48 49 - return 1; 49 + return true; 50 50 } 51 51 52 52 static int generic_print_tuple(struct seq_file *s,