diff options
author | sam <sam@FreeBSD.org> | 2004-01-13 06:22:55 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2004-01-13 06:22:55 +0000 |
commit | b8570d5db4cc681044b6c4270d95ab74ea9698e6 (patch) | |
tree | 390e3c64186554ac7917301427589c29aa45624c | |
parent | 1012c19191db10049b26de7225117ed77f83124f (diff) | |
download | FreeBSD-src-b8570d5db4cc681044b6c4270d95ab74ea9698e6.zip FreeBSD-src-b8570d5db4cc681044b6c4270d95ab74ea9698e6.tar.gz |
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.
-rw-r--r-- | sys/net80211/ieee80211.h | 11 | ||||
-rw-r--r-- | sys/net80211/ieee80211_ioctl.c | 8 |
2 files changed, 18 insertions, 1 deletions
diff --git a/sys/net80211/ieee80211.h b/sys/net80211/ieee80211.h index 7ad6231..217bbf0 100644 --- a/sys/net80211/ieee80211.h +++ b/sys/net80211/ieee80211.h @@ -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 \ diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 64a8879..1c7df74 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -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; |