Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F157623502
D27931.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.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
Sun, May 24, 1:10 PM (10 h, 45 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33472817
Default Alt Text
D27931.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