aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKristof Provost <kp@FreeBSD.org>2023-06-02 14:37:09 +0000
committerKristof Provost <kp@FreeBSD.org>2023-06-06 08:00:48 +0000
commita9bfd080d09a915055af51103defb5c38b94a236 (patch)
treeed4c89ccf36728d42c71b9120bfb824d25416dda /sys
parent1bbdfb0b438689a839e29094fcb582a104cbabd9 (diff)
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if_epair.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/net/if_epair.c b/sys/net/if_epair.c
index aee5a76a046b..56bfdfbd610f 100644
--- a/sys/net/if_epair.c
+++ b/sys/net/if_epair.c
@@ -337,6 +337,17 @@ epair_transmit(struct ifnet *ifp, struct mbuf *m)
M_ASSERTPKTHDR(m);
/*
+ * We could just transmit this, but it makes testing easier if we're a
+ * little bit more like real hardware.
+ * Allow just that little bit extra for ethernet (and vlan) headers.
+ */
+ if (m->m_pkthdr.len > (ifp->if_mtu + sizeof(struct ether_vlan_header))) {
+ m_freem(m);
+ if_inc_counter(ifp, IFCOUNTER_OERRORS, 1);
+ return (E2BIG);
+ }
+
+ /*
* We are not going to use the interface en/dequeue mechanism
* on the TX side. We are called from ether_output_frame()
* and will put the packet into the receive-queue (rxq) of the