From patchwork Tue Apr 24 02:56:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chris Novakovic X-Patchwork-Id: 903254 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=chrisn.me.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chrisn.me.uk header.i=@chrisn.me.uk header.b="C1De7Rxg"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40VSft2dCkz9rx7 for ; Tue, 24 Apr 2018 12:57:26 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932798AbeDXC5Y (ORCPT ); Mon, 23 Apr 2018 22:57:24 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:39990 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932865AbeDXC5C (ORCPT ); Mon, 23 Apr 2018 22:57:02 -0400 Received: by mail-wr0-f193.google.com with SMTP id v60-v6so46377016wrc.7 for ; Mon, 23 Apr 2018 19:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chrisn.me.uk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=w5e8UjDIjOCJpg7obJ+IGA97bDxo0mQJqpEl0Wl8AZg=; b=C1De7RxgI3aNTYIFrjQlMJLNNpCKcTjPjWwb/xExC9n+iyYeJ4IA3goVd2xFWOkMLp Ic07WuTUTGLSt4M0qb/3zSBQ+yEYP9S0gf30lXueFoh/JvcaRSPHp3DNtV2SiigOuK6+ nAYQA2aTedOrrQCo59CfxqgOxRaOOkOABDw2o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=w5e8UjDIjOCJpg7obJ+IGA97bDxo0mQJqpEl0Wl8AZg=; b=qByQjoKuFjC4ICOzDs1ki0hgVhfrVG2gwxBrcUBGpP/jO7xejB7WUu2TvkeCrrpCBF 7qRuvSel5PlvfxQAudEPQOXIFvM/I5SugayoR5EKUpHPcY3r1YWQBOw0wUtDPmfzf31S JuESBN2aYjJ/LxY7YZa30ywiyN9Xmdrzt3NRMy392e4YTY3h+8pym04UqApf04N3IbQj tT+gXuFD2NSEBosvMvFlJWs1TMTQvRqIyPdDJXGkjl3bkjFKNrGppFPsa44F16wXVF8m +4uuVSbxcW4n+CMg5Wf7VqpyH9l6Cx4Vl/JGEWX8/hKO2c7dwRYCa/YtxG8mCcC/4/8k GzUA== X-Gm-Message-State: ALQs6tBrsgkd9cQj0gvUzcmqE9qzr3vHCDJpmqdBY5l+9u3rdyUiuTw2 TTdmM+GKVaCmhzPFERNHDq8+AA== X-Google-Smtp-Source: AB8JxZpCX6Ds+9GCqG/1ViJobDfxW3zNYf5FlZdtekVIgT3PhCnMi5CjCsaJ+BvxipWFh+yExsesyg== X-Received: by 10.28.191.215 with SMTP id o84mr7940380wmi.157.1524538621764; Mon, 23 Apr 2018 19:57:01 -0700 (PDT) Received: from stronghold.base.iphq.net (cpc83449-wolv18-2-0-cust181.16-1.cable.virginm.net. [82.32.71.182]) by smtp.gmail.com with ESMTPSA id b18-v6sm17407241wrb.55.2018.04.23.19.57.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Apr 2018 19:57:01 -0700 (PDT) From: Chris Novakovic To: "David S. Miller" , netdev@vger.kernel.org Cc: Chris Novakovic Subject: [PATCH v2 4/8] ipconfig: BOOTP: Request CONF_NAMESERVERS_MAX name servers Date: Tue, 24 Apr 2018 03:56:35 +0100 Message-Id: <20180424025639.2228-5-chris@chrisn.me.uk> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180424025639.2228-1-chris@chrisn.me.uk> References: <20180424025639.2228-1-chris@chrisn.me.uk> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When ipconfig is autoconfigured via BOOTP, the request packet initialised by ic_bootp_init_ext() always allocates 8 bytes for the name server option, limiting the BOOTP server to responding with at most 2 name servers even though ipconfig in fact supports an arbitrary number of name servers (as defined by CONF_NAMESERVERS_MAX, which is currently 3). Only request name servers in the request packet if CONF_NAMESERVERS_MAX is positive (to comply with [1, ยง3.8]), and allocate enough space in the packet for CONF_NAMESERVERS_MAX name servers to indicate the maximum number we can accept in response. [1] RFC 2132, "DHCP Options and BOOTP Vendor Extensions": https://tools.ietf.org/rfc/rfc2132.txt Signed-off-by: Chris Novakovic --- net/ipv4/ipconfig.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/ipv4/ipconfig.c b/net/ipv4/ipconfig.c index bcf3c4f9882d..0f460d6d3cce 100644 --- a/net/ipv4/ipconfig.c +++ b/net/ipv4/ipconfig.c @@ -721,9 +721,11 @@ static void __init ic_bootp_init_ext(u8 *e) *e++ = 3; /* Default gateway request */ *e++ = 4; e += 4; +#if CONF_NAMESERVERS_MAX > 0 *e++ = 6; /* (DNS) name server request */ - *e++ = 8; - e += 8; + *e++ = 4 * CONF_NAMESERVERS_MAX; + e += 4 * CONF_NAMESERVERS_MAX; +#endif *e++ = 12; /* Host name request */ *e++ = 32; e += 32;