Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2012 23:14:57 +0100
From:      Monthadar Al Jaberi <monthadar@gmail.com>
To:        freebsd-wireless@freebsd.org
Cc:        Rui Paulo <rpaulo@freebsd.org>, Bernhard Schmidt <bschmidt@freebsd.org>
Subject:   Fragment and 11s inconsistency
Message-ID:  <CA%2BsBSoJGzabfyt8EXoT-g=GTJD0upX5jbRqfLWKQKzXu2FivaA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
--20cf3011da15e12aee04b8f3ec09
Content-Type: text/plain; charset=ISO-8859-1

Hi,

I cant verify this yet, but isn't there something wrong in current FreeBSD?

lets say an 11s data frame need to be fragmented in ieee80211_encap:
if (addqos)
		hdrsize = sizeof(struct ieee80211_qosframe);
else
		hdrsize = sizeof(struct ieee80211_frame);
...
if (vap->iv_opmode == IEEE80211_M_MBSS) {
...
		if (!IEEE80211_IS_MULTICAST(eh.ether_dhost))
			hdrsize += IEEE80211_ADDR_LEN;	/* unicast are 4-addr */
		meshhdrsize = sizeof(struct ieee80211_meshcntl);
}
...
if (__predict_true((m->m_flags & M_FF) == 0)) {
		/*
		 * Normal frame.
		 */
		m = ieee80211_mbuf_adjust(vap, hdrspace + meshhdrsize, key, m);
}
M_PREPEND(m, hdrspace + meshhdrsize, M_DONTWAIT);
if (txfrag && !ieee80211_fragment(vap, m, hdrsize,
	    key != NULL ? key->wk_cipher->ic_header : 0, vap->iv_fragthreshold))
		goto bad;

This means we send meshcontrol only in first segment, because we never
add meshhdrsize to hdrsize...


but in mesh_input
switch (type) {
	case IEEE80211_FC0_TYPE_DATA:
...
meshdrlen = sizeof(struct ieee80211_meshcntl) +
		    (mc->mc_flags & 3) * IEEE80211_ADDR_LEN;
		hdrspace += meshdrlen;
...
		/*
		 * Potentially forward packet.  See table s36 (p140)
		 * for the rules.  XXX tap fwd'd packets not for us?
		 */
		if (dir == IEEE80211_FC1_DIR_FROMDS ||
		    !mesh_isucastforme(vap, wh, mc)) {
			mesh_forward(vap, m, mc);
...
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
			m = ieee80211_defrag(ni, m, hdrspace);
			if (m == NULL) {

This seems wrong to me, how can we potentially forward before defragin
the frame? this will fail cause sub-frag have no mesh control as code
shows above.

shouldnt the defrag code be moved above?

I am attaching a patch that both moves the defrag, validates that mesh
control is present and makes 11s data frames QoS and set Mesh control
bit present to 1 as the amendment specifies.

br,
-- 
Monthadar Al Jaberi

--20cf3011da15e12aee04b8f3ec09
Content-Type: text/x-patch; charset=US-ASCII; 
	name="0001-Make-mesh-data-frames-to-be-quality-of-service-QoS.patch"
Content-Disposition: attachment; 
	filename="0001-Make-mesh-data-frames-to-be-quality-of-service-QoS.patch"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_gynhniow0

RnJvbSA4MmFhNTg2OWNlMTQwNTg4Mjc0YzgwMjFhNWQ0MDQyMDI1ZDFmMWFhIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBNb250aGFkYXIgQWwgSmFiZXJpIDxtb250aGFkYXJAZ21haWwu
Y29tPgpEYXRlOiBUdWUsIDE0IEZlYiAyMDEyIDE2OjQ3OjQzICswMTAwClN1YmplY3Q6IFtQQVRD
SF0gTWFrZSBtZXNoIGRhdGEgZnJhbWVzIHRvIGJlIHF1YWxpdHkgb2Ygc2VydmljZSAoUW9TKS4K
CiogSW50cm9kdWNlIG5ldyBmbGFnIGZvciBRb1MgY29udHJvbCBmaWVsZDsKKiBDaGFuZ2UgaW4g
bWVzaF9pbnB1dCB0byB2YWxpZGF0ZSB0aGF0IFFvUyBpcyBzZXQgYW5kIE1lc2ggQ29udHJvbCBm
aWVsZAppcyBwcmVzZW50LCBhbHNvIGJvdGggYnl0ZXMgb2YgdGhlIFFvUyBhcmUgcmVhZDsKKiBN
b3ZlZCBkZWZyYWdtZW50YXRpb24gaW4gbWVzaF9pbnB1dCBiZWZvcmUgd2UgdHJ5IHRvIGZvcndh
cmQgcGFja2V0IGFzCmluZm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ERV9IVCkpIHx8CisJICAgICh2YXAtPml2X29wbW9kZSA9PSBJRUVFODAy
MTFfTV9NQlNTKSkgJiYKKwkgICAgKG0tPm1fZmxhZ3MgJiBNX0VBUE9MKSA9PSAwOwogCWlmIChh
ZGRxb3MpCiAJCWhkcnNpemUgPSBzaXplb2Yoc3RydWN0IGllZWU4MDIxMV9xb3NmcmFtZSk7CiAJ
ZWxzZQpAQCAtMTI3Nyw3ICsxMjc5LDEyIEBAIGllZWU4MDIxMV9lbmNhcChzdHJ1Y3QgaWVlZTgw
MjExdmFwICp2YXAsIHN0cnVjdCBpZWVlODAyMTFfbm9kZSAqbmksCiAJCXFvc1swXSA9IHRpZCAm
IElFRUU4MDIxMV9RT1NfVElEOwogCQlpZiAoaWMtPmljX3dtZS53bWVfd21lQ2hhblBhcmFtcy5j
YXBfd21lUGFyYW1zW2FjXS53bWVwX25vYWNrUG9saWN5KQogCQkJcW9zWzBdIHw9IElFRUU4MDIx
MV9RT1NfQUNLUE9MSUNZX05PQUNLOwotCQlxb3NbMV0gPSAwOworI2lmZGVmIElFRUU4MDIxMV9T
VVBQT1JUX01FU0gKKwkJaWYgKHZhcC0+aXZfb3Btb2RlID09IElFRUU4MDIxMV9NX01CU1MpIHsK
KwkJCXFvc1sxXSB8PSBJRUVFODAyMTFfUU9TX01DOworCQl9IGVsc2UKKyNlbmRpZgorCQkJcW9z
WzFdID0gMDsKIAkJd2gtPmlfZmNbMF0gfD0gSUVFRTgwMjExX0ZDMF9TVUJUWVBFX1FPUzsKIAog
CQlpZiAoKG0tPm1fZmxhZ3MgJiBNX0FNUERVX01QRFUpID09IDApIHsKLS0gCjEuNy40LjEKCg==
--20cf3011da15e12aee04b8f3ec09--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CA%2BsBSoJGzabfyt8EXoT-g=GTJD0upX5jbRqfLWKQKzXu2FivaA>