aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2008-03-25 23:09:33 -0400
committerDavid S. Miller <davem@davemloft.net>2008-03-25 23:09:33 -0400
commitb8beedd25d3913d45b8330a08ab88fdf90eb54b8 (patch)
tree21faa48241a636225fd46ec8158247c82213eb7a /include
parent6002f266b3e7f0acc2d5158cddbed41730b02e82 (diff)
[NETFILTER]: Add nf_inet_addr_cmp()
Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r--include/linux/netfilter.h9
-rw-r--r--include/net/netfilter/nf_conntrack_tuple.h15
2 files changed, 12 insertions, 12 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index f0680c2bee73..89e6c72ad295 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -61,6 +61,15 @@ union nf_inet_addr {
61#ifdef __KERNEL__ 61#ifdef __KERNEL__
62#ifdef CONFIG_NETFILTER 62#ifdef CONFIG_NETFILTER
63 63
64static inline int nf_inet_addr_cmp(const union nf_inet_addr *a1,
65 const union nf_inet_addr *a2)
66{
67 return a1->all[0] == a2->all[0] &&
68 a1->all[1] == a2->all[1] &&
69 a1->all[2] == a2->all[2] &&
70 a1->all[3] == a2->all[3];
71}
72
64extern void netfilter_init(void); 73extern void netfilter_init(void);
65 74
66/* Largest hook number + 1 */ 75/* Largest hook number + 1 */
diff --git a/include/net/netfilter/nf_conntrack_tuple.h b/include/net/netfilter/nf_conntrack_tuple.h
index d9b53dd601ad..168c91754d89 100644
--- a/include/net/netfilter/nf_conntrack_tuple.h
+++ b/include/net/netfilter/nf_conntrack_tuple.h
@@ -163,10 +163,7 @@ struct nf_conntrack_tuple_hash
163static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1, 163static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
164 const struct nf_conntrack_tuple *t2) 164 const struct nf_conntrack_tuple *t2)
165{ 165{
166 return (t1->src.u3.all[0] == t2->src.u3.all[0] && 166 return (nf_inet_addr_cmp(&t1->src.u3, &t2->src.u3) &&
167 t1->src.u3.all[1] == t2->src.u3.all[1] &&
168 t1->src.u3.all[2] == t2->src.u3.all[2] &&
169 t1->src.u3.all[3] == t2->src.u3.all[3] &&
170 t1->src.u.all == t2->src.u.all && 167 t1->src.u.all == t2->src.u.all &&
171 t1->src.l3num == t2->src.l3num); 168 t1->src.l3num == t2->src.l3num);
172} 169}
@@ -174,10 +171,7 @@ static inline int __nf_ct_tuple_src_equal(const struct nf_conntrack_tuple *t1,
174static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1, 171static inline int __nf_ct_tuple_dst_equal(const struct nf_conntrack_tuple *t1,
175 const struct nf_conntrack_tuple *t2) 172 const struct nf_conntrack_tuple *t2)
176{ 173{
177 return (t1->dst.u3.all[0] == t2->dst.u3.all[0] && 174 return (nf_inet_addr_cmp(&t1->dst.u3, &t2->dst.u3) &&
178 t1->dst.u3.all[1] == t2->dst.u3.all[1] &&
179 t1->dst.u3.all[2] == t2->dst.u3.all[2] &&
180 t1->dst.u3.all[3] == t2->dst.u3.all[3] &&
181 t1->dst.u.all == t2->dst.u.all && 175 t1->dst.u.all == t2->dst.u.all &&
182 t1->dst.protonum == t2->dst.protonum); 176 t1->dst.protonum == t2->dst.protonum);
183} 177}
@@ -192,10 +186,7 @@ static inline int nf_ct_tuple_equal(const struct nf_conntrack_tuple *t1,
192static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1, 186static inline int nf_ct_tuple_mask_equal(const struct nf_conntrack_tuple_mask *m1,
193 const struct nf_conntrack_tuple_mask *m2) 187 const struct nf_conntrack_tuple_mask *m2)
194{ 188{
195 return (m1->src.u3.all[0] == m2->src.u3.all[0] && 189 return (nf_inet_addr_cmp(&m1->src.u3, &m2->src.u3) &&
196 m1->src.u3.all[1] == m2->src.u3.all[1] &&
197 m1->src.u3.all[2] == m2->src.u3.all[2] &&
198 m1->src.u3.all[3] == m2->src.u3.all[3] &&
199 m1->src.u.all == m2->src.u.all); 190 m1->src.u.all == m2->src.u.all);
200} 191}
201 192