Index: sys/dev/virtio/network/if_vtnet.c =================================================================== --- sys/dev/virtio/network/if_vtnet.c +++ sys/dev/virtio/network/if_vtnet.c @@ -646,6 +646,20 @@ negotiated_features = virtio_negotiate_features(dev, features); + if (virtio_with_feature(dev, VIRTIO_NET_F_MTU)) { + uint16_t mtu; + + mtu = virtio_read_dev_config_2(dev, + offsetof(struct virtio_net_config, mtu)); + if (mtu < VTNET_MIN_MTU /* || mtu > VTNET_MAX_MTU */) { + device_printf(dev, "Invalid MTU value: %d. " + "MTU feature disabled.\n", mtu); + features &= ~VIRTIO_NET_F_MTU; + negotiated_features = + virtio_negotiate_features(dev, features); + } + } + if (virtio_with_feature(dev, VIRTIO_NET_F_MQ)) { uint16_t npairs; Index: sys/dev/virtio/network/if_vtnetvar.h =================================================================== --- sys/dev/virtio/network/if_vtnetvar.h +++ sys/dev/virtio/network/if_vtnetvar.h @@ -331,6 +331,7 @@ #define VTNET_LRO_FEATURES (VIRTIO_NET_F_GUEST_TSO4 | \ VIRTIO_NET_F_GUEST_TSO6 | VIRTIO_NET_F_GUEST_ECN) +#define VTNET_MIN_MTU 68 #define VTNET_MAX_MTU 65536 #define VTNET_MAX_RX_SIZE 65550