aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_hashtables.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_hashtables.h')
-rw-r--r--include/net/inet_hashtables.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index 1c4fa0065a8e..c38c637e0734 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -14,6 +14,8 @@
14#ifndef _INET_HASHTABLES_H 14#ifndef _INET_HASHTABLES_H
15#define _INET_HASHTABLES_H 15#define _INET_HASHTABLES_H
16 16
17#include <linux/config.h>
18
17#include <linux/interrupt.h> 19#include <linux/interrupt.h>
18#include <linux/ip.h> 20#include <linux/ip.h>
19#include <linux/ipv6.h> 21#include <linux/ipv6.h>
@@ -310,4 +312,43 @@ sherry_cache:
310 read_unlock(&hashinfo->lhash_lock); 312 read_unlock(&hashinfo->lhash_lock);
311 return sk; 313 return sk;
312} 314}
315
316/* Socket demux engine toys. */
317#ifdef __BIG_ENDIAN
318#define INET_COMBINED_PORTS(__sport, __dport) \
319 (((__u32)(__sport) << 16) | (__u32)(__dport))
320#else /* __LITTLE_ENDIAN */
321#define INET_COMBINED_PORTS(__sport, __dport) \
322 (((__u32)(__dport) << 16) | (__u32)(__sport))
323#endif
324
325#if (BITS_PER_LONG == 64)
326#ifdef __BIG_ENDIAN
327#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
328 const __u64 __name = (((__u64)(__saddr)) << 32) | ((__u64)(__daddr));
329#else /* __LITTLE_ENDIAN */
330#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \
331 const __u64 __name = (((__u64)(__daddr)) << 32) | ((__u64)(__saddr));
332#endif /* __BIG_ENDIAN */
333#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
334 (((*((__u64 *)&(inet_sk(__sk)->daddr))) == (__cookie)) && \
335 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
336 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
337#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif)\
338 (((*((__u64 *)&(inet_twsk(__sk)->tw_daddr))) == (__cookie)) && \
339 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
340 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
341#else /* 32-bit arch */
342#define INET_ADDR_COOKIE(__name, __saddr, __daddr)
343#define INET_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \
344 ((inet_sk(__sk)->daddr == (__saddr)) && \
345 (inet_sk(__sk)->rcv_saddr == (__daddr)) && \
346 ((*((__u32 *)&(inet_sk(__sk)->dport))) == (__ports)) && \
347 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
348#define INET_TW_MATCH(__sk, __cookie, __saddr, __daddr, __ports, __dif) \
349 ((inet_twsk(__sk)->tw_daddr == (__saddr)) && \
350 (inet_twsk(__sk)->tw_rcv_saddr == (__daddr)) && \
351 ((*((__u32 *)&(inet_twsk(__sk)->tw_dport))) == (__ports)) && \
352 (!((__sk)->sk_bound_dev_if) || ((__sk)->sk_bound_dev_if == (__dif))))
353#endif /* 64-bit arch */
313#endif /* _INET_HASHTABLES_H */ 354#endif /* _INET_HASHTABLES_H */