aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorJan Engelhardt <jengelh@computergmbh.de>2008-04-14 05:15:53 -0400
committerPatrick McHardy <kaber@trash.net>2008-04-14 05:15:53 -0400
commit5f2b4c9006fc667c4614f0b079efab3721f68316 (patch)
tree828631ee4bcbe4ba58ddfe24d95b2615f763c042 /include/net
parent09f263cd39751cada63dec2dccc71e67c00bc38c (diff)
[NETFILTER]: nf_conntrack: use bool type in struct nf_conntrack_tuple.h
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/netfilter/nf_conntrack.h11
-rw-r--r--include/net/netfilter/nf_conntrack_core.h4
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h39
3 files changed, 28 insertions, 26 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h
index 26e6a6e2b5a2..2dbd6c015b94 100644
--- a/include/net/netfilter/nf_conntrack.h
+++ b/include/net/netfilter/nf_conntrack.h
@@ -194,12 +194,11 @@ extern void nf_conntrack_hash_insert(struct nf_conn *ct);
194 194
195extern void nf_conntrack_flush(void); 195extern void nf_conntrack_flush(void);
196 196
197extern int nf_ct_get_tuplepr(const struct sk_buff *skb, 197extern bool nf_ct_get_tuplepr(const struct sk_buff *skb,
198 unsigned int nhoff, 198 unsigned int nhoff, u_int16_t l3num,
199 u_int16_t l3num, 199 struct nf_conntrack_tuple *tuple);
200 struct nf_conntrack_tuple *tuple); 200extern bool nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse,
201extern int nf_ct_invert_tuplepr(struct nf_conntrack_tuple *inverse, 201 const struct nf_conntrack_tuple *orig);
202 const struct nf_conntrack_tuple *orig);
203 202
204extern void __nf_ct_refresh_acct(struct nf_conn *ct, 203extern void __nf_ct_refresh_acct(struct nf_conn *ct,
205 enum ip_conntrack_info ctinfo, 204 enum ip_conntrack_info ctinfo,
diff --git a/include/net/netfilter/nf_conntrack_core.h b/include/net/netfilter/nf_conntrack_core.h
index 9ee26469c759..a81771210934 100644
--- a/include/net/netfilter/nf_conntrack_core.h
+++ b/include/net/netfilter/nf_conntrack_core.h
@@ -30,7 +30,7 @@ extern void nf_conntrack_cleanup(void);
30extern int nf_conntrack_proto_init(void); 30extern int nf_conntrack_proto_init(void);
31extern void nf_conntrack_proto_fini(void); 31extern void nf_conntrack_proto_fini(void);
32 32
33extern int 33extern bool
34nf_ct_get_tuple(const struct sk_buff *skb, 34nf_ct_get_tuple(const struct sk_buff *skb,
35 unsigned int nhoff, 35 unsigned int nhoff,
36 unsigned int dataoff, 36 unsigned int dataoff,
@@ -40,7 +40,7 @@ nf_ct_get_tuple(const struct sk_buff *skb,
40 const struct nf_conntrack_l3proto *l3proto, 40 const struct nf_conntrack_l3proto *l3proto,
41 const struct nf_conntrack_l4proto *l4proto); 41 const struct nf_conntrack_l4proto *l4proto);
42 42
43extern int 43extern bool
44nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse, 44nf_ct_invert_tuple(struct nf_conntrack_tuple *inverse,
45 const struct nf_conntrack_tuple *orig, 45 const struct nf_conntrack_tuple *orig,
46 const struct nf_conntrack_l3proto *l3proto, 46 const struct nf_conntrack_l3proto *l3proto,
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index bdeec3461384..2722b13ecd6c 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -166,61 +166,64 @@ struct nf_conntrack_tuple_hash
166 166
167#endif /* __KERNEL__ */ 167#endif /* __KERNEL__ */
168 168
169static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, 169static inline bool __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
170 const struct nf_conntrack_tuple *t2) 170 const struct nf_conntrack_tuple *t2)
171{ 171{
172 return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) && 172 return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) &&
173 t1->src.u.all == t2->src.u.all && 173 t1->src.u.all == t2->src.u.all &&
174 t1->src.l3num == t2->src.l3num); 174 t1->src.l3num == t2->src.l3num);
175} 175}
176 176
177static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, 177static inline bool __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
178 const struct nf_conntrack_tuple *t2) 178 const struct nf_conntrack_tuple *t2)
179{ 179{
180 return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) && 180 return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) &&
181 t1->dst.u.all == t2->dst.u.all && 181 t1->dst.u.all == t2->dst.u.all &&
182 t1->dst.protonum == t2->dst.protonum); 182 t1->dst.protonum == t2->dst.protonum);
183} 183}
184 184
185static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1, 185static inline bool nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
186 const struct nf_conntrack_tuple *t2) 186 const struct nf_conntrack_tuple *t2)
187{ 187{
188 return __nf_ct_tuple_src_equal(t1, t2) && 188 return __nf_ct_tuple_src_equal(t1, t2) &&
189 __nf_ct_tuple_dst_equal(t1, t2); 189 __nf_ct_tuple_dst_equal(t1, t2);
190} 190}
191 191
192static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, 192static inline bool
193 const struct nf_conntrack_tuple_mask *m2) 193nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1,
194 const struct nf_conntrack_tuple_mask *m2)
194{ 195{
195 return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) && 196 return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) &&
196 m1->src.u.all == m2->src.u.all); 197 m1->src.u.all == m2->src.u.all);
197} 198}
198 199
199static inline int nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1, 200static inline bool
200 const struct nf_conntrack_tuple *t2, 201nf_ct_tuple_src_mask_cmp(const struct nf_conntrack_tuple *t1,
201 const struct nf_conntrack_tuple_mask *mask) 202 const struct nf_conntrack_tuple *t2,
203 const struct nf_conntrack_tuple_mask *mask)
202{ 204{
203 int count; 205 int count;
204 206
205 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) { 207 for (count = 0; count < NF_CT_TUPLE_L3SIZE; count++) {
206 if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) & 208 if ((t1->src.u3.all[count] ^ t2->src.u3.all[count]) &
207 mask->src.u3.all[count]) 209 mask->src.u3.all[count])
208 return 0; 210 return false;
209 } 211 }
210 212
211 if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all) 213 if ((t1->src.u.all ^ t2->src.u.all) & mask->src.u.all)
212 return 0; 214 return false;
213 215
214 if (t1->src.l3num != t2->src.l3num || 216 if (t1->src.l3num != t2->src.l3num ||
215 t1->dst.protonum != t2->dst.protonum) 217 t1->dst.protonum != t2->dst.protonum)
216 return 0; 218 return false;
217 219
218 return 1; 220 return true;
219} 221}
220 222
221static inline int nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t, 223static inline bool
222 const struct nf_conntrack_tuple *tuple, 224nf_ct_tuple_mask_cmp(const struct nf_conntrack_tuple *t,
223 const struct nf_conntrack_tuple_mask *mask) 225 const struct nf_conntrack_tuple *tuple,
226 const struct nf_conntrack_tuple_mask *mask)
224{ 227{
225 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) && 228 return nf_ct_tuple_src_mask_cmp(t, tuple, mask) &&
226 __nf_ct_tuple_dst_equal(t, tuple); 229 __nf_ct_tuple_dst_equal(t, tuple);