aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/inet_timewait_sock.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/inet_timewait_sock.h')
-rw-r--r--include/net/inet_timewait_sock.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h
index f93ad90a601b..79f67eae8a7e 100644
--- a/include/net/inet_timewait_sock.h
+++ b/include/net/inet_timewait_sock.h
@@ -194,11 +194,16 @@ static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
194static inline __be32 inet_rcv_saddr(const struct sock *sk) 194static inline __be32 inet_rcv_saddr(const struct sock *sk)
195{ 195{
196 return likely(sk->sk_state != TCP_TIME_WAIT) ? 196 return likely(sk->sk_state != TCP_TIME_WAIT) ?
197 inet_sk(sk)->rcv_saddr : inet_twsk(sk)->tw_rcv_saddr; 197 inet_sk(sk)->inet_rcv_saddr : inet_twsk(sk)->tw_rcv_saddr;
198} 198}
199 199
200extern void inet_twsk_put(struct inet_timewait_sock *tw); 200extern void inet_twsk_put(struct inet_timewait_sock *tw);
201 201
202extern int inet_twsk_unhash(struct inet_timewait_sock *tw);
203
204extern int inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
205 struct inet_hashinfo *hashinfo);
206
202extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk, 207extern struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
203 const int state); 208 const int state);
204 209
@@ -212,14 +217,14 @@ extern void inet_twsk_schedule(struct inet_timewait_sock *tw,
212extern void inet_twsk_deschedule(struct inet_timewait_sock *tw, 217extern void inet_twsk_deschedule(struct inet_timewait_sock *tw,
213 struct inet_timewait_death_row *twdr); 218 struct inet_timewait_death_row *twdr);
214 219
215extern void inet_twsk_purge(struct net *net, struct inet_hashinfo *hashinfo, 220extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
216 struct inet_timewait_death_row *twdr, int family); 221 struct inet_timewait_death_row *twdr, int family);
217 222
218static inline 223static inline
219struct net *twsk_net(const struct inet_timewait_sock *twsk) 224struct net *twsk_net(const struct inet_timewait_sock *twsk)
220{ 225{
221#ifdef CONFIG_NET_NS 226#ifdef CONFIG_NET_NS
222 return twsk->tw_net; 227 return rcu_dereference(twsk->tw_net);
223#else 228#else
224 return &init_net; 229 return &init_net;
225#endif 230#endif
@@ -229,7 +234,7 @@ static inline
229void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net) 234void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
230{ 235{
231#ifdef CONFIG_NET_NS 236#ifdef CONFIG_NET_NS
232 twsk->tw_net = net; 237 rcu_assign_pointer(twsk->tw_net, net);
233#endif 238#endif
234} 239}
235#endif /* _INET_TIMEWAIT_SOCK_ */ 240#endif /* _INET_TIMEWAIT_SOCK_ */