You are not logged in.

#26 2013-02-02 06:23:09

aatoma
Member
Registered: 2013-01-22
Posts: 29

Re: Hostapd and WPA2

You're right Leonid,

I do have wpa_supplicant running when I start hostapd (BTW who is starting it? I don't have NM, only static IP address configuration for wlan0) both 1.1 and 2.0.
If this is the problem, what should I do then: upgrade to wpa_supplicant 2.0 from testing? uninstall wpa_supplicant? will WPA work then?

Regards.
Antonio.

Offline

#27 2013-02-02 19:34:37

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Hostapd and WPA2

aatoma wrote:

You're right Leonid,

I do have wpa_supplicant running when I start hostapd (BTW who is starting it? I don't have NM, only static IP address configuration for wlan0) both 1.1 and 2.0.
If this is the problem, what should I do then: upgrade to wpa_supplicant 2.0 from testing? uninstall wpa_supplicant? will WPA work then?

Regards.
Antonio.

Good, it clears up things.

I don't know what starts wpa_supplicant on your system, but you can use pstree and assuming systemd, you can track wpa_supplicant's  cgroup as

cat /proc/<wpa_supplicant-PID>/cgroup

This should tell you which unit is to blame. For example, on my laptop:

$ ps ax| grep -m 1 wpa_suppl 
  387 ?        Ss     0:00 wpa_supplicant -B -P /run/wpa_supplicant_wlan0.pid -i wlan0 -D nl80211,wext -c/run/network/wpa.wlan0/wpa.conf -W
$ cat /proc/387/cgroup 
8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/system/net-auto-wireless.service
2:cpuset:/
1:name=systemd:/system/net-auto-wireless.service

You don't have to uninstall wpa_supplicant, just don't run it alongside hostapd. You see, wpa_supplicant is a client which talks to authenticator, while hostapd _is_ the authenticator. Hostapd's WPA functionality has nothing to do with wpa_supplicant being installed/run or not (although they share a lot of code). See http://hostap.epitest.fi/wpa_supplicant/devel/ for details.

There is only one case when you need wpa_supplicant on a server AP -- wireless client mode (http://wiki.openwrt.org/doc/howto/clientmode). Otherwise, I'd simply remove wpa_supplicant alltogether.

HTH...

Last edited by Leonid.I (2013-02-02 19:36:23)


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#28 2013-02-03 08:57:13

aatoma
Member
Registered: 2013-01-22
Posts: 29

Re: Hostapd and WPA2

OK,

now things are offically getting confused hmm
It turns out that in my case wpa_supplicant is started by netcfg

8:blkio:/
7:net_cls:/
6:freezer:/
5:devices:/
4:memory:/
3:cpuacct,cpu:/system/netcfg@.service/wlan0
2:cpuset:/
1:name=systemd:/system/netcfg@.service/wlan0

which I use to set the static IP address of the AP with the following profile

CONNECTION='wireless'
DESCRIPTION='Wireless connection using a static IP for hostap'
INTERFACE='wlan0'
IP='static' # Any other CONNECTION='ethernet' options may be used.
ADDR='192.168.2.1'
NETMASK='255.255.255.0'
SKIPNOCARRIER='yes'

and it seems that this is 'by design' (https://bbs.archlinux.org/viewtopic.php?id=150405).
So, if I try to get rid of wpa_supplicant, I don't have my static IP address anymore.
How can I set the address on wlan0 without starting wpa_supplicant?

Regards.
Antonio.

Offline

#29 2013-02-03 09:42:10

cleanrock
Member
Registered: 2008-11-17
Posts: 109

Re: Hostapd and WPA2

aatoma,
I have my wlan0 setup for hostapd very similar to yours, only difference is i have CONNECTION='ethernet' and i dont have wpa_supplicant running.

I have not dared to update my server yet because of this thread though, so it would be interesting to hear if CONNECTION='ethernet' helps you.

Offline

#30 2013-02-04 05:31:45

aatoma
Member
Registered: 2013-01-22
Posts: 29

Re: Hostapd and WPA2

Correct, cleanrock,

marking the connection as 'ethernet' causes netcfg to add the address without attempting any wireless related work.
This way I'm able to run hostapd 2.0. Here we go!
I don't know if this trick should be tracked somewhere in the wiki or if netcfg should be fixd somehow, but is good to have the information in this thread.
Thank you all for the help.
@Nekroman: did you fix your problem? should this thread be marked as solved?

Regards.
Antonio.

Offline

#31 2013-02-04 17:06:55

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: Hostapd and WPA2

aatoma wrote:

I don't know if this trick should be tracked somewhere in the wiki or if netcfg should be fixd somehow, but is good to have the information in this thread.
.

If you only need to set a static IP on wlan0, why can't you just use a simple script with 3 lines, like

ip link set dev wlan0 up
ip addr add 10.0.0.1/24 brd + dev wlan0
ip route add default via 10.0.0.255 dev wlan0

and similarly for bringing the interface down. Call it from a systemd service, and remove netcfg...


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#32 2013-02-06 09:20:20

skink
Member
Registered: 2013-01-28
Posts: 3

Re: Hostapd and WPA2

For me changing CONNECTION to ethernet doesn't work. So I use workaround with removed wpa_supplicant package and custom service to set ip address on wlan interface:
[Unit]
Description=Add static ip for wireless
Before=hostapd.service
After=network.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/ip addr add x.x.x.x/x dev wlan0

[Install]
WantedBy=multi-user.target

Offline

Board footer

Powered by FluxBB