Commit b9c7862d authored by David S. Miller's avatar David S. Miller

[TCP]: Make sure tcp_tw_bucket tw_daddr is aligned properly.

parent e34410f0
...@@ -160,6 +160,12 @@ static __inline__ int tcp_bhashfn(__u16 lport) ...@@ -160,6 +160,12 @@ static __inline__ int tcp_bhashfn(__u16 lport)
extern void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb, extern void tcp_bind_hash(struct sock *sk, struct tcp_bind_bucket *tb,
unsigned short snum); unsigned short snum);
#if (BITS_PER_LONG == 64)
#define TCP_ADDRCMP_ALIGN_BYTES 8
#else
#define TCP_ADDRCMP_ALIGN_BYTES 4
#endif
/* This is a TIME_WAIT bucket. It works around the memory consumption /* This is a TIME_WAIT bucket. It works around the memory consumption
* problems of sockets in such a state on heavily loaded servers, but * problems of sockets in such a state on heavily loaded servers, but
* without violating the protocol specification. * without violating the protocol specification.
...@@ -184,7 +190,8 @@ struct tcp_tw_bucket { ...@@ -184,7 +190,8 @@ struct tcp_tw_bucket {
__u16 tw_sport; __u16 tw_sport;
/* Socket demultiplex comparisons on incoming packets. */ /* Socket demultiplex comparisons on incoming packets. */
/* these five are in inet_opt */ /* these five are in inet_opt */
__u32 tw_daddr; __u32 tw_daddr
__attribute__((aligned(TCP_ADDRCMP_ALIGN_BYTES)));
__u32 tw_rcv_saddr; __u32 tw_rcv_saddr;
__u16 tw_dport; __u16 tw_dport;
__u16 tw_num; __u16 tw_num;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment