From patchwork Mon Mar 28 16:55:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 5404 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 4KRzN26c5bz3wcX for ; Mon, 28 Mar 2022 16:55:30 +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 4KRzN02bBqzYl; Mon, 28 Mar 2022 16:55:28 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4KRzN01BHBz2yjv; Mon, 28 Mar 2022 16:55:28 +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) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4KRzMy6xS7z2xCy for ; Mon, 28 Mar 2022 16:55:26 +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 4KRzMy0pKyz9p; Mon, 28 Mar 2022 16:55:26 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1648486526; 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=97OX7tkDYG8sdu1oNNze9vlSI4AQ0zFkK0MhPAmxWJo=; b=16zXEdrdQENq0XelzE7bxhHSxLspdO3W6FHBqm2a3bDknOz3mU/cQKVQLKOvsmk3j6sozA hp9GxCc/9Nhe5LBA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1648486526; 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=97OX7tkDYG8sdu1oNNze9vlSI4AQ0zFkK0MhPAmxWJo=; b=fBF6lUkB+H7J4nz68U69wYSdYOn4cPsBqNsR1scdnLQyX/3ZpP/fc7MpYsfSYkNF+H5JVo qn1dZTmDORLw+sJ7skwGQeTG/1gCIxKiGCzNCgUSZphnR8AYAfzeTlBYOG/ql1YRCKFADb 3VkSIe6AC5wj1tz7QkP36ITMMDdODTtVV+GQvWi6IRkC7IfKu6OGXYYWPksM1t3GyPA/Q+ KCCHd1MNDT0pUbjUWUigPrseVolM21jZkjYb4gk/frb0aIFtuETgbQmR6xV7LMMjUXxwGt ArLmeiRPtiuY21EcK6ZVBTXqUXOa3Z/cVq924powwHX9+M8/AlcSRsTWyvINZQ== From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH] networking: Correctly set MTU on all bridges Date: Mon, 28 Mar 2022 16:55:20 +0000 Message-Id: <20220328165520.675137-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" Signed-off-by: Michael Tremer Reviewed-by: Peter Müller --- config/udev/network-hotplug-bridges | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/config/udev/network-hotplug-bridges b/config/udev/network-hotplug-bridges index 4b8764598..9fded1fd0 100644 --- a/config/udev/network-hotplug-bridges +++ b/config/udev/network-hotplug-bridges @@ -80,11 +80,17 @@ MODE="$(get_value "${ZONE}_MODE")" # The name of the virtual bridge BRIDGE="$(get_value "${ZONE}_DEV")" +MTU="$(get_value "${ZONE}_MTU")" STP="$(get_value "${ZONE}_STP")" STP_PRIORITY="$(get_value "${ZONE}_STP_PRIORITY")" case "${MODE}" in bridge) + # Set default MTU if nothing is set + if [ -z "${MTU}" ]; then + MTU=1500 + fi + # We need to check if $STP_PRIORITY has a valid value if not set it if [ -z "${STP_PRIORITY}" ]; then STP_PRIORITY=16384 @@ -95,7 +101,7 @@ case "${MODE}" in # We need to create the bridge if it doesn't exist, yet if [ ! -d "/sys/class/net/${BRIDGE}" ]; then - ip link add "${BRIDGE}" address "${ADDRESS}" type bridge \ + ip link add "${BRIDGE}" address "${ADDRESS}" mtu "${MTU}" type bridge \ $([ "${STP}" = "on" ] && echo "stp_state 1 priority ${STP_PRIORITY}" ) #ip link set "${BRIDGE}" up fi @@ -105,6 +111,9 @@ case "${MODE}" in iw dev "${INTERFACE}" set type __ap fi + # Attempt to set the MTU + ip link set dev "${INTERFACE}" mtu "${MTU}" + # Attach the physical device logger "Attach ${INTERFACE} to ${BRIDGE}" ip link set dev "${INTERFACE}" master "${BRIDGE}"