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 | 09f263cd39751cada63dec2dccc71e67c00bc38c (patch) | |
tree | 99ec45362e3545b42757803bb43d926d39f3922a /net/ipv4 | |
parent | 8ce8439a31f723f3aa28adf27fe8797a5678dde1 (diff) |
[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_l4proto
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r-- | net/ipv4/netfilter/nf_conntrack_proto_icmp.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c index 6873fddb3529..193a845fe7f8 100644 --- a/net/ipv4/netfilter/nf_conntrack_proto_icmp.c +++ b/net/ipv4/netfilter/nf_conntrack_proto_icmp.c | |||
@@ -22,22 +22,21 @@ | |||
22 | 22 | ||
23 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; | 23 | static unsigned long nf_ct_icmp_timeout __read_mostly = 30*HZ; |
24 | 24 | ||
25 | static int icmp_pkt_to_tuple(const struct sk_buff *skb, | 25 | static bool icmp_pkt_to_tuple(const struct sk_buff *skb, unsigned int dataoff, |
26 | unsigned int dataoff, | 26 | struct nf_conntrack_tuple *tuple) |
27 | struct nf_conntrack_tuple *tuple) | ||
28 | { | 27 | { |
29 | const struct icmphdr *hp; | 28 | const struct icmphdr *hp; |
30 | struct icmphdr _hdr; | 29 | struct icmphdr _hdr; |
31 | 30 | ||
32 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); | 31 | hp = skb_header_pointer(skb, dataoff, sizeof(_hdr), &_hdr); |
33 | if (hp == NULL) | 32 | if (hp == NULL) |
34 | return 0; | 33 | return false; |
35 | 34 | ||
36 | tuple->dst.u.icmp.type = hp->type; | 35 | tuple->dst.u.icmp.type = hp->type; |
37 | tuple->src.u.icmp.id = hp->un.echo.id; | 36 | tuple->src.u.icmp.id = hp->un.echo.id; |
38 | tuple->dst.u.icmp.code = hp->code; | 37 | tuple->dst.u.icmp.code = hp->code; |
39 | 38 | ||
40 | return 1; | 39 | return true; |
41 | } | 40 | } |
42 | 41 | ||
43 | /* Add 1; spaces filled with 0. */ | 42 | /* Add 1; spaces filled with 0. */ |
@@ -52,17 +51,17 @@ static const u_int8_t invmap[] = { | |||
52 | [ICMP_ADDRESSREPLY] = ICMP_ADDRESS + 1 | 51 | [ICMP_ADDRESSREPLY] = ICMP_ADDRESS + 1 |
53 | }; | 52 | }; |
54 | 53 | ||
55 | static int icmp_invert_tuple(struct nf_conntrack_tuple *tuple, | 54 | static bool icmp_invert_tuple(struct nf_conntrack_tuple *tuple, |
56 | const struct nf_conntrack_tuple *orig) | 55 | const struct nf_conntrack_tuple *orig) |
57 | { | 56 | { |
58 | if (orig->dst.u.icmp.type >= sizeof(invmap) | 57 | if (orig->dst.u.icmp.type >= sizeof(invmap) |
59 | || !invmap[orig->dst.u.icmp.type]) | 58 | || !invmap[orig->dst.u.icmp.type]) |
60 | return 0; | 59 | return false; |
61 | 60 | ||
62 | tuple->src.u.icmp.id = orig->src.u.icmp.id; | 61 | tuple->src.u.icmp.id = orig->src.u.icmp.id; |
63 | tuple->dst.u.icmp.type = invmap[orig->dst.u.icmp.type] - 1; | 62 | tuple->dst.u.icmp.type = invmap[orig->dst.u.icmp.type] - 1; |
64 | tuple->dst.u.icmp.code = orig->dst.u.icmp.code; | 63 | tuple->dst.u.icmp.code = orig->dst.u.icmp.code; |
65 | return 1; | 64 | return true; |
66 | } | 65 | } |
67 | 66 | ||
68 | /* Print out the per-protocol part of the tuple. */ | 67 | /* Print out the per-protocol part of the tuple. */ |
@@ -101,8 +100,8 @@ static int icmp_packet(struct nf_conn *ct, | |||
101 | } | 100 | } |
102 | 101 | ||
103 | /* Called when a new connection for this protocol found. */ | 102 | /* Called when a new connection for this protocol found. */ |
104 | static int icmp_new(struct nf_conn *ct, | 103 | static bool icmp_new(struct nf_conn *ct, const struct sk_buff *skb, |
105 | const struct sk_buff *skb, unsigned int dataoff) | 104 | unsigned int dataoff) |
106 | { | 105 | { |
107 | static const u_int8_t valid_new[] = { | 106 | static const u_int8_t valid_new[] = { |
108 | [ICMP_ECHO] = 1, | 107 | [ICMP_ECHO] = 1, |
@@ -117,10 +116,10 @@ static int icmp_new(struct nf_conn *ct, | |||
117 | pr_debug("icmp: can't create new conn with type %u\n", | 116 | pr_debug("icmp: can't create new conn with type %u\n", |
118 | ct->tuplehash[0].tuple.dst.u.icmp.type); | 117 | ct->tuplehash[0].tuple.dst.u.icmp.type); |
119 | NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); | 118 | NF_CT_DUMP_TUPLE(&ct->tuplehash[0].tuple); |
120 | return 0; | 119 | return false; |
121 | } | 120 | } |
122 | atomic_set(&ct->proto.icmp.count, 0); | 121 | atomic_set(&ct->proto.icmp.count, 0); |
123 | return 1; | 122 | return true; |
124 | } | 123 | } |
125 | 124 | ||
126 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ | 125 | /* Returns conntrack if it dealt with ICMP, and filled in skb fields */ |