From 5479d6f1eefd1e5a7258b9eedbf92214a95db819 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 28 Sep 2016 09:55:07 +0200 Subject: [PATCH] device: ignore MTU values below minimum Signed-off-by: Felix Fietkau --- device.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/device.c b/device.c index 996ffab..82596e4 100644 --- a/device.c +++ b/device.c @@ -240,12 +240,12 @@ device_init_settings(struct device *dev, struct blob_attr **tb) if ((cur = tb[DEV_ATTR_ENABLED])) disabled = !blobmsg_get_bool(cur); - if ((cur = tb[DEV_ATTR_MTU])) { + if ((cur = tb[DEV_ATTR_MTU]) && blobmsg_get_u32(cur) >= 68) { s->mtu = blobmsg_get_u32(cur); s->flags |= DEV_OPT_MTU; } - if ((cur = tb[DEV_ATTR_MTU6])) { + if ((cur = tb[DEV_ATTR_MTU6]) && blobmsg_get_u32(cur) >= 1280) { s->mtu6 = blobmsg_get_u32(cur); s->flags |= DEV_OPT_MTU6; } -- 2.30.2