From patchwork Fri Oct 7 20:29:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: michael-dev X-Patchwork-Id: 9367469 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2B5D3600C8 for ; Fri, 7 Oct 2016 20:29:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CF53297FE for ; Fri, 7 Oct 2016 20:29:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1188029832; Fri, 7 Oct 2016 20:29:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40473297FE for ; Fri, 7 Oct 2016 20:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754882AbcJGU3a (ORCPT ); Fri, 7 Oct 2016 16:29:30 -0400 Received: from mail.fem.tu-ilmenau.de ([141.24.220.54]:35921 "EHLO mail.fem.tu-ilmenau.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754792AbcJGU33 (ORCPT ); Fri, 7 Oct 2016 16:29:29 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.fem.tu-ilmenau.de (Postfix) with ESMTP id DF17567BE; Fri, 7 Oct 2016 22:29:26 +0200 (CEST) X-Virus-Scanned: amavisd-new at fem.tu-ilmenau.de Received: from mail.fem.tu-ilmenau.de ([127.0.0.1]) by localhost (mail.fem.tu-ilmenau.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9l5PVVABmTSz; Fri, 7 Oct 2016 22:29:25 +0200 (CEST) Received: from mail-backup.fem.tu-ilmenau.de (mail-backup.net.fem.tu-ilmenau.de [10.42.40.22]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.fem.tu-ilmenau.de (Postfix) with ESMTPS; Fri, 7 Oct 2016 22:29:25 +0200 (CEST) Received: from a234.fem.tu-ilmenau.de (ray-controller.net.fem.tu-ilmenau.de [10.42.51.234]) by mail-backup.fem.tu-ilmenau.de (Postfix) with ESMTP id 0443655130; Fri, 7 Oct 2016 22:29:24 +0200 (CEST) Received: by a234.fem.tu-ilmenau.de (Postfix, from userid 1000) id BA28430C9264; Fri, 7 Oct 2016 22:29:24 +0200 (CEST) From: Michael Braun To: johannes@sipsolutions.net Cc: Michael Braun , linux-wireless@vger.kernel.org, projekt-wlan@fem.tu-ilmenau.de Subject: [PATCH] mac80211: enable to inject a-msdu frames using monitor interface Date: Fri, 7 Oct 2016 22:29:22 +0200 Message-Id: <1475872162-2835-1-git-send-email-michael-dev@fami-braun.de> X-Mailer: git-send-email 2.1.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Problem: When injecting an A-MSDU using a PF_PACKET socket, the qos flag IEEE80211_QOS_CTL_A_MSDU_PRESENT is cleared. How to reproduce: Inject a frame on a mac80211 hwsim monitor interface and have tshark sniffing on this monitor interface. You'll see the packet twice: Once with correct flag and once with flag cleared. On hwsim0, you'll only see the packet with a cleared flag. I guess the same is needed for packets with IEEE80211_TX_CTRL_AMSDU set. Signed-off-by: Michael Braun --- net/mac80211/wme.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c index 9eb0aee..3faa972 100644 --- a/net/mac80211/wme.c +++ b/net/mac80211/wme.c @@ -248,6 +248,13 @@ void ieee80211_set_qos_hdr(struct ieee80211_sub_if_data *sdata, /* preserve EOSP bit */ ack_policy = *p & IEEE80211_QOS_CTL_EOSP; + /* preserve A-MSDU bit for MONITOR interfaces to allow injecting + * A-MSDU frames + */ + if (info->flags & IEEE80211_TX_CTL_INJECTED || + info->control.flags & IEEE80211_TX_CTRL_AMSDU) + ack_policy |= *p & IEEE80211_QOS_CTL_A_MSDU_PRESENT; + if (is_multicast_ether_addr(hdr->addr1) || sdata->noack_map & BIT(tid)) { ack_policy |= IEEE80211_QOS_CTL_ACK_POLICY_NOACK;