New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 688469 link

Starred by 3 users

Issue metadata

Status: Archived
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

crosh 'packet_capture' doesn't work for OTA monitoring

Project Member Reported by briannorris@chromium.org, Feb 3 2017

Issue description

crosh's 'packet_capture' command allegedly works for OTA monitor mode captures, but it fails like this:

crosh> packet_capture --frequency 5745
Shutting down interface wlan0 so we can perform
monitoring.  You may need to disable, then re-enable WiFi to
use this interface again normally again.
command failed: Device or resource busy (-16)
Shutting down interface wlan0 so we can perform
monitoring.  You may need to disable, then re-enable WiFi to
use this interface again normally again.
command failed: Device or resource busy (-16)
Could not find a device to monitor 5745 MHz.  It is likely
that none of your wireless devices are capable of monitor-mode.


Looks like we're failing to enable the monitor-mode interface before trying to set the frequency:

  # iw dev phy0_mon set freq 5745
  command failed: Device or resource busy (-16)
 
Cc: snanda@chromium.org
Might I suggest changing the help verbiage for packet_capture in crosh as well?
Right now, packet_capture can be run as:
crosh> packet_capture --device wlan0
crosh> packet_capture --device wlan0 --frequency 2437

To a novice user, it is not at all clear that the first will maintain your current connection, and the capture you get is not monitor mode, it is merely TCP/IP and friends. 
The second will tear down your connection, put it in monitor mode and do a proper 802.11 capture.

Monitor-mode support is device specific. Some drivers/firmware support it, while others do not.

IIRC, the only Wifi device that we have monitor mode working on is ath9k.
I'm testing it on iwl7000 w/ samus as we speak. Seems to work.
@1: Did you read the help description? (e.g., 'help packet_capture') This is mostly noted there, although I guess it doesn't describe each option in detail. But also, this is dev-mode only, so I'm not sure how user friendly it needs to be.

But you are free to improve the help description if you'd like.

Also, for the record:

https://chromium-review.googlesource.com/#/c/437584/ debugd: capture_utility: bring up monitor-mode interface before using
https://chromium-review.googlesource.com/#/c/437625/ debugd: add iw and ip dependencies
https://chromium-review.googlesource.com/#/c/437747/ debugd: capture_utility: stop using 'ifconfig'
https://chromium-review.googlesource.com/#/c/437748/ debugd: netif: stop referring to ifconfig

@3: Glad to hear it! Thanks.
Project Member

Comment 6 by bugdroid1@chromium.org, Feb 6 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/3f89c2039c468d88245abb2c46aeef83774c41ca

commit 3f89c2039c468d88245abb2c46aeef83774c41ca
Author: Brian Norris <briannorris@chromium.org>
Date: Mon Feb 06 22:50:33 2017

debugd: capture_utility: bring up monitor-mode interface before using

crosh> packet_capture --frequency 5745
Shutting down interface wlan0 so we can perform
monitoring.  You may need to disable, then re-enable WiFi to
use this interface again normally again.
command failed: Device or resource busy (-16)
Shutting down interface wlan0 so we can perform
monitoring.  You may need to disable, then re-enable WiFi to
use this interface again normally again.
command failed: Device or resource busy (-16)
Could not find a device to monitor 5745 MHz.  It is likely
that none of your wireless devices are capable of monitor-mode.

A trace of the shell script shows that it's this command that fails:

  # iw dev phy0_mon set freq 5745
  command failed: Device or resource busy (-16)

Apparently, we're not allowed to set the frequency on a disabled network
interface. If we simply bring it up (e.g., with 'ip link set XXX up')
before trying to use it, then everything works fine.

BUG= chromium:688469 
TEST=`packet_capture --frequency XXXX` in crosh;
     helpers/capture_utility_test.sh

Change-Id: I864ae1f820a259b408ad686fcab4b2432e048651
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/437584
Reviewed-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Kirtika Ruchandani <kirtika@chromium.org>

[modify] https://crrev.com/3f89c2039c468d88245abb2c46aeef83774c41ca/debugd/src/helpers/capture_utility_test.sh
[modify] https://crrev.com/3f89c2039c468d88245abb2c46aeef83774c41ca/debugd/src/helpers/capture_utility.sh

Project Member

Comment 7 by bugdroid1@chromium.org, Feb 7 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromiumos/platform2/+/1ec00f495d2ff6c2c3e2eb1c8e48165497482bc8

commit 1ec00f495d2ff6c2c3e2eb1c8e48165497482bc8
Author: Brian Norris <briannorris@chromium.org>
Date: Tue Feb 07 00:40:56 2017

debugd: capture_utility: stop using 'ifconfig'

It's been deprecated for practically forever. Let's do our part to kick
the habit, I guess?

BUG= chromium:688469 
TEST=helpers/capture_utility_test.sh

Change-Id: I9b87b4461f71f0a93aa5d4bb698dab49be1a0b4e
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/437747
Reviewed-by: Ben Chan <benchan@chromium.org>

[modify] https://crrev.com/1ec00f495d2ff6c2c3e2eb1c8e48165497482bc8/debugd/src/helpers/capture_utility_test.sh
[modify] https://crrev.com/1ec00f495d2ff6c2c3e2eb1c8e48165497482bc8/debugd/src/helpers/capture_utility.sh

Labels: M-58
Status: Fixed (was: Started)
Looks like it should work now (for some definition of work; it's still a little bit finicky if your Wifi is currently in used. But hey, it's a dev-mode feature).

Comment 9 by dchan@chromium.org, Jan 22 2018

Status: Archived (was: Fixed)

Sign in to add a comment