maverick icon indicating copy to clipboard operation
maverick copied to clipboard

Network: Add wifi hybrid mode

Open fnoop opened this issue 7 years ago • 15 comments

Add a filesystem/SD file flag to boot the system into AP mode. This is useful if normal wifi or network configuration fails for any reason, and particularly useful in the field.

fnoop avatar May 01 '18 09:05 fnoop

Add a simultaneous managed/AP option, set by default on raspberry

fnoop avatar May 30 '18 10:05 fnoop

Good guide for the raspberry https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/

fnoop avatar May 30 '18 11:05 fnoop

Current wireless modes are managed, monitor and ap. Add a hybrid mode which simultaneously provides managed and ap, and set it by default on sample-nodes (download images) where possible.

fnoop avatar May 31 '18 17:05 fnoop

Using the raspberry guides involves using udev rules and mac addresses. This is not feasible for distributed images as the mac address is unknown on user systems. Move the config up the stack.

fnoop avatar May 31 '18 20:05 fnoop

iw phy phy0 interface add wlanap0 type __ap This produces a 'rename3' interface: 3: rename3: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000

fnoop avatar May 31 '18 20:05 fnoop

Can use canonical interface name instead of physical: sudo iw dev wlan0 interface add test1 type __ap

The interface then gets renamed immediately: May 31 21:40:15 maverick-up kernel: [14008.805210] brcmfmac mmc1:0001:1 rename6: renamed from test1

fnoop avatar May 31 '18 20:05 fnoop

Refs: https://superuser.com/questions/1272705/wifi-single-radio-acting-as-ap-and-ap-client-simultaneously?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa http://www.0xf8.org/2016/02/using-your-raspberry-pi-zeros-usb-wifi-adapter-as-both-wifi-client-and-access-point/

fnoop avatar Jun 07 '18 23:06 fnoop

iw list shows combinations available for an interface (eg. for rpi3):

valid interface combinations:
		 * #{ managed } <= 1, #{ P2P-device } <= 1, #{ P2P-client, P2P-GO } <= 1,
		   total <= 3, #channels <= 2
		 * #{ managed } <= 1, #{ AP } <= 1, #{ P2P-client } <= 1, #{ P2P-device } <= 1,
		   total <= 4, #channels <= 1

Need to programatically obtain this list in a python structure so we can expose in -api and start to make decisions and present to the user. Parsing iwlist output is not ideal, try and find better underlying source of data.

fnoop avatar May 18 '19 08:05 fnoop

Control with python. Need to figure out:

  • How to determine which interfaces are capable of what combinations
  • How to add virtual interfaces
  • How to add virtuals in correct order for useable hybrid mode

fnoop avatar May 20 '19 08:05 fnoop

Wireless tools provide iwconfig, iwlist etc. Different packages:

  • iw (eventual replacement for wireless-tools)
  • wireless-tools (iwlist, iwconfig)
  • libiw30 (underlying wireless tools library)
  • libiw-dev (dev tools for wireless-tools)

Python:

  • iwlib

fnoop avatar May 20 '19 08:05 fnoop

python iwlib doesn't provide anything about combinations. Need to look at the source code for iwlist, and then code it into a new python library. https://github.com/nathan-hoad/python-iwlib/blob/master/iwlib/_iwlib_build.py As a quick hack to start with, we can just parse iwlist

fnoop avatar May 20 '19 09:05 fnoop

PyRIC contains the mechanisms necessary to extract combinations without any other 3rdparty support, but not the code to do so yet. It's probably the best way long term.

fnoop avatar May 20 '19 15:05 fnoop

Add 'iw' package to support parsing 'iw list'.

fnoop avatar May 20 '19 16:05 fnoop

Near impossible to parse iw output, notwithstanding warning from iw: Do NOT screenscrape this tool, we don't consider its output stable.

Instead, use netlink/pyric to extract the combinations in a proper python structure: https://github.com/wraith-wireless/PyRIC/issues/48

fnoop avatar May 22 '19 10:05 fnoop

Can't get it to work with rpi3. Have to start with managed interface first, then add an AP. Interfaces are created, but don't seem to be useable although the AP shows up in other devices. https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=138730&sid=af012818635ca579a0b0c609ad61e31b&start=150

fnoop avatar May 24 '19 08:05 fnoop