summaryrefslogtreecommitdiffstats
path: root/net/ipv4/syncookies.c
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-10-15 14:33:21 -0700
committerDavid S. Miller <davem@davemloft.net>2014-10-17 12:02:57 -0400
commite25f866fbc8a4bf387b5dbe8e25aa5b07e55c74f (patch)
treedf2c77e0b95e195dc496bba98155e2c62b9a80cd /net/ipv4/syncookies.c
parent2077eebf7d8bf20b36524de45851e28111a60c52 (diff)
downloadlinux-e25f866fbc8a4bf387b5dbe8e25aa5b07e55c74f.tar.bz2
ipv4: share tcp_v4_save_options() with cookie_v4_check()
cookie_v4_check() allocates ip_options_rcu in the same way with tcp_v4_save_options(), we can just make it a helper function. Cc: Krzysztof Kolasa <kkolasa@winsoft.pl> Cc: Eric Dumazet <edumazet@google.com> Signed-off-by: Cong Wang <cwang@twopensource.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/syncookies.c')
-rw-r--r--net/ipv4/syncookies.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 7e7401cdb9d7..c68d0a1a468e 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -317,15 +317,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
/* We throwed the options of the initial SYN away, so we hope
* the ACK carries the same options again (see RFC1122 4.2.3.8)
*/
- if (opt && opt->optlen) {
- int opt_size = sizeof(struct ip_options_rcu) + opt->optlen;
-
- ireq->opt = kmalloc(opt_size, GFP_ATOMIC);
- if (ireq->opt != NULL && __ip_options_echo(&ireq->opt->opt, skb, opt)) {
- kfree(ireq->opt);
- ireq->opt = NULL;
- }
- }
+ ireq->opt = tcp_v4_save_options(skb);
if (security_inet_conn_request(sk, skb, req)) {
reqsk_free(req);