From owner-freebsd-wireless@freebsd.org Sat Aug 4 22:48:54 2018 Return-Path: Delivered-To: freebsd-wireless@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 258BC1056499 for ; Sat, 4 Aug 2018 22:48:54 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 846368CB69 for ; Sat, 4 Aug 2018 22:48:53 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by mail-wm0-x22d.google.com with SMTP id w24-v6so10230054wmc.1 for ; Sat, 04 Aug 2018 15:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6x/rbVkESHfYW5uB0MfZvhB49ntWMa4RlM5TEla3mVc=; b=oc+siLZpsldNnKTgZasclkV6id6qavYkDFYLIu6X247vEnZYk75aPoQelBvHiK+bij d6CbjrtBmcNcOhM41JJlsgbD95ex7LSkngoLG+cTeof/zsyNHswqkwQE1ImuON+9pG5C clToUBWJfWTJvS2zqGwm0T+dFenRRBMA8rbDE1BhNWVvbpxTmgM/VhAPuduERMx29qdr Jou543jlk12X1Y/mbFzOR0YdzpHa7Wmdeh0rNTURs4V7gF5EKtBhp4OluawteABNTbZb m7Ih0mUf/05vvKUyu7qTFccxk9BU6/uQw6GktE24EELq2btgGRFVKK2waOAbDemkCXus LNFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6x/rbVkESHfYW5uB0MfZvhB49ntWMa4RlM5TEla3mVc=; b=AEniejZl6LsxNJndfOpYXZ4DCsI+NP6GhGxchRV4GMb2FJcf2/p5hjlFt4AUTcxhNB JQxPS7hLmceqiiMa/Ezd21N74c1QDLKF+WA+N/0K9BCLf3cEVlV7D+d+oaUfYNInktsU zGj48X4CGTXZrHh0FygTffHSsoGLcs12/gCZU/AVTj92Jp/KwYOxoXuwrt1qGxA6ssJ0 dydDXNRd70ZD/GeRe3A1M6FSC0xwZ8F7JXOq0IWZOa9UOsabZYSPhLL2wn8JN7U1ZEQQ 3xggrfx0oFw+YRjt464hW4nW+B8KXPWRRtr7IZTlRdQvxg2cFvThXISkhOlRzrVeKuiE 8meA== X-Gm-Message-State: AOUpUlGZOfIALvNBiFSxL2cXxsi6S1lz4C8DTeDT8dAdEG5I4eorKz2b K4BJvEC5oXnWKEZ0miQw12dFBsWwIxViJ0THy4o= X-Google-Smtp-Source: AAOMgpcoD3D7bcgeQIhDU9QrO7aBK2SRcSzgvwxl+GBly5p/0nGHasDBun5rRrFNyNmno3Tzp/FEpaUZpvHXqMNdD8Q= X-Received: by 2002:a1c:c64f:: with SMTP id w76-v6mr8503678wmf.3.1533422931688; Sat, 04 Aug 2018 15:48:51 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Adrian Chadd Date: Sat, 4 Aug 2018 15:48:38 -0700 Message-ID: Subject: Re: Where do monitor mode and STA mode begin to differ? To: Farhan Khan Cc: "freebsd-wireless@freebsd.org" Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-wireless@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "Discussions of 802.11 stack, tools device driver development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Aug 2018 22:48:54 -0000 hi! So, net80211 itself shouldn't really differ that much for this particular issue. There may be some functions that aren't called in monitor mode (like sta_join) but you're not yet there.s I'd look at the difference in the driver VAP setup and the newstate function for different operating modes. If RX works in monitor mode but it's not working in scanning mode then I'd look at how the hardware is programmed in STA versus monitor mode. Eg, there may not be a BSS Mask programmed in for monitor mode, or it's programmed to something like "all bits." -adrian On Sat, 4 Aug 2018 at 15:32, Farhan Khan wrote: > Hi all, > > Is there anything in net80211(4)'s initialization that is different > between STA and monitor mode, specially around Rx? > > Short explanation: My extension to rtwn(4)'s monitor mode works, I can > see arbitrary frames with tcpdump, but STA mode does not receive > anything except the probe requests it sends out itself. Every 30 > seconds in STA mode I get this: "rtwn0: device timeout" and the device > re-initializes. > > I suspect this is due to it not receiving any frames. What might be > initializing differently depending on if its STA or Monitor mode? If I > can find where that is, I might be able to make an adjustment. I do > not see anything that stands out in rtwn(4)'s init sequence, but I'll > give it another look. Is there anything in net80211(4) that happens > different based on the mode of the vap? > > Verbose explanation: As Adrian suggested on IRC, I went through > rtwn_scan_start and rtwn_scan_end. This matched the Linux code. All > these lines did, however, was adjust the Rx filter to receive > beacons/probes from any BSSID, then uses ieee80211's probe functions > to send out probe requests for whatever the VAP's ssid is set to. > > Running "tcpdump -ni wlan0 -y IEEE802_11_RADIO" **only** shows probes > from what the device is sending and dtrace probes do not show the > net80211(4) functions you would expect to happen to classify the > frame. On a separate device, I monitored for frames and saw the Probe > requests and responses to and from a test AP I setup, followed by an > empty probe requests, which is exactly what > ieee80211_swscan_probe_curchan() does. So Tx works. Great! > > rtwn(4) performs filter initialization in rtwn_rxfilter_init(). I > checked that code to see if anything was being filtered that should > not and nothing stood out to me. I unfiltered everything using > rtwn_write_2(sc, R92C-RXFLTMAP0/1/2, 0xffff), and #IFDEF 0'd out the > entire function. Same result. I should also note that > rtwn_rxfilter_init() is used by every rtwn(4) device and is probably > standard for this Realtek series. > > This suggests to me that somewhere during the initialization STA > fails. Again, I will look through rtwn(4)'s init sequence, but is > there anything in ieee80211(4) that might be different depending on if > its in monitor mode or STA mode? > > And if you don't know, can you kindly guide me to what net80211(4) > function first discriminates between the device mode? > > Thank you and I apologize for the long email. > > -- > Farhan Khan > PGP Fingerprint: B28D 2726 E2BC A97E 3854 5ABE 9A9F 00BC D525 16EE > _______________________________________________ > freebsd-wireless@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-wireless > To unsubscribe, send any mail to "freebsd-wireless-unsubscribe@freebsd.org > " >