device: ignore MTU values below minimum
authorFelix Fietkau <nbd@nbd.name>
Wed, 28 Sep 2016 07:55:07 +0000 (09:55 +0200)
committerFelix Fietkau <nbd@nbd.name>
Wed, 28 Sep 2016 07:55:07 +0000 (09:55 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
device.c

index 996ffabe770beadac52754ec6c4da69c2c31c7ab..82596e4d46df63b486abccc23b95397bcc8f55ff 100644 (file)
--- 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;
        }