Creating an access point with wpa_supplicant via dbus interface

Jouni Malinen j
Thu Apr 23 14:46:04 PDT 2015


On Thu, Apr 23, 2015 at 01:57:58PM -0700, Marlon Smith wrote:
> I need a way for the user to be able to configure the system as an
> access point as well.  I've tried setting mode=2 and frequency=2412 but
> with no luck.  I'm thinking I might have to instead use hostapd, but
> that becomes a pain because hostapd kills wpa_supplicant when it starts
> and has no dbus interfaces that I can find.
> 
> What I'd really like to know is:  is there anyway to use wpa_supplicant
> via the dbus interface to configure it as an access point?  If not, are
> there any undocumented dbus interfaces that can control hostapd?

Works fine for me with wpa_supplicant.. For example with this as an
extension to tests/hwsim/test_dbus.py:

def test_dbus_ap_simple(dev, apdev):
    """D-Bus AddNetwork for AP mode (simple)"""
    (bus,wpas_obj,path,if_obj) = prepare_dbus(dev[0])
    iface = dbus.Interface(if_obj, WPAS_DBUS_IFACE)

    ssid = "test-wpa2-psk"
    passphrase = 'qwertyuiop'
    args = dbus.Dictionary({ 'ssid': ssid,
                             'key_mgmt': 'WPA-PSK',
                             'psk': passphrase,
                             'mode': 2,
                             'frequency': 2412 },
                           signature='sv')
    netw = iface.AddNetwork(args)
    iface.SelectNetwork(netw)

    dev[1].connect(ssid, psk=passphrase, scan_freq="2412")

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list