[3/4] util: add function mtu_is_valid
Message ID | 1496489110-10134-3-git-send-email-jonatan.schlag@ipfire.org |
---|---|
State | Rejected |
Headers |
Return-Path: <network-bounces@lists.ipfire.org> Received: from mail01.ipfire.org (unknown [172.28.1.200]) by web02.ipfire.org (Postfix) with ESMTP id 3FE4561545 for <patchwork@ipfire.org>; Sat, 3 Jun 2017 13:25:32 +0200 (CEST) Received: from mail01.ipfire.org (localhost [IPv6:::1]) by mail01.ipfire.org (Postfix) with ESMTP id F3D66285A; Sat, 3 Jun 2017 13:25:31 +0200 (CEST) Received: from ipfire.localdomain (dslb-088-073-206-165.088.073.pools.vodafone-ip.de [88.73.206.165]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id ED4922852; Sat, 3 Jun 2017 13:25:20 +0200 (CEST) From: Jonatan Schlag <jonatan.schlag@ipfire.org> To: development@lists.ipfire.org, network@lists.ipfire.org Date: Sat, 3 Jun 2017 13:25:09 +0200 Message-Id: <1496489110-10134-3-git-send-email-jonatan.schlag@ipfire.org> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1496489110-10134-1-git-send-email-jonatan.schlag@ipfire.org> References: <1496489110-10134-1-git-send-email-jonatan.schlag@ipfire.org> Subject: [network] [PATCH 3/4] util: add function mtu_is_valid X-BeenThere: network@lists.ipfire.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List for the network package <network.lists.ipfire.org> List-Unsubscribe: <http://lists.ipfire.org/mailman/options/network>, <mailto:network-request@lists.ipfire.org?subject=unsubscribe> List-Archive: <http://lists.ipfire.org/pipermail/network/> List-Post: <mailto:network@lists.ipfire.org> List-Help: <mailto:network-request@lists.ipfire.org?subject=help> List-Subscribe: <http://lists.ipfire.org/mailman/listinfo/network>, <mailto:network-request@lists.ipfire.org?subject=subscribe> Errors-To: network-bounces@lists.ipfire.org Sender: "network" <network-bounces@lists.ipfire.org> |
Message
Jonatan Schlag
June 3, 2017, 9:25 p.m. UTC
This function checks if an mtu is valid for a given IP protocol.
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
---
src/functions/functions.util | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
Comments
Hello, could you please resend this patch with indentation fixed? All other functions are indented by one tab where this one is not. On Sat, 2017-06-03 at 13:25 +0200, Jonatan Schlag wrote: > This function checks if an mtu is valid for a given IP protocol. > > Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org> > --- > src/functions/functions.util | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/src/functions/functions.util b/src/functions/functions.util > index 4b6f956..98ad9d4 100644 > --- a/src/functions/functions.util > +++ b/src/functions/functions.util > @@ -321,6 +321,25 @@ isipaddress() { > ip_is_valid ${addr} > } > > +mtu_is_valid() { > + > +local proto=${1} > +local mtu=${2} The empty line after the function name is unnecessary. > + > +case ${proto} in > + ipv4) > + [ ${mtu} -ge 576 ] && [ ${mtu} -le 9000 ] > + ;; > + ipv6) > + [ ${mtu} -ge 1280 ] && [ ${mtu} -le 9000 ] > + ;; > + *) > + error "${proto} is not a valid proto" > + return ${EXIT_ERROR} > + ;; > +esac > +} > + > backtrace() { > local start=1 > Best, -Michael