net80211: replace m_getcl/m_gethdr pair with m_get2 in ieee80211_fragment()

- Switch to m_get2() for mbuf allocation instead of manual mbuf size
determination.
- Reuse MIN() macro for mbuf size selection.
This commit is contained in:
Andriy Voskoboinyk 2016-05-28 19:13:39 +00:00
parent 8722deef15
commit 18d20be00f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=300911

View File

@ -1679,16 +1679,8 @@ ieee80211_fragment(struct ieee80211vap *vap, struct mbuf *m0,
remainder = m0->m_pkthdr.len - off;
prev = m0;
do {
fragsize = totalhdrsize + remainder;
if (fragsize > mtu)
fragsize = mtu;
/* XXX fragsize can be >2048! */
KASSERT(fragsize < MCLBYTES,
("fragment size %u too big!", fragsize));
if (fragsize > MHLEN)
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
else
m = m_gethdr(M_NOWAIT, MT_DATA);
fragsize = MIN(totalhdrsize + remainder, mtu);
m = m_get2(fragsize, M_NOWAIT, MT_DATA, M_PKTHDR);
if (m == NULL)
goto bad;
/* leave room to prepend any cipher header */