diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/re/if_re.c | 14 | ||||
-rw-r--r-- | sys/pci/if_rlreg.h | 2 |
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; |