From b8570d5db4cc681044b6c4270d95ab74ea9698e6 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Jan 2004 06:22:55 +0000 Subject: 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. --- sys/net80211/ieee80211.h | 11 ++++++++++- sys/net80211/ieee80211_ioctl.c | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) 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; -- cgit v1.1