Handle SIOCSIFMTU ioctl directly so we can apply 802.11-specific bounds.

Note that the min is actually constrained to IF_MINMTU by the if layer.
This commit is contained in:
Sam Leffler 2004-01-13 06:22:55 +00:00
parent 22acb4fa32
commit 6f161f0342
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=124457
2 changed files with 18 additions and 1 deletions

View File

@ -360,7 +360,16 @@ enum {
#define IEEE80211_CRC_LEN 4
#define IEEE80211_MTU 1500
/*
* Maximum acceptable MTU is:
* IEEE80211_MAX_LEN - WEP overhead - CRC -
* QoS overhead - RSN/WPA overhead
* Min is arbitrarily chosen > IEEE80211_MIN_LEN. The default
* mtu is Ethernet-compatible; it's set by ether_ifattach.
*/
#define IEEE80211_MTU_MAX 2290
#define IEEE80211_MTU_MIN 32
#define IEEE80211_MAX_LEN (2300 + IEEE80211_CRC_LEN + \
(IEEE80211_WEP_IVLEN + IEEE80211_WEP_KIDLEN + IEEE80211_WEP_CRCLEN))
#define IEEE80211_MIN_LEN \

View File

@ -1017,6 +1017,14 @@ ieee80211_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
ifr = (struct ifreq *)data;
copyout(&ic->ic_stats, ifr->ifr_data, sizeof (ic->ic_stats));
break;
case SIOCSIFMTU:
ifr = (struct ifreq *)data;
if (!(IEEE80211_MTU_MIN <= ifr->ifr_mtu &&
ifr->ifr_mtu <= IEEE80211_MTU_MAX))
error = EINVAL;
else
ifp->if_mtu = ifr->ifr_mtu;
break;
default:
error = ether_ioctl(ifp, cmd, data);
break;