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 b68c3c7d906b..bc7f62e2792b 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3448,6 +3448,43 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
3448 return 1; 3448 return 1;
3449} 3449}
3450 3450
3451#ifdef CONFIG_TCP_MD5SIG
3452/*
3453 * Parse MD5 Signature option
3454 */
3455u8 *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
3451static inline void tcp_store_ts_recent(struct tcp_sock *tp) 3488static inline void tcp_store_ts_recent(struct tcp_sock *tp)
3452{ 3489{
3453 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval; 3490 tp->rx_opt.ts_recent = tp->rx_opt.rcv_tsval;
@@ -5465,6 +5502,9 @@ EXPORT_SYMBOL(sysctl_tcp_ecn);
5465EXPORT_SYMBOL(sysctl_tcp_reordering); 5502EXPORT_SYMBOL(sysctl_tcp_reordering);
5466EXPORT_SYMBOL(sysctl_tcp_adv_win_scale); 5503EXPORT_SYMBOL(sysctl_tcp_adv_win_scale);
5467EXPORT_SYMBOL(tcp_parse_options); 5504EXPORT_SYMBOL(tcp_parse_options);
5505#ifdef CONFIG_TCP_MD5SIG
5506EXPORT_SYMBOL(tcp_parse_md5sig_option);
5507#endif
5468EXPORT_SYMBOL(tcp_rcv_established); 5508EXPORT_SYMBOL(tcp_rcv_established);
5469EXPORT_SYMBOL(tcp_rcv_state_process); 5509EXPORT_SYMBOL(tcp_rcv_state_process);
5470EXPORT_SYMBOL(tcp_initialize_rcv_mss); 5510EXPORT_SYMBOL(tcp_initialize_rcv_mss);