diff options
Diffstat (limited to 'include/net/inet_timewait_sock.h')
| -rw-r--r-- | include/net/inet_timewait_sock.h | 69 |
1 files changed, 28 insertions, 41 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index f908dfc06505..71c6e264e5b5 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
| @@ -58,6 +58,11 @@ struct inet_hashinfo; | |||
| 58 | # define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) | 58 | # define INET_TWDR_RECYCLE_TICK (12 + 2 - INET_TWDR_RECYCLE_SLOTS_LOG) |
| 59 | #endif | 59 | #endif |
| 60 | 60 | ||
| 61 | static inline u32 inet_tw_time_stamp(void) | ||
| 62 | { | ||
| 63 | return jiffies; | ||
| 64 | } | ||
| 65 | |||
| 61 | /* TIME_WAIT reaping mechanism. */ | 66 | /* TIME_WAIT reaping mechanism. */ |
| 62 | #define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */ | 67 | #define INET_TWDR_TWKILL_SLOTS 8 /* Please keep this a power of 2. */ |
| 63 | 68 | ||
| @@ -83,9 +88,9 @@ struct inet_timewait_death_row { | |||
| 83 | int sysctl_max_tw_buckets; | 88 | int sysctl_max_tw_buckets; |
| 84 | }; | 89 | }; |
| 85 | 90 | ||
| 86 | extern void inet_twdr_hangman(unsigned long data); | 91 | void inet_twdr_hangman(unsigned long data); |
| 87 | extern void inet_twdr_twkill_work(struct work_struct *work); | 92 | void inet_twdr_twkill_work(struct work_struct *work); |
| 88 | extern void inet_twdr_twcal_tick(unsigned long data); | 93 | void inet_twdr_twcal_tick(unsigned long data); |
| 89 | 94 | ||
| 90 | struct inet_bind_bucket; | 95 | struct inet_bind_bucket; |
| 91 | 96 | ||
| @@ -111,11 +116,11 @@ struct inet_timewait_sock { | |||
| 111 | #define tw_prot __tw_common.skc_prot | 116 | #define tw_prot __tw_common.skc_prot |
| 112 | #define tw_net __tw_common.skc_net | 117 | #define tw_net __tw_common.skc_net |
| 113 | #define tw_daddr __tw_common.skc_daddr | 118 | #define tw_daddr __tw_common.skc_daddr |
| 119 | #define tw_v6_daddr __tw_common.skc_v6_daddr | ||
| 114 | #define tw_rcv_saddr __tw_common.skc_rcv_saddr | 120 | #define tw_rcv_saddr __tw_common.skc_rcv_saddr |
| 115 | #define tw_addrpair __tw_common.skc_addrpair | 121 | #define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr |
| 116 | #define tw_dport __tw_common.skc_dport | 122 | #define tw_dport __tw_common.skc_dport |
| 117 | #define tw_num __tw_common.skc_num | 123 | #define tw_num __tw_common.skc_num |
| 118 | #define tw_portpair __tw_common.skc_portpair | ||
| 119 | 124 | ||
| 120 | int tw_timeout; | 125 | int tw_timeout; |
| 121 | volatile unsigned char tw_substate; | 126 | volatile unsigned char tw_substate; |
| @@ -130,26 +135,14 @@ struct inet_timewait_sock { | |||
| 130 | tw_transparent : 1, | 135 | tw_transparent : 1, |
| 131 | tw_pad : 6, /* 6 bits hole */ | 136 | tw_pad : 6, /* 6 bits hole */ |
| 132 | tw_tos : 8, | 137 | tw_tos : 8, |
| 133 | tw_ipv6_offset : 16; | 138 | tw_pad2 : 16; /* 16 bits hole */ |
| 134 | kmemcheck_bitfield_end(flags); | 139 | kmemcheck_bitfield_end(flags); |
| 135 | unsigned long tw_ttd; | 140 | u32 tw_ttd; |
| 136 | struct inet_bind_bucket *tw_tb; | 141 | struct inet_bind_bucket *tw_tb; |
| 137 | struct hlist_node tw_death_node; | 142 | struct hlist_node tw_death_node; |
| 138 | }; | 143 | }; |
| 139 | #define tw_tclass tw_tos | 144 | #define tw_tclass tw_tos |
| 140 | 145 | ||
| 141 | static inline void inet_twsk_add_node_rcu(struct inet_timewait_sock *tw, | ||
| 142 | struct hlist_nulls_head *list) | ||
| 143 | { | ||
| 144 | hlist_nulls_add_head_rcu(&tw->tw_node, list); | ||
| 145 | } | ||
| 146 | |||
| 147 | static inline void inet_twsk_add_bind_node(struct inet_timewait_sock *tw, | ||
| 148 | struct hlist_head *list) | ||
| 149 | { | ||
| 150 | hlist_add_head(&tw->tw_bind_node, list); | ||
| 151 | } | ||
| 152 | |||
| 153 | static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) | 146 | static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw) |
| 154 | { | 147 | { |
| 155 | return !hlist_unhashed(&tw->tw_death_node); | 148 | return !hlist_unhashed(&tw->tw_death_node); |
| @@ -189,34 +182,28 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk) | |||
| 189 | return (struct inet_timewait_sock *)sk; | 182 | return (struct inet_timewait_sock *)sk; |
| 190 | } | 183 | } |
| 191 | 184 | ||
| 192 | static inline __be32 sk_rcv_saddr(const struct sock *sk) | 185 | void inet_twsk_free(struct inet_timewait_sock *tw); |
| 193 | { | 186 | void inet_twsk_put(struct inet_timewait_sock *tw); |
| 194 | /* both inet_sk() and inet_twsk() store rcv_saddr in skc_rcv_saddr */ | ||
| 195 | return sk->__sk_common.skc_rcv_saddr; | ||
| 196 | } | ||
| 197 | |||
| 198 | extern void inet_twsk_put(struct inet_timewait_sock *tw); | ||
| 199 | 187 | ||
| 200 | extern int inet_twsk_unhash(struct inet_timewait_sock *tw); | 188 | int inet_twsk_unhash(struct inet_timewait_sock *tw); |
| 201 | 189 | ||
| 202 | extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, | 190 | int inet_twsk_bind_unhash(struct inet_timewait_sock *tw, |
| 203 | struct inet_hashinfo *hashinfo); | 191 | struct inet_hashinfo *hashinfo); |
| 204 | 192 | ||
| 205 | extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, | 193 | struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, |
| 206 | const int state); | 194 | const int state); |
| 207 | 195 | ||
| 208 | extern void __inet_twsk_hashdance(struct inet_timewait_sock *tw, | 196 | void __inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk, |
| 209 | struct sock *sk, | 197 | struct inet_hashinfo *hashinfo); |
| 210 | struct inet_hashinfo *hashinfo); | ||
| 211 | 198 | ||
| 212 | extern void inet_twsk_schedule(struct inet_timewait_sock *tw, | 199 | void inet_twsk_schedule(struct inet_timewait_sock *tw, |
| 213 | struct inet_timewait_death_row *twdr, | 200 | struct inet_timewait_death_row *twdr, |
| 214 | const int timeo, const int timewait_len); | 201 | const int timeo, const int timewait_len); |
| 215 | extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, | 202 | void inet_twsk_deschedule(struct inet_timewait_sock *tw, |
| 216 | struct inet_timewait_death_row *twdr); | 203 | struct inet_timewait_death_row *twdr); |
| 217 | 204 | ||
| 218 | extern void inet_twsk_purge(struct inet_hashinfo *hashinfo, | 205 | void inet_twsk_purge(struct inet_hashinfo *hashinfo, |
| 219 | struct inet_timewait_death_row *twdr, int family); | 206 | struct inet_timewait_death_row *twdr, int family); |
| 220 | 207 | ||
| 221 | static inline | 208 | static inline |
| 222 | struct net *twsk_net(const struct inet_timewait_sock *twsk) | 209 | struct net *twsk_net(const struct inet_timewait_sock *twsk) |
