OpenBSD Journal

WiFi: 11n hostap mode added to athn(4) driver, testers wanted

Contributed by pitrh on from the Puffy off the wire dept.

OpenBSD as WiFi access points look set to be making a comeback in the near future.

With this diff https://marc.info/?l=openbsd-tech&m=148396652007923&w=2, Stefan Sperling added 802.11n hostap mode, with full support initially for the Atheros chips supported by the athn(4) driver.

This diff adds 11n support to the athn(4) driver.
Requires -current net80211 code from today.

Tested in hostap mode and client mode with:

athn0 at pci1 dev 0 function 0 "Atheros AR9281" rev 0x01: apic 2 int 16
athn0: AR9280 rev 2 (2T2R), ROM rev 22, adddress xx:xx:xx:xx:xx:xx
And in client mode with:

athn0 at uhub1 port 2 configuration 1 interface 0 "ATHEROS USB2.0 WLAN" rev 2.00/1.08 addr 2
athn0: AR9271 rev 1 (1T1R), ROM rev 13, address xx:xx:xx:xx:xx:xx

Hostap performance is not perfect yet but should be no worse than 11a/b/g modes in the same environment.

For Linux clients a fix for WME params is needed which I also posted to tech@.

This diff does not modify the known-broken and disabled ar9003 code, apart from making sure it still builds.

I'm looking for both tests and OKs.

You heard the man: Testers wanted. You know you want your APs to run OpenBSD, sooner rather than later.

(Comments are closed)


Comments
  1. By Stefan Sperling (stsp) stsp@openbsd.org on http://stsp.name

    Please don't test the first diff I posted.
    There is an updated diff which marc.info hasn't archived yet.
    Here's an alternative link: https://www.mail-archive.com/tech@openbsd.org/msg36647.html

    Also make sure to get all recent net80211 code commits from -current.

    Comments
  2. By Stefan Sperling (stsp) stsp@openbsd.org on http://stsp.name

    Since this post is still being quoted by some other sites as news,
    please note that by now, all the diff are part of -current snapshots.
    So do not mess around with the diffs anymore at this point.
    Just install the latest snapshot.

    Also, the /etc/hostname.athn0 config file currently must specify
    'mode 11n' and set a channel, else there might be known issues.
    A config based on this example should work:

    media autoselect mode 11n mediaopt hostap chan 1
    nwid foo wpakey xxxxxxxx
    inet 192.168.1.1 255.255.255.0

    Comments
    1. By johncharbs (47.16.142.214) on

      TP-link model TL-WN722N USB wireless adapter
      works as a access point in hostap mode

      /etc/hostname.athn0
      media autoselect mode 11n mediaopt hostap chan 1
      nwid openbsdwifi wpakey mypasswd123456789
      inet 10.0.3.1 255.255.255.0

      for
      /etc/pf.conf
      (used example from www.bsdguides.org)

      wired = "em0"
      wireless = "athn0"

      icmp_types = "{echoreq, unreach}"

      set block-policy return
      set loginterface $wireless
      set skip on lo0

      # some packet scrubbing
      match in all scrub (no-df max-mss 1440)

      # NAT for wireless clients
      match out on egress inet from ! (egress:network) \
      to any nat-to (egress:0)

      # block everything by default
      block in all

      # Let traffic out
      pass out quick

      # Let traffic in

      # allowing 'gre' is usefull to allow PPTP traffic
      pass in quick inet proto { tcp udp gre } from any to any
      pass in quick inet proto icmp all icmp-type $icmp_types keep state

      created file
      /etc/sysctl.conf
      net.inet.ip.forwarding=1

      ifconfig athn0

      athn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
      lladdr 18:a6:f7:17:a9:c6
      index 4 priority 4 llprio 3
      groups: wlan
      media: IEEE802.11 autoselect (autoselect mode 11n hostap)
      status: active
      ieee80211: nwid openbsdwifi chan 1 bssid 18:a6:f7:17:a9:c6 wpakey 0x626f8252065399330e5876cba523bcfcfb8fd046ac5e3eff39331c36d693a7fc wpaprotos wpa2 wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
      inet 10.0.3.1 netmask 0xffffff00 broadcast 10.0.3.255


      The computer used for this setup is a Compulab Minibox Mini running OpenBSD 6.0 current, to test the access point I used a netbook running a liveusb image of GhostBSD.
      used the wifi icon to select network and entered password, then opened a terminal and set a static inet address
      # ifconfig wlan0 inet 10.0.3.2
      then set default route
      #route add default 10.0.3.1
      then added to /etc/resolv.conf
      nameserver 8.8.8.8

      and thats it
      can ping an outside network in the terminal, and use browser to search the web

      one problem I did note in the beginning was that the athn0 firmware was failing to load when the computer was booted up with the usb adapter plugged in, but later booted without and if plugged in after boot,the firmware loaded fine. after creating the hostname.athn0 file, I never had a problem again with the firmware loading

      Comments
      1. By johncharbs (47.16.142.214) on

        note for the previous comment/setup

        not to have to use a static IP address, configure default route, and name server I created the file
        /etc/dhcpd.conf


        #dhcpd.conf for wireless access point

        default-lease-time 600;
        max-lease-time 7200;

        subnet 10.0.3.0 netmask 255.255.255.0 {
        range 10.0.3.100 10.0.3.150;
        option routers 10.0.3.1;
        option domain-name-servers 192.168.1.1;
        option domain-name "home";
        }

        # note I used 192.168.1.1 beacuse thats my main router
        # 8.8.8.8 , 8.8.4.4 Google public DNS could be used instead

        then to have dhcpd on athn0 automatically start at boot I created file
        /etc/rc.conf.local
        dhcpd_flags=athn0

        rebooted and it works.
        hope this helps someone else, that may be working on a similar setup
        thanks for the work put into the driver

    2. By Bob (64.228.35.179) on

      Does AR9271 work as a client yet?

      http://marc.info/?l=openbsd-bugs&m=137001370631666&w=2

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]