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, 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)

  1. By Stefan Sperling (stsp) on

    Please don't test the first diff I posted.
    There is an updated diff which hasn't archived yet.
    Here's an alternative link:

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

  2. By Stefan Sperling (stsp) on

    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

    1. By johncharbs ( on

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

      media autoselect mode 11n mediaopt hostap chan 1
      nwid openbsdwifi wpakey mypasswd123456789

      (used example from

      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

      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 netmask 0xffffff00 broadcast

      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
      then set default route
      #route add default
      then added to /etc/resolv.conf

      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

      1. By johncharbs ( 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

        #dhcpd.conf for wireless access point

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

        subnet netmask {
        option routers;
        option domain-name-servers;
        option domain-name "home";

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

        then to have dhcpd on athn0 automatically start at boot I created file

        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 ( on

      Does AR9271 work as a client yet?


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 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.]