diff options
Diffstat (limited to 'include')
75 files changed, 935 insertions, 495 deletions
diff --git a/include/asm-alpha/bitops.h b/include/asm-alpha/bitops.h index 578ed3f1a607..302201f1a097 100644 --- a/include/asm-alpha/bitops.h +++ b/include/asm-alpha/bitops.h | |||
@@ -321,6 +321,7 @@ static inline int fls(int word) | |||
321 | #else | 321 | #else |
322 | #define fls generic_fls | 322 | #define fls generic_fls |
323 | #endif | 323 | #endif |
324 | #define fls64 generic_fls64 | ||
324 | 325 | ||
325 | /* Compute powers of two for the given integer. */ | 326 | /* Compute powers of two for the given integer. */ |
326 | static inline long floor_log2(unsigned long word) | 327 | static inline long floor_log2(unsigned long word) |
diff --git a/include/asm-arm/bitops.h b/include/asm-arm/bitops.h index 7399d431edfe..d02de721ecc1 100644 --- a/include/asm-arm/bitops.h +++ b/include/asm-arm/bitops.h | |||
@@ -332,6 +332,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
332 | */ | 332 | */ |
333 | 333 | ||
334 | #define fls(x) generic_fls(x) | 334 | #define fls(x) generic_fls(x) |
335 | #define fls64(x) generic_fls64(x) | ||
335 | 336 | ||
336 | /* | 337 | /* |
337 | * ffs: find first bit set. This is defined the same way as | 338 | * ffs: find first bit set. This is defined the same way as |
@@ -351,6 +352,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
351 | #define fls(x) \ | 352 | #define fls(x) \ |
352 | ( __builtin_constant_p(x) ? generic_fls(x) : \ | 353 | ( __builtin_constant_p(x) ? generic_fls(x) : \ |
353 | ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) | 354 | ({ int __r; asm("clz\t%0, %1" : "=r"(__r) : "r"(x) : "cc"); 32-__r; }) ) |
355 | #define fls64(x) generic_fls64(x) | ||
354 | #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) | 356 | #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); }) |
355 | #define __ffs(x) (ffs(x) - 1) | 357 | #define __ffs(x) (ffs(x) - 1) |
356 | #define ffz(x) __ffs( ~(x) ) | 358 | #define ffz(x) __ffs( ~(x) ) |
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h index 7d062fb2e343..15cc6f2da792 100644 --- a/include/asm-arm26/bitops.h +++ b/include/asm-arm26/bitops.h | |||
@@ -259,6 +259,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
259 | */ | 259 | */ |
260 | 260 | ||
261 | #define fls(x) generic_fls(x) | 261 | #define fls(x) generic_fls(x) |
262 | #define fls64(x) generic_fls64(x) | ||
262 | 263 | ||
263 | /* | 264 | /* |
264 | * ffs: find first bit set. This is defined the same way as | 265 | * ffs: find first bit set. This is defined the same way as |
diff --git a/include/asm-cris/bitops.h b/include/asm-cris/bitops.h index 1bddb3f3a289..d3eb0f1e4208 100644 --- a/include/asm-cris/bitops.h +++ b/include/asm-cris/bitops.h | |||
@@ -240,6 +240,7 @@ static inline int test_bit(int nr, const volatile unsigned long *addr) | |||
240 | */ | 240 | */ |
241 | 241 | ||
242 | #define fls(x) generic_fls(x) | 242 | #define fls(x) generic_fls(x) |
243 | #define fls64(x) generic_fls64(x) | ||
243 | 244 | ||
244 | /* | 245 | /* |
245 | * hweightN - returns the hamming weight of a N-bit word | 246 | * hweightN - returns the hamming weight of a N-bit word |
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index b664bd5b6663..02be7b3a8a83 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
@@ -228,6 +228,7 @@ found_middle: | |||
228 | \ | 228 | \ |
229 | bit ? 33 - bit : bit; \ | 229 | bit ? 33 - bit : bit; \ |
230 | }) | 230 | }) |
231 | #define fls64(x) generic_fls64(x) | ||
231 | 232 | ||
232 | /* | 233 | /* |
233 | * Every architecture must define this function. It's the fastest | 234 | * Every architecture must define this function. It's the fastest |
diff --git a/include/asm-generic/bitops.h b/include/asm-generic/bitops.h index ce31b739fd80..0e6d9852008c 100644 --- a/include/asm-generic/bitops.h +++ b/include/asm-generic/bitops.h | |||
@@ -56,6 +56,7 @@ extern __inline__ int test_bit(int nr, const unsigned long * addr) | |||
56 | */ | 56 | */ |
57 | 57 | ||
58 | #define fls(x) generic_fls(x) | 58 | #define fls(x) generic_fls(x) |
59 | #define fls64(x) generic_fls64(x) | ||
59 | 60 | ||
60 | #ifdef __KERNEL__ | 61 | #ifdef __KERNEL__ |
61 | 62 | ||
diff --git a/include/asm-h8300/bitops.h b/include/asm-h8300/bitops.h index 5036f595f8c9..c0411ec9d651 100644 --- a/include/asm-h8300/bitops.h +++ b/include/asm-h8300/bitops.h | |||
@@ -406,5 +406,6 @@ found_middle: | |||
406 | #endif /* __KERNEL__ */ | 406 | #endif /* __KERNEL__ */ |
407 | 407 | ||
408 | #define fls(x) generic_fls(x) | 408 | #define fls(x) generic_fls(x) |
409 | #define fls64(x) generic_fls64(x) | ||
409 | 410 | ||
410 | #endif /* _H8300_BITOPS_H */ | 411 | #endif /* _H8300_BITOPS_H */ |
diff --git a/include/asm-i386/bitops.h b/include/asm-i386/bitops.h index ddf1739dc7fd..4807aa1d2e3d 100644 --- a/include/asm-i386/bitops.h +++ b/include/asm-i386/bitops.h | |||
@@ -372,6 +372,7 @@ static inline unsigned long ffz(unsigned long word) | |||
372 | */ | 372 | */ |
373 | 373 | ||
374 | #define fls(x) generic_fls(x) | 374 | #define fls(x) generic_fls(x) |
375 | #define fls64(x) generic_fls64(x) | ||
375 | 376 | ||
376 | #ifdef __KERNEL__ | 377 | #ifdef __KERNEL__ |
377 | 378 | ||
diff --git a/include/asm-ia64/bitops.h b/include/asm-ia64/bitops.h index 7232528e2d0c..36d0fb95ea89 100644 --- a/include/asm-ia64/bitops.h +++ b/include/asm-ia64/bitops.h | |||
@@ -345,6 +345,7 @@ fls (int t) | |||
345 | x |= x >> 16; | 345 | x |= x >> 16; |
346 | return ia64_popcnt(x); | 346 | return ia64_popcnt(x); |
347 | } | 347 | } |
348 | #define fls64(x) generic_fls64(x) | ||
348 | 349 | ||
349 | /* | 350 | /* |
350 | * ffs: find first bit set. This is defined the same way as the libc and compiler builtin | 351 | * ffs: find first bit set. This is defined the same way as the libc and compiler builtin |
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h index e78443981349..abea2fdd8689 100644 --- a/include/asm-m32r/bitops.h +++ b/include/asm-m32r/bitops.h | |||
@@ -465,6 +465,7 @@ static __inline__ unsigned long __ffs(unsigned long word) | |||
465 | * fls: find last bit set. | 465 | * fls: find last bit set. |
466 | */ | 466 | */ |
467 | #define fls(x) generic_fls(x) | 467 | #define fls(x) generic_fls(x) |
468 | #define fls64(x) generic_fls64(x) | ||
468 | 469 | ||
469 | #ifdef __KERNEL__ | 470 | #ifdef __KERNEL__ |
470 | 471 | ||
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index b1bcf7c66516..13f4c0048463 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h | |||
@@ -310,6 +310,7 @@ static inline int fls(int x) | |||
310 | 310 | ||
311 | return 32 - cnt; | 311 | return 32 - cnt; |
312 | } | 312 | } |
313 | #define fls64(x) generic_fls64(x) | ||
313 | 314 | ||
314 | /* | 315 | /* |
315 | * Every architecture must define this function. It's the fastest | 316 | * Every architecture must define this function. It's the fastest |
diff --git a/include/asm-m68knommu/bitops.h b/include/asm-m68knommu/bitops.h index c42f88a9b9f9..4058dd086a02 100644 --- a/include/asm-m68knommu/bitops.h +++ b/include/asm-m68knommu/bitops.h | |||
@@ -499,5 +499,6 @@ found_middle: | |||
499 | * fls: find last bit set. | 499 | * fls: find last bit set. |
500 | */ | 500 | */ |
501 | #define fls(x) generic_fls(x) | 501 | #define fls(x) generic_fls(x) |
502 | #define fls64(x) generic_fls64(x) | ||
502 | 503 | ||
503 | #endif /* _M68KNOMMU_BITOPS_H */ | 504 | #endif /* _M68KNOMMU_BITOPS_H */ |
diff --git a/include/asm-mips/bitops.h b/include/asm-mips/bitops.h index 5496f9064a6a..3b0c8aaf6e8b 100644 --- a/include/asm-mips/bitops.h +++ b/include/asm-mips/bitops.h | |||
@@ -695,7 +695,7 @@ static inline unsigned long fls(unsigned long word) | |||
695 | 695 | ||
696 | return flz(~word) + 1; | 696 | return flz(~word) + 1; |
697 | } | 697 | } |
698 | 698 | #define fls64(x) generic_fls64(x) | |
699 | 699 | ||
700 | /* | 700 | /* |
701 | * find_next_zero_bit - find the first zero bit in a memory region | 701 | * find_next_zero_bit - find the first zero bit in a memory region |
diff --git a/include/asm-parisc/bitops.h b/include/asm-parisc/bitops.h index 55b98c67fd82..15d8c2b51584 100644 --- a/include/asm-parisc/bitops.h +++ b/include/asm-parisc/bitops.h | |||
@@ -263,6 +263,7 @@ static __inline__ int fls(int x) | |||
263 | 263 | ||
264 | return ret; | 264 | return ret; |
265 | } | 265 | } |
266 | #define fls64(x) generic_fls64(x) | ||
266 | 267 | ||
267 | /* | 268 | /* |
268 | * hweightN: returns the hamming weight (i.e. the number | 269 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h index 5727229b0444..1996eaa8aeae 100644 --- a/include/asm-powerpc/bitops.h +++ b/include/asm-powerpc/bitops.h | |||
@@ -310,6 +310,7 @@ static __inline__ int fls(unsigned int x) | |||
310 | asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); | 310 | asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); |
311 | return 32 - lz; | 311 | return 32 - lz; |
312 | } | 312 | } |
313 | #define fls64(x) generic_fls64(x) | ||
313 | 314 | ||
314 | /* | 315 | /* |
315 | * hweightN: returns the hamming weight (i.e. the number | 316 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-s390/bitops.h b/include/asm-s390/bitops.h index b07c578b22ea..61232760cc3b 100644 --- a/include/asm-s390/bitops.h +++ b/include/asm-s390/bitops.h | |||
@@ -839,6 +839,7 @@ static inline int sched_find_first_bit(unsigned long *b) | |||
839 | * fls: find last bit set. | 839 | * fls: find last bit set. |
840 | */ | 840 | */ |
841 | #define fls(x) generic_fls(x) | 841 | #define fls(x) generic_fls(x) |
842 | #define fls64(x) generic_fls64(x) | ||
842 | 843 | ||
843 | /* | 844 | /* |
844 | * hweightN: returns the hamming weight (i.e. the number | 845 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-sh/bitops.h b/include/asm-sh/bitops.h index 5163d1ff2f1b..1c5260860045 100644 --- a/include/asm-sh/bitops.h +++ b/include/asm-sh/bitops.h | |||
@@ -470,6 +470,7 @@ found_middle: | |||
470 | */ | 470 | */ |
471 | 471 | ||
472 | #define fls(x) generic_fls(x) | 472 | #define fls(x) generic_fls(x) |
473 | #define fls64(x) generic_fls64(x) | ||
473 | 474 | ||
474 | #endif /* __KERNEL__ */ | 475 | #endif /* __KERNEL__ */ |
475 | 476 | ||
diff --git a/include/asm-sh64/bitops.h b/include/asm-sh64/bitops.h index e1ff63e09227..ce9c3ad45fe0 100644 --- a/include/asm-sh64/bitops.h +++ b/include/asm-sh64/bitops.h | |||
@@ -510,6 +510,7 @@ found_middle: | |||
510 | 510 | ||
511 | #define ffs(x) generic_ffs(x) | 511 | #define ffs(x) generic_ffs(x) |
512 | #define fls(x) generic_fls(x) | 512 | #define fls(x) generic_fls(x) |
513 | #define fls64(x) generic_fls64(x) | ||
513 | 514 | ||
514 | #endif /* __KERNEL__ */ | 515 | #endif /* __KERNEL__ */ |
515 | 516 | ||
diff --git a/include/asm-sparc/bitops.h b/include/asm-sparc/bitops.h index bfbd795a0a80..41722b5e45ef 100644 --- a/include/asm-sparc/bitops.h +++ b/include/asm-sparc/bitops.h | |||
@@ -298,6 +298,7 @@ static inline int ffs(int x) | |||
298 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. | 298 | * Note fls(0) = 0, fls(1) = 1, fls(0x80000000) = 32. |
299 | */ | 299 | */ |
300 | #define fls(x) generic_fls(x) | 300 | #define fls(x) generic_fls(x) |
301 | #define fls64(x) generic_fls64(x) | ||
301 | 302 | ||
302 | /* | 303 | /* |
303 | * hweightN: returns the hamming weight (i.e. the number | 304 | * hweightN: returns the hamming weight (i.e. the number |
diff --git a/include/asm-sparc64/bitops.h b/include/asm-sparc64/bitops.h index 6388b8376c50..6efc0162fb09 100644 --- a/include/asm-sparc64/bitops.h +++ b/include/asm-sparc64/bitops.h | |||
@@ -119,6 +119,7 @@ static inline unsigned long __ffs(unsigned long word) | |||
119 | */ | 119 | */ |
120 | 120 | ||
121 | #define fls(x) generic_fls(x) | 121 | #define fls(x) generic_fls(x) |
122 | #define fls64(x) generic_fls64(x) | ||
122 | 123 | ||
123 | #ifdef __KERNEL__ | 124 | #ifdef __KERNEL__ |
124 | 125 | ||
diff --git a/include/asm-v850/bitops.h b/include/asm-v850/bitops.h index b91e799763fd..8955d2376ac8 100644 --- a/include/asm-v850/bitops.h +++ b/include/asm-v850/bitops.h | |||
@@ -276,6 +276,7 @@ found_middle: | |||
276 | 276 | ||
277 | #define ffs(x) generic_ffs (x) | 277 | #define ffs(x) generic_ffs (x) |
278 | #define fls(x) generic_fls (x) | 278 | #define fls(x) generic_fls (x) |
279 | #define fls64(x) generic_fls64(x) | ||
279 | #define __ffs(x) ffs(x) | 280 | #define __ffs(x) ffs(x) |
280 | 281 | ||
281 | 282 | ||
diff --git a/include/asm-x86_64/bitops.h b/include/asm-x86_64/bitops.h index 05a0d374404b..a4d5d0909453 100644 --- a/include/asm-x86_64/bitops.h +++ b/include/asm-x86_64/bitops.h | |||
@@ -340,6 +340,20 @@ static __inline__ unsigned long __ffs(unsigned long word) | |||
340 | return word; | 340 | return word; |
341 | } | 341 | } |
342 | 342 | ||
343 | /* | ||
344 | * __fls: find last bit set. | ||
345 | * @word: The word to search | ||
346 | * | ||
347 | * Undefined if no zero exists, so code should check against ~0UL first. | ||
348 | */ | ||
349 | static __inline__ unsigned long __fls(unsigned long word) | ||
350 | { | ||
351 | __asm__("bsrq %1,%0" | ||
352 | :"=r" (word) | ||
353 | :"rm" (word)); | ||
354 | return word; | ||
355 | } | ||
356 | |||
343 | #ifdef __KERNEL__ | 357 | #ifdef __KERNEL__ |
344 | 358 | ||
345 | static inline int sched_find_first_bit(const unsigned long *b) | 359 | static inline int sched_find_first_bit(const unsigned long *b) |
@@ -370,6 +384,19 @@ static __inline__ int ffs(int x) | |||
370 | } | 384 | } |
371 | 385 | ||
372 | /** | 386 | /** |
387 | * fls64 - find last bit set in 64 bit word | ||
388 | * @x: the word to search | ||
389 | * | ||
390 | * This is defined the same way as fls. | ||
391 | */ | ||
392 | static __inline__ int fls64(__u64 x) | ||
393 | { | ||
394 | if (x == 0) | ||
395 | return 0; | ||
396 | return __fls(x) + 1; | ||
397 | } | ||
398 | |||
399 | /** | ||
373 | * hweightN - returns the hamming weight of a N-bit word | 400 | * hweightN - returns the hamming weight of a N-bit word |
374 | * @x: the word to weigh | 401 | * @x: the word to weigh |
375 | * | 402 | * |
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index e76ee889e21d..0a2065f1a372 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h | |||
@@ -245,6 +245,7 @@ static __inline__ int fls (unsigned int x) | |||
245 | { | 245 | { |
246 | return __cntlz(x); | 246 | return __cntlz(x); |
247 | } | 247 | } |
248 | #define fls64(x) generic_fls64(x) | ||
248 | 249 | ||
249 | static __inline__ int | 250 | static __inline__ int |
250 | find_next_bit(const unsigned long *addr, int size, int offset) | 251 | find_next_bit(const unsigned long *addr, int size, int offset) |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 38c2fb7ebe09..6a2a19f14bb2 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -76,6 +76,15 @@ static __inline__ int generic_fls(int x) | |||
76 | */ | 76 | */ |
77 | #include <asm/bitops.h> | 77 | #include <asm/bitops.h> |
78 | 78 | ||
79 | |||
80 | static inline int generic_fls64(__u64 x) | ||
81 | { | ||
82 | __u32 h = x >> 32; | ||
83 | if (h) | ||
84 | return fls(x) + 32; | ||
85 | return fls(x); | ||
86 | } | ||
87 | |||
79 | static __inline__ int get_bitmask_order(unsigned int count) | 88 | static __inline__ int get_bitmask_order(unsigned int count) |
80 | { | 89 | { |
81 | int order; | 90 | int order; |
diff --git a/include/linux/dccp.h b/include/linux/dccp.h index 71fab4311e92..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, |
@@ -408,8 +407,6 @@ struct dccp_ackvec; | |||
408 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss | 407 | * @dccps_gar - greatest valid ack number received on a non-Sync; initialized to %dccps_iss |
409 | * @dccps_timestamp_time - time of latest TIMESTAMP option | 408 | * @dccps_timestamp_time - time of latest TIMESTAMP option |
410 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option | 409 | * @dccps_timestamp_echo - latest timestamp received on a TIMESTAMP option |
411 | * @dccps_ext_header_len - network protocol overhead (IP/IPv6 options) | ||
412 | * @dccps_pmtu_cookie - Last pmtu seen by socket | ||
413 | * @dccps_packet_size - Set thru setsockopt | 410 | * @dccps_packet_size - Set thru setsockopt |
414 | * @dccps_role - Role of this sock, one of %dccp_role | 411 | * @dccps_role - Role of this sock, one of %dccp_role |
415 | * @dccps_ndp_count - number of Non Data Packets since last data packet | 412 | * @dccps_ndp_count - number of Non Data Packets since last data packet |
@@ -434,8 +431,6 @@ struct dccp_sock { | |||
434 | __u32 dccps_timestamp_echo; | 431 | __u32 dccps_timestamp_echo; |
435 | __u32 dccps_packet_size; | 432 | __u32 dccps_packet_size; |
436 | unsigned long dccps_ndp_count; | 433 | unsigned long dccps_ndp_count; |
437 | __u16 dccps_ext_header_len; | ||
438 | __u32 dccps_pmtu_cookie; | ||
439 | __u32 dccps_mss_cache; | 434 | __u32 dccps_mss_cache; |
440 | struct dccp_options dccps_options; | 435 | struct dccp_options dccps_options; |
441 | struct dccp_ackvec *dccps_hc_rx_ackvec; | 436 | struct dccp_ackvec *dccps_hc_rx_ackvec; |
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h index 5f49a30eb6f2..745c988359c0 100644 --- a/include/linux/etherdevice.h +++ b/include/linux/etherdevice.h | |||
@@ -63,10 +63,11 @@ static inline int is_zero_ether_addr(const u8 *addr) | |||
63 | * @addr: Pointer to a six-byte array containing the Ethernet address | 63 | * @addr: Pointer to a six-byte array containing the Ethernet address |
64 | * | 64 | * |
65 | * Return true if the address is a multicast address. | 65 | * Return true if the address is a multicast address. |
66 | * By definition the broadcast address is also a multicast address. | ||
66 | */ | 67 | */ |
67 | static inline int is_multicast_ether_addr(const u8 *addr) | 68 | static inline int is_multicast_ether_addr(const u8 *addr) |
68 | { | 69 | { |
69 | return ((addr[0] != 0xff) && (0x01 & addr[0])); | 70 | return (0x01 & addr[0]); |
70 | } | 71 | } |
71 | 72 | ||
72 | /** | 73 | /** |
diff --git a/include/linux/if_pppox.h b/include/linux/if_pppox.h index e677f73f13dd..4fab3d0a4bce 100644 --- a/include/linux/if_pppox.h +++ b/include/linux/if_pppox.h | |||
@@ -157,8 +157,7 @@ struct pppox_proto { | |||
157 | extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); | 157 | extern int register_pppox_proto(int proto_num, struct pppox_proto *pp); |
158 | extern void unregister_pppox_proto(int proto_num); | 158 | extern void unregister_pppox_proto(int proto_num); |
159 | extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ | 159 | extern void pppox_unbind_sock(struct sock *sk);/* delete ppp-channel binding */ |
160 | extern int pppox_channel_ioctl(struct ppp_channel *pc, unsigned int cmd, | 160 | extern int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg); |
161 | unsigned long arg); | ||
162 | 161 | ||
163 | /* PPPoX socket states */ | 162 | /* PPPoX socket states */ |
164 | enum { | 163 | enum { |
diff --git a/include/linux/ip.h b/include/linux/ip.h index 33e8a19a1a0f..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,126 +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 | u32 loc_addr; | ||
114 | u32 rmt_addr; | ||
115 | u16 rmt_port; | ||
116 | u16 snd_wscale : 4, | ||
117 | rcv_wscale : 4, | ||
118 | tstamp_ok : 1, | ||
119 | sack_ok : 1, | ||
120 | wscale_ok : 1, | ||
121 | ecn_ok : 1, | ||
122 | acked : 1; | ||
123 | struct ip_options *opt; | ||
124 | }; | ||
125 | |||
126 | static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk) | ||
127 | { | ||
128 | return (struct inet_request_sock *)sk; | ||
129 | } | ||
130 | |||
131 | struct ipv6_pinfo; | ||
132 | |||
133 | struct inet_sock { | ||
134 | /* sk and pinet6 has to be the first two members of inet_sock */ | ||
135 | struct sock sk; | ||
136 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | ||
137 | struct ipv6_pinfo *pinet6; | ||
138 | #endif | ||
139 | /* Socket demultiplex comparisons on incoming packets. */ | ||
140 | __u32 daddr; /* Foreign IPv4 addr */ | ||
141 | __u32 rcv_saddr; /* Bound local IPv4 addr */ | ||
142 | __u16 dport; /* Destination port */ | ||
143 | __u16 num; /* Local port */ | ||
144 | __u32 saddr; /* Sending source */ | ||
145 | __s16 uc_ttl; /* Unicast TTL */ | ||
146 | __u16 cmsg_flags; | ||
147 | struct ip_options *opt; | ||
148 | __u16 sport; /* Source port */ | ||
149 | __u16 id; /* ID counter for DF pkts */ | ||
150 | __u8 tos; /* TOS */ | ||
151 | __u8 mc_ttl; /* Multicasting TTL */ | ||
152 | __u8 pmtudisc; | ||
153 | unsigned recverr : 1, | ||
154 | freebind : 1, | ||
155 | hdrincl : 1, | ||
156 | mc_loop : 1; | ||
157 | int mc_index; /* Multicast device index */ | ||
158 | __u32 mc_addr; | ||
159 | struct ip_mc_socklist *mc_list; /* Group array */ | ||
160 | /* | ||
161 | * Following members are used to retain the infomation to build | ||
162 | * an ip header on each ip fragmentation while the socket is corked. | ||
163 | */ | ||
164 | struct { | ||
165 | unsigned int flags; | ||
166 | unsigned int fragsize; | ||
167 | struct ip_options *opt; | ||
168 | struct rtable *rt; | ||
169 | int length; /* Total length of all frames */ | ||
170 | u32 addr; | ||
171 | struct flowi fl; | ||
172 | } cork; | ||
173 | }; | ||
174 | |||
175 | #define IPCORK_OPT 1 /* ip-options has been held in ipcork.opt */ | ||
176 | #define IPCORK_ALLFRAG 2 /* always fragment (for ipv6 for now) */ | ||
177 | |||
178 | static inline struct inet_sock *inet_sk(const struct sock *sk) | ||
179 | { | ||
180 | return (struct inet_sock *)sk; | ||
181 | } | ||
182 | |||
183 | static inline void __inet_sk_copy_descendant(struct sock *sk_to, | ||
184 | const struct sock *sk_from, | ||
185 | const int ancestor_size) | ||
186 | { | ||
187 | memcpy(inet_sk(sk_to) + 1, inet_sk(sk_from) + 1, | ||
188 | sk_from->sk_prot->obj_size - ancestor_size); | ||
189 | } | ||
190 | #if !(defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)) | ||
191 | static inline void inet_sk_copy_descendant(struct sock *sk_to, | ||
192 | const struct sock *sk_from) | ||
193 | { | ||
194 | __inet_sk_copy_descendant(sk_to, sk_from, sizeof(struct inet_sock)); | ||
195 | } | ||
196 | #endif | ||
197 | #endif | ||
198 | |||
199 | extern int inet_sk_rebuild_header(struct sock *sk); | ||
200 | |||
201 | struct iphdr { | 82 | struct iphdr { |
202 | #if defined(__LITTLE_ENDIAN_BITFIELD) | 83 | #if defined(__LITTLE_ENDIAN_BITFIELD) |
203 | __u8 ihl:4, | 84 | __u8 ihl:4, |
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index e0b922785d98..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. |
@@ -199,18 +200,17 @@ static inline int inet6_iif(const struct sk_buff *skb) | |||
199 | return IP6CB(skb)->iif; | 200 | return IP6CB(skb)->iif; |
200 | } | 201 | } |
201 | 202 | ||
202 | struct tcp6_request_sock { | 203 | struct inet6_request_sock { |
203 | struct tcp_request_sock req; | ||
204 | struct in6_addr loc_addr; | 204 | struct in6_addr loc_addr; |
205 | struct in6_addr rmt_addr; | 205 | struct in6_addr rmt_addr; |
206 | struct sk_buff *pktopts; | 206 | struct sk_buff *pktopts; |
207 | int iif; | 207 | int iif; |
208 | }; | 208 | }; |
209 | 209 | ||
210 | static inline struct tcp6_request_sock *tcp6_rsk(const struct request_sock *sk) | 210 | struct tcp6_request_sock { |
211 | { | 211 | struct tcp_request_sock tcp6rsk_tcp; |
212 | return (struct tcp6_request_sock *)sk; | 212 | struct inet6_request_sock tcp6rsk_inet6; |
213 | } | 213 | }; |
214 | 214 | ||
215 | /** | 215 | /** |
216 | * struct ipv6_pinfo - ipv6 private area | 216 | * struct ipv6_pinfo - ipv6 private area |
@@ -298,12 +298,36 @@ struct tcp6_sock { | |||
298 | struct ipv6_pinfo inet6; | 298 | struct ipv6_pinfo inet6; |
299 | }; | 299 | }; |
300 | 300 | ||
301 | extern int inet6_sk_rebuild_header(struct sock *sk); | ||
302 | |||
301 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) | 303 | #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) |
302 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) | 304 | static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) |
303 | { | 305 | { |
304 | return inet_sk(__sk)->pinet6; | 306 | return inet_sk(__sk)->pinet6; |
305 | } | 307 | } |
306 | 308 | ||
309 | static inline struct inet6_request_sock * | ||
310 | inet6_rsk(const struct request_sock *rsk) | ||
311 | { | ||
312 | return (struct inet6_request_sock *)(((u8 *)rsk) + | ||
313 | inet_rsk(rsk)->inet6_rsk_offset); | ||
314 | } | ||
315 | |||
316 | static inline u32 inet6_rsk_offset(struct request_sock *rsk) | ||
317 | { | ||
318 | return rsk->rsk_ops->obj_size - sizeof(struct inet6_request_sock); | ||
319 | } | ||
320 | |||
321 | static inline struct request_sock *inet6_reqsk_alloc(struct request_sock_ops *ops) | ||
322 | { | ||
323 | struct request_sock *req = reqsk_alloc(ops); | ||
324 | |||
325 | if (req != NULL) | ||
326 | inet_rsk(req)->inet6_rsk_offset = inet6_rsk_offset(req); | ||
327 | |||
328 | return req; | ||
329 | } | ||
330 | |||
307 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) | 331 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) |
308 | { | 332 | { |
309 | return (struct raw6_sock *)sk; | 333 | return (struct raw6_sock *)sk; |
@@ -323,28 +347,37 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to, | |||
323 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) | 347 | #define __ipv6_only_sock(sk) (inet6_sk(sk)->ipv6only) |
324 | #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)) |
325 | 349 | ||
326 | #include <linux/tcp.h> | 350 | struct inet6_timewait_sock { |
351 | struct in6_addr tw_v6_daddr; | ||
352 | struct in6_addr tw_v6_rcv_saddr; | ||
353 | }; | ||
327 | 354 | ||
328 | struct tcp6_timewait_sock { | 355 | struct tcp6_timewait_sock { |
329 | struct tcp_timewait_sock tw_v6_sk; | 356 | struct tcp_timewait_sock tcp6tw_tcp; |
330 | struct in6_addr tw_v6_daddr; | 357 | struct inet6_timewait_sock tcp6tw_inet6; |
331 | struct in6_addr tw_v6_rcv_saddr; | ||
332 | }; | 358 | }; |
333 | 359 | ||
334 | static inline struct tcp6_timewait_sock *tcp6_twsk(const struct sock *sk) | 360 | static inline u16 inet6_tw_offset(const struct proto *prot) |
335 | { | 361 | { |
336 | return (struct tcp6_timewait_sock *)sk; | 362 | return prot->twsk_prot->twsk_obj_size - |
363 | sizeof(struct inet6_timewait_sock); | ||
337 | } | 364 | } |
338 | 365 | ||
339 | static inline struct in6_addr *__tcp_v6_rcv_saddr(const struct sock *sk) | 366 | static inline struct inet6_timewait_sock *inet6_twsk(const struct sock *sk) |
367 | { | ||
368 | return (struct inet6_timewait_sock *)(((u8 *)sk) + | ||
369 | inet_twsk(sk)->tw_ipv6_offset); | ||
370 | } | ||
371 | |||
372 | static inline struct in6_addr *__inet6_rcv_saddr(const struct sock *sk) | ||
340 | { | 373 | { |
341 | return likely(sk->sk_state != TCP_TIME_WAIT) ? | 374 | return likely(sk->sk_state != TCP_TIME_WAIT) ? |
342 | &inet6_sk(sk)->rcv_saddr : &tcp6_twsk(sk)->tw_v6_rcv_saddr; | 375 | &inet6_sk(sk)->rcv_saddr : &inet6_twsk(sk)->tw_v6_rcv_saddr; |
343 | } | 376 | } |
344 | 377 | ||
345 | static inline struct in6_addr *tcp_v6_rcv_saddr(const struct sock *sk) | 378 | static inline struct in6_addr *inet6_rcv_saddr(const struct sock *sk) |
346 | { | 379 | { |
347 | return sk->sk_family == AF_INET6 ? __tcp_v6_rcv_saddr(sk) : NULL; | 380 | return sk->sk_family == AF_INET6 ? __inet6_rcv_saddr(sk) : NULL; |
348 | } | 381 | } |
349 | 382 | ||
350 | static inline int inet_v6_ipv6only(const struct sock *sk) | 383 | static inline int inet_v6_ipv6only(const struct sock *sk) |
@@ -361,13 +394,19 @@ static inline struct ipv6_pinfo * inet6_sk(const struct sock *__sk) | |||
361 | return NULL; | 394 | return NULL; |
362 | } | 395 | } |
363 | 396 | ||
397 | static inline struct inet6_request_sock * | ||
398 | inet6_rsk(const struct request_sock *rsk) | ||
399 | { | ||
400 | return NULL; | ||
401 | } | ||
402 | |||
364 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) | 403 | static inline struct raw6_sock *raw6_sk(const struct sock *sk) |
365 | { | 404 | { |
366 | return NULL; | 405 | return NULL; |
367 | } | 406 | } |
368 | 407 | ||
369 | #define __tcp_v6_rcv_saddr(__sk) NULL | 408 | #define __inet6_rcv_saddr(__sk) NULL |
370 | #define tcp_v6_rcv_saddr(__sk) NULL | 409 | #define inet6_rcv_saddr(__sk) NULL |
371 | #define tcp_twsk_ipv6only(__sk) 0 | 410 | #define tcp_twsk_ipv6only(__sk) 0 |
372 | #define inet_v6_ipv6only(__sk) 0 | 411 | #define inet_v6_ipv6only(__sk) 0 |
373 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ | 412 | #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */ |
diff --git a/include/linux/net.h b/include/linux/net.h index d6a41e6577f6..28195a2d8ff0 100644 --- a/include/linux/net.h +++ b/include/linux/net.h | |||
@@ -107,7 +107,7 @@ enum sock_type { | |||
107 | struct socket { | 107 | struct socket { |
108 | socket_state state; | 108 | socket_state state; |
109 | unsigned long flags; | 109 | unsigned long flags; |
110 | struct proto_ops *ops; | 110 | const struct proto_ops *ops; |
111 | struct fasync_struct *fasync_list; | 111 | struct fasync_struct *fasync_list; |
112 | struct file *file; | 112 | struct file *file; |
113 | struct sock *sk; | 113 | struct sock *sk; |
@@ -260,7 +260,7 @@ SOCKCALL_WRAP(name, recvmsg, (struct kiocb *iocb, struct socket *sock, struct ms | |||
260 | SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ | 260 | SOCKCALL_WRAP(name, mmap, (struct file *file, struct socket *sock, struct vm_area_struct *vma), \ |
261 | (file, sock, vma)) \ | 261 | (file, sock, vma)) \ |
262 | \ | 262 | \ |
263 | static struct proto_ops name##_ops = { \ | 263 | static const struct proto_ops name##_ops = { \ |
264 | .family = fam, \ | 264 | .family = fam, \ |
265 | .owner = THIS_MODULE, \ | 265 | .owner = THIS_MODULE, \ |
266 | .release = __lock_##name##_release, \ | 266 | .release = __lock_##name##_release, \ |
diff --git a/include/linux/pfkeyv2.h b/include/linux/pfkeyv2.h index 724066778aff..6351c4055ace 100644 --- a/include/linux/pfkeyv2.h +++ b/include/linux/pfkeyv2.h | |||
@@ -216,6 +216,16 @@ struct sadb_x_nat_t_port { | |||
216 | } __attribute__((packed)); | 216 | } __attribute__((packed)); |
217 | /* sizeof(struct sadb_x_nat_t_port) == 8 */ | 217 | /* sizeof(struct sadb_x_nat_t_port) == 8 */ |
218 | 218 | ||
219 | /* Generic LSM security context */ | ||
220 | struct sadb_x_sec_ctx { | ||
221 | uint16_t sadb_x_sec_len; | ||
222 | uint16_t sadb_x_sec_exttype; | ||
223 | uint8_t sadb_x_ctx_alg; /* LSMs: e.g., selinux == 1 */ | ||
224 | uint8_t sadb_x_ctx_doi; | ||
225 | uint16_t sadb_x_ctx_len; | ||
226 | } __attribute__((packed)); | ||
227 | /* sizeof(struct sadb_sec_ctx) = 8 */ | ||
228 | |||
219 | /* Message types */ | 229 | /* Message types */ |
220 | #define SADB_RESERVED 0 | 230 | #define SADB_RESERVED 0 |
221 | #define SADB_GETSPI 1 | 231 | #define SADB_GETSPI 1 |
@@ -325,7 +335,8 @@ struct sadb_x_nat_t_port { | |||
325 | #define SADB_X_EXT_NAT_T_SPORT 21 | 335 | #define SADB_X_EXT_NAT_T_SPORT 21 |
326 | #define SADB_X_EXT_NAT_T_DPORT 22 | 336 | #define SADB_X_EXT_NAT_T_DPORT 22 |
327 | #define SADB_X_EXT_NAT_T_OA 23 | 337 | #define SADB_X_EXT_NAT_T_OA 23 |
328 | #define SADB_EXT_MAX 23 | 338 | #define SADB_X_EXT_SEC_CTX 24 |
339 | #define SADB_EXT_MAX 24 | ||
329 | 340 | ||
330 | /* Identity Extension values */ | 341 | /* Identity Extension values */ |
331 | #define SADB_IDENTTYPE_RESERVED 0 | 342 | #define SADB_IDENTTYPE_RESERVED 0 |
diff --git a/include/linux/pkt_sched.h b/include/linux/pkt_sched.h index e87b233615b3..d10f35338507 100644 --- a/include/linux/pkt_sched.h +++ b/include/linux/pkt_sched.h | |||
@@ -429,6 +429,7 @@ enum | |||
429 | TCA_NETEM_CORR, | 429 | TCA_NETEM_CORR, |
430 | TCA_NETEM_DELAY_DIST, | 430 | TCA_NETEM_DELAY_DIST, |
431 | TCA_NETEM_REORDER, | 431 | TCA_NETEM_REORDER, |
432 | TCA_NETEM_CORRUPT, | ||
432 | __TCA_NETEM_MAX, | 433 | __TCA_NETEM_MAX, |
433 | }; | 434 | }; |
434 | 435 | ||
@@ -457,6 +458,12 @@ struct tc_netem_reorder | |||
457 | __u32 correlation; | 458 | __u32 correlation; |
458 | }; | 459 | }; |
459 | 460 | ||
461 | struct tc_netem_corrupt | ||
462 | { | ||
463 | __u32 probability; | ||
464 | __u32 correlation; | ||
465 | }; | ||
466 | |||
460 | #define NETEM_DIST_SCALE 8192 | 467 | #define NETEM_DIST_SCALE 8192 |
461 | 468 | ||
462 | #endif | 469 | #endif |
diff --git a/include/linux/random.h b/include/linux/random.h index 7b2adb3322d5..5d6456bcdeba 100644 --- a/include/linux/random.h +++ b/include/linux/random.h | |||
@@ -52,9 +52,9 @@ extern void get_random_bytes(void *buf, int nbytes); | |||
52 | void generate_random_uuid(unsigned char uuid_out[16]); | 52 | void generate_random_uuid(unsigned char uuid_out[16]); |
53 | 53 | ||
54 | extern __u32 secure_ip_id(__u32 daddr); | 54 | extern __u32 secure_ip_id(__u32 daddr); |
55 | extern u32 secure_tcp_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); | 55 | extern u32 secure_ipv4_port_ephemeral(__u32 saddr, __u32 daddr, __u16 dport); |
56 | extern u32 secure_tcpv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, | 56 | extern u32 secure_ipv6_port_ephemeral(const __u32 *saddr, const __u32 *daddr, |
57 | __u16 dport); | 57 | __u16 dport); |
58 | extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, | 58 | extern __u32 secure_tcp_sequence_number(__u32 saddr, __u32 daddr, |
59 | __u16 sport, __u16 dport); | 59 | __u16 sport, __u16 dport); |
60 | extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, | 60 | extern __u32 secure_tcpv6_sequence_number(__u32 *saddr, __u32 *daddr, |
diff --git a/include/linux/security.h b/include/linux/security.h index f7e0ae018712..ef753654daa5 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -59,6 +59,12 @@ struct sk_buff; | |||
59 | struct sock; | 59 | struct sock; |
60 | struct sockaddr; | 60 | struct sockaddr; |
61 | struct socket; | 61 | struct socket; |
62 | struct flowi; | ||
63 | struct dst_entry; | ||
64 | struct xfrm_selector; | ||
65 | struct xfrm_policy; | ||
66 | struct xfrm_state; | ||
67 | struct xfrm_user_sec_ctx; | ||
62 | 68 | ||
63 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 69 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
64 | extern int cap_netlink_recv(struct sk_buff *skb); | 70 | extern int cap_netlink_recv(struct sk_buff *skb); |
@@ -788,6 +794,52 @@ struct swap_info_struct; | |||
788 | * which is used to copy security attributes between local stream sockets. | 794 | * which is used to copy security attributes between local stream sockets. |
789 | * @sk_free_security: | 795 | * @sk_free_security: |
790 | * Deallocate security structure. | 796 | * Deallocate security structure. |
797 | * @sk_getsid: | ||
798 | * Retrieve the LSM-specific sid for the sock to enable caching of network | ||
799 | * authorizations. | ||
800 | * | ||
801 | * Security hooks for XFRM operations. | ||
802 | * | ||
803 | * @xfrm_policy_alloc_security: | ||
804 | * @xp contains the xfrm_policy being added to Security Policy Database | ||
805 | * used by the XFRM system. | ||
806 | * @sec_ctx contains the security context information being provided by | ||
807 | * the user-level policy update program (e.g., setkey). | ||
808 | * Allocate a security structure to the xp->selector.security field. | ||
809 | * The security field is initialized to NULL when the xfrm_policy is | ||
810 | * allocated. | ||
811 | * Return 0 if operation was successful (memory to allocate, legal context) | ||
812 | * @xfrm_policy_clone_security: | ||
813 | * @old contains an existing xfrm_policy in the SPD. | ||
814 | * @new contains a new xfrm_policy being cloned from old. | ||
815 | * Allocate a security structure to the new->selector.security field | ||
816 | * that contains the information from the old->selector.security field. | ||
817 | * Return 0 if operation was successful (memory to allocate). | ||
818 | * @xfrm_policy_free_security: | ||
819 | * @xp contains the xfrm_policy | ||
820 | * Deallocate xp->selector.security. | ||
821 | * @xfrm_state_alloc_security: | ||
822 | * @x contains the xfrm_state being added to the Security Association | ||
823 | * Database by the XFRM system. | ||
824 | * @sec_ctx contains the security context information being provided by | ||
825 | * the user-level SA generation program (e.g., setkey or racoon). | ||
826 | * Allocate a security structure to the x->sel.security field. The | ||
827 | * security field is initialized to NULL when the xfrm_state is | ||
828 | * allocated. | ||
829 | * Return 0 if operation was successful (memory to allocate, legal context). | ||
830 | * @xfrm_state_free_security: | ||
831 | * @x contains the xfrm_state. | ||
832 | * Deallocate x>sel.security. | ||
833 | * @xfrm_policy_lookup: | ||
834 | * @xp contains the xfrm_policy for which the access control is being | ||
835 | * checked. | ||
836 | * @sk_sid contains the sock security label that is used to authorize | ||
837 | * access to the policy xp. | ||
838 | * @dir contains the direction of the flow (input or output). | ||
839 | * Check permission when a sock selects a xfrm_policy for processing | ||
840 | * XFRMs on a packet. The hook is called when selecting either a | ||
841 | * per-socket policy or a generic xfrm policy. | ||
842 | * Return 0 if permission is granted. | ||
791 | * | 843 | * |
792 | * Security hooks affecting all Key Management operations | 844 | * Security hooks affecting all Key Management operations |
793 | * | 845 | * |
@@ -1237,8 +1289,18 @@ struct security_operations { | |||
1237 | int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); | 1289 | int (*socket_getpeersec) (struct socket *sock, char __user *optval, int __user *optlen, unsigned len); |
1238 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); | 1290 | int (*sk_alloc_security) (struct sock *sk, int family, gfp_t priority); |
1239 | void (*sk_free_security) (struct sock *sk); | 1291 | void (*sk_free_security) (struct sock *sk); |
1292 | unsigned int (*sk_getsid) (struct sock *sk, struct flowi *fl, u8 dir); | ||
1240 | #endif /* CONFIG_SECURITY_NETWORK */ | 1293 | #endif /* CONFIG_SECURITY_NETWORK */ |
1241 | 1294 | ||
1295 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | ||
1296 | int (*xfrm_policy_alloc_security) (struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx); | ||
1297 | int (*xfrm_policy_clone_security) (struct xfrm_policy *old, struct xfrm_policy *new); | ||
1298 | void (*xfrm_policy_free_security) (struct xfrm_policy *xp); | ||
1299 | int (*xfrm_state_alloc_security) (struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx); | ||
1300 | void (*xfrm_state_free_security) (struct xfrm_state *x); | ||
1301 | int (*xfrm_policy_lookup)(struct xfrm_policy *xp, u32 sk_sid, u8 dir); | ||
1302 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | ||
1303 | |||
1242 | /* key management security hooks */ | 1304 | /* key management security hooks */ |
1243 | #ifdef CONFIG_KEYS | 1305 | #ifdef CONFIG_KEYS |
1244 | int (*key_alloc)(struct key *key); | 1306 | int (*key_alloc)(struct key *key); |
@@ -2679,6 +2741,11 @@ static inline void security_sk_free(struct sock *sk) | |||
2679 | { | 2741 | { |
2680 | return security_ops->sk_free_security(sk); | 2742 | return security_ops->sk_free_security(sk); |
2681 | } | 2743 | } |
2744 | |||
2745 | static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) | ||
2746 | { | ||
2747 | return security_ops->sk_getsid(sk, fl, dir); | ||
2748 | } | ||
2682 | #else /* CONFIG_SECURITY_NETWORK */ | 2749 | #else /* CONFIG_SECURITY_NETWORK */ |
2683 | static inline int security_unix_stream_connect(struct socket * sock, | 2750 | static inline int security_unix_stream_connect(struct socket * sock, |
2684 | struct socket * other, | 2751 | struct socket * other, |
@@ -2795,8 +2862,73 @@ static inline int security_sk_alloc(struct sock *sk, int family, gfp_t priority) | |||
2795 | static inline void security_sk_free(struct sock *sk) | 2862 | static inline void security_sk_free(struct sock *sk) |
2796 | { | 2863 | { |
2797 | } | 2864 | } |
2865 | |||
2866 | static inline unsigned int security_sk_sid(struct sock *sk, struct flowi *fl, u8 dir) | ||
2867 | { | ||
2868 | return 0; | ||
2869 | } | ||
2798 | #endif /* CONFIG_SECURITY_NETWORK */ | 2870 | #endif /* CONFIG_SECURITY_NETWORK */ |
2799 | 2871 | ||
2872 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | ||
2873 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | ||
2874 | { | ||
2875 | return security_ops->xfrm_policy_alloc_security(xp, sec_ctx); | ||
2876 | } | ||
2877 | |||
2878 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | ||
2879 | { | ||
2880 | return security_ops->xfrm_policy_clone_security(old, new); | ||
2881 | } | ||
2882 | |||
2883 | static inline void security_xfrm_policy_free(struct xfrm_policy *xp) | ||
2884 | { | ||
2885 | security_ops->xfrm_policy_free_security(xp); | ||
2886 | } | ||
2887 | |||
2888 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) | ||
2889 | { | ||
2890 | return security_ops->xfrm_state_alloc_security(x, sec_ctx); | ||
2891 | } | ||
2892 | |||
2893 | static inline void security_xfrm_state_free(struct xfrm_state *x) | ||
2894 | { | ||
2895 | security_ops->xfrm_state_free_security(x); | ||
2896 | } | ||
2897 | |||
2898 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) | ||
2899 | { | ||
2900 | return security_ops->xfrm_policy_lookup(xp, sk_sid, dir); | ||
2901 | } | ||
2902 | #else /* CONFIG_SECURITY_NETWORK_XFRM */ | ||
2903 | static inline int security_xfrm_policy_alloc(struct xfrm_policy *xp, struct xfrm_user_sec_ctx *sec_ctx) | ||
2904 | { | ||
2905 | return 0; | ||
2906 | } | ||
2907 | |||
2908 | static inline int security_xfrm_policy_clone(struct xfrm_policy *old, struct xfrm_policy *new) | ||
2909 | { | ||
2910 | return 0; | ||
2911 | } | ||
2912 | |||
2913 | static inline void security_xfrm_policy_free(struct xfrm_policy *xp) | ||
2914 | { | ||
2915 | } | ||
2916 | |||
2917 | static inline int security_xfrm_state_alloc(struct xfrm_state *x, struct xfrm_user_sec_ctx *sec_ctx) | ||
2918 | { | ||
2919 | return 0; | ||
2920 | } | ||
2921 | |||
2922 | static inline void security_xfrm_state_free(struct xfrm_state *x) | ||
2923 | { | ||
2924 | } | ||
2925 | |||
2926 | static inline int security_xfrm_policy_lookup(struct xfrm_policy *xp, u32 sk_sid, u8 dir) | ||
2927 | { | ||
2928 | return 0; | ||
2929 | } | ||
2930 | #endif /* CONFIG_SECURITY_NETWORK_XFRM */ | ||
2931 | |||
2800 | #ifdef CONFIG_KEYS | 2932 | #ifdef CONFIG_KEYS |
2801 | #ifdef CONFIG_SECURITY | 2933 | #ifdef CONFIG_SECURITY |
2802 | static inline int security_key_alloc(struct key *key) | 2934 | static inline int security_key_alloc(struct key *key) |
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 8c5d6001a923..483cfc47ec34 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h | |||
@@ -32,7 +32,6 @@ | |||
32 | 32 | ||
33 | #define HAVE_ALLOC_SKB /* For the drivers to know */ | 33 | #define HAVE_ALLOC_SKB /* For the drivers to know */ |
34 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ | 34 | #define HAVE_ALIGNABLE_SKB /* Ditto 8) */ |
35 | #define SLAB_SKB /* Slabified skbuffs */ | ||
36 | 35 | ||
37 | #define CHECKSUM_NONE 0 | 36 | #define CHECKSUM_NONE 0 |
38 | #define CHECKSUM_HW 1 | 37 | #define CHECKSUM_HW 1 |
@@ -134,7 +133,7 @@ struct skb_frag_struct { | |||
134 | */ | 133 | */ |
135 | struct skb_shared_info { | 134 | struct skb_shared_info { |
136 | atomic_t dataref; | 135 | atomic_t dataref; |
137 | unsigned int nr_frags; | 136 | unsigned short nr_frags; |
138 | unsigned short tso_size; | 137 | unsigned short tso_size; |
139 | unsigned short tso_segs; | 138 | unsigned short tso_segs; |
140 | unsigned short ufo_size; | 139 | unsigned short ufo_size; |
@@ -1239,6 +1238,8 @@ extern int skb_copy_and_csum_datagram_iovec(struct sk_buff *skb, | |||
1239 | int hlen, | 1238 | int hlen, |
1240 | struct iovec *iov); | 1239 | struct iovec *iov); |
1241 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); | 1240 | extern void skb_free_datagram(struct sock *sk, struct sk_buff *skb); |
1241 | extern void skb_kill_datagram(struct sock *sk, struct sk_buff *skb, | ||
1242 | unsigned int flags); | ||
1242 | extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, | 1243 | extern unsigned int skb_checksum(const struct sk_buff *skb, int offset, |
1243 | int len, unsigned int csum); | 1244 | int len, unsigned int csum); |
1244 | extern int skb_copy_bits(const struct sk_buff *skb, int offset, | 1245 | extern int skb_copy_bits(const struct sk_buff *skb, int offset, |
diff --git a/include/linux/socket.h b/include/linux/socket.h index 1739c2d5b95b..9f4019156fd8 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h | |||
@@ -27,7 +27,6 @@ struct __kernel_sockaddr_storage { | |||
27 | #include <linux/compiler.h> /* __user */ | 27 | #include <linux/compiler.h> /* __user */ |
28 | 28 | ||
29 | extern int sysctl_somaxconn; | 29 | extern int sysctl_somaxconn; |
30 | extern void sock_init(void); | ||
31 | #ifdef CONFIG_PROC_FS | 30 | #ifdef CONFIG_PROC_FS |
32 | struct seq_file; | 31 | struct seq_file; |
33 | extern void socket_seq_show(struct seq_file *seq); | 32 | extern void socket_seq_show(struct seq_file *seq); |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 4be34ef8c2f7..93fa765e47d3 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
@@ -390,6 +390,7 @@ enum | |||
390 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, | 390 | NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR=109, |
391 | NET_TCP_CONG_CONTROL=110, | 391 | NET_TCP_CONG_CONTROL=110, |
392 | NET_TCP_ABC=111, | 392 | NET_TCP_ABC=111, |
393 | NET_IPV4_IPFRAG_MAX_DIST=112, | ||
393 | }; | 394 | }; |
394 | 395 | ||
395 | enum { | 396 | enum { |
diff --git a/include/linux/tcp.h b/include/linux/tcp.h index 0e1da6602e05..f2bb2396853f 100644 --- a/include/linux/tcp.h +++ b/include/linux/tcp.h | |||
@@ -55,22 +55,6 @@ struct tcphdr { | |||
55 | __u16 urg_ptr; | 55 | __u16 urg_ptr; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | #define TCP_ACTION_FIN (1 << 7) | ||
59 | |||
60 | enum { | ||
61 | TCPF_ESTABLISHED = (1 << 1), | ||
62 | TCPF_SYN_SENT = (1 << 2), | ||
63 | TCPF_SYN_RECV = (1 << 3), | ||
64 | TCPF_FIN_WAIT1 = (1 << 4), | ||
65 | TCPF_FIN_WAIT2 = (1 << 5), | ||
66 | TCPF_TIME_WAIT = (1 << 6), | ||
67 | TCPF_CLOSE = (1 << 7), | ||
68 | TCPF_CLOSE_WAIT = (1 << 8), | ||
69 | TCPF_LAST_ACK = (1 << 9), | ||
70 | TCPF_LISTEN = (1 << 10), | ||
71 | TCPF_CLOSING = (1 << 11) | ||
72 | }; | ||
73 | |||
74 | /* | 58 | /* |
75 | * The union cast uses a gcc extension to avoid aliasing problems | 59 | * The union cast uses a gcc extension to avoid aliasing problems |
76 | * (union is compatible to any of its members) | 60 | * (union is compatible to any of its members) |
@@ -254,10 +238,9 @@ struct tcp_sock { | |||
254 | __u32 snd_wl1; /* Sequence for window update */ | 238 | __u32 snd_wl1; /* Sequence for window update */ |
255 | __u32 snd_wnd; /* The window we expect to receive */ | 239 | __u32 snd_wnd; /* The window we expect to receive */ |
256 | __u32 max_window; /* Maximal window ever seen from peer */ | 240 | __u32 max_window; /* Maximal window ever seen from peer */ |
257 | __u32 pmtu_cookie; /* Last pmtu seen by socket */ | ||
258 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ | 241 | __u32 mss_cache; /* Cached effective mss, not including SACKS */ |
259 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ | 242 | __u16 xmit_size_goal; /* Goal for segmenting output packets */ |
260 | __u16 ext_header_len; /* Network protocol overhead (IP/IPv6 options) */ | 243 | /* XXX Two bytes hole, try to pack */ |
261 | 244 | ||
262 | __u32 window_clamp; /* Maximal window to advertise */ | 245 | __u32 window_clamp; /* Maximal window to advertise */ |
263 | __u32 rcv_ssthresh; /* Current window clamp */ | 246 | __u32 rcv_ssthresh; /* Current window clamp */ |
@@ -295,8 +278,6 @@ struct tcp_sock { | |||
295 | 278 | ||
296 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ | 279 | struct sk_buff_head out_of_order_queue; /* Out of order segments go here */ |
297 | 280 | ||
298 | struct tcp_func *af_specific; /* Operations which are AF_INET{4,6} specific */ | ||
299 | |||
300 | __u32 rcv_wnd; /* Current receiver window */ | 281 | __u32 rcv_wnd; /* Current receiver window */ |
301 | __u32 rcv_wup; /* rcv_nxt on last window update sent */ | 282 | __u32 rcv_wup; /* rcv_nxt on last window update sent */ |
302 | __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ | 283 | __u32 write_seq; /* Tail(+1) of data held in tcp send buffer */ |
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/linux/xfrm.h b/include/linux/xfrm.h index 0fb077d68441..82fbb758e28f 100644 --- a/include/linux/xfrm.h +++ b/include/linux/xfrm.h | |||
@@ -27,6 +27,22 @@ struct xfrm_id | |||
27 | __u8 proto; | 27 | __u8 proto; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | struct xfrm_sec_ctx { | ||
31 | __u8 ctx_doi; | ||
32 | __u8 ctx_alg; | ||
33 | __u16 ctx_len; | ||
34 | __u32 ctx_sid; | ||
35 | char ctx_str[0]; | ||
36 | }; | ||
37 | |||
38 | /* Security Context Domains of Interpretation */ | ||
39 | #define XFRM_SC_DOI_RESERVED 0 | ||
40 | #define XFRM_SC_DOI_LSM 1 | ||
41 | |||
42 | /* Security Context Algorithms */ | ||
43 | #define XFRM_SC_ALG_RESERVED 0 | ||
44 | #define XFRM_SC_ALG_SELINUX 1 | ||
45 | |||
30 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ | 46 | /* Selector, used as selector both on policy rules (SPD) and SAs. */ |
31 | 47 | ||
32 | struct xfrm_selector | 48 | struct xfrm_selector |
@@ -146,6 +162,18 @@ enum { | |||
146 | 162 | ||
147 | #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) | 163 | #define XFRM_NR_MSGTYPES (XFRM_MSG_MAX + 1 - XFRM_MSG_BASE) |
148 | 164 | ||
165 | /* | ||
166 | * Generic LSM security context for comunicating to user space | ||
167 | * NOTE: Same format as sadb_x_sec_ctx | ||
168 | */ | ||
169 | struct xfrm_user_sec_ctx { | ||
170 | __u16 len; | ||
171 | __u16 exttype; | ||
172 | __u8 ctx_alg; /* LSMs: e.g., selinux == 1 */ | ||
173 | __u8 ctx_doi; | ||
174 | __u16 ctx_len; | ||
175 | }; | ||
176 | |||
149 | struct xfrm_user_tmpl { | 177 | struct xfrm_user_tmpl { |
150 | struct xfrm_id id; | 178 | struct xfrm_id id; |
151 | __u16 family; | 179 | __u16 family; |
@@ -176,6 +204,7 @@ enum xfrm_attr_type_t { | |||
176 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ | 204 | XFRMA_TMPL, /* 1 or more struct xfrm_user_tmpl */ |
177 | XFRMA_SA, | 205 | XFRMA_SA, |
178 | XFRMA_POLICY, | 206 | XFRMA_POLICY, |
207 | XFRMA_SEC_CTX, /* struct xfrm_sec_ctx */ | ||
179 | __XFRMA_MAX | 208 | __XFRMA_MAX |
180 | 209 | ||
181 | #define XFRMA_MAX (__XFRMA_MAX - 1) | 210 | #define XFRMA_MAX (__XFRMA_MAX - 1) |
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index b5d785ab4a0e..bfc1779fc753 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -13,7 +13,7 @@ extern void unix_gc(void); | |||
13 | #define UNIX_HASH_SIZE 256 | 13 | #define UNIX_HASH_SIZE 256 |
14 | 14 | ||
15 | extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; | 15 | extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1]; |
16 | extern rwlock_t unix_table_lock; | 16 | extern spinlock_t unix_table_lock; |
17 | 17 | ||
18 | extern atomic_t unix_tot_inflight; | 18 | extern atomic_t unix_tot_inflight; |
19 | 19 | ||
@@ -58,10 +58,10 @@ struct unix_skb_parms { | |||
58 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) | 58 | #define UNIXCB(skb) (*(struct unix_skb_parms*)&((skb)->cb)) |
59 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) | 59 | #define UNIXCREDS(skb) (&UNIXCB((skb)).creds) |
60 | 60 | ||
61 | #define unix_state_rlock(s) read_lock(&unix_sk(s)->lock) | 61 | #define unix_state_rlock(s) spin_lock(&unix_sk(s)->lock) |
62 | #define unix_state_runlock(s) read_unlock(&unix_sk(s)->lock) | 62 | #define unix_state_runlock(s) spin_unlock(&unix_sk(s)->lock) |
63 | #define unix_state_wlock(s) write_lock(&unix_sk(s)->lock) | 63 | #define unix_state_wlock(s) spin_lock(&unix_sk(s)->lock) |
64 | #define unix_state_wunlock(s) write_unlock(&unix_sk(s)->lock) | 64 | #define unix_state_wunlock(s) spin_unlock(&unix_sk(s)->lock) |
65 | 65 | ||
66 | #ifdef __KERNEL__ | 66 | #ifdef __KERNEL__ |
67 | /* The AF_UNIX socket */ | 67 | /* The AF_UNIX socket */ |
@@ -76,7 +76,7 @@ struct unix_sock { | |||
76 | struct sock *other; | 76 | struct sock *other; |
77 | struct sock *gc_tree; | 77 | struct sock *gc_tree; |
78 | atomic_t inflight; | 78 | atomic_t inflight; |
79 | rwlock_t lock; | 79 | spinlock_t lock; |
80 | wait_queue_head_t peer_wait; | 80 | wait_queue_head_t peer_wait; |
81 | }; | 81 | }; |
82 | #define unix_sk(__sk) ((struct unix_sock *)__sk) | 82 | #define unix_sk(__sk) ((struct unix_sock *)__sk) |
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/flow.h b/include/net/flow.h index 9a5c94b1a0ec..ec7eb86eb203 100644 --- a/include/net/flow.h +++ b/include/net/flow.h | |||
@@ -84,11 +84,12 @@ struct flowi { | |||
84 | #define FLOW_DIR_OUT 1 | 84 | #define FLOW_DIR_OUT 1 |
85 | #define FLOW_DIR_FWD 2 | 85 | #define FLOW_DIR_FWD 2 |
86 | 86 | ||
87 | typedef void (*flow_resolve_t)(struct flowi *key, u16 family, u8 dir, | 87 | struct sock; |
88 | typedef void (*flow_resolve_t)(struct flowi *key, u32 sk_sid, u16 family, u8 dir, | ||
88 | void **objp, atomic_t **obj_refp); | 89 | void **objp, atomic_t **obj_refp); |
89 | 90 | ||
90 | extern void *flow_cache_lookup(struct flowi *key, u16 family, u8 dir, | 91 | extern void *flow_cache_lookup(struct flowi *key, u32 sk_sid, u16 family, u8 dir, |
91 | flow_resolve_t resolver); | 92 | flow_resolve_t resolver); |
92 | extern void flow_cache_flush(void); | 93 | extern void flow_cache_flush(void); |
93 | extern atomic_t flow_cache_genid; | 94 | extern atomic_t flow_cache_genid; |
94 | 95 | ||
diff --git a/include/net/genetlink.h b/include/net/genetlink.h index 52d8b1a73d52..c5b96b2b8155 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h | |||
@@ -60,7 +60,7 @@ struct genl_info | |||
60 | */ | 60 | */ |
61 | struct genl_ops | 61 | struct genl_ops |
62 | { | 62 | { |
63 | unsigned int cmd; | 63 | u8 cmd; |
64 | unsigned int flags; | 64 | unsigned int flags; |
65 | struct nla_policy *policy; | 65 | struct nla_policy *policy; |
66 | int (*doit)(struct sk_buff *skb, | 66 | int (*doit)(struct sk_buff *skb, |
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/inet6_connection_sock.h b/include/net/inet6_connection_sock.h new file mode 100644 index 000000000000..b33b438bffcc --- /dev/null +++ b/include/net/inet6_connection_sock.h | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * NET Generic infrastructure for INET6 connection oriented protocols. | ||
3 | * | ||
4 | * Authors: Many people, see the TCPv6 sources | ||
5 | * | ||
6 | * From code originally in TCPv6 | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | #ifndef _INET6_CONNECTION_SOCK_H | ||
14 | #define _INET6_CONNECTION_SOCK_H | ||
15 | |||
16 | #include <linux/types.h> | ||
17 | |||
18 | struct in6_addr; | ||
19 | struct inet_bind_bucket; | ||
20 | struct request_sock; | ||
21 | struct sk_buff; | ||
22 | struct sock; | ||
23 | struct sockaddr; | ||
24 | |||
25 | extern int inet6_csk_bind_conflict(const struct sock *sk, | ||
26 | const struct inet_bind_bucket *tb); | ||
27 | |||
28 | extern struct request_sock *inet6_csk_search_req(const struct sock *sk, | ||
29 | struct request_sock ***prevp, | ||
30 | const __u16 rport, | ||
31 | const struct in6_addr *raddr, | ||
32 | const struct in6_addr *laddr, | ||
33 | const int iif); | ||
34 | |||
35 | extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk, | ||
36 | struct request_sock *req, | ||
37 | const unsigned long timeout); | ||
38 | |||
39 | extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | ||
40 | |||
41 | extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok); | ||
42 | #endif /* _INET6_CONNECTION_SOCK_H */ | ||
diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 5a2beed5a770..25f708ff020e 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h | |||
@@ -48,6 +48,32 @@ static inline int inet6_sk_ehashfn(const struct sock *sk) | |||
48 | return inet6_ehashfn(laddr, lport, faddr, fport); | 48 | return inet6_ehashfn(laddr, lport, faddr, fport); |
49 | } | 49 | } |
50 | 50 | ||
51 | static inline void __inet6_hash(struct inet_hashinfo *hashinfo, | ||
52 | struct sock *sk) | ||
53 | { | ||
54 | struct hlist_head *list; | ||
55 | rwlock_t *lock; | ||
56 | |||
57 | BUG_TRAP(sk_unhashed(sk)); | ||
58 | |||
59 | if (sk->sk_state == TCP_LISTEN) { | ||
60 | list = &hashinfo->listening_hash[inet_sk_listen_hashfn(sk)]; | ||
61 | lock = &hashinfo->lhash_lock; | ||
62 | inet_listen_wlock(hashinfo); | ||
63 | } else { | ||
64 | unsigned int hash; | ||
65 | sk->sk_hash = hash = inet6_sk_ehashfn(sk); | ||
66 | hash &= (hashinfo->ehash_size - 1); | ||
67 | list = &hashinfo->ehash[hash].chain; | ||
68 | lock = &hashinfo->ehash[hash].lock; | ||
69 | write_lock(lock); | ||
70 | } | ||
71 | |||
72 | __sk_add_node(sk, list); | ||
73 | sock_prot_inc_use(sk->sk_prot); | ||
74 | write_unlock(lock); | ||
75 | } | ||
76 | |||
51 | /* | 77 | /* |
52 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so | 78 | * Sockets in TCP_CLOSE state are _always_ taken out of the hash, so |
53 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM | 79 | * we need not check it for TCP lookups anymore, thanks Alexey. -DaveM |
@@ -84,10 +110,10 @@ static inline struct sock * | |||
84 | 110 | ||
85 | if(*((__u32 *)&(tw->tw_dport)) == ports && | 111 | if(*((__u32 *)&(tw->tw_dport)) == ports && |
86 | sk->sk_family == PF_INET6) { | 112 | sk->sk_family == PF_INET6) { |
87 | const struct tcp6_timewait_sock *tcp6tw = tcp6_twsk(sk); | 113 | const struct inet6_timewait_sock *tw6 = inet6_twsk(sk); |
88 | 114 | ||
89 | if (ipv6_addr_equal(&tcp6tw->tw_v6_daddr, saddr) && | 115 | if (ipv6_addr_equal(&tw6->tw_v6_daddr, saddr) && |
90 | ipv6_addr_equal(&tcp6tw->tw_v6_rcv_saddr, daddr) && | 116 | ipv6_addr_equal(&tw6->tw_v6_rcv_saddr, daddr) && |
91 | (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) | 117 | (!sk->sk_bound_dev_if || sk->sk_bound_dev_if == dif)) |
92 | goto hit; | 118 | goto hit; |
93 | } | 119 | } |
diff --git a/include/net/inet_common.h b/include/net/inet_common.h index f943306ce5ff..227adcbdfec8 100644 --- a/include/net/inet_common.h +++ b/include/net/inet_common.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _INET_COMMON_H | 1 | #ifndef _INET_COMMON_H |
2 | #define _INET_COMMON_H | 2 | #define _INET_COMMON_H |
3 | 3 | ||
4 | extern struct proto_ops inet_stream_ops; | 4 | extern const struct proto_ops inet_stream_ops; |
5 | extern struct proto_ops inet_dgram_ops; | 5 | extern const struct proto_ops inet_dgram_ops; |
6 | 6 | ||
7 | /* | 7 | /* |
8 | * INET4 prototypes used by INET6 | 8 | * INET4 prototypes used by INET6 |
diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index b0c99060b78d..50234fa56a68 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h | |||
@@ -15,9 +15,11 @@ | |||
15 | #ifndef _INET_CONNECTION_SOCK_H | 15 | #ifndef _INET_CONNECTION_SOCK_H |
16 | #define _INET_CONNECTION_SOCK_H | 16 | #define _INET_CONNECTION_SOCK_H |
17 | 17 | ||
18 | #include <linux/ip.h> | 18 | #include <linux/compiler.h> |
19 | #include <linux/string.h> | 19 | #include <linux/string.h> |
20 | #include <linux/timer.h> | 20 | #include <linux/timer.h> |
21 | |||
22 | #include <net/inet_sock.h> | ||
21 | #include <net/request_sock.h> | 23 | #include <net/request_sock.h> |
22 | 24 | ||
23 | #define INET_CSK_DEBUG 1 | 25 | #define INET_CSK_DEBUG 1 |
@@ -29,6 +31,29 @@ struct inet_bind_bucket; | |||
29 | struct inet_hashinfo; | 31 | struct inet_hashinfo; |
30 | struct tcp_congestion_ops; | 32 | struct tcp_congestion_ops; |
31 | 33 | ||
34 | /* | ||
35 | * Pointers to address related TCP functions | ||
36 | * (i.e. things that depend on the address family) | ||
37 | */ | ||
38 | struct inet_connection_sock_af_ops { | ||
39 | int (*queue_xmit)(struct sk_buff *skb, int ipfragok); | ||
40 | void (*send_check)(struct sock *sk, int len, | ||
41 | struct sk_buff *skb); | ||
42 | int (*rebuild_header)(struct sock *sk); | ||
43 | int (*conn_request)(struct sock *sk, struct sk_buff *skb); | ||
44 | struct sock *(*syn_recv_sock)(struct sock *sk, struct sk_buff *skb, | ||
45 | struct request_sock *req, | ||
46 | struct dst_entry *dst); | ||
47 | int (*remember_stamp)(struct sock *sk); | ||
48 | __u16 net_header_len; | ||
49 | int (*setsockopt)(struct sock *sk, int level, int optname, | ||
50 | char __user *optval, int optlen); | ||
51 | int (*getsockopt)(struct sock *sk, int level, int optname, | ||
52 | char __user *optval, int __user *optlen); | ||
53 | void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); | ||
54 | int sockaddr_len; | ||
55 | }; | ||
56 | |||
32 | /** inet_connection_sock - INET connection oriented sock | 57 | /** inet_connection_sock - INET connection oriented sock |
33 | * | 58 | * |
34 | * @icsk_accept_queue: FIFO of established children | 59 | * @icsk_accept_queue: FIFO of established children |
@@ -36,13 +61,16 @@ struct tcp_congestion_ops; | |||
36 | * @icsk_timeout: Timeout | 61 | * @icsk_timeout: Timeout |
37 | * @icsk_retransmit_timer: Resend (no ack) | 62 | * @icsk_retransmit_timer: Resend (no ack) |
38 | * @icsk_rto: Retransmit timeout | 63 | * @icsk_rto: Retransmit timeout |
64 | * @icsk_pmtu_cookie Last pmtu seen by socket | ||
39 | * @icsk_ca_ops Pluggable congestion control hook | 65 | * @icsk_ca_ops Pluggable congestion control hook |
66 | * @icsk_af_ops Operations which are AF_INET{4,6} specific | ||
40 | * @icsk_ca_state: Congestion control state | 67 | * @icsk_ca_state: Congestion control state |
41 | * @icsk_retransmits: Number of unrecovered [RTO] timeouts | 68 | * @icsk_retransmits: Number of unrecovered [RTO] timeouts |
42 | * @icsk_pending: Scheduled timer event | 69 | * @icsk_pending: Scheduled timer event |
43 | * @icsk_backoff: Backoff | 70 | * @icsk_backoff: Backoff |
44 | * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries | 71 | * @icsk_syn_retries: Number of allowed SYN (or equivalent) retries |
45 | * @icsk_probes_out: unanswered 0 window probes | 72 | * @icsk_probes_out: unanswered 0 window probes |
73 | * @icsk_ext_hdr_len: Network protocol overhead (IP/IPv6 options) | ||
46 | * @icsk_ack: Delayed ACK control data | 74 | * @icsk_ack: Delayed ACK control data |
47 | */ | 75 | */ |
48 | struct inet_connection_sock { | 76 | struct inet_connection_sock { |
@@ -54,14 +82,17 @@ struct inet_connection_sock { | |||
54 | struct timer_list icsk_retransmit_timer; | 82 | struct timer_list icsk_retransmit_timer; |
55 | struct timer_list icsk_delack_timer; | 83 | struct timer_list icsk_delack_timer; |
56 | __u32 icsk_rto; | 84 | __u32 icsk_rto; |
85 | __u32 icsk_pmtu_cookie; | ||
57 | struct tcp_congestion_ops *icsk_ca_ops; | 86 | struct tcp_congestion_ops *icsk_ca_ops; |
87 | struct inet_connection_sock_af_ops *icsk_af_ops; | ||
88 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); | ||
58 | __u8 icsk_ca_state; | 89 | __u8 icsk_ca_state; |
59 | __u8 icsk_retransmits; | 90 | __u8 icsk_retransmits; |
60 | __u8 icsk_pending; | 91 | __u8 icsk_pending; |
61 | __u8 icsk_backoff; | 92 | __u8 icsk_backoff; |
62 | __u8 icsk_syn_retries; | 93 | __u8 icsk_syn_retries; |
63 | __u8 icsk_probes_out; | 94 | __u8 icsk_probes_out; |
64 | /* 2 BYTES HOLE, TRY TO PACK! */ | 95 | __u16 icsk_ext_hdr_len; |
65 | struct { | 96 | struct { |
66 | __u8 pending; /* ACK is pending */ | 97 | __u8 pending; /* ACK is pending */ |
67 | __u8 quick; /* Scheduled number of quick acks */ | 98 | __u8 quick; /* Scheduled number of quick acks */ |
@@ -192,8 +223,12 @@ extern struct request_sock *inet_csk_search_req(const struct sock *sk, | |||
192 | const __u16 rport, | 223 | const __u16 rport, |
193 | const __u32 raddr, | 224 | const __u32 raddr, |
194 | const __u32 laddr); | 225 | const __u32 laddr); |
226 | extern int inet_csk_bind_conflict(const struct sock *sk, | ||
227 | const struct inet_bind_bucket *tb); | ||
195 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, | 228 | extern int inet_csk_get_port(struct inet_hashinfo *hashinfo, |
196 | struct sock *sk, unsigned short snum); | 229 | struct sock *sk, unsigned short snum, |
230 | int (*bind_conflict)(const struct sock *sk, | ||
231 | const struct inet_bind_bucket *tb)); | ||
197 | 232 | ||
198 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, | 233 | extern struct dst_entry* inet_csk_route_req(struct sock *sk, |
199 | const struct request_sock *req); | 234 | const struct request_sock *req); |
@@ -207,7 +242,7 @@ static inline void inet_csk_reqsk_queue_add(struct sock *sk, | |||
207 | 242 | ||
208 | extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, | 243 | extern void inet_csk_reqsk_queue_hash_add(struct sock *sk, |
209 | struct request_sock *req, | 244 | struct request_sock *req, |
210 | const unsigned timeout); | 245 | unsigned long timeout); |
211 | 246 | ||
212 | static inline void inet_csk_reqsk_queue_removed(struct sock *sk, | 247 | static inline void inet_csk_reqsk_queue_removed(struct sock *sk, |
213 | struct request_sock *req) | 248 | struct request_sock *req) |
@@ -273,4 +308,6 @@ static inline unsigned int inet_csk_listen_poll(const struct sock *sk) | |||
273 | extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); | 308 | extern int inet_csk_listen_start(struct sock *sk, const int nr_table_entries); |
274 | extern void inet_csk_listen_stop(struct sock *sk); | 309 | extern void inet_csk_listen_stop(struct sock *sk); |
275 | 310 | ||
311 | extern void inet_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr); | ||
312 | |||
276 | #endif /* _INET_CONNECTION_SOCK_H */ | 313 | #endif /* _INET_CONNECTION_SOCK_H */ |
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 07840baa9341..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) |
@@ -434,4 +415,7 @@ static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, | |||
434 | 415 | ||
435 | return sk; | 416 | return sk; |
436 | } | 417 | } |
418 | |||
419 | extern int inet_hash_connect(struct inet_timewait_death_row *death_row, | ||
420 | struct sock *sk); | ||
437 | #endif /* _INET_HASHTABLES_H */ | 421 | #endif /* _INET_HASHTABLES_H */ |
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 28f7b2103505..1da294c47522 100644 --- a/include/net/inet_timewait_sock.h +++ b/include/net/inet_timewait_sock.h | |||
@@ -17,15 +17,16 @@ | |||
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 | 30 | ||
30 | #include <asm/atomic.h> | 31 | #include <asm/atomic.h> |
31 | 32 | ||
@@ -127,7 +128,8 @@ struct inet_timewait_sock { | |||
127 | __u16 tw_num; | 128 | __u16 tw_num; |
128 | /* And these are ours. */ | 129 | /* And these are ours. */ |
129 | __u8 tw_ipv6only:1; | 130 | __u8 tw_ipv6only:1; |
130 | /* 31 bits hole, try to pack */ | 131 | /* 15 bits hole, try to pack */ |
132 | __u16 tw_ipv6_offset; | ||
131 | int tw_timeout; | 133 | int tw_timeout; |
132 | unsigned long tw_ttd; | 134 | unsigned long tw_ttd; |
133 | struct inet_bind_bucket *tw_tb; | 135 | struct inet_bind_bucket *tw_tb; |
@@ -199,7 +201,7 @@ static inline void inet_twsk_put(struct inet_timewait_sock *tw) | |||
199 | printk(KERN_DEBUG "%s timewait_sock %p released\n", | 201 | printk(KERN_DEBUG "%s timewait_sock %p released\n", |
200 | tw->tw_prot->name, tw); | 202 | tw->tw_prot->name, tw); |
201 | #endif | 203 | #endif |
202 | kmem_cache_free(tw->tw_prot->twsk_slab, tw); | 204 | kmem_cache_free(tw->tw_prot->twsk_prot->twsk_slab, tw); |
203 | module_put(owner); | 205 | module_put(owner); |
204 | } | 206 | } |
205 | } | 207 | } |
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index 7fda471002b6..0965515f40cf 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h | |||
@@ -25,6 +25,7 @@ struct inet_peer | |||
25 | __u32 v4daddr; /* peer's address */ | 25 | __u32 v4daddr; /* peer's address */ |
26 | __u16 avl_height; | 26 | __u16 avl_height; |
27 | __u16 ip_id_count; /* IP ID for the next packet */ | 27 | __u16 ip_id_count; /* IP ID for the next packet */ |
28 | atomic_t rid; /* Frag reception counter */ | ||
28 | __u32 tcp_ts; | 29 | __u32 tcp_ts; |
29 | unsigned long tcp_ts_stamp; | 30 | unsigned long tcp_ts_stamp; |
30 | }; | 31 | }; |
diff --git a/include/net/ip.h b/include/net/ip.h index e4563bbee6ea..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; |
@@ -45,6 +41,7 @@ struct inet_skb_parm | |||
45 | #define IPSKB_TRANSLATED 2 | 41 | #define IPSKB_TRANSLATED 2 |
46 | #define IPSKB_FORWARDED 4 | 42 | #define IPSKB_FORWARDED 4 |
47 | #define IPSKB_XFRM_TUNNEL_SIZE 8 | 43 | #define IPSKB_XFRM_TUNNEL_SIZE 8 |
44 | #define IPSKB_FRAG_COMPLETE 16 | ||
48 | }; | 45 | }; |
49 | 46 | ||
50 | struct ipcm_cookie | 47 | struct ipcm_cookie |
@@ -74,6 +71,13 @@ extern rwlock_t ip_ra_lock; | |||
74 | 71 | ||
75 | #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ | 72 | #define IP_FRAG_TIME (30 * HZ) /* fragment lifetime */ |
76 | 73 | ||
74 | struct msghdr; | ||
75 | struct net_device; | ||
76 | struct packet_type; | ||
77 | struct rtable; | ||
78 | struct sk_buff; | ||
79 | struct sockaddr; | ||
80 | |||
77 | extern void ip_mc_dropsocket(struct sock *); | 81 | extern void ip_mc_dropsocket(struct sock *); |
78 | extern void ip_mc_dropdevice(struct net_device *dev); | 82 | extern void ip_mc_dropdevice(struct net_device *dev); |
79 | extern int igmp_mc_proc_init(void); | 83 | extern int igmp_mc_proc_init(void); |
@@ -168,6 +172,7 @@ extern int sysctl_ipfrag_high_thresh; | |||
168 | extern int sysctl_ipfrag_low_thresh; | 172 | extern int sysctl_ipfrag_low_thresh; |
169 | extern int sysctl_ipfrag_time; | 173 | extern int sysctl_ipfrag_time; |
170 | extern int sysctl_ipfrag_secret_interval; | 174 | extern int sysctl_ipfrag_secret_interval; |
175 | extern int sysctl_ipfrag_max_dist; | ||
171 | 176 | ||
172 | /* From inetpeer.c */ | 177 | /* From inetpeer.c */ |
173 | extern int inet_peer_threshold; | 178 | extern int inet_peer_threshold; |
@@ -182,6 +187,8 @@ extern int sysctl_ip_dynaddr; | |||
182 | extern void ipfrag_init(void); | 187 | extern void ipfrag_init(void); |
183 | 188 | ||
184 | #ifdef CONFIG_INET | 189 | #ifdef CONFIG_INET |
190 | #include <net/dst.h> | ||
191 | |||
185 | /* The function in 2.2 was invalid, producing wrong result for | 192 | /* The function in 2.2 was invalid, producing wrong result for |
186 | * 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) */ |
187 | 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 0a2ad51cff82..860bbac4c4ee 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h | |||
@@ -240,6 +240,8 @@ extern struct ipv6_txoptions * ipv6_renew_options(struct sock *sk, struct ipv6_t | |||
240 | struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, | 240 | struct ipv6_txoptions *ipv6_fixup_options(struct ipv6_txoptions *opt_space, |
241 | struct ipv6_txoptions *opt); | 241 | struct ipv6_txoptions *opt); |
242 | 242 | ||
243 | extern int ipv6_opt_accepted(struct sock *sk, struct sk_buff *skb); | ||
244 | |||
243 | extern int ip6_frag_nqueues; | 245 | extern int ip6_frag_nqueues; |
244 | extern atomic_t ip6_frag_mem; | 246 | extern atomic_t ip6_frag_mem; |
245 | 247 | ||
@@ -525,6 +527,9 @@ extern int inet6_getname(struct socket *sock, struct sockaddr *uaddr, | |||
525 | extern int inet6_ioctl(struct socket *sock, unsigned int cmd, | 527 | extern int inet6_ioctl(struct socket *sock, unsigned int cmd, |
526 | unsigned long arg); | 528 | unsigned long arg); |
527 | 529 | ||
530 | extern int inet6_hash_connect(struct inet_timewait_death_row *death_row, | ||
531 | struct sock *sk); | ||
532 | |||
528 | /* | 533 | /* |
529 | * reassembly.c | 534 | * reassembly.c |
530 | */ | 535 | */ |
@@ -533,8 +538,11 @@ extern int sysctl_ip6frag_low_thresh; | |||
533 | extern int sysctl_ip6frag_time; | 538 | extern int sysctl_ip6frag_time; |
534 | extern int sysctl_ip6frag_secret_interval; | 539 | extern int sysctl_ip6frag_secret_interval; |
535 | 540 | ||
536 | extern struct proto_ops inet6_stream_ops; | 541 | extern const struct proto_ops inet6_stream_ops; |
537 | extern struct proto_ops inet6_dgram_ops; | 542 | extern const struct proto_ops inet6_dgram_ops; |
543 | |||
544 | struct group_source_req; | ||
545 | struct group_filter; | ||
538 | 546 | ||
539 | 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, |
540 | struct group_source_req *pgsr); | 548 | struct group_source_req *pgsr); |
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/protocol.h b/include/net/protocol.h index 357691f6a45f..63f7db99c2a6 100644 --- a/include/net/protocol.h +++ b/include/net/protocol.h | |||
@@ -65,7 +65,7 @@ struct inet_protosw { | |||
65 | int protocol; /* This is the L4 protocol number. */ | 65 | int protocol; /* This is the L4 protocol number. */ |
66 | 66 | ||
67 | struct proto *prot; | 67 | struct proto *prot; |
68 | struct proto_ops *ops; | 68 | const struct proto_ops *ops; |
69 | 69 | ||
70 | int capability; /* Which (if any) capability do | 70 | int capability; /* Which (if any) capability do |
71 | * we need to use this socket | 71 | * we need to use this socket |
@@ -76,6 +76,7 @@ struct inet_protosw { | |||
76 | }; | 76 | }; |
77 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ | 77 | #define INET_PROTOSW_REUSE 0x01 /* Are ports automatically reusable? */ |
78 | #define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ | 78 | #define INET_PROTOSW_PERMANENT 0x02 /* Permanent protocols are unremovable. */ |
79 | #define INET_PROTOSW_ICSK 0x04 /* Is this an inet_connection_sock? */ | ||
79 | 80 | ||
80 | extern struct net_protocol *inet_protocol_base; | 81 | extern struct net_protocol *inet_protocol_base; |
81 | extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; | 82 | extern struct net_protocol *inet_protos[MAX_INET_PROTOS]; |
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/request_sock.h b/include/net/request_sock.h index b52cc52ffe39..11641c9384f7 100644 --- a/include/net/request_sock.h +++ b/include/net/request_sock.h | |||
@@ -244,7 +244,7 @@ static inline int reqsk_queue_is_full(const struct request_sock_queue *queue) | |||
244 | 244 | ||
245 | static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, | 245 | static inline void reqsk_queue_hash_req(struct request_sock_queue *queue, |
246 | u32 hash, struct request_sock *req, | 246 | u32 hash, struct request_sock *req, |
247 | unsigned timeout) | 247 | unsigned long timeout) |
248 | { | 248 | { |
249 | struct listen_sock *lopt = queue->listen_opt; | 249 | struct listen_sock *lopt = queue->listen_opt; |
250 | 250 | ||
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 8e7794ee27ff..f5c22d77feab 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -277,6 +277,24 @@ struct sctp_sock { | |||
277 | __u32 default_context; | 277 | __u32 default_context; |
278 | __u32 default_timetolive; | 278 | __u32 default_timetolive; |
279 | 279 | ||
280 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | ||
281 | * the destination address every heartbeat interval. This value | ||
282 | * will be inherited by all new associations. | ||
283 | */ | ||
284 | __u32 hbinterval; | ||
285 | |||
286 | /* This is the max_retrans value for new associations. */ | ||
287 | __u16 pathmaxrxt; | ||
288 | |||
289 | /* The initial Path MTU to use for new associations. */ | ||
290 | __u32 pathmtu; | ||
291 | |||
292 | /* The default SACK delay timeout for new associations. */ | ||
293 | __u32 sackdelay; | ||
294 | |||
295 | /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ | ||
296 | __u32 param_flags; | ||
297 | |||
280 | struct sctp_initmsg initmsg; | 298 | struct sctp_initmsg initmsg; |
281 | struct sctp_rtoinfo rtoinfo; | 299 | struct sctp_rtoinfo rtoinfo; |
282 | struct sctp_paddrparams paddrparam; | 300 | struct sctp_paddrparams paddrparam; |
@@ -845,9 +863,6 @@ struct sctp_transport { | |||
845 | /* Data that has been sent, but not acknowledged. */ | 863 | /* Data that has been sent, but not acknowledged. */ |
846 | __u32 flight_size; | 864 | __u32 flight_size; |
847 | 865 | ||
848 | /* PMTU : The current known path MTU. */ | ||
849 | __u32 pmtu; | ||
850 | |||
851 | /* Destination */ | 866 | /* Destination */ |
852 | struct dst_entry *dst; | 867 | struct dst_entry *dst; |
853 | /* Source address. */ | 868 | /* Source address. */ |
@@ -862,7 +877,22 @@ struct sctp_transport { | |||
862 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | 877 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to |
863 | * the destination address every heartbeat interval. | 878 | * the destination address every heartbeat interval. |
864 | */ | 879 | */ |
865 | int hb_interval; | 880 | __u32 hbinterval; |
881 | |||
882 | /* This is the max_retrans value for the transport and will | ||
883 | * be initialized from the assocs value. This can be changed | ||
884 | * using SCTP_SET_PEER_ADDR_PARAMS socket option. | ||
885 | */ | ||
886 | __u16 pathmaxrxt; | ||
887 | |||
888 | /* PMTU : The current known path MTU. */ | ||
889 | __u32 pathmtu; | ||
890 | |||
891 | /* SACK delay timeout */ | ||
892 | __u32 sackdelay; | ||
893 | |||
894 | /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ | ||
895 | __u32 param_flags; | ||
866 | 896 | ||
867 | /* When was the last time (in jiffies) that we heard from this | 897 | /* When was the last time (in jiffies) that we heard from this |
868 | * transport? We use this to pick new active and retran paths. | 898 | * transport? We use this to pick new active and retran paths. |
@@ -882,22 +912,11 @@ struct sctp_transport { | |||
882 | */ | 912 | */ |
883 | int state; | 913 | int state; |
884 | 914 | ||
885 | /* hb_allowed : The current heartbeat state of this destination, | ||
886 | * : i.e. ALLOW-HB, NO-HEARTBEAT, etc. | ||
887 | */ | ||
888 | int hb_allowed; | ||
889 | |||
890 | /* These are the error stats for this destination. */ | 915 | /* These are the error stats for this destination. */ |
891 | 916 | ||
892 | /* Error count : The current error count for this destination. */ | 917 | /* Error count : The current error count for this destination. */ |
893 | unsigned short error_count; | 918 | unsigned short error_count; |
894 | 919 | ||
895 | /* This is the max_retrans value for the transport and will | ||
896 | * be initialized to proto.max_retrans.path. This can be changed | ||
897 | * using SCTP_SET_PEER_ADDR_PARAMS socket option. | ||
898 | */ | ||
899 | int max_retrans; | ||
900 | |||
901 | /* Per : A timer used by each destination. | 920 | /* Per : A timer used by each destination. |
902 | * Destination : | 921 | * Destination : |
903 | * Timer : | 922 | * Timer : |
@@ -1502,6 +1521,28 @@ struct sctp_association { | |||
1502 | /* The largest timeout or RTO value to use in attempting an INIT */ | 1521 | /* The largest timeout or RTO value to use in attempting an INIT */ |
1503 | __u16 max_init_timeo; | 1522 | __u16 max_init_timeo; |
1504 | 1523 | ||
1524 | /* Heartbeat interval: The endpoint sends out a Heartbeat chunk to | ||
1525 | * the destination address every heartbeat interval. This value | ||
1526 | * will be inherited by all new transports. | ||
1527 | */ | ||
1528 | __u32 hbinterval; | ||
1529 | |||
1530 | /* This is the max_retrans value for new transports in the | ||
1531 | * association. | ||
1532 | */ | ||
1533 | __u16 pathmaxrxt; | ||
1534 | |||
1535 | /* Association : The smallest PMTU discovered for all of the | ||
1536 | * PMTU : peer's transport addresses. | ||
1537 | */ | ||
1538 | __u32 pathmtu; | ||
1539 | |||
1540 | /* SACK delay timeout */ | ||
1541 | __u32 sackdelay; | ||
1542 | |||
1543 | /* Flags controling Heartbeat, SACK delay, and Path MTU Discovery. */ | ||
1544 | __u32 param_flags; | ||
1545 | |||
1505 | int timeouts[SCTP_NUM_TIMEOUT_TYPES]; | 1546 | int timeouts[SCTP_NUM_TIMEOUT_TYPES]; |
1506 | struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; | 1547 | struct timer_list timers[SCTP_NUM_TIMEOUT_TYPES]; |
1507 | 1548 | ||
@@ -1571,11 +1612,6 @@ struct sctp_association { | |||
1571 | */ | 1612 | */ |
1572 | wait_queue_head_t wait; | 1613 | wait_queue_head_t wait; |
1573 | 1614 | ||
1574 | /* Association : The smallest PMTU discovered for all of the | ||
1575 | * PMTU : peer's transport addresses. | ||
1576 | */ | ||
1577 | __u32 pmtu; | ||
1578 | |||
1579 | /* The message size at which SCTP fragmentation will occur. */ | 1615 | /* The message size at which SCTP fragmentation will occur. */ |
1580 | __u32 frag_point; | 1616 | __u32 frag_point; |
1581 | 1617 | ||
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h index f1c3bc54526a..8a6bef6f91eb 100644 --- a/include/net/sctp/user.h +++ b/include/net/sctp/user.h | |||
@@ -93,6 +93,8 @@ enum sctp_optname { | |||
93 | #define SCTP_STATUS SCTP_STATUS | 93 | #define SCTP_STATUS SCTP_STATUS |
94 | SCTP_GET_PEER_ADDR_INFO, | 94 | SCTP_GET_PEER_ADDR_INFO, |
95 | #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO | 95 | #define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO |
96 | SCTP_DELAYED_ACK_TIME, | ||
97 | #define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME | ||
96 | 98 | ||
97 | /* Internal Socket Options. Some of the sctp library functions are | 99 | /* Internal Socket Options. Some of the sctp library functions are |
98 | * implemented using these socket options. | 100 | * implemented using these socket options. |
@@ -503,13 +505,41 @@ struct sctp_setadaption { | |||
503 | * unreachable. The following structure is used to access and modify an | 505 | * unreachable. The following structure is used to access and modify an |
504 | * address's parameters: | 506 | * address's parameters: |
505 | */ | 507 | */ |
508 | enum sctp_spp_flags { | ||
509 | SPP_HB_ENABLE = 1, /*Enable heartbeats*/ | ||
510 | SPP_HB_DISABLE = 2, /*Disable heartbeats*/ | ||
511 | SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE, | ||
512 | SPP_HB_DEMAND = 4, /*Send heartbeat immediately*/ | ||
513 | SPP_PMTUD_ENABLE = 8, /*Enable PMTU discovery*/ | ||
514 | SPP_PMTUD_DISABLE = 16, /*Disable PMTU discovery*/ | ||
515 | SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE, | ||
516 | SPP_SACKDELAY_ENABLE = 32, /*Enable SACK*/ | ||
517 | SPP_SACKDELAY_DISABLE = 64, /*Disable SACK*/ | ||
518 | SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE, | ||
519 | }; | ||
520 | |||
506 | struct sctp_paddrparams { | 521 | struct sctp_paddrparams { |
507 | sctp_assoc_t spp_assoc_id; | 522 | sctp_assoc_t spp_assoc_id; |
508 | struct sockaddr_storage spp_address; | 523 | struct sockaddr_storage spp_address; |
509 | __u32 spp_hbinterval; | 524 | __u32 spp_hbinterval; |
510 | __u16 spp_pathmaxrxt; | 525 | __u16 spp_pathmaxrxt; |
526 | __u32 spp_pathmtu; | ||
527 | __u32 spp_sackdelay; | ||
528 | __u32 spp_flags; | ||
511 | } __attribute__((packed, aligned(4))); | 529 | } __attribute__((packed, aligned(4))); |
512 | 530 | ||
531 | /* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) | ||
532 | * | ||
533 | * This options will get or set the delayed ack timer. The time is set | ||
534 | * in milliseconds. If the assoc_id is 0, then this sets or gets the | ||
535 | * endpoints default delayed ack timer value. If the assoc_id field is | ||
536 | * non-zero, then the set or get effects the specified association. | ||
537 | */ | ||
538 | struct sctp_assoc_value { | ||
539 | sctp_assoc_t assoc_id; | ||
540 | uint32_t assoc_value; | ||
541 | }; | ||
542 | |||
513 | /* | 543 | /* |
514 | * 7.2.2 Peer Address Information | 544 | * 7.2.2 Peer Address Information |
515 | * | 545 | * |
diff --git a/include/net/sock.h b/include/net/sock.h index 982b4ecd187b..6961700ff3a0 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -493,6 +493,7 @@ extern void sk_stream_kill_queues(struct sock *sk); | |||
493 | extern int sk_wait_data(struct sock *sk, long *timeo); | 493 | extern int sk_wait_data(struct sock *sk, long *timeo); |
494 | 494 | ||
495 | struct request_sock_ops; | 495 | struct request_sock_ops; |
496 | struct timewait_sock_ops; | ||
496 | 497 | ||
497 | /* Networking protocol blocks we attach to sockets. | 498 | /* Networking protocol blocks we attach to sockets. |
498 | * socket layer -> transport layer interface | 499 | * socket layer -> transport layer interface |
@@ -557,11 +558,10 @@ struct proto { | |||
557 | kmem_cache_t *slab; | 558 | kmem_cache_t *slab; |
558 | unsigned int obj_size; | 559 | unsigned int obj_size; |
559 | 560 | ||
560 | kmem_cache_t *twsk_slab; | ||
561 | unsigned int twsk_obj_size; | ||
562 | atomic_t *orphan_count; | 561 | atomic_t *orphan_count; |
563 | 562 | ||
564 | struct request_sock_ops *rsk_prot; | 563 | struct request_sock_ops *rsk_prot; |
564 | struct timewait_sock_ops *twsk_prot; | ||
565 | 565 | ||
566 | struct module *owner; | 566 | struct module *owner; |
567 | 567 | ||
@@ -926,6 +926,29 @@ static inline void sock_put(struct sock *sk) | |||
926 | sk_free(sk); | 926 | sk_free(sk); |
927 | } | 927 | } |
928 | 928 | ||
929 | static inline int sk_receive_skb(struct sock *sk, struct sk_buff *skb) | ||
930 | { | ||
931 | int rc = NET_RX_SUCCESS; | ||
932 | |||
933 | if (sk_filter(sk, skb, 0)) | ||
934 | goto discard_and_relse; | ||
935 | |||
936 | skb->dev = NULL; | ||
937 | |||
938 | bh_lock_sock(sk); | ||
939 | if (!sock_owned_by_user(sk)) | ||
940 | rc = sk->sk_backlog_rcv(sk, skb); | ||
941 | else | ||
942 | sk_add_backlog(sk, skb); | ||
943 | bh_unlock_sock(sk); | ||
944 | out: | ||
945 | sock_put(sk); | ||
946 | return rc; | ||
947 | discard_and_relse: | ||
948 | kfree_skb(skb); | ||
949 | goto out; | ||
950 | } | ||
951 | |||
929 | /* Detach socket from process context. | 952 | /* Detach socket from process context. |
930 | * Announce socket dead, detach it from wait queue and inode. | 953 | * Announce socket dead, detach it from wait queue and inode. |
931 | * Note that parent inode held reference count on this struct sock, | 954 | * Note that parent inode held reference count on this struct sock, |
@@ -1166,7 +1189,10 @@ static inline int sock_queue_err_skb(struct sock *sk, struct sk_buff *skb) | |||
1166 | 1189 | ||
1167 | static inline int sock_error(struct sock *sk) | 1190 | static inline int sock_error(struct sock *sk) |
1168 | { | 1191 | { |
1169 | int err = xchg(&sk->sk_err, 0); | 1192 | int err; |
1193 | if (likely(!sk->sk_err)) | ||
1194 | return 0; | ||
1195 | err = xchg(&sk->sk_err, 0); | ||
1170 | return -err; | 1196 | return -err; |
1171 | } | 1197 | } |
1172 | 1198 | ||
diff --git a/include/net/tcp.h b/include/net/tcp.h index d78025f9fbea..77f21c65bbca 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -225,53 +225,6 @@ extern atomic_t tcp_sockets_allocated; | |||
225 | extern int tcp_memory_pressure; | 225 | extern int tcp_memory_pressure; |
226 | 226 | ||
227 | /* | 227 | /* |
228 | * Pointers to address related TCP functions | ||
229 | * (i.e. things that depend on the address family) | ||
230 | */ | ||
231 | |||
232 | struct tcp_func { | ||
233 | int (*queue_xmit) (struct sk_buff *skb, | ||
234 | int ipfragok); | ||
235 | |||
236 | void (*send_check) (struct sock *sk, | ||
237 | struct tcphdr *th, | ||
238 | int len, | ||
239 | struct sk_buff *skb); | ||
240 | |||
241 | int (*rebuild_header) (struct sock *sk); | ||
242 | |||
243 | int (*conn_request) (struct sock *sk, | ||
244 | struct sk_buff *skb); | ||
245 | |||
246 | struct sock * (*syn_recv_sock) (struct sock *sk, | ||
247 | struct sk_buff *skb, | ||
248 | struct request_sock *req, | ||
249 | struct dst_entry *dst); | ||
250 | |||
251 | int (*remember_stamp) (struct sock *sk); | ||
252 | |||
253 | __u16 net_header_len; | ||
254 | |||
255 | int (*setsockopt) (struct sock *sk, | ||
256 | int level, | ||
257 | int optname, | ||
258 | char __user *optval, | ||
259 | int optlen); | ||
260 | |||
261 | int (*getsockopt) (struct sock *sk, | ||
262 | int level, | ||
263 | int optname, | ||
264 | char __user *optval, | ||
265 | int __user *optlen); | ||
266 | |||
267 | |||
268 | void (*addr2sockaddr) (struct sock *sk, | ||
269 | struct sockaddr *); | ||
270 | |||
271 | int sockaddr_len; | ||
272 | }; | ||
273 | |||
274 | /* | ||
275 | * The next routines deal with comparing 32 bit unsigned ints | 228 | * The next routines deal with comparing 32 bit unsigned ints |
276 | * and worry about wraparound (automatic with unsigned arithmetic). | 229 | * and worry about wraparound (automatic with unsigned arithmetic). |
277 | */ | 230 | */ |
@@ -334,6 +287,9 @@ extern int tcp_rcv_established(struct sock *sk, | |||
334 | 287 | ||
335 | extern void tcp_rcv_space_adjust(struct sock *sk); | 288 | extern void tcp_rcv_space_adjust(struct sock *sk); |
336 | 289 | ||
290 | extern int tcp_twsk_unique(struct sock *sk, | ||
291 | struct sock *sktw, void *twp); | ||
292 | |||
337 | static inline void tcp_dec_quickack_mode(struct sock *sk, | 293 | static inline void tcp_dec_quickack_mode(struct sock *sk, |
338 | const unsigned int pkts) | 294 | const unsigned int pkts) |
339 | { | 295 | { |
@@ -405,8 +361,7 @@ extern void tcp_parse_options(struct sk_buff *skb, | |||
405 | * TCP v4 functions exported for the inet6 API | 361 | * TCP v4 functions exported for the inet6 API |
406 | */ | 362 | */ |
407 | 363 | ||
408 | extern void tcp_v4_send_check(struct sock *sk, | 364 | extern void tcp_v4_send_check(struct sock *sk, int len, |
409 | struct tcphdr *th, int len, | ||
410 | struct sk_buff *skb); | 365 | struct sk_buff *skb); |
411 | 366 | ||
412 | extern int tcp_v4_conn_request(struct sock *sk, | 367 | extern int tcp_v4_conn_request(struct sock *sk, |
@@ -490,34 +445,16 @@ typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *, | |||
490 | extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, | 445 | extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc, |
491 | sk_read_actor_t recv_actor); | 446 | sk_read_actor_t recv_actor); |
492 | 447 | ||
493 | /* Initialize RCV_MSS value. | 448 | extern void tcp_initialize_rcv_mss(struct sock *sk); |
494 | * RCV_MSS is an our guess about MSS used by the peer. | ||
495 | * We haven't any direct information about the MSS. | ||
496 | * It's better to underestimate the RCV_MSS rather than overestimate. | ||
497 | * Overestimations make us ACKing less frequently than needed. | ||
498 | * Underestimations are more easy to detect and fix by tcp_measure_rcv_mss(). | ||
499 | */ | ||
500 | 449 | ||
501 | static inline void tcp_initialize_rcv_mss(struct sock *sk) | 450 | static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) |
502 | { | ||
503 | struct tcp_sock *tp = tcp_sk(sk); | ||
504 | unsigned int hint = min_t(unsigned int, tp->advmss, tp->mss_cache); | ||
505 | |||
506 | hint = min(hint, tp->rcv_wnd/2); | ||
507 | hint = min(hint, TCP_MIN_RCVMSS); | ||
508 | hint = max(hint, TCP_MIN_MSS); | ||
509 | |||
510 | inet_csk(sk)->icsk_ack.rcv_mss = hint; | ||
511 | } | ||
512 | |||
513 | static __inline__ void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd) | ||
514 | { | 451 | { |
515 | tp->pred_flags = htonl((tp->tcp_header_len << 26) | | 452 | tp->pred_flags = htonl((tp->tcp_header_len << 26) | |
516 | ntohl(TCP_FLAG_ACK) | | 453 | ntohl(TCP_FLAG_ACK) | |
517 | snd_wnd); | 454 | snd_wnd); |
518 | } | 455 | } |
519 | 456 | ||
520 | static __inline__ void tcp_fast_path_on(struct tcp_sock *tp) | 457 | static inline void tcp_fast_path_on(struct tcp_sock *tp) |
521 | { | 458 | { |
522 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); | 459 | __tcp_fast_path_on(tp, tp->snd_wnd >> tp->rx_opt.snd_wscale); |
523 | } | 460 | } |
@@ -535,7 +472,7 @@ static inline void tcp_fast_path_check(struct sock *sk, struct tcp_sock *tp) | |||
535 | * Rcv_nxt can be after the window if our peer push more data | 472 | * Rcv_nxt can be after the window if our peer push more data |
536 | * than the offered window. | 473 | * than the offered window. |
537 | */ | 474 | */ |
538 | static __inline__ u32 tcp_receive_window(const struct tcp_sock *tp) | 475 | static inline u32 tcp_receive_window(const struct tcp_sock *tp) |
539 | { | 476 | { |
540 | s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; | 477 | s32 win = tp->rcv_wup + tp->rcv_wnd - tp->rcv_nxt; |
541 | 478 | ||
@@ -707,6 +644,7 @@ extern void tcp_cleanup_congestion_control(struct sock *sk); | |||
707 | extern int tcp_set_default_congestion_control(const char *name); | 644 | extern int tcp_set_default_congestion_control(const char *name); |
708 | extern void tcp_get_default_congestion_control(char *name); | 645 | extern void tcp_get_default_congestion_control(char *name); |
709 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); | 646 | extern int tcp_set_congestion_control(struct sock *sk, const char *name); |
647 | extern void tcp_slow_start(struct tcp_sock *tp); | ||
710 | 648 | ||
711 | extern struct tcp_congestion_ops tcp_init_congestion_ops; | 649 | extern struct tcp_congestion_ops tcp_init_congestion_ops; |
712 | extern u32 tcp_reno_ssthresh(struct sock *sk); | 650 | extern u32 tcp_reno_ssthresh(struct sock *sk); |
@@ -746,7 +684,7 @@ static inline void tcp_ca_event(struct sock *sk, const enum tcp_ca_event event) | |||
746 | * "Packets left network, but not honestly ACKed yet" PLUS | 684 | * "Packets left network, but not honestly ACKed yet" PLUS |
747 | * "Packets fast retransmitted" | 685 | * "Packets fast retransmitted" |
748 | */ | 686 | */ |
749 | static __inline__ unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) | 687 | static inline unsigned int tcp_packets_in_flight(const struct tcp_sock *tp) |
750 | { | 688 | { |
751 | return (tp->packets_out - tp->left_out + tp->retrans_out); | 689 | return (tp->packets_out - tp->left_out + tp->retrans_out); |
752 | } | 690 | } |
@@ -766,33 +704,6 @@ static inline __u32 tcp_current_ssthresh(const struct sock *sk) | |||
766 | (tp->snd_cwnd >> 2))); | 704 | (tp->snd_cwnd >> 2))); |
767 | } | 705 | } |
768 | 706 | ||
769 | /* | ||
770 | * Linear increase during slow start | ||
771 | */ | ||
772 | static inline void tcp_slow_start(struct tcp_sock *tp) | ||
773 | { | ||
774 | if (sysctl_tcp_abc) { | ||
775 | /* RFC3465: Slow Start | ||
776 | * TCP sender SHOULD increase cwnd by the number of | ||
777 | * previously unacknowledged bytes ACKed by each incoming | ||
778 | * acknowledgment, provided the increase is not more than L | ||
779 | */ | ||
780 | if (tp->bytes_acked < tp->mss_cache) | ||
781 | return; | ||
782 | |||
783 | /* We MAY increase by 2 if discovered delayed ack */ | ||
784 | if (sysctl_tcp_abc > 1 && tp->bytes_acked > 2*tp->mss_cache) { | ||
785 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) | ||
786 | tp->snd_cwnd++; | ||
787 | } | ||
788 | } | ||
789 | tp->bytes_acked = 0; | ||
790 | |||
791 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) | ||
792 | tp->snd_cwnd++; | ||
793 | } | ||
794 | |||
795 | |||
796 | static inline void tcp_sync_left_out(struct tcp_sock *tp) | 707 | static inline void tcp_sync_left_out(struct tcp_sock *tp) |
797 | { | 708 | { |
798 | if (tp->rx_opt.sack_ok && | 709 | if (tp->rx_opt.sack_ok && |
@@ -801,34 +712,7 @@ static inline void tcp_sync_left_out(struct tcp_sock *tp) | |||
801 | tp->left_out = tp->sacked_out + tp->lost_out; | 712 | tp->left_out = tp->sacked_out + tp->lost_out; |
802 | } | 713 | } |
803 | 714 | ||
804 | /* Set slow start threshold and cwnd not falling to slow start */ | 715 | extern void tcp_enter_cwr(struct sock *sk); |
805 | static inline void __tcp_enter_cwr(struct sock *sk) | ||
806 | { | ||
807 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
808 | struct tcp_sock *tp = tcp_sk(sk); | ||
809 | |||
810 | tp->undo_marker = 0; | ||
811 | tp->snd_ssthresh = icsk->icsk_ca_ops->ssthresh(sk); | ||
812 | tp->snd_cwnd = min(tp->snd_cwnd, | ||
813 | tcp_packets_in_flight(tp) + 1U); | ||
814 | tp->snd_cwnd_cnt = 0; | ||
815 | tp->high_seq = tp->snd_nxt; | ||
816 | tp->snd_cwnd_stamp = tcp_time_stamp; | ||
817 | TCP_ECN_queue_cwr(tp); | ||
818 | } | ||
819 | |||
820 | static inline void tcp_enter_cwr(struct sock *sk) | ||
821 | { | ||
822 | struct tcp_sock *tp = tcp_sk(sk); | ||
823 | |||
824 | tp->prior_ssthresh = 0; | ||
825 | tp->bytes_acked = 0; | ||
826 | if (inet_csk(sk)->icsk_ca_state < TCP_CA_CWR) { | ||
827 | __tcp_enter_cwr(sk); | ||
828 | tcp_set_ca_state(sk, TCP_CA_CWR); | ||
829 | } | ||
830 | } | ||
831 | |||
832 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); | 716 | extern __u32 tcp_init_cwnd(struct tcp_sock *tp, struct dst_entry *dst); |
833 | 717 | ||
834 | /* Slow start with delack produces 3 packets of burst, so that | 718 | /* Slow start with delack produces 3 packets of burst, so that |
@@ -860,14 +744,14 @@ static inline int tcp_is_cwnd_limited(const struct sock *sk, u32 in_flight) | |||
860 | return left <= tcp_max_burst(tp); | 744 | return left <= tcp_max_burst(tp); |
861 | } | 745 | } |
862 | 746 | ||
863 | static __inline__ void tcp_minshall_update(struct tcp_sock *tp, int mss, | 747 | static inline void tcp_minshall_update(struct tcp_sock *tp, int mss, |
864 | const struct sk_buff *skb) | 748 | const struct sk_buff *skb) |
865 | { | 749 | { |
866 | if (skb->len < mss) | 750 | if (skb->len < mss) |
867 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; | 751 | tp->snd_sml = TCP_SKB_CB(skb)->end_seq; |
868 | } | 752 | } |
869 | 753 | ||
870 | static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) | 754 | static inline void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *tp) |
871 | { | 755 | { |
872 | const struct inet_connection_sock *icsk = inet_csk(sk); | 756 | const struct inet_connection_sock *icsk = inet_csk(sk); |
873 | if (!tp->packets_out && !icsk->icsk_pending) | 757 | if (!tp->packets_out && !icsk->icsk_pending) |
@@ -875,18 +759,18 @@ static __inline__ void tcp_check_probe_timer(struct sock *sk, struct tcp_sock *t | |||
875 | icsk->icsk_rto, TCP_RTO_MAX); | 759 | icsk->icsk_rto, TCP_RTO_MAX); |
876 | } | 760 | } |
877 | 761 | ||
878 | static __inline__ void tcp_push_pending_frames(struct sock *sk, | 762 | static inline void tcp_push_pending_frames(struct sock *sk, |
879 | struct tcp_sock *tp) | 763 | struct tcp_sock *tp) |
880 | { | 764 | { |
881 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); | 765 | __tcp_push_pending_frames(sk, tp, tcp_current_mss(sk, 1), tp->nonagle); |
882 | } | 766 | } |
883 | 767 | ||
884 | static __inline__ void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 768 | static inline void tcp_init_wl(struct tcp_sock *tp, u32 ack, u32 seq) |
885 | { | 769 | { |
886 | tp->snd_wl1 = seq; | 770 | tp->snd_wl1 = seq; |
887 | } | 771 | } |
888 | 772 | ||
889 | static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) | 773 | static inline void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) |
890 | { | 774 | { |
891 | tp->snd_wl1 = seq; | 775 | tp->snd_wl1 = seq; |
892 | } | 776 | } |
@@ -894,19 +778,19 @@ static __inline__ void tcp_update_wl(struct tcp_sock *tp, u32 ack, u32 seq) | |||
894 | /* | 778 | /* |
895 | * Calculate(/check) TCP checksum | 779 | * Calculate(/check) TCP checksum |
896 | */ | 780 | */ |
897 | static __inline__ u16 tcp_v4_check(struct tcphdr *th, int len, | 781 | static inline u16 tcp_v4_check(struct tcphdr *th, int len, |
898 | unsigned long saddr, unsigned long daddr, | 782 | unsigned long saddr, unsigned long daddr, |
899 | unsigned long base) | 783 | unsigned long base) |
900 | { | 784 | { |
901 | return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); | 785 | return csum_tcpudp_magic(saddr,daddr,len,IPPROTO_TCP,base); |
902 | } | 786 | } |
903 | 787 | ||
904 | static __inline__ int __tcp_checksum_complete(struct sk_buff *skb) | 788 | static inline int __tcp_checksum_complete(struct sk_buff *skb) |
905 | { | 789 | { |
906 | return __skb_checksum_complete(skb); | 790 | return __skb_checksum_complete(skb); |
907 | } | 791 | } |
908 | 792 | ||
909 | static __inline__ int tcp_checksum_complete(struct sk_buff *skb) | 793 | static inline int tcp_checksum_complete(struct sk_buff *skb) |
910 | { | 794 | { |
911 | return skb->ip_summed != CHECKSUM_UNNECESSARY && | 795 | return skb->ip_summed != CHECKSUM_UNNECESSARY && |
912 | __tcp_checksum_complete(skb); | 796 | __tcp_checksum_complete(skb); |
@@ -914,7 +798,7 @@ static __inline__ int tcp_checksum_complete(struct sk_buff *skb) | |||
914 | 798 | ||
915 | /* Prequeue for VJ style copy to user, combined with checksumming. */ | 799 | /* Prequeue for VJ style copy to user, combined with checksumming. */ |
916 | 800 | ||
917 | static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) | 801 | static inline void tcp_prequeue_init(struct tcp_sock *tp) |
918 | { | 802 | { |
919 | tp->ucopy.task = NULL; | 803 | tp->ucopy.task = NULL; |
920 | tp->ucopy.len = 0; | 804 | tp->ucopy.len = 0; |
@@ -930,7 +814,7 @@ static __inline__ void tcp_prequeue_init(struct tcp_sock *tp) | |||
930 | * | 814 | * |
931 | * NOTE: is this not too big to inline? | 815 | * NOTE: is this not too big to inline? |
932 | */ | 816 | */ |
933 | static __inline__ int tcp_prequeue(struct sock *sk, struct sk_buff *skb) | 817 | static inline int tcp_prequeue(struct sock *sk, struct sk_buff *skb) |
934 | { | 818 | { |
935 | struct tcp_sock *tp = tcp_sk(sk); | 819 | struct tcp_sock *tp = tcp_sk(sk); |
936 | 820 | ||
@@ -971,7 +855,7 @@ static const char *statename[]={ | |||
971 | }; | 855 | }; |
972 | #endif | 856 | #endif |
973 | 857 | ||
974 | static __inline__ void tcp_set_state(struct sock *sk, int state) | 858 | static inline void tcp_set_state(struct sock *sk, int state) |
975 | { | 859 | { |
976 | int oldstate = sk->sk_state; | 860 | int oldstate = sk->sk_state; |
977 | 861 | ||
@@ -1005,7 +889,7 @@ static __inline__ void tcp_set_state(struct sock *sk, int state) | |||
1005 | #endif | 889 | #endif |
1006 | } | 890 | } |
1007 | 891 | ||
1008 | static __inline__ void tcp_done(struct sock *sk) | 892 | static inline void tcp_done(struct sock *sk) |
1009 | { | 893 | { |
1010 | tcp_set_state(sk, TCP_CLOSE); | 894 | tcp_set_state(sk, TCP_CLOSE); |
1011 | tcp_clear_xmit_timers(sk); | 895 | tcp_clear_xmit_timers(sk); |
@@ -1018,81 +902,13 @@ static __inline__ void tcp_done(struct sock *sk) | |||
1018 | inet_csk_destroy_sock(sk); | 902 | inet_csk_destroy_sock(sk); |
1019 | } | 903 | } |
1020 | 904 | ||
1021 | static __inline__ void tcp_sack_reset(struct tcp_options_received *rx_opt) | 905 | static inline void tcp_sack_reset(struct tcp_options_received *rx_opt) |
1022 | { | 906 | { |
1023 | rx_opt->dsack = 0; | 907 | rx_opt->dsack = 0; |
1024 | rx_opt->eff_sacks = 0; | 908 | rx_opt->eff_sacks = 0; |
1025 | rx_opt->num_sacks = 0; | 909 | rx_opt->num_sacks = 0; |
1026 | } | 910 | } |
1027 | 911 | ||
1028 | static __inline__ void tcp_build_and_update_options(__u32 *ptr, struct tcp_sock *tp, __u32 tstamp) | ||
1029 | { | ||
1030 | if (tp->rx_opt.tstamp_ok) { | ||
1031 | *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | | ||
1032 | (TCPOPT_NOP << 16) | | ||
1033 | (TCPOPT_TIMESTAMP << 8) | | ||
1034 | TCPOLEN_TIMESTAMP); | ||
1035 | *ptr++ = htonl(tstamp); | ||
1036 | *ptr++ = htonl(tp->rx_opt.ts_recent); | ||
1037 | } | ||
1038 | if (tp->rx_opt.eff_sacks) { | ||
1039 | struct tcp_sack_block *sp = tp->rx_opt.dsack ? tp->duplicate_sack : tp->selective_acks; | ||
1040 | int this_sack; | ||
1041 | |||
1042 | *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | | ||
1043 | (TCPOPT_NOP << 16) | | ||
1044 | (TCPOPT_SACK << 8) | | ||
1045 | (TCPOLEN_SACK_BASE + | ||
1046 | (tp->rx_opt.eff_sacks * TCPOLEN_SACK_PERBLOCK))); | ||
1047 | for(this_sack = 0; this_sack < tp->rx_opt.eff_sacks; this_sack++) { | ||
1048 | *ptr++ = htonl(sp[this_sack].start_seq); | ||
1049 | *ptr++ = htonl(sp[this_sack].end_seq); | ||
1050 | } | ||
1051 | if (tp->rx_opt.dsack) { | ||
1052 | tp->rx_opt.dsack = 0; | ||
1053 | tp->rx_opt.eff_sacks--; | ||
1054 | } | ||
1055 | } | ||
1056 | } | ||
1057 | |||
1058 | /* Construct a tcp options header for a SYN or SYN_ACK packet. | ||
1059 | * If this is every changed make sure to change the definition of | ||
1060 | * MAX_SYN_SIZE to match the new maximum number of options that you | ||
1061 | * can generate. | ||
1062 | */ | ||
1063 | static inline void tcp_syn_build_options(__u32 *ptr, int mss, int ts, int sack, | ||
1064 | int offer_wscale, int wscale, __u32 tstamp, __u32 ts_recent) | ||
1065 | { | ||
1066 | /* We always get an MSS option. | ||
1067 | * The option bytes which will be seen in normal data | ||
1068 | * packets should timestamps be used, must be in the MSS | ||
1069 | * advertised. But we subtract them from tp->mss_cache so | ||
1070 | * that calculations in tcp_sendmsg are simpler etc. | ||
1071 | * So account for this fact here if necessary. If we | ||
1072 | * don't do this correctly, as a receiver we won't | ||
1073 | * recognize data packets as being full sized when we | ||
1074 | * should, and thus we won't abide by the delayed ACK | ||
1075 | * rules correctly. | ||
1076 | * SACKs don't matter, we never delay an ACK when we | ||
1077 | * have any of those going out. | ||
1078 | */ | ||
1079 | *ptr++ = htonl((TCPOPT_MSS << 24) | (TCPOLEN_MSS << 16) | mss); | ||
1080 | if (ts) { | ||
1081 | if(sack) | ||
1082 | *ptr++ = __constant_htonl((TCPOPT_SACK_PERM << 24) | (TCPOLEN_SACK_PERM << 16) | | ||
1083 | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); | ||
1084 | else | ||
1085 | *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | | ||
1086 | (TCPOPT_TIMESTAMP << 8) | TCPOLEN_TIMESTAMP); | ||
1087 | *ptr++ = htonl(tstamp); /* TSVAL */ | ||
1088 | *ptr++ = htonl(ts_recent); /* TSECR */ | ||
1089 | } else if(sack) | ||
1090 | *ptr++ = __constant_htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) | | ||
1091 | (TCPOPT_SACK_PERM << 8) | TCPOLEN_SACK_PERM); | ||
1092 | if (offer_wscale) | ||
1093 | *ptr++ = htonl((TCPOPT_NOP << 24) | (TCPOPT_WINDOW << 16) | (TCPOLEN_WINDOW << 8) | (wscale)); | ||
1094 | } | ||
1095 | |||
1096 | /* Determine a window scaling and initial window to offer. */ | 912 | /* Determine a window scaling and initial window to offer. */ |
1097 | extern void tcp_select_initial_window(int __space, __u32 mss, | 913 | extern void tcp_select_initial_window(int __space, __u32 mss, |
1098 | __u32 *rcv_wnd, __u32 *window_clamp, | 914 | __u32 *rcv_wnd, __u32 *window_clamp, |
@@ -1117,9 +933,9 @@ static inline int tcp_full_space(const struct sock *sk) | |||
1117 | return tcp_win_from_space(sk->sk_rcvbuf); | 933 | return tcp_win_from_space(sk->sk_rcvbuf); |
1118 | } | 934 | } |
1119 | 935 | ||
1120 | static __inline__ void tcp_openreq_init(struct request_sock *req, | 936 | static inline void tcp_openreq_init(struct request_sock *req, |
1121 | struct tcp_options_received *rx_opt, | 937 | struct tcp_options_received *rx_opt, |
1122 | struct sk_buff *skb) | 938 | struct sk_buff *skb) |
1123 | { | 939 | { |
1124 | struct inet_request_sock *ireq = inet_rsk(req); | 940 | struct inet_request_sock *ireq = inet_rsk(req); |
1125 | 941 | ||
diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h index b9d4176b2d15..b0b645988bd8 100644 --- a/include/net/tcp_states.h +++ b/include/net/tcp_states.h | |||
@@ -31,4 +31,20 @@ enum { | |||
31 | 31 | ||
32 | #define TCP_STATE_MASK 0xF | 32 | #define TCP_STATE_MASK 0xF |
33 | 33 | ||
34 | #define TCP_ACTION_FIN (1 << 7) | ||
35 | |||
36 | enum { | ||
37 | TCPF_ESTABLISHED = (1 << 1), | ||
38 | TCPF_SYN_SENT = (1 << 2), | ||
39 | TCPF_SYN_RECV = (1 << 3), | ||
40 | TCPF_FIN_WAIT1 = (1 << 4), | ||
41 | TCPF_FIN_WAIT2 = (1 << 5), | ||
42 | TCPF_TIME_WAIT = (1 << 6), | ||
43 | TCPF_CLOSE = (1 << 7), | ||
44 | TCPF_CLOSE_WAIT = (1 << 8), | ||
45 | TCPF_LAST_ACK = (1 << 9), | ||
46 | TCPF_LISTEN = (1 << 10), | ||
47 | TCPF_CLOSING = (1 << 11) | ||
48 | }; | ||
49 | |||
34 | #endif /* _LINUX_TCP_STATES_H */ | 50 | #endif /* _LINUX_TCP_STATES_H */ |
diff --git a/include/net/timewait_sock.h b/include/net/timewait_sock.h new file mode 100644 index 000000000000..2544281e1d5e --- /dev/null +++ b/include/net/timewait_sock.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * NET Generic infrastructure for Network protocols. | ||
3 | * | ||
4 | * Authors: Arnaldo Carvalho de Melo <acme@conectiva.com.br> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License | ||
8 | * as published by the Free Software Foundation; either version | ||
9 | * 2 of the License, or (at your option) any later version. | ||
10 | */ | ||
11 | #ifndef _TIMEWAIT_SOCK_H | ||
12 | #define _TIMEWAIT_SOCK_H | ||
13 | |||
14 | #include <linux/slab.h> | ||
15 | #include <net/sock.h> | ||
16 | |||
17 | struct timewait_sock_ops { | ||
18 | kmem_cache_t *twsk_slab; | ||
19 | unsigned int twsk_obj_size; | ||
20 | int (*twsk_unique)(struct sock *sk, | ||
21 | struct sock *sktw, void *twp); | ||
22 | }; | ||
23 | |||
24 | static inline int twsk_unique(struct sock *sk, struct sock *sktw, void *twp) | ||
25 | { | ||
26 | if (sk->sk_prot->twsk_prot->twsk_unique != NULL) | ||
27 | return sk->sk_prot->twsk_prot->twsk_unique(sk, sktw, twp); | ||
28 | return 0; | ||
29 | } | ||
30 | |||
31 | #endif /* _TIMEWAIT_SOCK_H */ | ||
diff --git a/include/net/transp_v6.h b/include/net/transp_v6.h index 4e86f2de6638..61f724c1036f 100644 --- a/include/net/transp_v6.h +++ b/include/net/transp_v6.h | |||
@@ -44,7 +44,7 @@ extern int datagram_send_ctl(struct msghdr *msg, | |||
44 | /* | 44 | /* |
45 | * address family specific functions | 45 | * address family specific functions |
46 | */ | 46 | */ |
47 | extern struct tcp_func ipv4_specific; | 47 | extern struct inet_connection_sock_af_ops ipv4_specific; |
48 | 48 | ||
49 | extern int inet6_destroy_sock(struct sock *sk); | 49 | extern int inet6_destroy_sock(struct sock *sk); |
50 | 50 | ||
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 1cdb87912137..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> |
@@ -144,6 +145,9 @@ struct xfrm_state | |||
144 | * transformer. */ | 145 | * transformer. */ |
145 | struct xfrm_type *type; | 146 | struct xfrm_type *type; |
146 | 147 | ||
148 | /* Security context */ | ||
149 | struct xfrm_sec_ctx *security; | ||
150 | |||
147 | /* Private data of this transformer, format is opaque, | 151 | /* Private data of this transformer, format is opaque, |
148 | * interpreted by xfrm_type methods. */ | 152 | * interpreted by xfrm_type methods. */ |
149 | void *data; | 153 | void *data; |
@@ -298,6 +302,7 @@ struct xfrm_policy | |||
298 | __u8 flags; | 302 | __u8 flags; |
299 | __u8 dead; | 303 | __u8 dead; |
300 | __u8 xfrm_nr; | 304 | __u8 xfrm_nr; |
305 | struct xfrm_sec_ctx *security; | ||
301 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; | 306 | struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH]; |
302 | }; | 307 | }; |
303 | 308 | ||
@@ -510,6 +515,25 @@ xfrm_selector_match(struct xfrm_selector *sel, struct flowi *fl, | |||
510 | return 0; | 515 | return 0; |
511 | } | 516 | } |
512 | 517 | ||
518 | #ifdef CONFIG_SECURITY_NETWORK_XFRM | ||
519 | /* If neither has a context --> match | ||
520 | * Otherwise, both must have a context and the sids, doi, alg must match | ||
521 | */ | ||
522 | static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) | ||
523 | { | ||
524 | return ((!s1 && !s2) || | ||
525 | (s1 && s2 && | ||
526 | (s1->ctx_sid == s2->ctx_sid) && | ||
527 | (s1->ctx_doi == s2->ctx_doi) && | ||
528 | (s1->ctx_alg == s2->ctx_alg))); | ||
529 | } | ||
530 | #else | ||
531 | static inline int xfrm_sec_ctx_match(struct xfrm_sec_ctx *s1, struct xfrm_sec_ctx *s2) | ||
532 | { | ||
533 | return 1; | ||
534 | } | ||
535 | #endif | ||
536 | |||
513 | /* A struct encoding bundle of transformations to apply to some set of flow. | 537 | /* A struct encoding bundle of transformations to apply to some set of flow. |
514 | * | 538 | * |
515 | * dst->child points to the next element of bundle. | 539 | * dst->child points to the next element of bundle. |
@@ -878,8 +902,8 @@ static inline int xfrm_dst_lookup(struct xfrm_dst **dst, struct flowi *fl, unsig | |||
878 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); | 902 | struct xfrm_policy *xfrm_policy_alloc(gfp_t gfp); |
879 | extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); | 903 | extern int xfrm_policy_walk(int (*func)(struct xfrm_policy *, int, int, void*), void *); |
880 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); | 904 | int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl); |
881 | struct xfrm_policy *xfrm_policy_bysel(int dir, struct xfrm_selector *sel, | 905 | struct xfrm_policy *xfrm_policy_bysel_ctx(int dir, struct xfrm_selector *sel, |
882 | int delete); | 906 | struct xfrm_sec_ctx *ctx, int delete); |
883 | struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); | 907 | struct xfrm_policy *xfrm_policy_byid(int dir, u32 id, int delete); |
884 | void xfrm_policy_flush(void); | 908 | void xfrm_policy_flush(void); |
885 | u32 xfrm_get_acqseq(void); | 909 | u32 xfrm_get_acqseq(void); |