0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef _INET_TIMEWAIT_SOCK_
0012 #define _INET_TIMEWAIT_SOCK_
0013
0014 #include <linux/list.h>
0015 #include <linux/timer.h>
0016 #include <linux/types.h>
0017 #include <linux/workqueue.h>
0018
0019 #include <net/inet_sock.h>
0020 #include <net/sock.h>
0021 #include <net/tcp_states.h>
0022 #include <net/timewait_sock.h>
0023
0024 #include <linux/atomic.h>
0025
0026 struct inet_bind_bucket;
0027
0028
0029
0030
0031
0032
0033 struct inet_timewait_sock {
0034
0035
0036
0037
0038 struct sock_common __tw_common;
0039 #define tw_family __tw_common.skc_family
0040 #define tw_state __tw_common.skc_state
0041 #define tw_reuse __tw_common.skc_reuse
0042 #define tw_reuseport __tw_common.skc_reuseport
0043 #define tw_ipv6only __tw_common.skc_ipv6only
0044 #define tw_bound_dev_if __tw_common.skc_bound_dev_if
0045 #define tw_node __tw_common.skc_nulls_node
0046 #define tw_bind_node __tw_common.skc_bind_node
0047 #define tw_refcnt __tw_common.skc_refcnt
0048 #define tw_hash __tw_common.skc_hash
0049 #define tw_prot __tw_common.skc_prot
0050 #define tw_net __tw_common.skc_net
0051 #define tw_daddr __tw_common.skc_daddr
0052 #define tw_v6_daddr __tw_common.skc_v6_daddr
0053 #define tw_rcv_saddr __tw_common.skc_rcv_saddr
0054 #define tw_v6_rcv_saddr __tw_common.skc_v6_rcv_saddr
0055 #define tw_dport __tw_common.skc_dport
0056 #define tw_num __tw_common.skc_num
0057 #define tw_cookie __tw_common.skc_cookie
0058 #define tw_dr __tw_common.skc_tw_dr
0059
0060 __u32 tw_mark;
0061 volatile unsigned char tw_substate;
0062 unsigned char tw_rcv_wscale;
0063
0064
0065
0066 __be16 tw_sport;
0067
0068 unsigned int tw_transparent : 1,
0069 tw_flowlabel : 20,
0070 tw_pad : 3,
0071 tw_tos : 8;
0072 u32 tw_txhash;
0073 u32 tw_priority;
0074 struct timer_list tw_timer;
0075 struct inet_bind_bucket *tw_tb;
0076 };
0077 #define tw_tclass tw_tos
0078
0079 static inline struct inet_timewait_sock *inet_twsk(const struct sock *sk)
0080 {
0081 return (struct inet_timewait_sock *)sk;
0082 }
0083
0084 void inet_twsk_free(struct inet_timewait_sock *tw);
0085 void inet_twsk_put(struct inet_timewait_sock *tw);
0086
0087 void inet_twsk_bind_unhash(struct inet_timewait_sock *tw,
0088 struct inet_hashinfo *hashinfo);
0089
0090 struct inet_timewait_sock *inet_twsk_alloc(const struct sock *sk,
0091 struct inet_timewait_death_row *dr,
0092 const int state);
0093
0094 void inet_twsk_hashdance(struct inet_timewait_sock *tw, struct sock *sk,
0095 struct inet_hashinfo *hashinfo);
0096
0097 void __inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo,
0098 bool rearm);
0099
0100 static inline void inet_twsk_schedule(struct inet_timewait_sock *tw, int timeo)
0101 {
0102 __inet_twsk_schedule(tw, timeo, false);
0103 }
0104
0105 static inline void inet_twsk_reschedule(struct inet_timewait_sock *tw, int timeo)
0106 {
0107 __inet_twsk_schedule(tw, timeo, true);
0108 }
0109
0110 void inet_twsk_deschedule_put(struct inet_timewait_sock *tw);
0111
0112 void inet_twsk_purge(struct inet_hashinfo *hashinfo, int family);
0113
0114 static inline
0115 struct net *twsk_net(const struct inet_timewait_sock *twsk)
0116 {
0117 return read_pnet(&twsk->tw_net);
0118 }
0119
0120 static inline
0121 void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
0122 {
0123 write_pnet(&twsk->tw_net, net);
0124 }
0125 #endif