aboutsummaryrefslogtreecommitdiffstats
path: root/include/net/ip.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/net/ip.h')
-rw-r--r--include/net/ip.h53
1 files changed, 34 insertions, 19 deletions
diff --git a/include/net/ip.h b/include/net/ip.h
index 2f47e5482b55..503994a38ed1 100644
--- a/include/net/ip.h
+++ b/include/net/ip.h
@@ -33,8 +33,7 @@
33 33
34struct sock; 34struct sock;
35 35
36struct inet_skb_parm 36struct inet_skb_parm {
37{
38 struct ip_options opt; /* Compiled IP options */ 37 struct ip_options opt; /* Compiled IP options */
39 unsigned char flags; 38 unsigned char flags;
40 39
@@ -50,8 +49,7 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb)
50 return ip_hdr(skb)->ihl * 4; 49 return ip_hdr(skb)->ihl * 4;
51} 50}
52 51
53struct ipcm_cookie 52struct ipcm_cookie {
54{
55 __be32 addr; 53 __be32 addr;
56 int oif; 54 int oif;
57 struct ip_options *opt; 55 struct ip_options *opt;
@@ -60,8 +58,7 @@ struct ipcm_cookie
60 58
61#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) 59#define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
62 60
63struct ip_ra_chain 61struct ip_ra_chain {
64{
65 struct ip_ra_chain *next; 62 struct ip_ra_chain *next;
66 struct sock *sk; 63 struct sock *sk;
67 void (*destructor)(struct sock *); 64 void (*destructor)(struct sock *);
@@ -159,8 +156,7 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg)
159void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, 156void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg,
160 unsigned int len); 157 unsigned int len);
161 158
162struct ipv4_config 159struct ipv4_config {
163{
164 int log_martians; 160 int log_martians;
165 int no_pmtu_disc; 161 int no_pmtu_disc;
166}; 162};
@@ -178,9 +174,9 @@ extern struct ipv4_config ipv4_config;
178#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) 174#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
179#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) 175#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
180 176
181extern unsigned long snmp_fold_field(void *mib[], int offt); 177extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
182extern int snmp_mib_init(void *ptr[2], size_t mibsize); 178extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize);
183extern void snmp_mib_free(void *ptr[2]); 179extern void snmp_mib_free(void __percpu *ptr[2]);
184 180
185extern struct local_ports { 181extern struct local_ports {
186 seqlock_t lock; 182 seqlock_t lock;
@@ -240,8 +236,8 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
240 * does not change, they drop every other packet in 236 * does not change, they drop every other packet in
241 * a TCP stream using header compression. 237 * a TCP stream using header compression.
242 */ 238 */
243 iph->id = (sk && inet_sk(sk)->daddr) ? 239 iph->id = (sk && inet_sk(sk)->inet_daddr) ?
244 htons(inet_sk(sk)->id++) : 0; 240 htons(inet_sk(sk)->inet_id++) : 0;
245 } else 241 } else
246 __ip_select_ident(iph, dst, 0); 242 __ip_select_ident(iph, dst, 0);
247} 243}
@@ -249,9 +245,9 @@ static inline void ip_select_ident(struct iphdr *iph, struct dst_entry *dst, str
249static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more) 245static inline void ip_select_ident_more(struct iphdr *iph, struct dst_entry *dst, struct sock *sk, int more)
250{ 246{
251 if (iph->frag_off & htons(IP_DF)) { 247 if (iph->frag_off & htons(IP_DF)) {
252 if (sk && inet_sk(sk)->daddr) { 248 if (sk && inet_sk(sk)->inet_daddr) {
253 iph->id = htons(inet_sk(sk)->id); 249 iph->id = htons(inet_sk(sk)->inet_id);
254 inet_sk(sk)->id += 1 + more; 250 inet_sk(sk)->inet_id += 1 + more;
255 } else 251 } else
256 iph->id = 0; 252 iph->id = 0;
257 } else 253 } else
@@ -317,7 +313,7 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch
317 313
318static __inline__ void inet_reset_saddr(struct sock *sk) 314static __inline__ void inet_reset_saddr(struct sock *sk)
319{ 315{
320 inet_sk(sk)->rcv_saddr = inet_sk(sk)->saddr = 0; 316 inet_sk(sk)->inet_rcv_saddr = inet_sk(sk)->inet_saddr = 0;
321#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) 317#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
322 if (sk->sk_family == PF_INET6) { 318 if (sk->sk_family == PF_INET6) {
323 struct ipv6_pinfo *np = inet6_sk(sk); 319 struct ipv6_pinfo *np = inet6_sk(sk);
@@ -330,18 +326,37 @@ static __inline__ void inet_reset_saddr(struct sock *sk)
330 326
331#endif 327#endif
332 328
329static inline int sk_mc_loop(struct sock *sk)
330{
331 if (!sk)
332 return 1;
333 switch (sk->sk_family) {
334 case AF_INET:
335 return inet_sk(sk)->mc_loop;
336#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
337 case AF_INET6:
338 return inet6_sk(sk)->mc_loop;
339#endif
340 }
341 WARN_ON(1);
342 return 1;
343}
344
333extern int ip_call_ra_chain(struct sk_buff *skb); 345extern int ip_call_ra_chain(struct sk_buff *skb);
334 346
335/* 347/*
336 * Functions provided by ip_fragment.c 348 * Functions provided by ip_fragment.c
337 */ 349 */
338 350
339enum ip_defrag_users 351enum ip_defrag_users {
340{
341 IP_DEFRAG_LOCAL_DELIVER, 352 IP_DEFRAG_LOCAL_DELIVER,
342 IP_DEFRAG_CALL_RA_CHAIN, 353 IP_DEFRAG_CALL_RA_CHAIN,
343 IP_DEFRAG_CONNTRACK_IN, 354 IP_DEFRAG_CONNTRACK_IN,
355 __IP_DEFRAG_CONNTRACK_IN_END = IP_DEFRAG_CONNTRACK_IN + USHORT_MAX,
344 IP_DEFRAG_CONNTRACK_OUT, 356 IP_DEFRAG_CONNTRACK_OUT,
357 __IP_DEFRAG_CONNTRACK_OUT_END = IP_DEFRAG_CONNTRACK_OUT + USHORT_MAX,
358 IP_DEFRAG_CONNTRACK_BRIDGE_IN,
359 __IP_DEFRAG_CONNTRACK_BRIDGE_IN = IP_DEFRAG_CONNTRACK_BRIDGE_IN + USHORT_MAX,
345 IP_DEFRAG_VS_IN, 360 IP_DEFRAG_VS_IN,
346 IP_DEFRAG_VS_OUT, 361 IP_DEFRAG_VS_OUT,
347 IP_DEFRAG_VS_FWD 362 IP_DEFRAG_VS_FWD