diff options
author | Arnaldo Carvalho de Melo <acme@mandriva.com> | 2005-12-26 23:43:12 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-01-03 16:11:21 -0500 |
commit | 14c850212ed8f8cbb5972ad6b8812e08a0bc901c (patch) | |
tree | 53c88f03e7bbac4064f6e80d462ad484ee038326 /include | |
parent | 25995ff577675b58dbd848b7758e7bad87411947 (diff) |
[INET_SOCK]: Move struct inet_sock & helper functions to net/inet_sock.h
To help in reducing the number of include dependencies, several files were
touched as they were getting needed headers indirectly for stuff they use.
Thanks also to Alan Menegotto for pointing out that net/dccp/proto.c had
linux/dccp.h include twice.
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/dccp.h | 3 | ||||
-rw-r--r-- | include/linux/ip.h | 126 | ||||
-rw-r--r-- | include/linux/ipv6.h | 7 | ||||
-rw-r--r-- | include/linux/udp.h | 6 | ||||
-rw-r--r-- | include/net/atmclip.h | 2 | ||||
-rw-r--r-- | include/net/dst.h | 1 | ||||
-rw-r--r-- | include/net/icmp.h | 9 | ||||
-rw-r--r-- | include/net/ieee80211_crypt.h | 9 | ||||
-rw-r--r-- | include/net/inet_connection_sock.h | 3 | ||||
-rw-r--r-- | include/net/inet_ecn.h | 2 | ||||
-rw-r--r-- | include/net/inet_hashtables.h | 21 | ||||
-rw-r--r-- | include/net/inet_sock.h | 193 | ||||
-rw-r--r-- | include/net/inet_timewait_sock.h | 2 | ||||
-rw-r--r-- | include/net/ip.h | 17 | ||||
-rw-r--r-- | include/net/ip_fib.h | 2 | ||||
-rw-r--r-- | include/net/ip_vs.h | 12 | ||||
-rw-r--r-- | include/net/ipv6.h | 3 | ||||
-rw-r--r-- | include/net/ndisc.h | 17 | ||||
-rw-r--r-- | include/net/neighbour.h | 2 | ||||
-rw-r--r-- | include/net/pkt_act.h | 1 | ||||
-rw-r--r-- | include/net/raw.h | 2 | ||||
-rw-r--r-- | include/net/udp.h | 4 | ||||
-rw-r--r-- | include/net/xfrm.h | 3 |
23 files changed, 265 insertions, 182 deletions
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index d0bdb499cf8d..088529f54965 100644 --- a/include/linux/dccp.h +++ b/include/linux/dccp.h | |||
@@ -192,10 +192,9 @@ enum { | |||
192 | #include <linux/workqueue.h> | 192 | #include <linux/workqueue.h> |
193 | 193 | ||
194 | #include <net/inet_connection_sock.h> | 194 | #include <net/inet_connection_sock.h> |
195 | #include <net/inet_sock.h> | ||
195 | #include <net/inet_timewait_sock.h> | 196 | #include <net/inet_timewait_sock.h> |
196 | #include <net/sock.h> | ||
197 | #include <net/tcp_states.h> | 197 | #include <net/tcp_states.h> |
198 | #include <net/tcp.h> | ||
199 | 198 | ||
200 | enum dccp_state { | 199 | enum dccp_state { |
201 | DCCP_OPEN = TCP_ESTABLISHED, | 200 | DCCP_OPEN = TCP_ESTABLISHED, |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 6ccc596c19c8..9e2eb9a602eb 100644 --- a/include/linux/ip.h +++ b/include/linux/ip.h | |||
@@ -16,6 +16,7 @@ | |||
16 | */ | 16 | */ |
17 | #ifndef _LINUX_IP_H | 17 | #ifndef _LINUX_IP_H |
18 | #define _LINUX_IP_H | 18 | #define _LINUX_IP_H |
19 | #include <linux/types.h> | ||
19 | #include <asm/byteorder.h> | 20 | #include <asm/byteorder.h> |
20 | 21 | ||
21 | #define IPTOS_TOS_MASK 0x1E | 22 | #define IPTOS_TOS_MASK 0x1E |
@@ -78,131 +79,6 @@ | |||
78 | #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ | 79 | #define IPOPT_TS_TSANDADDR 1 /* timestamps and addresses */ |
79 | #define IPOPT_TS_PRESPEC 3 /* specified modules only */ | 80 | #define IPOPT_TS_PRESPEC 3 /* specified modules only */ |
80 | 81 | ||
81 | #ifdef __KERNEL__ | ||
82 | #include <linux/config.h> | ||
83 | #include <linux/types.h> | ||
84 | #include <net/request_sock.h> | ||
85 | #include <net/sock.h> | ||
86 | #include <linux/igmp.h> | ||
87 | #include <net/flow.h> | ||
88 | |||
89 | struct ip_options { | ||
90 | __u32 faddr; /* Saved first hop address */ | ||
91 | unsigned char optlen; | ||
92 | unsigned char srr; | ||
93 | unsigned char rr; | ||
94 | unsigned char ts; | ||
95 | unsigned char is_setbyuser:1, /* Set by setsockopt? */ | ||
96 | is_data:1, /* Options in __data, rather than skb */ | ||
97 | is_strictroute:1, /* Strict source route */ | ||
98 | srr_is_hit:1, /* Packet destination addr was our one */ | ||
99 | is_changed:1, /* IP checksum more not valid */ | ||
100 | rr_needaddr:1, /* Need to record addr of outgoing dev */ | ||
101 | ts_needtime:1, /* Need to record timestamp */ | ||
102 | ts_needaddr:1; /* Need to record addr of outgoing dev */ | ||
103 | unsigned char router_alert; | ||
104 | unsigned char __pad1; | ||
105 | unsigned char __pad2; | ||
106 | unsigned char __data[0]; | ||
107 | }; | ||
108 | |||
109 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) | ||
110 | |||
111 | struct inet_request_sock { | ||
112 | struct request_sock req; | ||
113 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
114 | u16 inet6_rsk_offset; | ||
115 | /* 2 bytes hole, try to pack */ | ||
116 | #endif | ||
117 | u32 loc_addr; | ||
118 | u32 rmt_addr; | ||
119 | u16 rmt_port; | ||
120 | u16 snd_wscale : 4, | ||
121 | rcv_wscale : 4, | ||
122 | tstamp_ok : 1, | ||
123 | sack_ok : 1, | ||
124 | wscale_ok : 1, | ||
125 | ecn_ok : 1, | ||
126 | acked : 1; | ||
127 | struct ip_options *opt; | ||
128 | }; | ||
129 | |||
130 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | ||
131 | { | ||
132 | return (struct inet_request_sock *)sk; | ||
133 | } | ||
134 | |||
135 | struct ipv6_pinfo; | ||
136 | |||
137 | struct inet_sock { | ||
138 | /* sk and pinet6 has to be the first two members of inet_sock */ | ||
139 | struct sock sk; | ||
140 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
141 | struct ipv6_pinfo *pinet6; | ||
142 | #endif | ||
143 | /* Socket demultiplex comparisons on incoming packets. */ | ||
144 | __u32 daddr; /* Foreign IPv4 addr */ | ||
145 | __u32 rcv_saddr; /* Bound local IPv4 addr */ | ||
146 | __u16 dport; /* Destination port */ | ||
147 | __u16 num; /* Local port */ | ||
148 | __u32 saddr; /* Sending source */ | ||
149 | __s16 uc_ttl; /* Unicast TTL */ | ||
150 | __u16 cmsg_flags; | ||
151 | struct ip_options *opt; | ||
152 | __u16 sport; /* Source port */ | ||
153 | __u16 id; /* ID counter for DF pkts */ | ||
154 | __u8 tos; /* TOS */ | ||
155 | __u8 mc_ttl; /* Multicasting TTL */ | ||
156 | __u8 pmtudisc; | ||
157 | unsigned recverr : 1, | ||
158 | is_icsk : 1, /* inet_connection_sock? */ | ||
159 | freebind : 1, | ||
160 | hdrincl : 1, | ||
161 | mc_loop : 1; | ||
162 | int mc_index; /* Multicast device index */ | ||
163 | __u32 mc_addr; | ||
164 | struct ip_mc_socklist *mc_list; /* Group array */ | ||
165 | /* | ||
166 | * Following members are used to retain the infomation to build | ||
167 | * an ip header on each ip fragmentation while the socket is corked. | ||
168 | */ | ||
169 | struct { | ||
170 | unsigned int flags; | ||
171 | unsigned int fragsize; | ||
172 | struct ip_options *opt; | ||
173 | struct rtable *rt; | ||
174 | int length; /* Total length of all frames */ | ||
175 | u32 addr; | ||
176 | struct flowi fl; | ||
177 | } cork; | ||
178 | }; | ||
179 | |||
180 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | ||
181 | #define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ | ||
182 | |||
183 | static inline struct inet_sock *inet_sk(const struct sock *sk) | ||
184 | { | ||
185 | return (struct inet_sock *)sk; | ||
186 | } | ||
187 | |||
188 | static inline void __inet_sk_copy_descendant(struct sock *sk_to, | ||
189 | const struct sock *sk_from, | ||
190 | const int ancestor_size) | ||
191 | { | ||
192 | memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, | ||
193 | sk_from->sk_prot->obj_size - ancestor_size); | ||
194 | } | ||
195 | #if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) | ||
196 | static inline void inet_sk_copy_descendant(struct sock *sk_to, | ||
197 | const struct sock *sk_from) | ||
198 | { | ||
199 | __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); | ||
200 | } | ||
201 | #endif | ||
202 | #endif | ||
203 | |||
204 | extern int inet_sk_rebuild_header(struct sock *sk); | ||
205 | |||
206 | struct iphdr { | 82 | struct iphdr { |
207 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 83 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
208 | __u8 ihl:4, | 84 | __u8 ihl:4, |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index a0d04891fe12..93bbed5c6cf4 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h | |||
@@ -171,12 +171,13 @@ enum { | |||
171 | }; | 171 | }; |
172 | 172 | ||
173 | #ifdef __KERNEL__ | 173 | #ifdef __KERNEL__ |
174 | #include <linux/in6.h> /* struct sockaddr_in6 */ | ||
175 | #include <linux/icmpv6.h> | 174 | #include <linux/icmpv6.h> |
176 | #include <net/if_inet6.h> /* struct ipv6_mc_socklist */ | ||
177 | #include <linux/tcp.h> | 175 | #include <linux/tcp.h> |
178 | #include <linux/udp.h> | 176 | #include <linux/udp.h> |
179 | 177 | ||
178 | #include <net/if_inet6.h> /* struct ipv6_mc_socklist */ | ||
179 | #include <net/inet_sock.h> | ||
180 | |||
180 | /* | 181 | /* |
181 | This structure contains results of exthdrs parsing | 182 | This structure contains results of exthdrs parsing |
182 | as offsets from skb->nh. | 183 | as offsets from skb->nh. |
@@ -346,8 +347,6 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
346 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 347 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) |
347 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) | 348 | #define ipv6_only_sock(sk) ((sk)->sk_family == PF_INET6 && __ipv6_only_sock(sk)) |
348 | 349 | ||
349 | #include <linux/tcp.h> | ||
350 | |||
351 | struct inet6_timewait_sock { | 350 | struct inet6_timewait_sock { |
352 | struct in6_addr tw_v6_daddr; | 351 | struct in6_addr tw_v6_daddr; |
353 | struct in6_addr tw_v6_rcv_saddr; | 352 | struct in6_addr tw_v6_rcv_saddr; |
diff --git a/include/linux/udp.h b/include/linux/udp.h index b60e0b4a25c4..85a55658831c 100644 --- a/include/linux/udp.h +++ b/include/linux/udp.h | |||
@@ -35,10 +35,10 @@ struct udphdr { | |||
35 | #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ | 35 | #define UDP_ENCAP_ESPINUDP 2 /* draft-ietf-ipsec-udp-encaps-06 */ |
36 | 36 | ||
37 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
38 | |||
39 | #include <linux/config.h> | 38 | #include <linux/config.h> |
40 | #include <net/sock.h> | 39 | #include <linux/types.h> |
41 | #include <linux/ip.h> | 40 | |
41 | #include <net/inet_sock.h> | ||
42 | 42 | ||
43 | struct udp_sock { | 43 | struct udp_sock { |
44 | /* inet_sock has to be the first member */ | 44 | /* inet_sock has to be the first member */ |
diff --git a/include/net/atmclip.h b/include/net/atmclip.h index 47048b1d179a..90fcc98e676f 100644 --- a/include/net/atmclip.h +++ b/include/net/atmclip.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #define _ATMCLIP_H | 7 | #define _ATMCLIP_H |
8 | 8 | ||
9 | #include <linux/netdevice.h> | 9 | #include <linux/netdevice.h> |
10 | #include <linux/skbuff.h> | ||
11 | #include <linux/atm.h> | 10 | #include <linux/atm.h> |
12 | #include <linux/atmdev.h> | 11 | #include <linux/atmdev.h> |
13 | #include <linux/atmarp.h> | 12 | #include <linux/atmarp.h> |
@@ -18,6 +17,7 @@ | |||
18 | #define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) | 17 | #define CLIP_VCC(vcc) ((struct clip_vcc *) ((vcc)->user_back)) |
19 | #define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) | 18 | #define NEIGH2ENTRY(neigh) ((struct atmarp_entry *) (neigh)->primary_key) |
20 | 19 | ||
20 | struct sk_buff; | ||
21 | 21 | ||
22 | struct clip_vcc { | 22 | struct clip_vcc { |
23 | struct atm_vcc *vcc; /* VCC descriptor */ | 23 | struct atm_vcc *vcc; /* VCC descriptor */ |
diff --git a/include/net/dst.h b/include/net/dst.h index 6c196a5baf24..bee8b84d329d 100644 --- a/include/net/dst.h +++ b/include/net/dst.h | |||
@@ -9,6 +9,7 @@ | |||
9 | #define _NET_DST_H | 9 | #define _NET_DST_H |
10 | 10 | ||
11 | #include <linux/config.h> | 11 | #include <linux/config.h> |
12 | #include <linux/netdevice.h> | ||
12 | #include <linux/rtnetlink.h> | 13 | #include <linux/rtnetlink.h> |
13 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
14 | #include <linux/jiffies.h> | 15 | #include <linux/jiffies.h> |
diff --git a/include/net/icmp.h b/include/net/icmp.h index 6cdebeee5f96..e7c3f20fbafc 100644 --- a/include/net/icmp.h +++ b/include/net/icmp.h | |||
@@ -20,12 +20,9 @@ | |||
20 | 20 | ||
21 | #include <linux/config.h> | 21 | #include <linux/config.h> |
22 | #include <linux/icmp.h> | 22 | #include <linux/icmp.h> |
23 | #include <linux/skbuff.h> | ||
24 | 23 | ||
25 | #include <net/sock.h> | 24 | #include <net/inet_sock.h> |
26 | #include <net/protocol.h> | ||
27 | #include <net/snmp.h> | 25 | #include <net/snmp.h> |
28 | #include <linux/ip.h> | ||
29 | 26 | ||
30 | struct icmp_err { | 27 | struct icmp_err { |
31 | int errno; | 28 | int errno; |
@@ -38,6 +35,10 @@ DECLARE_SNMP_STAT(struct icmp_mib, icmp_statistics); | |||
38 | #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) | 35 | #define ICMP_INC_STATS_BH(field) SNMP_INC_STATS_BH(icmp_statistics, field) |
39 | #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) | 36 | #define ICMP_INC_STATS_USER(field) SNMP_INC_STATS_USER(icmp_statistics, field) |
40 | 37 | ||
38 | struct dst_entry; | ||
39 | struct net_proto_family; | ||
40 | struct sk_buff; | ||
41 | |||
41 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); | 42 | extern void icmp_send(struct sk_buff *skb_in, int type, int code, u32 info); |
42 | extern int icmp_rcv(struct sk_buff *skb); | 43 | extern int icmp_rcv(struct sk_buff *skb); |
43 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); | 44 | extern int icmp_ioctl(struct sock *sk, int cmd, unsigned long arg); |
diff --git a/include/net/ieee80211_crypt.h b/include/net/ieee80211_crypt.h index 225fc751d464..03b766afdc39 100644 --- a/include/net/ieee80211_crypt.h +++ b/include/net/ieee80211_crypt.h | |||
@@ -23,12 +23,17 @@ | |||
23 | #ifndef IEEE80211_CRYPT_H | 23 | #ifndef IEEE80211_CRYPT_H |
24 | #define IEEE80211_CRYPT_H | 24 | #define IEEE80211_CRYPT_H |
25 | 25 | ||
26 | #include <linux/skbuff.h> | 26 | #include <linux/types.h> |
27 | #include <linux/list.h> | ||
28 | #include <asm/atomic.h> | ||
27 | 29 | ||
28 | enum { | 30 | enum { |
29 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), | 31 | IEEE80211_CRYPTO_TKIP_COUNTERMEASURES = (1 << 0), |
30 | }; | 32 | }; |
31 | 33 | ||
34 | struct sk_buff; | ||
35 | struct module; | ||
36 | |||
32 | struct ieee80211_crypto_ops { | 37 | struct ieee80211_crypto_ops { |
33 | const char *name; | 38 | const char *name; |
34 | struct list_head list; | 39 | struct list_head list; |
@@ -87,6 +92,8 @@ struct ieee80211_crypt_data { | |||
87 | atomic_t refcnt; | 92 | atomic_t refcnt; |
88 | }; | 93 | }; |
89 | 94 | ||
95 | struct ieee80211_device; | ||
96 | |||
90 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); | 97 | int ieee80211_register_crypto_ops(struct ieee80211_crypto_ops *ops); |
91 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); | 98 | int ieee80211_unregister_crypto_ops(struct ieee80211_crypto_ops *ops); |
92 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); | 99 | struct ieee80211_crypto_ops *ieee80211_get_crypto_ops(const char *name); |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 91888967d3e3..50234fa56a68 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -16,9 +16,10 @@ | |||
16 | #define _INET_CONNECTION_SOCK_H | 16 | #define _INET_CONNECTION_SOCK_H |
17 | 17 | ||
18 | #include <linux/compiler.h> | 18 | #include <linux/compiler.h> |
19 | #include <linux/ip.h> | ||
20 | #include <linux/string.h> | 19 | #include <linux/string.h> |
21 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
21 | |||
22 | #include <net/inet_sock.h> | ||
22 | #include <net/request_sock.h> | 23 | #include <net/request_sock.h> |
23 | 24 | ||
24 | #define INET_CSK_DEBUG 1 | 25 | #define INET_CSK_DEBUG 1 |
diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h index b0c47e2eccf1..d599c6bfbb86 100644 --- a/include/net/inet_ecn.h +++ b/include/net/inet_ecn.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | #include <linux/ip.h> | 4 | #include <linux/ip.h> |
5 | #include <linux/skbuff.h> | 5 | #include <linux/skbuff.h> |
6 | |||
7 | #include <net/inet_sock.h> | ||
6 | #include <net/dsfield.h> | 8 | #include <net/dsfield.h> |
7 | 9 | ||
8 | enum { | 10 | enum { |
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index c83baa79f66e..135d80fd658e 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/wait.h> | 26 | #include <linux/wait.h> |
27 | 27 | ||
28 | #include <net/inet_connection_sock.h> | 28 | #include <net/inet_connection_sock.h> |
29 | #include <net/inet_sock.h> | ||
29 | #include <net/route.h> | 30 | #include <net/route.h> |
30 | #include <net/sock.h> | 31 | #include <net/sock.h> |
31 | #include <net/tcp_states.h> | 32 | #include <net/tcp_states.h> |
@@ -128,26 +129,6 @@ struct inet_hashinfo { | |||
128 | kmem_cache_t *bind_bucket_cachep; | 129 | kmem_cache_t *bind_bucket_cachep; |
129 | }; | 130 | }; |
130 | 131 | ||
131 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | ||
132 | const __u32 faddr, const __u16 fport) | ||
133 | { | ||
134 | unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); | ||
135 | h ^= h >> 16; | ||
136 | h ^= h >> 8; | ||
137 | return h; | ||
138 | } | ||
139 | |||
140 | static inline int inet_sk_ehashfn(const struct sock *sk) | ||
141 | { | ||
142 | const struct inet_sock *inet = inet_sk(sk); | ||
143 | const __u32 laddr = inet->rcv_saddr; | ||
144 | const __u16 lport = inet->num; | ||
145 | const __u32 faddr = inet->daddr; | ||
146 | const __u16 fport = inet->dport; | ||
147 | |||
148 | return inet_ehashfn(laddr, lport, faddr, fport); | ||
149 | } | ||
150 | |||
151 | static inline struct inet_ehash_bucket *inet_ehash_bucket( | 132 | static inline struct inet_ehash_bucket *inet_ehash_bucket( |
152 | struct inet_hashinfo *hashinfo, | 133 | struct inet_hashinfo *hashinfo, |
153 | unsigned int hash) | 134 | unsigned int hash) |
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h new file mode 100644 index 000000000000..883eb529ef8e --- /dev/null +++ b/include/net/inet_sock.h | |||
@@ -0,0 +1,193 @@ | |||
1 | /* | ||
2 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
3 | * operating system. INET is implemented using the BSD Socket | ||
4 | * interface as the means of communication with the user level. | ||
5 | * | ||
6 | * Definitions for inet_sock | ||
7 | * | ||
8 | * Authors: Many, reorganised here by | ||
9 | * Arnaldo Carvalho de Melo <acme@mandriva.com> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or | ||
12 | * modify it under the terms of the GNU General Public License | ||
13 | * as published by the Free Software Foundation; either version | ||
14 | * 2 of the License, or (at your option) any later version. | ||
15 | */ | ||
16 | #ifndef _INET_SOCK_H | ||
17 | #define _INET_SOCK_H | ||
18 | |||
19 | #include <linux/config.h> | ||
20 | |||
21 | #include <linux/string.h> | ||
22 | #include <linux/types.h> | ||
23 | |||
24 | #include <net/flow.h> | ||
25 | #include <net/sock.h> | ||
26 | #include <net/request_sock.h> | ||
27 | |||
28 | /** struct ip_options - IP Options | ||
29 | * | ||
30 | * @faddr - Saved first hop address | ||
31 | * @is_setbyuser - Set by setsockopt? | ||
32 | * @is_data - Options in __data, rather than skb | ||
33 | * @is_strictroute - Strict source route | ||
34 | * @srr_is_hit - Packet destination addr was our one | ||
35 | * @is_changed - IP checksum more not valid | ||
36 | * @rr_needaddr - Need to record addr of outgoing dev | ||
37 | * @ts_needtime - Need to record timestamp | ||
38 | * @ts_needaddr - Need to record addr of outgoing dev | ||
39 | */ | ||
40 | struct ip_options { | ||
41 | __u32 faddr; | ||
42 | unsigned char optlen; | ||
43 | unsigned char srr; | ||
44 | unsigned char rr; | ||
45 | unsigned char ts; | ||
46 | unsigned char is_setbyuser:1, | ||
47 | is_data:1, | ||
48 | is_strictroute:1, | ||
49 | srr_is_hit:1, | ||
50 | is_changed:1, | ||
51 | rr_needaddr:1, | ||
52 | ts_needtime:1, | ||
53 | ts_needaddr:1; | ||
54 | unsigned char router_alert; | ||
55 | unsigned char __pad1; | ||
56 | unsigned char __pad2; | ||
57 | unsigned char __data[0]; | ||
58 | }; | ||
59 | |||
60 | #define optlength(opt) (sizeof(struct ip_options) + opt->optlen) | ||
61 | |||
62 | struct inet_request_sock { | ||
63 | struct request_sock req; | ||
64 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
65 | u16 inet6_rsk_offset; | ||
66 | /* 2 bytes hole, try to pack */ | ||
67 | #endif | ||
68 | u32 loc_addr; | ||
69 | u32 rmt_addr; | ||
70 | u16 rmt_port; | ||
71 | u16 snd_wscale : 4, | ||
72 | rcv_wscale : 4, | ||
73 | tstamp_ok : 1, | ||
74 | sack_ok : 1, | ||
75 | wscale_ok : 1, | ||
76 | ecn_ok : 1, | ||
77 | acked : 1; | ||
78 | struct ip_options *opt; | ||
79 | }; | ||
80 | |||
81 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | ||
82 | { | ||
83 | return (struct inet_request_sock *)sk; | ||
84 | } | ||
85 | |||
86 | struct ip_mc_socklist; | ||
87 | struct ipv6_pinfo; | ||
88 | struct rtable; | ||
89 | |||
90 | /** struct inet_sock - representation of INET sockets | ||
91 | * | ||
92 | * @sk - ancestor class | ||
93 | * @pinet6 - pointer to IPv6 control block | ||
94 | * @daddr - Foreign IPv4 addr | ||
95 | * @rcv_saddr - Bound local IPv4 addr | ||
96 | * @dport - Destination port | ||
97 | * @num - Local port | ||
98 | * @saddr - Sending source | ||
99 | * @uc_ttl - Unicast TTL | ||
100 | * @sport - Source port | ||
101 | * @id - ID counter for DF pkts | ||
102 | * @tos - TOS | ||
103 | * @mc_ttl - Multicasting TTL | ||
104 | * @is_icsk - is this an inet_connection_sock? | ||
105 | * @mc_index - Multicast device index | ||
106 | * @mc_list - Group array | ||
107 | * @cork - info to build ip hdr on each ip frag while socket is corked | ||
108 | */ | ||
109 | struct inet_sock { | ||
110 | /* sk and pinet6 has to be the first two members of inet_sock */ | ||
111 | struct sock sk; | ||
112 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
113 | struct ipv6_pinfo *pinet6; | ||
114 | #endif | ||
115 | /* Socket demultiplex comparisons on incoming packets. */ | ||
116 | __u32 daddr; | ||
117 | __u32 rcv_saddr; | ||
118 | __u16 dport; | ||
119 | __u16 num; | ||
120 | __u32 saddr; | ||
121 | __s16 uc_ttl; | ||
122 | __u16 cmsg_flags; | ||
123 | struct ip_options *opt; | ||
124 | __u16 sport; | ||
125 | __u16 id; | ||
126 | __u8 tos; | ||
127 | __u8 mc_ttl; | ||
128 | __u8 pmtudisc; | ||
129 | __u8 recverr:1, | ||
130 | is_icsk:1, | ||
131 | freebind:1, | ||
132 | hdrincl:1, | ||
133 | mc_loop:1; | ||
134 | int mc_index; | ||
135 | __u32 mc_addr; | ||
136 | struct ip_mc_socklist *mc_list; | ||
137 | struct { | ||
138 | unsigned int flags; | ||
139 | unsigned int fragsize; | ||
140 | struct ip_options *opt; | ||
141 | struct rtable *rt; | ||
142 | int length; /* Total length of all frames */ | ||
143 | u32 addr; | ||
144 | struct flowi fl; | ||
145 | } cork; | ||
146 | }; | ||
147 | |||
148 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | ||
149 | #define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ | ||
150 | |||
151 | static inline struct inet_sock *inet_sk(const struct sock *sk) | ||
152 | { | ||
153 | return (struct inet_sock *)sk; | ||
154 | } | ||
155 | |||
156 | static inline void __inet_sk_copy_descendant(struct sock *sk_to, | ||
157 | const struct sock *sk_from, | ||
158 | const int ancestor_size) | ||
159 | { | ||
160 | memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, | ||
161 | sk_from->sk_prot->obj_size - ancestor_size); | ||
162 | } | ||
163 | #if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) | ||
164 | static inline void inet_sk_copy_descendant(struct sock *sk_to, | ||
165 | const struct sock *sk_from) | ||
166 | { | ||
167 | __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); | ||
168 | } | ||
169 | #endif | ||
170 | |||
171 | extern int inet_sk_rebuild_header(struct sock *sk); | ||
172 | |||
173 | static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, | ||
174 | const __u32 faddr, const __u16 fport) | ||
175 | { | ||
176 | unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); | ||
177 | h ^= h >> 16; | ||
178 | h ^= h >> 8; | ||
179 | return h; | ||
180 | } | ||
181 | |||
182 | static inline int inet_sk_ehashfn(const struct sock *sk) | ||
183 | { | ||
184 | const struct inet_sock *inet = inet_sk(sk); | ||
185 | const __u32 laddr = inet->rcv_saddr; | ||
186 | const __u16 lport = inet->num; | ||
187 | const __u32 faddr = inet->daddr; | ||
188 | const __u16 fport = inet->dport; | ||
189 | |||
190 | return inet_ehashfn(laddr, lport, faddr, fport); | ||
191 | } | ||
192 | |||
193 | #endif /* _INET_SOCK_H */ | ||
diff --git a/include/net/inet_timewait_sock.h b/include/net/inet_timewait_sock.h index e396a65473d7..1da294c47522 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -17,13 +17,13 @@ | |||
17 | 17 | ||
18 | #include <linux/config.h> | 18 | #include <linux/config.h> |
19 | 19 | ||
20 | #include <linux/ip.h> | ||
21 | #include <linux/list.h> | 20 | #include <linux/list.h> |
22 | #include <linux/module.h> | 21 | #include <linux/module.h> |
23 | #include <linux/timer.h> | 22 | #include <linux/timer.h> |
24 | #include <linux/types.h> | 23 | #include <linux/types.h> |
25 | #include <linux/workqueue.h> | 24 | #include <linux/workqueue.h> |
26 | 25 | ||
26 | #include <net/inet_sock.h> | ||
27 | #include <net/sock.h> | 27 | #include <net/sock.h> |
28 | #include <net/tcp_states.h> | 28 | #include <net/tcp_states.h> |
29 | #include <net/timewait_sock.h> | 29 | #include <net/timewait_sock.h> |
diff --git a/include/net/ip.h b/include/net/ip.h index 4d6294ba038e..f7e7fd728b67 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -24,14 +24,10 @@ | |||
24 | 24 | ||
25 | #include <linux/config.h> | 25 | #include <linux/config.h> |
26 | #include <linux/types.h> | 26 | #include <linux/types.h> |
27 | #include <linux/socket.h> | ||
28 | #include <linux/ip.h> | 27 | #include <linux/ip.h> |
29 | #include <linux/in.h> | 28 | #include <linux/in.h> |
30 | #include <linux/netdevice.h> | 29 | |
31 | #include <linux/inetdevice.h> | 30 | #include <net/inet_sock.h> |
32 | #include <linux/in_route.h> | ||
33 | #include <net/route.h> | ||
34 | #include <net/arp.h> | ||
35 | #include <net/snmp.h> | 31 | #include <net/snmp.h> |
36 | 32 | ||
37 | struct sock; | 33 | struct sock; |
@@ -75,6 +71,13 @@ extern rwlock_t ip_ra_lock; | |||
75 | 71 | ||
76 | #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ | 72 | #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ |
77 | 73 | ||
74 | struct msghdr; | ||
75 | struct net_device; | ||
76 | struct packet_type; | ||
77 | struct rtable; | ||
78 | struct sk_buff; | ||
79 | struct sockaddr; | ||
80 | |||
78 | extern void ip_mc_dropsocket(struct sock *); | 81 | extern void ip_mc_dropsocket(struct sock *); |
79 | extern void ip_mc_dropdevice(struct net_device *dev); | 82 | extern void ip_mc_dropdevice(struct net_device *dev); |
80 | extern int igmp_mc_proc_init(void); | 83 | extern int igmp_mc_proc_init(void); |
@@ -184,6 +187,8 @@ extern int sysctl_ip_dynaddr; | |||
184 | extern void ipfrag_init(void); | 187 | extern void ipfrag_init(void); |
185 | 188 | ||
186 | #ifdef CONFIG_INET | 189 | #ifdef CONFIG_INET |
190 | #include <net/dst.h> | ||
191 | |||
187 | /* The function in 2.2 was invalid, producing wrong result for | 192 | /* The function in 2.2 was invalid, producing wrong result for |
188 | * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ | 193 | * check=0xFEFF. It was noticed by Arthur Skawina _year_ ago. --ANK(000625) */ |
189 | static inline | 194 | static inline |
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index 14de4ebd1211..e000fa2cd5f6 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h | |||
@@ -238,6 +238,8 @@ extern int fib_validate_source(u32 src, u32 dst, u8 tos, int oif, | |||
238 | struct net_device *dev, u32 *spec_dst, u32 *itag); | 238 | struct net_device *dev, u32 *spec_dst, u32 *itag); |
239 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); | 239 | extern void fib_select_multipath(const struct flowi *flp, struct fib_result *res); |
240 | 240 | ||
241 | struct rtentry; | ||
242 | |||
241 | /* Exported by fib_semantics.c */ | 243 | /* Exported by fib_semantics.c */ |
242 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); | 244 | extern int ip_fib_check_default(u32 gw, struct net_device *dev); |
243 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); | 245 | extern int fib_sync_down(u32 local, struct net_device *dev, int force); |
diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h index 3b5559a023a4..7d2674fde19a 100644 --- a/include/net/ip_vs.h +++ b/include/net/ip_vs.h | |||
@@ -251,16 +251,15 @@ struct ip_vs_daemon_user { | |||
251 | #include <linux/config.h> | 251 | #include <linux/config.h> |
252 | #include <linux/list.h> /* for struct list_head */ | 252 | #include <linux/list.h> /* for struct list_head */ |
253 | #include <linux/spinlock.h> /* for struct rwlock_t */ | 253 | #include <linux/spinlock.h> /* for struct rwlock_t */ |
254 | #include <linux/skbuff.h> /* for struct sk_buff */ | ||
255 | #include <linux/ip.h> /* for struct iphdr */ | ||
256 | #include <asm/atomic.h> /* for struct atomic_t */ | 254 | #include <asm/atomic.h> /* for struct atomic_t */ |
257 | #include <linux/netdevice.h> /* for struct neighbour */ | ||
258 | #include <net/dst.h> /* for struct dst_entry */ | ||
259 | #include <net/udp.h> | ||
260 | #include <linux/compiler.h> | 255 | #include <linux/compiler.h> |
256 | #include <linux/timer.h> | ||
261 | 257 | ||
258 | #include <net/checksum.h> | ||
262 | 259 | ||
263 | #ifdef CONFIG_IP_VS_DEBUG | 260 | #ifdef CONFIG_IP_VS_DEBUG |
261 | #include <linux/net.h> | ||
262 | |||
264 | extern int ip_vs_get_debug_level(void); | 263 | extern int ip_vs_get_debug_level(void); |
265 | #define IP_VS_DBG(level, msg...) \ | 264 | #define IP_VS_DBG(level, msg...) \ |
266 | do { \ | 265 | do { \ |
@@ -429,8 +428,11 @@ struct ip_vs_stats | |||
429 | spinlock_t lock; /* spin lock */ | 428 | spinlock_t lock; /* spin lock */ |
430 | }; | 429 | }; |
431 | 430 | ||
431 | struct dst_entry; | ||
432 | struct iphdr; | ||
432 | struct ip_vs_conn; | 433 | struct ip_vs_conn; |
433 | struct ip_vs_app; | 434 | struct ip_vs_app; |
435 | struct sk_buff; | ||
434 | 436 | ||
435 | struct ip_vs_protocol { | 437 | struct ip_vs_protocol { |
436 | struct ip_vs_protocol *next; | 438 | struct ip_vs_protocol *next; |
diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 11a725662c36..860bbac4c4ee 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -541,6 +541,9 @@ extern int sysctl_ip6frag_secret_interval; | |||
541 | extern const struct proto_ops inet6_stream_ops; | 541 | extern const struct proto_ops inet6_stream_ops; |
542 | extern const struct proto_ops inet6_dgram_ops; | 542 | extern const struct proto_ops inet6_dgram_ops; |
543 | 543 | ||
544 | struct group_source_req; | ||
545 | struct group_filter; | ||
546 | |||
544 | extern int ip6_mc_source(int add, int omode, struct sock *sk, | 547 | extern int ip6_mc_source(int add, int omode, struct sock *sk, |
545 | struct group_source_req *pgsr); | 548 | struct group_source_req *pgsr); |
546 | extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); | 549 | extern int ip6_mc_msfilter(struct sock *sk, struct group_filter *gsf); |
diff --git a/include/net/ndisc.h b/include/net/ndisc.h index f85d6e4b7442..bbac87eeb422 100644 --- a/include/net/ndisc.h +++ b/include/net/ndisc.h | |||
@@ -35,11 +35,20 @@ enum { | |||
35 | 35 | ||
36 | #ifdef __KERNEL__ | 36 | #ifdef __KERNEL__ |
37 | 37 | ||
38 | #include <linux/skbuff.h> | 38 | #include <linux/config.h> |
39 | #include <linux/netdevice.h> | 39 | #include <linux/compiler.h> |
40 | #include <linux/icmpv6.h> | 40 | #include <linux/icmpv6.h> |
41 | #include <linux/in6.h> | ||
42 | #include <linux/types.h> | ||
43 | |||
41 | #include <net/neighbour.h> | 44 | #include <net/neighbour.h> |
42 | #include <asm/atomic.h> | 45 | |
46 | struct ctl_table; | ||
47 | struct file; | ||
48 | struct inet6_dev; | ||
49 | struct net_device; | ||
50 | struct net_proto_family; | ||
51 | struct sk_buff; | ||
43 | 52 | ||
44 | extern struct neigh_table nd_tbl; | 53 | extern struct neigh_table nd_tbl; |
45 | 54 | ||
@@ -108,7 +117,7 @@ extern int igmp6_event_report(struct sk_buff *skb); | |||
108 | extern void igmp6_cleanup(void); | 117 | extern void igmp6_cleanup(void); |
109 | 118 | ||
110 | #ifdef CONFIG_SYSCTL | 119 | #ifdef CONFIG_SYSCTL |
111 | extern int ndisc_ifinfo_sysctl_change(ctl_table *ctl, | 120 | extern int ndisc_ifinfo_sysctl_change(struct ctl_table *ctl, |
112 | int write, | 121 | int write, |
113 | struct file * filp, | 122 | struct file * filp, |
114 | void __user *buffer, | 123 | void __user *buffer, |
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index 34c07731933d..6fa9ae190741 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h | |||
@@ -49,8 +49,8 @@ | |||
49 | #ifdef __KERNEL__ | 49 | #ifdef __KERNEL__ |
50 | 50 | ||
51 | #include <asm/atomic.h> | 51 | #include <asm/atomic.h> |
52 | #include <linux/skbuff.h> | ||
53 | #include <linux/netdevice.h> | 52 | #include <linux/netdevice.h> |
53 | #include <linux/skbuff.h> | ||
54 | #include <linux/rcupdate.h> | 54 | #include <linux/rcupdate.h> |
55 | #include <linux/seq_file.h> | 55 | #include <linux/seq_file.h> |
56 | 56 | ||
diff --git a/include/net/pkt_act.h b/include/net/pkt_act.h index bd08964b72c0..b225d8472b7e 100644 --- a/include/net/pkt_act.h +++ b/include/net/pkt_act.h | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/in.h> | 15 | #include <linux/in.h> |
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/netdevice.h> | ||
19 | #include <linux/skbuff.h> | 18 | #include <linux/skbuff.h> |
20 | #include <linux/rtnetlink.h> | 19 | #include <linux/rtnetlink.h> |
21 | #include <linux/module.h> | 20 | #include <linux/module.h> |
diff --git a/include/net/raw.h b/include/net/raw.h index f47917469b12..e67b28a0248c 100644 --- a/include/net/raw.h +++ b/include/net/raw.h | |||
@@ -19,6 +19,8 @@ | |||
19 | 19 | ||
20 | #include <linux/config.h> | 20 | #include <linux/config.h> |
21 | 21 | ||
22 | #include <net/protocol.h> | ||
23 | |||
22 | extern struct proto raw_prot; | 24 | extern struct proto raw_prot; |
23 | 25 | ||
24 | extern void raw_err(struct sock *, struct sk_buff *, u32 info); | 26 | extern void raw_err(struct sock *, struct sk_buff *, u32 info); |
diff --git a/include/net/udp.h b/include/net/udp.h index 107b9d791a1f..766fba1369ce 100644 --- a/include/net/udp.h +++ b/include/net/udp.h | |||
@@ -22,9 +22,8 @@ | |||
22 | #ifndef _UDP_H | 22 | #ifndef _UDP_H |
23 | #define _UDP_H | 23 | #define _UDP_H |
24 | 24 | ||
25 | #include <linux/udp.h> | ||
26 | #include <linux/ip.h> | ||
27 | #include <linux/list.h> | 25 | #include <linux/list.h> |
26 | #include <net/inet_sock.h> | ||
28 | #include <net/sock.h> | 27 | #include <net/sock.h> |
29 | #include <net/snmp.h> | 28 | #include <net/snmp.h> |
30 | #include <linux/seq_file.h> | 29 | #include <linux/seq_file.h> |
@@ -62,6 +61,7 @@ static inline int udp_lport_inuse(u16 num) | |||
62 | 61 | ||
63 | extern struct proto udp_prot; | 62 | extern struct proto udp_prot; |
64 | 63 | ||
64 | struct sk_buff; | ||
65 | 65 | ||
66 | extern void udp_err(struct sk_buff *, u32); | 66 | extern void udp_err(struct sk_buff *, u32); |
67 | 67 | ||
diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 487abca3ca6f..07d7b50cdd76 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h | |||
@@ -2,11 +2,12 @@ | |||
2 | #define _NET_XFRM_H | 2 | #define _NET_XFRM_H |
3 | 3 | ||
4 | #include <linux/compiler.h> | 4 | #include <linux/compiler.h> |
5 | #include <linux/in.h> | ||
5 | #include <linux/xfrm.h> | 6 | #include <linux/xfrm.h> |
6 | #include <linux/spinlock.h> | 7 | #include <linux/spinlock.h> |
7 | #include <linux/list.h> | 8 | #include <linux/list.h> |
8 | #include <linux/skbuff.h> | 9 | #include <linux/skbuff.h> |
9 | #include <linux/netdevice.h> | 10 | #include <linux/socket.h> |
10 | #include <linux/crypto.h> | 11 | #include <linux/crypto.h> |
11 | #include <linux/pfkeyv2.h> | 12 | #include <linux/pfkeyv2.h> |
12 | #include <linux/in6.h> | 13 | #include <linux/in6.h> |