diff options
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r-- | net/ipv4/tcp_input.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index cad73b7dfef0..de30e70ff256 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -5,8 +5,6 @@ | |||
5 | * | 5 | * |
6 | * Implementation of the Transmission Control Protocol(TCP). | 6 | * Implementation of the Transmission Control Protocol(TCP). |
7 | * | 7 | * |
8 | * Version: $Id: tcp_input.c,v 1.243 2002/02/01 22:01:04 davem Exp $ | ||
9 | * | ||
10 | * Authors: Ross Biro | 8 | * Authors: Ross Biro |
11 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> | 9 | * Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG> |
12 | * Mark Evans, <evansmp@uhura.aston.ac.uk> | 10 | * Mark Evans, <evansmp@uhura.aston.ac.uk> |
@@ -3450,6 +3448,43 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th, | |||
3450 | return 1; | 3448 | return 1; |
3451 | } | 3449 | } |
3452 | 3450 | ||
3451 | #ifdef CONFIG_TCP_MD5SIG | ||
3452 | /* | ||
3453 | * Parse MD5 Signature option | ||
3454 | */ | ||
3455 | u8 *tcp_parse_md5sig_option(struct tcphdr *th) | ||
3456 | { | ||
3457 | int length = (th->doff << 2) - sizeof (*th); | ||
3458 | u8 *ptr = (u8*)(th + 1); | ||
3459 | |||
3460 | /* If the TCP option is too short, we can short cut */ | ||
3461 | if (length < TCPOLEN_MD5SIG) | ||
3462 | return NULL; | ||
3463 | |||
3464 | while (length > 0) { | ||
3465 | int opcode = *ptr++; | ||
3466 | int opsize; | ||
3467 | |||
3468 | switch(opcode) { | ||
3469 | case TCPOPT_EOL: | ||
3470 | return NULL; | ||
3471 | case TCPOPT_NOP: | ||
3472 | length--; | ||
3473 | continue; | ||
3474 | default: | ||
3475 | opsize = *ptr++; | ||
3476 | if (opsize < 2 || opsize > length) | ||
3477 | return NULL; | ||
3478 | if (opcode == TCPOPT_MD5SIG) | ||
3479 | return ptr; | ||
3480 | } | ||
3481 | ptr += opsize - 2; | ||
3482 | length -= opsize; | ||
3483 | } | ||
3484 | return NULL; | ||
3485 | } | ||
3486 | #endif | ||
3487 | |||
3453 | static inline void tcp_store_ts_recent(struct tcp_sock *tp) | 3488 | static inline void tcp_store_ts_recent(struct tcp_sock *tp) |
3454 | { | 3489 | { |
3455 | tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; | 3490 | tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; |
@@ -5422,6 +5457,9 @@ EXPORT_SYMBOL(sysctl_tcp_ecn); | |||
5422 | EXPORT_SYMBOL(sysctl_tcp_reordering); | 5457 | EXPORT_SYMBOL(sysctl_tcp_reordering); |
5423 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); | 5458 | EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); |
5424 | EXPORT_SYMBOL(tcp_parse_options); | 5459 | EXPORT_SYMBOL(tcp_parse_options); |
5460 | #ifdef CONFIG_TCP_MD5SIG | ||
5461 | EXPORT_SYMBOL(tcp_parse_md5sig_option); | ||
5462 | #endif | ||
5425 | EXPORT_SYMBOL(tcp_rcv_established); | 5463 | EXPORT_SYMBOL(tcp_rcv_established); |
5426 | EXPORT_SYMBOL(tcp_rcv_state_process); | 5464 | EXPORT_SYMBOL(tcp_rcv_state_process); |
5427 | EXPORT_SYMBOL(tcp_initialize_rcv_mss); | 5465 | EXPORT_SYMBOL(tcp_initialize_rcv_mss); |