diff options
Diffstat (limited to 'include/net/ip.h')
-rw-r--r-- | include/net/ip.h | 74 |
1 files changed, 38 insertions, 36 deletions
diff --git a/include/net/ip.h b/include/net/ip.h index 3ec2b0fb9d83..7596eb22e1ce 100644 --- a/include/net/ip.h +++ b/include/net/ip.h | |||
@@ -196,35 +196,31 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, | |||
196 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) | 196 | #define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd) |
197 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) | 197 | #define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd) |
198 | 198 | ||
199 | unsigned long snmp_fold_field(void __percpu *mib[], int offt); | 199 | unsigned long snmp_fold_field(void __percpu *mib, int offt); |
200 | #if BITS_PER_LONG==32 | 200 | #if BITS_PER_LONG==32 |
201 | u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off); | 201 | u64 snmp_fold_field64(void __percpu *mib, int offt, size_t sync_off); |
202 | #else | 202 | #else |
203 | static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off) | 203 | static inline u64 snmp_fold_field64(void __percpu *mib, int offt, size_t syncp_off) |
204 | { | 204 | { |
205 | return snmp_fold_field(mib, offt); | 205 | return snmp_fold_field(mib, offt); |
206 | } | 206 | } |
207 | #endif | 207 | #endif |
208 | int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align); | ||
209 | |||
210 | static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ]) | ||
211 | { | ||
212 | int i; | ||
213 | |||
214 | BUG_ON(ptr == NULL); | ||
215 | for (i = 0; i < SNMP_ARRAY_SZ; i++) { | ||
216 | free_percpu(ptr[i]); | ||
217 | ptr[i] = NULL; | ||
218 | } | ||
219 | } | ||
220 | 208 | ||
221 | void inet_get_local_port_range(struct net *net, int *low, int *high); | 209 | void inet_get_local_port_range(struct net *net, int *low, int *high); |
222 | 210 | ||
223 | extern unsigned long *sysctl_local_reserved_ports; | 211 | #ifdef CONFIG_SYSCTL |
224 | static inline int inet_is_reserved_local_port(int port) | 212 | static inline int inet_is_local_reserved_port(struct net *net, int port) |
225 | { | 213 | { |
226 | return test_bit(port, sysctl_local_reserved_ports); | 214 | if (!net->ipv4.sysctl_local_reserved_ports) |
215 | return 0; | ||
216 | return test_bit(port, net->ipv4.sysctl_local_reserved_ports); | ||
227 | } | 217 | } |
218 | #else | ||
219 | static inline int inet_is_local_reserved_port(struct net *net, int port) | ||
220 | { | ||
221 | return 0; | ||
222 | } | ||
223 | #endif | ||
228 | 224 | ||
229 | extern int sysctl_ip_nonlocal_bind; | 225 | extern int sysctl_ip_nonlocal_bind; |
230 | 226 | ||
@@ -243,6 +239,9 @@ void ipfrag_init(void); | |||
243 | 239 | ||
244 | void ip_static_sysctl_init(void); | 240 | void ip_static_sysctl_init(void); |
245 | 241 | ||
242 | #define IP4_REPLY_MARK(net, mark) \ | ||
243 | ((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0) | ||
244 | |||
246 | static inline bool ip_is_fragment(const struct iphdr *iph) | 245 | static inline bool ip_is_fragment(const struct iphdr *iph) |
247 | { | 246 | { |
248 | return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; | 247 | return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0; |
@@ -281,7 +280,7 @@ static inline bool ip_sk_use_pmtu(const struct sock *sk) | |||
281 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; | 280 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_PROBE; |
282 | } | 281 | } |
283 | 282 | ||
284 | static inline bool ip_sk_local_df(const struct sock *sk) | 283 | static inline bool ip_sk_ignore_df(const struct sock *sk) |
285 | { | 284 | { |
286 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || | 285 | return inet_sk(sk)->pmtudisc < IP_PMTUDISC_DO || |
287 | inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; | 286 | inet_sk(sk)->pmtudisc == IP_PMTUDISC_OMIT; |
@@ -310,36 +309,39 @@ static inline unsigned int ip_skb_dst_mtu(const struct sk_buff *skb) | |||
310 | } | 309 | } |
311 | } | 310 | } |
312 | 311 | ||
313 | void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more); | 312 | u32 ip_idents_reserve(u32 hash, int segs); |
313 | void __ip_select_ident(struct iphdr *iph, int segs); | ||
314 | 314 | ||
315 | static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk) | 315 | static inline void ip_select_ident_segs(struct sk_buff *skb, struct sock *sk, int segs) |
316 | { | 316 | { |
317 | struct iphdr *iph = ip_hdr(skb); | 317 | struct iphdr *iph = ip_hdr(skb); |
318 | 318 | ||
319 | if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { | 319 | if ((iph->frag_off & htons(IP_DF)) && !skb->ignore_df) { |
320 | /* This is only to work around buggy Windows95/2000 | 320 | /* This is only to work around buggy Windows95/2000 |
321 | * VJ compression implementations. If the ID field | 321 | * VJ compression implementations. If the ID field |
322 | * does not change, they drop every other packet in | 322 | * does not change, they drop every other packet in |
323 | * a TCP stream using header compression. | 323 | * a TCP stream using header compression. |
324 | */ | 324 | */ |
325 | iph->id = (sk && inet_sk(sk)->inet_daddr) ? | 325 | if (sk && inet_sk(sk)->inet_daddr) { |
326 | htons(inet_sk(sk)->inet_id++) : 0; | 326 | iph->id = htons(inet_sk(sk)->inet_id); |
327 | } else | 327 | inet_sk(sk)->inet_id += segs; |
328 | __ip_select_ident(iph, dst, 0); | 328 | } else { |
329 | iph->id = 0; | ||
330 | } | ||
331 | } else { | ||
332 | __ip_select_ident(iph, segs); | ||
333 | } | ||
329 | } | 334 | } |
330 | 335 | ||
331 | static inline void ip_select_ident_more(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk, int more) | 336 | static inline void ip_select_ident(struct sk_buff *skb, struct sock *sk) |
332 | { | 337 | { |
333 | struct iphdr *iph = ip_hdr(skb); | 338 | ip_select_ident_segs(skb, sk, 1); |
339 | } | ||
334 | 340 | ||
335 | if ((iph->frag_off & htons(IP_DF)) && !skb->local_df) { | 341 | static inline __wsum inet_compute_pseudo(struct sk_buff *skb, int proto) |
336 | if (sk && inet_sk(sk)->inet_daddr) { | 342 | { |
337 | iph->id = htons(inet_sk(sk)->inet_id); | 343 | return csum_tcpudp_nofold(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr, |
338 | inet_sk(sk)->inet_id += 1 + more; | 344 | skb->len, proto, 0); |
339 | } else | ||
340 | iph->id = 0; | ||
341 | } else | ||
342 | __ip_select_ident(iph, dst, more); | ||
343 | } | 345 | } |
344 | 346 | ||
345 | /* | 347 | /* |