Received: by 10.192.165.156 with SMTP id m28csp1122447imm; Wed, 11 Apr 2018 12:52:20 -0700 (PDT) X-Google-Smtp-Source: AIpwx48QYX35fJ+mjHOqwtlYVpi7ryExUEs6+N/YOGmC1kAeRm+G0Tje+SCzDfb/JvERoEU9noSh X-Received: by 10.98.141.20 with SMTP id z20mr5132269pfd.144.1523476340466; Wed, 11 Apr 2018 12:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523476340; cv=none; d=google.com; s=arc-20160816; b=cKpVmqo/Cp0VpcH63S5JcKRleWX0w4UGLUjmWseyS15HrT51OAB1iWKPAHzBXGJwvN mvR95DwBcdbVTR7A39AQur0Mlhceg8Fg6c0EyY4KDtmyBeEcbwDzcOruXCD1hzolDSw4 lrGFPqDN9PODL/68P0uXZhVxkbNc1imzEDxiDWi24FXhtwKN2/GfPsf2tJwCpqBFwwjT R+gnflQFlgqA1XNspDfMywWk1L4Ni7K2B/cx9cD0hZ+J/9NS3RLnlvqrzbxWRMD67eiH gXaT89GjPNXnQ9R6bA+7VLVj5UMiJIF8h+NJLWs2/l+vW8nL3wv5PtsaV/5T2FXRzfVN o4vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=9l8wDL23Ab7Zp9f+L2xgtyBfaE+yoisH6EXtSLxa9iQ=; b=UyK+Amx4VCgbLYVGIoqnJ6vFPWwsqYecs36rZkKsTSb2eQF1ppAvsbY+copExP8nBF NGhl5yY8sWq2Qe29nXs4QYXHOoyMiLQAam3MA3UZSlnqLpr+za4feyt61iRPlxfd3GOq Syg1E+OO6tVKgkwbKUL+Gevdk9cJNBTDB85nbRekuRvZ6gq+TpHHZcbo+rbayled5h1R W5519FMM3xHpgu07NTWtlz9O+quiEDH4Ll+/ETmQcVfwI0ypgIvtK8H6LMPA4rV4riFI j96A/BOoXI4u9MX7Ffr/DznEL/SPAjHqg/Mg24if6EtrDaKkyahscJet19eq87AjW86x X04Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s85si1371239pfi.32.2018.04.11.12.51.44; Wed, 11 Apr 2018 12:52:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934042AbeDKS7H (ORCPT + 99 others); Wed, 11 Apr 2018 14:59:07 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36918 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934013AbeDKS7D (ORCPT ); Wed, 11 Apr 2018 14:59:03 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2D663E1E; Wed, 11 Apr 2018 18:59:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Kapl , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 110/310] net: move somaxconn init from sysctl code Date: Wed, 11 Apr 2018 20:34:09 +0200 Message-Id: <20180411183626.930010814@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Roman Kapl [ Upstream commit 7c3f1875c66fbc19762760097cabc91849ea0bbb ] The default value for somaxconn is set in sysctl_core_net_init(), but this function is not called when kernel is configured without CONFIG_SYSCTL. This results in the kernel not being able to accept TCP connections, because the backlog has zero size. Usually, the user ends up with: "TCP: request_sock_TCP: Possible SYN flooding on port 7. Dropping request. Check SNMP counters." If SYN cookies are not enabled the connection is rejected. Before ef547f2ac16 (tcp: remove max_qlen_log), the effects were less severe, because the backlog was always at least eight slots long. Signed-off-by: Roman Kapl Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/core/net_namespace.c | 19 +++++++++++++++++++ net/core/sysctl_net_core.c | 2 -- 2 files changed, 19 insertions(+), 2 deletions(-) --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -312,6 +312,25 @@ out_undo: goto out; } +static int __net_init net_defaults_init_net(struct net *net) +{ + net->core.sysctl_somaxconn = SOMAXCONN; + return 0; +} + +static struct pernet_operations net_defaults_ops = { + .init = net_defaults_init_net, +}; + +static __init int net_defaults_init(void) +{ + if (register_pernet_subsys(&net_defaults_ops)) + panic("Cannot initialize net default settings"); + + return 0; +} + +core_initcall(net_defaults_init); #ifdef CONFIG_NET_NS static struct ucounts *inc_net_namespaces(struct user_namespace *ns) --- a/net/core/sysctl_net_core.c +++ b/net/core/sysctl_net_core.c @@ -438,8 +438,6 @@ static __net_init int sysctl_core_net_in { struct ctl_table *tbl; - net->core.sysctl_somaxconn = SOMAXCONN; - tbl = netns_core_table; if (!net_eq(net, &init_net)) { tbl = kmemdup(tbl, sizeof(netns_core_table), GFP_KERNEL);