aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ipv4/tcp_input.c')
-rw-r--r--net/ipv4/tcp_input.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index eba873e9b560..f331e67f2328 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3450,6 +3450,43 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
3450 return 1; 3450 return 1;
3451} 3451}
3452 3452
3453#ifdef CONFIG_TCP_MD5SIG
3454/*
3455 * Parse MD5 Signature option
3456 */
3457u8 *tcp_parse_md5sig_option(struct tcphdr *th)
3458{
3459 int length = (th->doff << 2) - sizeof (*th);
3460 u8 *ptr = (u8*)(th + 1);
3461
3462 /* If the TCP option is too short, we can short cut */
3463 if (length < TCPOLEN_MD5SIG)
3464 return NULL;
3465
3466 while (length > 0) {
3467 int opcode = *ptr++;
3468 int opsize;
3469
3470 switch(opcode) {
3471 case TCPOPT_EOL:
3472 return NULL;
3473 case TCPOPT_NOP:
3474 length--;
3475 continue;
3476 default:
3477 opsize = *ptr++;
3478 if (opsize < 2 || opsize > length)
3479 return NULL;
3480 if (opcode == TCPOPT_MD5SIG)
3481 return ptr;
3482 }
3483 ptr += opsize - 2;
3484 length -= opsize;
3485 }
3486 return NULL;
3487}
3488#endif
3489
3453static inline void tcp_store_ts_recent(struct tcp_sock *tp) 3490static inline void tcp_store_ts_recent(struct tcp_sock *tp)
3454{ 3491{
3455 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; 3492 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
@@ -5467,6 +5504,9 @@ EXPORT_SYMBOL(sysctl_tcp_ecn);
5467EXPORT_SYMBOL(sysctl_tcp_reordering); 5504EXPORT_SYMBOL(sysctl_tcp_reordering);
5468EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); 5505EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);
5469EXPORT_SYMBOL(tcp_parse_options); 5506EXPORT_SYMBOL(tcp_parse_options);
5507#ifdef CONFIG_TCP_MD5SIG
5508EXPORT_SYMBOL(tcp_parse_md5sig_option);
5509#endif
5470EXPORT_SYMBOL(tcp_rcv_established); 5510EXPORT_SYMBOL(tcp_rcv_established);
5471EXPORT_SYMBOL(tcp_rcv_state_process); 5511EXPORT_SYMBOL(tcp_rcv_state_process);
5472EXPORT_SYMBOL(tcp_initialize_rcv_mss); 5512EXPORT_SYMBOL(tcp_initialize_rcv_mss);