From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yafang Shao Subject: [PATCH net-next] Revert "net: init sk_cookie for inet socket" Date: Tue, 24 Apr 2018 20:05:37 +0800 Message-ID: <1524571537-9781-1-git-send-email-laoar.shao@gmail.com> Cc: netdev@vger.kernel.org, Yafang Shao To: eric.dumazet@gmail.com, davem@davemloft.net Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:36402 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751279AbeDXMFv (ORCPT ); Tue, 24 Apr 2018 08:05:51 -0400 Received: by mail-pf0-f193.google.com with SMTP id g14so12084805pfh.3 for ; Tue, 24 Apr 2018 05:05:51 -0700 (PDT) Sender: netdev-owner@vger.kernel.org List-ID: This revert commit ("net: init sk_cookie for inet socket") Per discussion with Eric. Signed-off-by: Yafang Shao --- include/linux/sock_diag.h | 9 --------- net/ipv4/tcp_input.c | 8 +------- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/linux/sock_diag.h b/include/linux/sock_diag.h index 5c916e6..15fe980 100644 --- a/include/linux/sock_diag.h +++ b/include/linux/sock_diag.h @@ -25,15 +25,6 @@ struct sock_diag_handler { void sock_diag_register_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); void sock_diag_unregister_inet_compat(int (*fn)(struct sk_buff *skb, struct nlmsghdr *nlh)); -static inline -void sock_init_cookie(struct sock *sk) -{ - u64 res; - - res = atomic64_inc_return(&sock_net(sk)->cookie_gen); - atomic64_set(&sk->sk_cookie, res); -} - u64 sock_gen_cookie(struct sock *sk); int sock_diag_check_cookie(struct sock *sk, const __u32 *cookie); void sock_diag_save_cookie(struct sock *sk, __u32 *cookie); diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 17b7858..5a17cfc 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -78,7 +78,6 @@ #include #include #include -#include int sysctl_tcp_max_orphans __read_mostly = NR_FILE; @@ -6191,15 +6190,10 @@ struct request_sock *inet_reqsk_alloc(const struct request_sock_ops *ops, #if IS_ENABLED(CONFIG_IPV6) ireq->pktopts = NULL; #endif + atomic64_set(&ireq->ir_cookie, 0); ireq->ireq_state = TCP_NEW_SYN_RECV; write_pnet(&ireq->ireq_net, sock_net(sk_listener)); ireq->ireq_family = sk_listener->sk_family; - - BUILD_BUG_ON(offsetof(struct inet_request_sock, ir_cookie) != - offsetof(struct sock, sk_cookie)); - BUILD_BUG_ON(offsetof(struct inet_request_sock, ireq_net) != - offsetof(struct sock, sk_net)); - sock_init_cookie((struct sock *)ireq); } return req; -- 1.8.3.1