diff options
Diffstat (limited to 'include/net/ip.h')
-rw-r--r-- | include/net/ip.h | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 890f9725d681..66dd49149208 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -52,14 +52,14 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | |||
52 | struct ipcm_cookie { | 52 | struct ipcm_cookie { |
53 | __be32 addr; | 53 | __be32 addr; |
54 | int oif; | 54 | int oif; |
55 | struct ip_options *opt; | 55 | struct ip_options_rcu *opt; |
56 | union skb_shared_tx shtx; | 56 | __u8 tx_flags; |
57 | }; | 57 | }; |
58 | 58 | ||
59 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) | 59 | #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb)) |
60 | 60 | ||
61 | struct ip_ra_chain { | 61 | struct ip_ra_chain { |
62 | struct ip_ra_chain *next; | 62 | struct ip_ra_chain __rcu *next; |
63 | struct sock *sk; | 63 | struct sock *sk; |
64 | union { | 64 | union { |
65 | void (*destructor)(struct sock *); | 65 | void (*destructor)(struct sock *); |
@@ -68,7 +68,7 @@ struct ip_ra_chain { | |||
68 | struct rcu_head rcu; | 68 | struct rcu_head rcu; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | extern struct ip_ra_chain *ip_ra_chain; | 71 | extern struct ip_ra_chain __rcu *ip_ra_chain; |
72 | 72 | ||
73 | /* IP flags. */ | 73 | /* IP flags. */ |
74 | #define IP_CE 0x8000 /* Flag: "Congestion" */ | 74 | #define IP_CE 0x8000 /* Flag: "Congestion" */ |
@@ -92,7 +92,7 @@ extern int igmp_mc_proc_init(void); | |||
92 | 92 | ||
93 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, | 93 | extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk, |
94 | __be32 saddr, __be32 daddr, | 94 | __be32 saddr, __be32 daddr, |
95 | struct ip_options *opt); | 95 | struct ip_options_rcu *opt); |
96 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, | 96 | extern int ip_rcv(struct sk_buff *skb, struct net_device *dev, |
97 | struct packet_type *pt, struct net_device *orig_dev); | 97 | struct packet_type *pt, struct net_device *orig_dev); |
98 | extern int ip_local_deliver(struct sk_buff *skb); | 98 | extern int ip_local_deliver(struct sk_buff *skb); |
@@ -104,9 +104,9 @@ extern int ip_do_nat(struct sk_buff *skb); | |||
104 | extern void ip_send_check(struct iphdr *ip); | 104 | extern void ip_send_check(struct iphdr *ip); |
105 | extern int __ip_local_out(struct sk_buff *skb); | 105 | extern int __ip_local_out(struct sk_buff *skb); |
106 | extern int ip_local_out(struct sk_buff *skb); | 106 | extern int ip_local_out(struct sk_buff *skb); |
107 | extern int ip_queue_xmit(struct sk_buff *skb); | 107 | extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl); |
108 | extern void ip_init(void); | 108 | extern void ip_init(void); |
109 | extern int ip_append_data(struct sock *sk, | 109 | extern int ip_append_data(struct sock *sk, struct flowi4 *fl4, |
110 | int getfrag(void *from, char *to, int offset, int len, | 110 | int getfrag(void *from, char *to, int offset, int len, |
111 | int odd, struct sk_buff *skb), | 111 | int odd, struct sk_buff *skb), |
112 | void *from, int len, int protolen, | 112 | void *from, int len, int protolen, |
@@ -114,10 +114,28 @@ extern int ip_append_data(struct sock *sk, | |||
114 | struct rtable **rt, | 114 | struct rtable **rt, |
115 | unsigned int flags); | 115 | unsigned int flags); |
116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); | 116 | extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb); |
117 | extern ssize_t ip_append_page(struct sock *sk, struct page *page, | 117 | extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page, |
118 | int offset, size_t size, int flags); | 118 | int offset, size_t size, int flags); |
119 | extern int ip_push_pending_frames(struct sock *sk); | 119 | extern struct sk_buff *__ip_make_skb(struct sock *sk, |
120 | struct flowi4 *fl4, | ||
121 | struct sk_buff_head *queue, | ||
122 | struct inet_cork *cork); | ||
123 | extern int ip_send_skb(struct sk_buff *skb); | ||
124 | extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4); | ||
120 | extern void ip_flush_pending_frames(struct sock *sk); | 125 | extern void ip_flush_pending_frames(struct sock *sk); |
126 | extern struct sk_buff *ip_make_skb(struct sock *sk, | ||
127 | struct flowi4 *fl4, | ||
128 | int getfrag(void *from, char *to, int offset, int len, | ||
129 | int odd, struct sk_buff *skb), | ||
130 | void *from, int length, int transhdrlen, | ||
131 | struct ipcm_cookie *ipc, | ||
132 | struct rtable **rtp, | ||
133 | unsigned int flags); | ||
134 | |||
135 | static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4) | ||
136 | { | ||
137 | return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base); | ||
138 | } | ||
121 | 139 | ||
122 | /* datagram.c */ | 140 | /* datagram.c */ |
123 | extern int ip4_datagram_connect(struct sock *sk, | 141 | extern int ip4_datagram_connect(struct sock *sk, |
@@ -156,8 +174,8 @@ static inline __u8 ip_reply_arg_flowi_flags(const struct ip_reply_arg *arg) | |||
156 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; | 174 | return (arg->flags & IP_REPLY_ARG_NOSRCCHECK) ? FLOWI_FLAG_ANYSRC : 0; |
157 | } | 175 | } |
158 | 176 | ||
159 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *arg, | 177 | void ip_send_reply(struct sock *sk, struct sk_buff *skb, __be32 daddr, |
160 | unsigned int len); | 178 | struct ip_reply_arg *arg, unsigned int len); |
161 | 179 | ||
162 | struct ipv4_config { | 180 | struct ipv4_config { |
163 | int log_martians; | 181 | int log_martians; |
@@ -201,7 +219,6 @@ static inline int inet_is_reserved_local_port(int port) | |||
201 | return test_bit(port, sysctl_local_reserved_ports); | 219 | return test_bit(port, sysctl_local_reserved_ports); |
202 | } | 220 | } |
203 | 221 | ||
204 | extern int sysctl_ip_default_ttl; | ||
205 | extern int sysctl_ip_nonlocal_bind; | 222 | extern int sysctl_ip_nonlocal_bind; |
206 | 223 | ||
207 | extern struct ctl_path net_core_path[]; | 224 | extern struct ctl_path net_core_path[]; |
@@ -238,9 +255,9 @@ int ip_decrease_ttl(struct iphdr *iph) | |||
238 | static inline | 255 | static inline |
239 | int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) | 256 | int ip_dont_fragment(struct sock *sk, struct dst_entry *dst) |
240 | { | 257 | { |
241 | return (inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || | 258 | return inet_sk(sk)->pmtudisc == IP_PMTUDISC_DO || |
242 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && | 259 | (inet_sk(sk)->pmtudisc == IP_PMTUDISC_WANT && |
243 | !(dst_metric_locked(dst, RTAX_MTU)))); | 260 | !(dst_metric_locked(dst, RTAX_MTU))); |
244 | } | 261 | } |
245 | 262 | ||
246 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); | 263 | extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); |
@@ -324,6 +341,14 @@ static inline void ip_ib_mc_map(__be32 naddr, const unsigned char *broadcast, ch | |||
324 | buf[16] = addr & 0x0f; | 341 | buf[16] = addr & 0x0f; |
325 | } | 342 | } |
326 | 343 | ||
344 | static inline void ip_ipgre_mc_map(__be32 naddr, const unsigned char *broadcast, char *buf) | ||
345 | { | ||
346 | if ((broadcast[0] | broadcast[1] | broadcast[2] | broadcast[3]) != 0) | ||
347 | memcpy(buf, broadcast, 4); | ||
348 | else | ||
349 | memcpy(buf, &naddr, sizeof(naddr)); | ||
350 | } | ||
351 | |||
327 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 352 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
328 | #include <linux/ipv6.h> | 353 | #include <linux/ipv6.h> |
329 | #endif | 354 | #endif |
@@ -393,14 +418,15 @@ extern int ip_forward(struct sk_buff *skb); | |||
393 | * Functions provided by ip_options.c | 418 | * Functions provided by ip_options.c |
394 | */ | 419 | */ |
395 | 420 | ||
396 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, __be32 daddr, struct rtable *rt, int is_frag); | 421 | extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt, |
422 | __be32 daddr, struct rtable *rt, int is_frag); | ||
397 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); | 423 | extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb); |
398 | extern void ip_options_fragment(struct sk_buff *skb); | 424 | extern void ip_options_fragment(struct sk_buff *skb); |
399 | extern int ip_options_compile(struct net *net, | 425 | extern int ip_options_compile(struct net *net, |
400 | struct ip_options *opt, struct sk_buff *skb); | 426 | struct ip_options *opt, struct sk_buff *skb); |
401 | extern int ip_options_get(struct net *net, struct ip_options **optp, | 427 | extern int ip_options_get(struct net *net, struct ip_options_rcu **optp, |
402 | unsigned char *data, int optlen); | 428 | unsigned char *data, int optlen); |
403 | extern int ip_options_get_from_user(struct net *net, struct ip_options **optp, | 429 | extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp, |
404 | unsigned char __user *data, int optlen); | 430 | unsigned char __user *data, int optlen); |
405 | extern void ip_options_undo(struct ip_options * opt); | 431 | extern void ip_options_undo(struct ip_options * opt); |
406 | extern void ip_forward_options(struct sk_buff *skb); | 432 | extern void ip_forward_options(struct sk_buff *skb); |
@@ -428,15 +454,6 @@ extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, | |||
428 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, | 454 | extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport, |
429 | u32 info); | 455 | u32 info); |
430 | 456 | ||
431 | /* sysctl helpers - any sysctl which holds a value that ends up being | ||
432 | * fed into the routing cache should use these handlers. | ||
433 | */ | ||
434 | int ipv4_doint_and_flush(ctl_table *ctl, int write, | ||
435 | void __user *buffer, | ||
436 | size_t *lenp, loff_t *ppos); | ||
437 | int ipv4_doint_and_flush_strategy(ctl_table *table, | ||
438 | void __user *oldval, size_t __user *oldlenp, | ||
439 | void __user *newval, size_t newlen); | ||
440 | #ifdef CONFIG_PROC_FS | 457 | #ifdef CONFIG_PROC_FS |
441 | extern int ip_misc_proc_init(void); | 458 | extern int ip_misc_proc_init(void); |
442 | #endif | 459 | #endif |