From patchwork Tue Feb 22 12:18:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5220 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4K2yqs3tBnz3xgb for ; Tue, 22 Feb 2022 12:18:17 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4K2yqp2g7nz3wJ; Tue, 22 Feb 2022 12:18:14 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4K2yqn6KdBz2yrp; Tue, 22 Feb 2022 12:18:13 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4K2yqm00Wvz2xKb for ; Tue, 22 Feb 2022 12:18:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4K2yql1f00zXD; Tue, 22 Feb 2022 12:18:11 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1645532291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=vb6ObdjNAQzhZdStwrhh9lq5nPQlPvFEBgaUWb46Bpo=; b=Hb7jnJ7d/EA+gQYA3pR1+X7AVlYDEwzTZ1nDYQwjWokGvCN7PfYs+B3q74Odunup+Nm1DW 6TnkivhpISx62BDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1645532291; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=vb6ObdjNAQzhZdStwrhh9lq5nPQlPvFEBgaUWb46Bpo=; b=mnjIDCl2sS9uhq7vOBfmCq79SvVxqgv37rRygWVN8FkTBP0DwaykuTdkh5eU7Y3TDDBWt8 LIyw4EcYxoUXS1vryM+MlA4dCUT6Yc8xGkJln8L004z2d7O+lL4O6JNQ7O8jskFP1Hc0Is kh/IBEt/XODdwHQQBXbxSDh26NtJins+xpkHRhRiihG9oTR0SyLjoA2mv4dxdWfjTUEzGv 0R6S/cUu1G5YBRsbXI6bFA2n3TItDlUcLVKBlkl7RuldqiZ66S5fSXevrkUWkYPIwjbUke gSzolOsn/VdrmHYznvyeDGQkmypr3Ob/a6pcQYnW66IFpGeA8pEs7Ez1I2qpNg== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 1/3] dhcpcd: Force setting MTU through dhcpcd Date: Tue, 22 Feb 2022 12:18:04 +0000 Message-Id: <20220222121806.1208994-1-michael.tremer@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michael Tremer Errors-To: development-bounces@lists.ipfire.org Sender: "Development" The DHCP server can instruct clients to configure a certain MTU. This used to be done by setting the MTU of the interface. However, dhcpcd has changed this behaviour using routes to. We used to have a modified version of the old mechanism which no longer works well with the new system and is therefore to be dropped. This is the first commit in the series implementing the new behaviour and telling dhcpcd to use the configured MTU. Fixes: #12563 Signed-off-by: Michael Tremer Reviewed-by: Peter Müller --- src/initscripts/networking/functions.network | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/initscripts/networking/functions.network b/src/initscripts/networking/functions.network index 7ec50f436..eae4a7b7c 100644 --- a/src/initscripts/networking/functions.network +++ b/src/initscripts/networking/functions.network @@ -61,7 +61,7 @@ dhcpcd_start() { # This function will start a dhcpcd on a speciefied device. local device="$1" - local dhcp_start="" + local dhcp_start=() boot_mesg -n "Starting dhcpcd on the ${device} interface..." @@ -76,11 +76,16 @@ dhcpcd_start() { # Check if a DHCP hostname has been set. if [ -n "${RED_DHCP_HOSTNAME}" ]; then - dhcp_start+="-h ${RED_DHCP_HOSTNAME}" + dhcp_start+=( "-h" "${RED_DHCP_HOSTNAME}" ) + fi + + # Tell dhcpcd to use the configured MTU + if [ -n "${RED_DHCP_FORCE_MTU}" ]; then + dhcp_start+=( "--static" "mtu=${RED_DHCP_FORCE_MTU}" ) fi # Start dhcpcd. - /sbin/dhcpcd ${dhcp_start} ${device} >/dev/null 2>&1 + /sbin/dhcpcd "${dhcp_start[@]}" ${device} >/dev/null 2>&1 ret="$?" if [ "${ret}" -eq 0 ]; then