Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F147216361
D27931.id82547.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D27931.id82547.diff
View Options
diff --git a/sys/dev/virtio/network/if_vtnet.c b/sys/dev/virtio/network/if_vtnet.c
--- a/sys/dev/virtio/network/if_vtnet.c
+++ b/sys/dev/virtio/network/if_vtnet.c
@@ -657,6 +657,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;
diff --git a/sys/dev/virtio/network/if_vtnetvar.h b/sys/dev/virtio/network/if_vtnetvar.h
--- a/sys/dev/virtio/network/if_vtnetvar.h
+++ b/sys/dev/virtio/network/if_vtnetvar.h
@@ -340,6 +340,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
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 10, 4:56 AM (6 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29474734
Default Alt Text
D27931.id82547.diff (1 KB)
Attached To
Mode
D27931: if_vtnet: Disable F_MTU feature if MTU is invalid
Attached
Detach File
Event Timeline
Log In to Comment