diff options
author | Jan Engelhardt <jengelh@computergmbh.de> | 2008-04-14 05:15:53 -0400 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2008-04-14 05:15:53 -0400 |
commit | f2ea825f483d5d78754ae813b6db63f8b74e9343 (patch) | |
tree | 9a71a03a99443078a14aad195fb6c15cbb3920c8 /net | |
parent | 5f2b4c9006fc667c4614f0b079efab3721f68316 (diff) |
[NETFILTER]: nf_nat: use bool type in nf_nat_proto
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/netfilter/nf_nat_core.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_common.c | 24 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_dccp.c | 10 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_gre.c | 18 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_icmp.c | 14 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_sctp.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_tcp.c | 10 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_udp.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_udplite.c | 8 | ||||
-rw-r--r-- | net/ipv4/netfilter/nf_nat_proto_unknown.c | 24 |
10 files changed, 66 insertions, 66 deletions
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c index 25c3efe4207e..07a2fbc59622 100644 --- a/net/ipv4/netfilter/nf_nat_core.c +++ b/net/ipv4/netfilter/nf_nat_core.c | |||
@@ -349,7 +349,7 @@ nf_nat_setup_info(struct nf_conn *ct, | |||
349 | EXPORT_SYMBOL(nf_nat_setup_info); | 349 | EXPORT_SYMBOL(nf_nat_setup_info); |
350 | 350 | ||
351 | /* Returns true if succeeded. */ | 351 | /* Returns true if succeeded. */ |
352 | static int | 352 | static bool |
353 | manip_pkt(u_int16_t proto, | 353 | manip_pkt(u_int16_t proto, |
354 | struct sk_buff *skb, | 354 | struct sk_buff *skb, |
355 | unsigned int iphdroff, | 355 | unsigned int iphdroff, |
@@ -360,7 +360,7 @@ manip_pkt(u_int16_t proto, | |||
360 | const struct nf_nat_protocol *p; | 360 | const struct nf_nat_protocol *p; |
361 | 361 | ||
362 | if (!skb_make_writable(skb, iphdroff + sizeof(*iph))) | 362 | if (!skb_make_writable(skb, iphdroff + sizeof(*iph))) |
363 | return 0; | 363 | return false; |
364 | 364 | ||
365 | iph = (void *)skb->data + iphdroff; | 365 | iph = (void *)skb->data + iphdroff; |
366 | 366 | ||
@@ -369,7 +369,7 @@ manip_pkt(u_int16_t proto, | |||
369 | /* rcu_read_lock()ed by nf_hook_slow */ | 369 | /* rcu_read_lock()ed by nf_hook_slow */ |
370 | p = __nf_nat_proto_find(proto); | 370 | p = __nf_nat_proto_find(proto); |
371 | if (!p->manip_pkt(skb, iphdroff, target, maniptype)) | 371 | if (!p->manip_pkt(skb, iphdroff, target, maniptype)) |
372 | return 0; | 372 | return false; |
373 | 373 | ||
374 | iph = (void *)skb->data + iphdroff; | 374 | iph = (void *)skb->data + iphdroff; |
375 | 375 | ||
@@ -380,7 +380,7 @@ manip_pkt(u_int16_t proto, | |||
380 | csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip); | 380 | csum_replace4(&iph->check, iph->daddr, target->dst.u3.ip); |
381 | iph->daddr = target->dst.u3.ip; | 381 | iph->daddr = target->dst.u3.ip; |
382 | } | 382 | } |
383 | return 1; | 383 | return true; |
384 | } | 384 | } |
385 | 385 | ||
386 | /* Do packet manipulations according to nf_nat_setup_info. */ | 386 | /* Do packet manipulations according to nf_nat_setup_info. */ |
diff --git a/net/ipv4/netfilter/nf_nat_proto_common.c b/net/ipv4/netfilter/nf_nat_proto_common.c index 4904b86265e1..91537f11273f 100644 --- a/net/ipv4/netfilter/nf_nat_proto_common.c +++ b/net/ipv4/netfilter/nf_nat_proto_common.c | |||
@@ -17,10 +17,10 @@ | |||
17 | #include <net/netfilter/nf_nat_rule.h> | 17 | #include <net/netfilter/nf_nat_rule.h> |
18 | #include <net/netfilter/nf_nat_protocol.h> | 18 | #include <net/netfilter/nf_nat_protocol.h> |
19 | 19 | ||
20 | int nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, | 20 | bool nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, |
21 | enum nf_nat_manip_type maniptype, | 21 | enum nf_nat_manip_type maniptype, |
22 | const union nf_conntrack_man_proto *min, | 22 | const union nf_conntrack_man_proto *min, |
23 | const union nf_conntrack_man_proto *max) | 23 | const union nf_conntrack_man_proto *max) |
24 | { | 24 | { |
25 | __be16 port; | 25 | __be16 port; |
26 | 26 | ||
@@ -34,11 +34,11 @@ int nf_nat_proto_in_range(const struct nf_conntrack_tuple *tuple, | |||
34 | } | 34 | } |
35 | EXPORT_SYMBOL_GPL(nf_nat_proto_in_range); | 35 | EXPORT_SYMBOL_GPL(nf_nat_proto_in_range); |
36 | 36 | ||
37 | int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, | 37 | bool nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, |
38 | const struct nf_nat_range *range, | 38 | const struct nf_nat_range *range, |
39 | enum nf_nat_manip_type maniptype, | 39 | enum nf_nat_manip_type maniptype, |
40 | const struct nf_conn *ct, | 40 | const struct nf_conn *ct, |
41 | u_int16_t *rover) | 41 | u_int16_t *rover) |
42 | { | 42 | { |
43 | unsigned int range_size, min, i; | 43 | unsigned int range_size, min, i; |
44 | __be16 *portptr; | 44 | __be16 *portptr; |
@@ -53,7 +53,7 @@ int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
53 | if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { | 53 | if (!(range->flags & IP_NAT_RANGE_PROTO_SPECIFIED)) { |
54 | /* If it's dst rewrite, can't change port */ | 54 | /* If it's dst rewrite, can't change port */ |
55 | if (maniptype == IP_NAT_MANIP_DST) | 55 | if (maniptype == IP_NAT_MANIP_DST) |
56 | return 0; | 56 | return false; |
57 | 57 | ||
58 | if (ntohs(*portptr) < 1024) { | 58 | if (ntohs(*portptr) < 1024) { |
59 | /* Loose convention: >> 512 is credential passing */ | 59 | /* Loose convention: >> 512 is credential passing */ |
@@ -83,9 +83,9 @@ int nf_nat_proto_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
83 | continue; | 83 | continue; |
84 | if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM)) | 84 | if (!(range->flags & IP_NAT_RANGE_PROTO_RANDOM)) |
85 | *rover = off; | 85 | *rover = off; |
86 | return 1; | 86 | return true; |
87 | } | 87 | } |
88 | return 0; | 88 | return false; |
89 | } | 89 | } |
90 | EXPORT_SYMBOL_GPL(nf_nat_proto_unique_tuple); | 90 | EXPORT_SYMBOL_GPL(nf_nat_proto_unique_tuple); |
91 | 91 | ||
diff --git a/net/ipv4/netfilter/nf_nat_proto_dccp.c b/net/ipv4/netfilter/nf_nat_proto_dccp.c index 12b51b38442e..f78eb26e9a20 100644 --- a/net/ipv4/netfilter/nf_nat_proto_dccp.c +++ b/net/ipv4/netfilter/nf_nat_proto_dccp.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | static u_int16_t dccp_port_rover; | 23 | static u_int16_t dccp_port_rover; |
24 | 24 | ||
25 | static int | 25 | static bool |
26 | dccp_unique_tuple(struct nf_conntrack_tuple *tuple, | 26 | dccp_unique_tuple(struct nf_conntrack_tuple *tuple, |
27 | const struct nf_nat_range *range, | 27 | const struct nf_nat_range *range, |
28 | enum nf_nat_manip_type maniptype, | 28 | enum nf_nat_manip_type maniptype, |
@@ -32,7 +32,7 @@ dccp_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
32 | &dccp_port_rover); | 32 | &dccp_port_rover); |
33 | } | 33 | } |
34 | 34 | ||
35 | static int | 35 | static bool |
36 | dccp_manip_pkt(struct sk_buff *skb, | 36 | dccp_manip_pkt(struct sk_buff *skb, |
37 | unsigned int iphdroff, | 37 | unsigned int iphdroff, |
38 | const struct nf_conntrack_tuple *tuple, | 38 | const struct nf_conntrack_tuple *tuple, |
@@ -49,7 +49,7 @@ dccp_manip_pkt(struct sk_buff *skb, | |||
49 | hdrsize = sizeof(struct dccp_hdr); | 49 | hdrsize = sizeof(struct dccp_hdr); |
50 | 50 | ||
51 | if (!skb_make_writable(skb, hdroff + hdrsize)) | 51 | if (!skb_make_writable(skb, hdroff + hdrsize)) |
52 | return 0; | 52 | return false; |
53 | 53 | ||
54 | iph = (struct iphdr *)(skb->data + iphdroff); | 54 | iph = (struct iphdr *)(skb->data + iphdroff); |
55 | hdr = (struct dccp_hdr *)(skb->data + hdroff); | 55 | hdr = (struct dccp_hdr *)(skb->data + hdroff); |
@@ -70,12 +70,12 @@ dccp_manip_pkt(struct sk_buff *skb, | |||
70 | *portptr = newport; | 70 | *portptr = newport; |
71 | 71 | ||
72 | if (hdrsize < sizeof(*hdr)) | 72 | if (hdrsize < sizeof(*hdr)) |
73 | return 1; | 73 | return true; |
74 | 74 | ||
75 | inet_proto_csum_replace4(&hdr->dccph_checksum, skb, oldip, newip, 1); | 75 | inet_proto_csum_replace4(&hdr->dccph_checksum, skb, oldip, newip, 1); |
76 | inet_proto_csum_replace2(&hdr->dccph_checksum, skb, oldport, newport, | 76 | inet_proto_csum_replace2(&hdr->dccph_checksum, skb, oldport, newport, |
77 | 0); | 77 | 0); |
78 | return 1; | 78 | return true; |
79 | } | 79 | } |
80 | 80 | ||
81 | static const struct nf_nat_protocol nf_nat_protocol_dccp = { | 81 | static const struct nf_nat_protocol nf_nat_protocol_dccp = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_gre.c b/net/ipv4/netfilter/nf_nat_proto_gre.c index 84bb7854137a..4c4af5a6d6c8 100644 --- a/net/ipv4/netfilter/nf_nat_proto_gre.c +++ b/net/ipv4/netfilter/nf_nat_proto_gre.c | |||
@@ -37,7 +37,7 @@ MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>"); | |||
37 | MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE"); | 37 | MODULE_DESCRIPTION("Netfilter NAT protocol helper module for GRE"); |
38 | 38 | ||
39 | /* generate unique tuple ... */ | 39 | /* generate unique tuple ... */ |
40 | static int | 40 | static bool |
41 | gre_unique_tuple(struct nf_conntrack_tuple *tuple, | 41 | gre_unique_tuple(struct nf_conntrack_tuple *tuple, |
42 | const struct nf_nat_range *range, | 42 | const struct nf_nat_range *range, |
43 | enum nf_nat_manip_type maniptype, | 43 | enum nf_nat_manip_type maniptype, |
@@ -50,7 +50,7 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
50 | /* If there is no master conntrack we are not PPTP, | 50 | /* If there is no master conntrack we are not PPTP, |
51 | do not change tuples */ | 51 | do not change tuples */ |
52 | if (!ct->master) | 52 | if (!ct->master) |
53 | return 0; | 53 | return false; |
54 | 54 | ||
55 | if (maniptype == IP_NAT_MANIP_SRC) | 55 | if (maniptype == IP_NAT_MANIP_SRC) |
56 | keyptr = &tuple->src.u.gre.key; | 56 | keyptr = &tuple->src.u.gre.key; |
@@ -71,15 +71,15 @@ gre_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
71 | for (i = 0; i < range_size; i++, key++) { | 71 | for (i = 0; i < range_size; i++, key++) { |
72 | *keyptr = htons(min + key % range_size); | 72 | *keyptr = htons(min + key % range_size); |
73 | if (!nf_nat_used_tuple(tuple, ct)) | 73 | if (!nf_nat_used_tuple(tuple, ct)) |
74 | return 1; | 74 | return true; |
75 | } | 75 | } |
76 | 76 | ||
77 | pr_debug("%p: no NAT mapping\n", ct); | 77 | pr_debug("%p: no NAT mapping\n", ct); |
78 | return 0; | 78 | return false; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* manipulate a GRE packet according to maniptype */ | 81 | /* manipulate a GRE packet according to maniptype */ |
82 | static int | 82 | static bool |
83 | gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff, | 83 | gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff, |
84 | const struct nf_conntrack_tuple *tuple, | 84 | const struct nf_conntrack_tuple *tuple, |
85 | enum nf_nat_manip_type maniptype) | 85 | enum nf_nat_manip_type maniptype) |
@@ -92,7 +92,7 @@ gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff, | |||
92 | /* pgreh includes two optional 32bit fields which are not required | 92 | /* pgreh includes two optional 32bit fields which are not required |
93 | * to be there. That's where the magic '8' comes from */ | 93 | * to be there. That's where the magic '8' comes from */ |
94 | if (!skb_make_writable(skb, hdroff + sizeof(*pgreh) - 8)) | 94 | if (!skb_make_writable(skb, hdroff + sizeof(*pgreh) - 8)) |
95 | return 0; | 95 | return false; |
96 | 96 | ||
97 | greh = (void *)skb->data + hdroff; | 97 | greh = (void *)skb->data + hdroff; |
98 | pgreh = (struct gre_hdr_pptp *)greh; | 98 | pgreh = (struct gre_hdr_pptp *)greh; |
@@ -100,7 +100,7 @@ gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff, | |||
100 | /* we only have destination manip of a packet, since 'source key' | 100 | /* we only have destination manip of a packet, since 'source key' |
101 | * is not present in the packet itself */ | 101 | * is not present in the packet itself */ |
102 | if (maniptype != IP_NAT_MANIP_DST) | 102 | if (maniptype != IP_NAT_MANIP_DST) |
103 | return 1; | 103 | return true; |
104 | switch (greh->version) { | 104 | switch (greh->version) { |
105 | case GRE_VERSION_1701: | 105 | case GRE_VERSION_1701: |
106 | /* We do not currently NAT any GREv0 packets. | 106 | /* We do not currently NAT any GREv0 packets. |
@@ -112,9 +112,9 @@ gre_manip_pkt(struct sk_buff *skb, unsigned int iphdroff, | |||
112 | break; | 112 | break; |
113 | default: | 113 | default: |
114 | pr_debug("can't nat unknown GRE version\n"); | 114 | pr_debug("can't nat unknown GRE version\n"); |
115 | return 0; | 115 | return false; |
116 | } | 116 | } |
117 | return 1; | 117 | return true; |
118 | } | 118 | } |
119 | 119 | ||
120 | static const struct nf_nat_protocol gre = { | 120 | static const struct nf_nat_protocol gre = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_icmp.c b/net/ipv4/netfilter/nf_nat_proto_icmp.c index ab3a0ec2a2d1..19a8b0b07d8e 100644 --- a/net/ipv4/netfilter/nf_nat_proto_icmp.c +++ b/net/ipv4/netfilter/nf_nat_proto_icmp.c | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <net/netfilter/nf_nat_rule.h> | 17 | #include <net/netfilter/nf_nat_rule.h> |
18 | #include <net/netfilter/nf_nat_protocol.h> | 18 | #include <net/netfilter/nf_nat_protocol.h> |
19 | 19 | ||
20 | static int | 20 | static bool |
21 | icmp_in_range(const struct nf_conntrack_tuple *tuple, | 21 | icmp_in_range(const struct nf_conntrack_tuple *tuple, |
22 | enum nf_nat_manip_type maniptype, | 22 | enum nf_nat_manip_type maniptype, |
23 | const union nf_conntrack_man_proto *min, | 23 | const union nf_conntrack_man_proto *min, |
@@ -27,7 +27,7 @@ icmp_in_range(const struct nf_conntrack_tuple *tuple, | |||
27 | ntohs(tuple->src.u.icmp.id) <= ntohs(max->icmp.id); | 27 | ntohs(tuple->src.u.icmp.id) <= ntohs(max->icmp.id); |
28 | } | 28 | } |
29 | 29 | ||
30 | static int | 30 | static bool |
31 | icmp_unique_tuple(struct nf_conntrack_tuple *tuple, | 31 | icmp_unique_tuple(struct nf_conntrack_tuple *tuple, |
32 | const struct nf_nat_range *range, | 32 | const struct nf_nat_range *range, |
33 | enum nf_nat_manip_type maniptype, | 33 | enum nf_nat_manip_type maniptype, |
@@ -46,12 +46,12 @@ icmp_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
46 | tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) + | 46 | tuple->src.u.icmp.id = htons(ntohs(range->min.icmp.id) + |
47 | (id % range_size)); | 47 | (id % range_size)); |
48 | if (!nf_nat_used_tuple(tuple, ct)) | 48 | if (!nf_nat_used_tuple(tuple, ct)) |
49 | return 1; | 49 | return true; |
50 | } | 50 | } |
51 | return 0; | 51 | return false; |
52 | } | 52 | } |
53 | 53 | ||
54 | static int | 54 | static bool |
55 | icmp_manip_pkt(struct sk_buff *skb, | 55 | icmp_manip_pkt(struct sk_buff *skb, |
56 | unsigned int iphdroff, | 56 | unsigned int iphdroff, |
57 | const struct nf_conntrack_tuple *tuple, | 57 | const struct nf_conntrack_tuple *tuple, |
@@ -62,13 +62,13 @@ icmp_manip_pkt(struct sk_buff *skb, | |||
62 | unsigned int hdroff = iphdroff + iph->ihl*4; | 62 | unsigned int hdroff = iphdroff + iph->ihl*4; |
63 | 63 | ||
64 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) | 64 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) |
65 | return 0; | 65 | return false; |
66 | 66 | ||
67 | hdr = (struct icmphdr *)(skb->data + hdroff); | 67 | hdr = (struct icmphdr *)(skb->data + hdroff); |
68 | inet_proto_csum_replace2(&hdr->checksum, skb, | 68 | inet_proto_csum_replace2(&hdr->checksum, skb, |
69 | hdr->un.echo.id, tuple->src.u.icmp.id, 0); | 69 | hdr->un.echo.id, tuple->src.u.icmp.id, 0); |
70 | hdr->un.echo.id = tuple->src.u.icmp.id; | 70 | hdr->un.echo.id = tuple->src.u.icmp.id; |
71 | return 1; | 71 | return true; |
72 | } | 72 | } |
73 | 73 | ||
74 | const struct nf_nat_protocol nf_nat_protocol_icmp = { | 74 | const struct nf_nat_protocol nf_nat_protocol_icmp = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_sctp.c b/net/ipv4/netfilter/nf_nat_proto_sctp.c index 3d3faa9d5f6d..82e4c0e286b8 100644 --- a/net/ipv4/netfilter/nf_nat_proto_sctp.c +++ b/net/ipv4/netfilter/nf_nat_proto_sctp.c | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | static u_int16_t nf_sctp_port_rover; | 17 | static u_int16_t nf_sctp_port_rover; |
18 | 18 | ||
19 | static int | 19 | static bool |
20 | sctp_unique_tuple(struct nf_conntrack_tuple *tuple, | 20 | sctp_unique_tuple(struct nf_conntrack_tuple *tuple, |
21 | const struct nf_nat_range *range, | 21 | const struct nf_nat_range *range, |
22 | enum nf_nat_manip_type maniptype, | 22 | enum nf_nat_manip_type maniptype, |
@@ -26,7 +26,7 @@ sctp_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
26 | &nf_sctp_port_rover); | 26 | &nf_sctp_port_rover); |
27 | } | 27 | } |
28 | 28 | ||
29 | static int | 29 | static bool |
30 | sctp_manip_pkt(struct sk_buff *skb, | 30 | sctp_manip_pkt(struct sk_buff *skb, |
31 | unsigned int iphdroff, | 31 | unsigned int iphdroff, |
32 | const struct nf_conntrack_tuple *tuple, | 32 | const struct nf_conntrack_tuple *tuple, |
@@ -39,7 +39,7 @@ sctp_manip_pkt(struct sk_buff *skb, | |||
39 | u32 crc32; | 39 | u32 crc32; |
40 | 40 | ||
41 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) | 41 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) |
42 | return 0; | 42 | return false; |
43 | 43 | ||
44 | iph = (struct iphdr *)(skb->data + iphdroff); | 44 | iph = (struct iphdr *)(skb->data + iphdroff); |
45 | hdr = (struct sctphdr *)(skb->data + hdroff); | 45 | hdr = (struct sctphdr *)(skb->data + hdroff); |
@@ -63,7 +63,7 @@ sctp_manip_pkt(struct sk_buff *skb, | |||
63 | crc32 = sctp_end_cksum(crc32); | 63 | crc32 = sctp_end_cksum(crc32); |
64 | hdr->checksum = htonl(crc32); | 64 | hdr->checksum = htonl(crc32); |
65 | 65 | ||
66 | return 1; | 66 | return true; |
67 | } | 67 | } |
68 | 68 | ||
69 | static const struct nf_nat_protocol nf_nat_protocol_sctp = { | 69 | static const struct nf_nat_protocol nf_nat_protocol_sctp = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_tcp.c b/net/ipv4/netfilter/nf_nat_proto_tcp.c index 5d4c8a0e89c0..399e2cfa263b 100644 --- a/net/ipv4/netfilter/nf_nat_proto_tcp.c +++ b/net/ipv4/netfilter/nf_nat_proto_tcp.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | static u_int16_t tcp_port_rover; | 21 | static u_int16_t tcp_port_rover; |
22 | 22 | ||
23 | static int | 23 | static bool |
24 | tcp_unique_tuple(struct nf_conntrack_tuple *tuple, | 24 | tcp_unique_tuple(struct nf_conntrack_tuple *tuple, |
25 | const struct nf_nat_range *range, | 25 | const struct nf_nat_range *range, |
26 | enum nf_nat_manip_type maniptype, | 26 | enum nf_nat_manip_type maniptype, |
@@ -30,7 +30,7 @@ tcp_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
30 | &tcp_port_rover); | 30 | &tcp_port_rover); |
31 | } | 31 | } |
32 | 32 | ||
33 | static int | 33 | static bool |
34 | tcp_manip_pkt(struct sk_buff *skb, | 34 | tcp_manip_pkt(struct sk_buff *skb, |
35 | unsigned int iphdroff, | 35 | unsigned int iphdroff, |
36 | const struct nf_conntrack_tuple *tuple, | 36 | const struct nf_conntrack_tuple *tuple, |
@@ -50,7 +50,7 @@ tcp_manip_pkt(struct sk_buff *skb, | |||
50 | hdrsize = sizeof(struct tcphdr); | 50 | hdrsize = sizeof(struct tcphdr); |
51 | 51 | ||
52 | if (!skb_make_writable(skb, hdroff + hdrsize)) | 52 | if (!skb_make_writable(skb, hdroff + hdrsize)) |
53 | return 0; | 53 | return false; |
54 | 54 | ||
55 | iph = (struct iphdr *)(skb->data + iphdroff); | 55 | iph = (struct iphdr *)(skb->data + iphdroff); |
56 | hdr = (struct tcphdr *)(skb->data + hdroff); | 56 | hdr = (struct tcphdr *)(skb->data + hdroff); |
@@ -73,11 +73,11 @@ tcp_manip_pkt(struct sk_buff *skb, | |||
73 | *portptr = newport; | 73 | *portptr = newport; |
74 | 74 | ||
75 | if (hdrsize < sizeof(*hdr)) | 75 | if (hdrsize < sizeof(*hdr)) |
76 | return 1; | 76 | return true; |
77 | 77 | ||
78 | inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1); | 78 | inet_proto_csum_replace4(&hdr->check, skb, oldip, newip, 1); |
79 | inet_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0); | 79 | inet_proto_csum_replace2(&hdr->check, skb, oldport, newport, 0); |
80 | return 1; | 80 | return true; |
81 | } | 81 | } |
82 | 82 | ||
83 | const struct nf_nat_protocol nf_nat_protocol_tcp = { | 83 | const struct nf_nat_protocol nf_nat_protocol_tcp = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_udp.c b/net/ipv4/netfilter/nf_nat_proto_udp.c index 74a7e7b63465..9e61c79492e4 100644 --- a/net/ipv4/netfilter/nf_nat_proto_udp.c +++ b/net/ipv4/netfilter/nf_nat_proto_udp.c | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | static u_int16_t udp_port_rover; | 20 | static u_int16_t udp_port_rover; |
21 | 21 | ||
22 | static int | 22 | static bool |
23 | udp_unique_tuple(struct nf_conntrack_tuple *tuple, | 23 | udp_unique_tuple(struct nf_conntrack_tuple *tuple, |
24 | const struct nf_nat_range *range, | 24 | const struct nf_nat_range *range, |
25 | enum nf_nat_manip_type maniptype, | 25 | enum nf_nat_manip_type maniptype, |
@@ -29,7 +29,7 @@ udp_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
29 | &udp_port_rover); | 29 | &udp_port_rover); |
30 | } | 30 | } |
31 | 31 | ||
32 | static int | 32 | static bool |
33 | udp_manip_pkt(struct sk_buff *skb, | 33 | udp_manip_pkt(struct sk_buff *skb, |
34 | unsigned int iphdroff, | 34 | unsigned int iphdroff, |
35 | const struct nf_conntrack_tuple *tuple, | 35 | const struct nf_conntrack_tuple *tuple, |
@@ -42,7 +42,7 @@ udp_manip_pkt(struct sk_buff *skb, | |||
42 | __be16 *portptr, newport; | 42 | __be16 *portptr, newport; |
43 | 43 | ||
44 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) | 44 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) |
45 | return 0; | 45 | return false; |
46 | 46 | ||
47 | iph = (struct iphdr *)(skb->data + iphdroff); | 47 | iph = (struct iphdr *)(skb->data + iphdroff); |
48 | hdr = (struct udphdr *)(skb->data + hdroff); | 48 | hdr = (struct udphdr *)(skb->data + hdroff); |
@@ -68,7 +68,7 @@ udp_manip_pkt(struct sk_buff *skb, | |||
68 | hdr->check = CSUM_MANGLED_0; | 68 | hdr->check = CSUM_MANGLED_0; |
69 | } | 69 | } |
70 | *portptr = newport; | 70 | *portptr = newport; |
71 | return 1; | 71 | return true; |
72 | } | 72 | } |
73 | 73 | ||
74 | const struct nf_nat_protocol nf_nat_protocol_udp = { | 74 | const struct nf_nat_protocol nf_nat_protocol_udp = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_udplite.c b/net/ipv4/netfilter/nf_nat_proto_udplite.c index b29346d0e7ab..440a229bbd87 100644 --- a/net/ipv4/netfilter/nf_nat_proto_udplite.c +++ b/net/ipv4/netfilter/nf_nat_proto_udplite.c | |||
@@ -18,7 +18,7 @@ | |||
18 | 18 | ||
19 | static u_int16_t udplite_port_rover; | 19 | static u_int16_t udplite_port_rover; |
20 | 20 | ||
21 | static int | 21 | static bool |
22 | udplite_unique_tuple(struct nf_conntrack_tuple *tuple, | 22 | udplite_unique_tuple(struct nf_conntrack_tuple *tuple, |
23 | const struct nf_nat_range *range, | 23 | const struct nf_nat_range *range, |
24 | enum nf_nat_manip_type maniptype, | 24 | enum nf_nat_manip_type maniptype, |
@@ -28,7 +28,7 @@ udplite_unique_tuple(struct nf_conntrack_tuple *tuple, | |||
28 | &udplite_port_rover); | 28 | &udplite_port_rover); |
29 | } | 29 | } |
30 | 30 | ||
31 | static int | 31 | static bool |
32 | udplite_manip_pkt(struct sk_buff *skb, | 32 | udplite_manip_pkt(struct sk_buff *skb, |
33 | unsigned int iphdroff, | 33 | unsigned int iphdroff, |
34 | const struct nf_conntrack_tuple *tuple, | 34 | const struct nf_conntrack_tuple *tuple, |
@@ -41,7 +41,7 @@ udplite_manip_pkt(struct sk_buff *skb, | |||
41 | __be16 *portptr, newport; | 41 | __be16 *portptr, newport; |
42 | 42 | ||
43 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) | 43 | if (!skb_make_writable(skb, hdroff + sizeof(*hdr))) |
44 | return 0; | 44 | return false; |
45 | 45 | ||
46 | iph = (struct iphdr *)(skb->data + iphdroff); | 46 | iph = (struct iphdr *)(skb->data + iphdroff); |
47 | hdr = (struct udphdr *)(skb->data + hdroff); | 47 | hdr = (struct udphdr *)(skb->data + hdroff); |
@@ -66,7 +66,7 @@ udplite_manip_pkt(struct sk_buff *skb, | |||
66 | hdr->check = CSUM_MANGLED_0; | 66 | hdr->check = CSUM_MANGLED_0; |
67 | 67 | ||
68 | *portptr = newport; | 68 | *portptr = newport; |
69 | return 1; | 69 | return true; |
70 | } | 70 | } |
71 | 71 | ||
72 | static const struct nf_nat_protocol nf_nat_protocol_udplite = { | 72 | static const struct nf_nat_protocol nf_nat_protocol_udplite = { |
diff --git a/net/ipv4/netfilter/nf_nat_proto_unknown.c b/net/ipv4/netfilter/nf_nat_proto_unknown.c index cda21ff0e4cf..14381c62acea 100644 --- a/net/ipv4/netfilter/nf_nat_proto_unknown.c +++ b/net/ipv4/netfilter/nf_nat_proto_unknown.c | |||
@@ -18,31 +18,31 @@ | |||
18 | #include <net/netfilter/nf_nat_rule.h> | 18 | #include <net/netfilter/nf_nat_rule.h> |
19 | #include <net/netfilter/nf_nat_protocol.h> | 19 | #include <net/netfilter/nf_nat_protocol.h> |
20 | 20 | ||
21 | static int unknown_in_range(const struct nf_conntrack_tuple *tuple, | 21 | static bool unknown_in_range(const struct nf_conntrack_tuple *tuple, |
22 | enum nf_nat_manip_type manip_type, | 22 | enum nf_nat_manip_type manip_type, |
23 | const union nf_conntrack_man_proto *min, | 23 | const union nf_conntrack_man_proto *min, |
24 | const union nf_conntrack_man_proto *max) | 24 | const union nf_conntrack_man_proto *max) |
25 | { | 25 | { |
26 | return 1; | 26 | return true; |
27 | } | 27 | } |
28 | 28 | ||
29 | static int unknown_unique_tuple(struct nf_conntrack_tuple *tuple, | 29 | static bool unknown_unique_tuple(struct nf_conntrack_tuple *tuple, |
30 | const struct nf_nat_range *range, | 30 | const struct nf_nat_range *range, |
31 | enum nf_nat_manip_type maniptype, | 31 | enum nf_nat_manip_type maniptype, |
32 | const struct nf_conn *ct) | 32 | const struct nf_conn *ct) |
33 | { | 33 | { |
34 | /* Sorry: we can't help you; if it's not unique, we can't frob | 34 | /* Sorry: we can't help you; if it's not unique, we can't frob |
35 | anything. */ | 35 | anything. */ |
36 | return 0; | 36 | return false; |
37 | } | 37 | } |
38 | 38 | ||
39 | static int | 39 | static bool |
40 | unknown_manip_pkt(struct sk_buff *skb, | 40 | unknown_manip_pkt(struct sk_buff *skb, |
41 | unsigned int iphdroff, | 41 | unsigned int iphdroff, |
42 | const struct nf_conntrack_tuple *tuple, | 42 | const struct nf_conntrack_tuple *tuple, |
43 | enum nf_nat_manip_type maniptype) | 43 | enum nf_nat_manip_type maniptype) |
44 | { | 44 | { |
45 | return 1; | 45 | return true; |
46 | } | 46 | } |
47 | 47 | ||
48 | const struct nf_nat_protocol nf_nat_unknown_protocol = { | 48 | const struct nf_nat_protocol nf_nat_unknown_protocol = { |