summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2008-03-03 03:41:06 +0000
committeryongari <yongari@FreeBSD.org>2008-03-03 03:41:06 +0000
commit936e4f90ebc612dfeed4f71f2b1f322c9af26393 (patch)
tree4adebcc4b4b593e75eb4309a5c27f1d048733b72 /sys
parent31e7117ef15ad6fc68674edeb61182605947f9f0 (diff)
downloadFreeBSD-src-936e4f90ebc612dfeed4f71f2b1f322c9af26393.zip
FreeBSD-src-936e4f90ebc612dfeed4f71f2b1f322c9af26393.tar.gz
Don't allow jumbo frame on 8139C+ controller.
While I'm here add a check for minimal MTU length.
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/re/if_re.c14
-rw-r--r--sys/pci/if_rlreg.h2
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/re/if_re.c b/sys/dev/re/if_re.c
index 9a05419..93d82b7 100644
--- a/sys/dev/re/if_re.c
+++ b/sys/dev/re/if_re.c
@@ -2640,10 +2640,18 @@ re_ioctl(ifp, command, data)
switch (command) {
case SIOCSIFMTU:
- RL_LOCK(sc);
- if (ifr->ifr_mtu > RL_JUMBO_MTU)
+ if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > RL_JUMBO_MTU) {
+ error = EINVAL;
+ break;
+ }
+ if (sc->rl_type == RL_8139CPLUS &&
+ ifr->ifr_mtu > RL_MAX_FRAMELEN) {
error = EINVAL;
- ifp->if_mtu = ifr->ifr_mtu;
+ break;
+ }
+ RL_LOCK(sc);
+ if (ifp->if_mtu != ifr->ifr_mtu)
+ ifp->if_mtu = ifr->ifr_mtu;
RL_UNLOCK(sc);
break;
case SIOCSIFFLAGS:
diff --git a/sys/pci/if_rlreg.h b/sys/pci/if_rlreg.h
index 74d9121..d110df0 100644
--- a/sys/pci/if_rlreg.h
+++ b/sys/pci/if_rlreg.h
@@ -722,6 +722,8 @@ struct rl_stats {
/* see comment in dev/re/if_re.c */
#define RL_JUMBO_FRAMELEN 7440
#define RL_JUMBO_MTU (RL_JUMBO_FRAMELEN-ETHER_HDR_LEN-ETHER_CRC_LEN)
+#define RL_MAX_FRAMELEN \
+ (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)
struct rl_txdesc {
struct mbuf *tx_m;
OpenPOWER on IntegriCloud