# Can't get working hostapd with madwifi-ng :(

## ConiKost

Hello!

I got here an miniPCI Atheros WLAN Card. I want to setup an WLAN AP!

I got managed it working without encryption. This works fine! But now, i need WPA.

So I installed hostapd 0.5.7 ... but i can't get it working. only getting this error:

```
Configuration file: /etc/hostapd/hostapd.conf

ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument

Could not connect to kernel driver.

Mode: IEEE 802.11g  Channel: 60  Frequency: 0 MHz

Using interface ath0 with hwaddr 00:14:85:d7:12:40 and ssid 'BlackBox.WLAN'

l2_packet_receive - recvfrom: Network is down
```

Debug:

```
BlackBox hostapd # hostapd -dd /etc/hostapd/hostapd.conf

Configuration file: /etc/hostapd/hostapd.conf

ctrl_interface_group=0

madwifi_set_iface_flags: dev_up=0

madwifi_set_privacy: enabled=0

BSS count 1, BSSID mask ff:ff:ff:ff:ff:ff (0 bits)

SIOCGIWRANGE: WE(compiled)=21 WE(source)=13 enc_capa=0xf

ath0: IEEE 802.11 Fetching hardware channel/rate support not supported.

Flushing old station entries

madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3

ioctl[IEEE80211_IOCTL_SETMLME]: Invalid argument

madwifi_sta_deauth: Failed to deauth STA (addr ff:ff:ff:ff:ff:ff reason 3)

Could not connect to kernel driver.

Deauthenticate all stations

Mode: IEEE 802.11g  Channel: 6  Frequency: 0 MHz

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=0

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=1

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=2

madwifi_del_key: addr=00:00:00:00:00:00 key_idx=3

Using interface ath0 with hwaddr 00:14:85:d7:12:40 and ssid 'BlackBox.WLAN'

SSID - hexdump_ascii(len=13):

     42 6c 61 63 6b 42 6f 78 2e 57 4c 41 4e            BlackBox.WLAN

PSK (ASCII passphrase) - hexdump_ascii(len=17):

     73 65 63 72 65 74 20 70 61 73 73 70 68 72 61 73   secret passphras

     65                                                e

PSK (from passphrase) - hexdump(len=32): 73 e3 fe 91 c5 01 12 a2 63 eb df 7b bc 34 b1 83 a8 f4 0a a1 9a cd eb 45 23 38 a9 de 39 e9 10 f5

madwifi_set_ieee8021x: enabled=1

madwifi_configure_wpa: group key cipher=1

madwifi_configure_wpa: pairwise key ciphers=0xa

madwifi_configure_wpa: key management algorithms=0x3

madwifi_configure_wpa: rsn capabilities=0x0

madwifi_configure_wpa: enable WPA=0x1

madwifi_set_privacy: enabled=0

WPA: group state machine entering state GTK_INIT (VLAN-ID 0)

GMK - hexdump(len=32): [REMOVED]

GTK - hexdump(len=32): [REMOVED]

WPA: group state machine entering state SETKEYSDONE (VLAN-ID 0)

madwifi_set_key: alg=TKIP addr=00:00:00:00:00:00 key_idx=1

madwifi_set_privacy: enabled=1

madwifi_set_iface_flags: dev_up=1

ath0: Setup of interface done.

l2_packet_receive - recvfrom: Network is down

Wireless event: cmd=0x8b1a len=22

Signal 2 received - terminating

Flushing old station entries

madwifi_sta_deauth: addr=ff:ff:ff:ff:ff:ff reason_code=3

Deauthenticate all stations

madwifi_set_privacy: enabled=0

madwifi_set_ieee8021x: enabled=0

madwifi_set_iface_flags: dev_up=0

```

```
http://www.bl4ckb0x.de/hostapd.conf
```

It madwifi-ng 0.9.2.1 not compatible with hostapd?

----------

## didymos

hostapd-0.5.7? Have you tried using one of the versions currently in portage?

----------

## didymos

Oh, yeah, if you're using /etc/hostapd/hostapd.wpa_psk, then you don't want to set the passphrase, and you can set wpa_key_mgmt=WPA-PSK.  No need for WPA-EAP.

----------

## ConiKost

Hi!

The Portage Version is not working!

0.5.7 is from bgo!

Do you need the error output here? 

I changed the config, as you said, but it not helped!

----------

## didymos

Sure, what's the error message?

----------

## ConiKost

 *didymos wrote:*   

> Sure, what's the error message?

 

The Testing 0.5.4 (which is in Portage) give exact the same error!

Stable 0.4.9 (Portage) is not working. does not find ath0 and can't use madwifi ... (as far i read, its not compatible with madwifi-ng)

----------

## mbar

why not use wpa_supplicant?

----------

## didymos

Because he wants to be an access point, not a supplicant. Hostapd is what wpa_supplicant talks to.

----------

## didymos

Ok, this is ironic: there is a madwifi trouble ticket about the exact same error, except it only occurred when encryption was off.  Of course, that's the only thing that actually works on your system.  Not that it'll be any help, but here's the URL:

http://madwifi.org/ticket/552

----------

## didymos

I keep thinking of things after I post.  If your hardware supports WPA2, try these settings in hostapd.conf:

```

wpa=2

#wpa_psk=

#wpa_passphrase=

wpa_psk_file=/etc/hostapd/hostapd.wpa_psk

wpa_key_mgmt=WPA-PSK

wpa_pairwise=CCMP

```

----------

## didymos

See, it happened again.  Try setting auth_algs=0 and post the output of iwconfig for the ath0 interface.

----------

## mbar

 *didymos wrote:*   

> Because he wants to be an access point, not a supplicant.

 

doh, I did my home AP using only madwifi-ng (in master mode) + wpa_supplicant.

EDIT: and I use wpa_supplicant only on client computer  :Smile: 

----------

## ConiKost

 *mbar wrote:*   

>  *didymos wrote:*   Because he wants to be an access point, not a supplicant. 
> 
> doh, I did my home AP using only madwifi-ng (in master mode) + wpa_supplicant.
> 
> EDIT: and I use wpa_supplicant only on client computer 

 

Yes! For setup an AP without Encryption, I do NOT used hostapd!

@didymos

With WPA2, i get the same error!

I also created an ticket @ madwifi: http://madwifi.org/ticket/1088#preview

When I use auth_algs=0 i get this:

```
BlackBox hostapd # hostapd hostapd.conf

Configuration file: hostapd.conf

Line 181: no authentication algorithms allowed

1 errors found in configuration file 'hostapd.conf'
```

----------

## didymos

Hmm, that's odd.  auth_algs=0 should just set it so it only uses Open Authentication.

mbar:  and what is running on the AP? WEP encryption, or no encryption?  If so, then you actually have no reason to use wpa_supplicant at all, on any machine.  However, if you want to do WPA/WPA2 encryption, you need hostapd on the AP.

----------

## mbar

I use WEP at home (on my Gentoo router), but I need wpa_supplicant on my laptop, because at work I have to use WPA encryption.

----------

## ConiKost

 *didymos wrote:*   

> Hmm, that's odd.  auth_algs=0 should just set it so it only uses Open Authentication.
> 
> mbar:  and what is running on the AP? WEP encryption, or no encryption?  If so, then you actually have no reason to use wpa_supplicant at all, on any machine.  However, if you want to do WPA/WPA2 encryption, you need hostapd on the AP.

 

And now? You got any Idea?

----------

## didymos

Sorry.  I just can't find anything of any use. Just to be complete, though,  what are the non-hostapd config settings you're using (i.e. /etc/conf.d/net) and who makes the adapter?

----------

## didymos

Ok, I found something buried in a madwifi bug report that might be useful: try hostapd-0.4.9.  I'm doubtful about this as a solution, but it's the only thing I could find.  Here's the bug if you're interested:

http://madwifi.org/ticket/539

----------

## ConiKost

 *didymos wrote:*   

> Sorry.  I just can't find anything of any use. Just to be complete, though,  what are the non-hostapd config settings you're using (i.e. /etc/conf.d/net) and who makes the adapter?

 

```

conikost@BlackBox ~ $ cat /etc/conf.d/net

# BlackBox - Net

# Realtek 8139D

config_eth0=( "192.168.0.254 netmask 255.255.255.0 brd 192.168.0.255" )

routes_eth0=( "default via 192.168.0.1" )

# Atheros AR5006XS WLAN

config_ath0=( "192.168.1.254/24" )

conikost@BlackBox ~ $ cat /etc/conf.d/wireless

# BlackBox - WLAN

mode_ath0="master"

essid_ath0="BlackBox.WLAN"

channel_ath0="6"

```

Tried hostapd 0.4.9, but this give another error:

```
BlackBox hostapd # hostapd hostapd.conf

Configuration file: hostapd.conf

Using interface ath0 with hwaddr 00:14:85:d7:12:40 and ssid 'BlackBox.WLAN'

Flushing old station entries

ioctl[unknown???]: Invalid argument

Could not connect to kernel driver.

Deauthenticate all stations

rmdir[ctrl_interface]: No such file or directory
```

----------

## didymos

Did you use the same hostapd.conf?  Probably some significant differences between 0.4.9 and 0.5.7.

----------

## ConiKost

 *didymos wrote:*   

> Did you use the same hostapd.conf?  Probably some significant differences between 0.4.9 and 0.5.7.

 

No, i used a fresh con 0.4.9!

----------

## didymos

Ok, skip hostapd for now and just load the driver.  What is the output of wlanconfig once that's done?

----------

## ConiKost

 *didymos wrote:*   

> Ok, skip hostapd for now and just load the driver.  What is the output of wlanconfig once that's done?

 

Here:

```

BlackBox / # modprobe ath_pci autocreate=ap

BlackBox / # /etc/init.d/net.ath0 start

 * Starting ath0

 *   Configuring wireless network for ath0

 *     ath0 configured as ESSID "BlackBox.WLAN"

 *     in master mode on channel 6 (WEP disabled)

 *   Bringing up ath0

 *     192.168.1.254/24                                                                  [ ok ]

BlackBox / # iwconfig

lo        no wireless extensions.

eth0      no wireless extensions.

wifi0     no wireless extensions.

ath0      IEEE 802.11g  ESSID:"BlackBox.WLAN"  Nickname:""

          Mode:Master  Frequency:2.437 GHz  Access Point: 00:14:85:D7:12:40

          Bit Rate:0 kb/s   Tx-Power:16 dBm   Sensitivity=0/3

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:off

          Link Quality=0/94  Signal level=-95 dBm  Noise level=-95 dBm

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

```

Sry, i won't run an WLAN AP with WEP or without any Encryption.

Problem is, WEP is to easy to crack  :Sad: 

----------

## didymos

Ok, I figured that's what'd it be, but I thought I just make sure the driver was doing what it was supposed to.  I don't know, man, I'm completely out of ideas at the moment.  This thing is annoying me, and it's not even my machine.  Work you bastard adapter.

----------

## ConiKost

May this be an error of the firmware on this wlan card ?!  :Sad: 

I need an AP ... very soon  :Sad: 

----------

## didymos

I don't know: who makes the adapter?

----------

## ConiKost

I got this Card:

Gigabyte GN-WI01HT Notebook Adapter, 108Mbps Dual Band, MiniPCI

http://geizhals.at/img/pix/200329.jpg

----------

## didymos

Well, apparently the firmware is upgradeable for this card. Unfortunately, according to Gigabyte new firmware is, to quote them, "Coming soon !!". So, that's a lot of help.

----------

## ConiKost

 *didymos wrote:*   

> Well, apparently the firmware is upgradeable for this card. Unfortunately, according to Gigabyte new firmware is, to quote them, "Coming soon !!". So, that's a lot of help.

 

Where do you read that?

----------

## didymos

http://www.gigabyte.com.tw/Support/Communication/Firmware_Model.aspx?ProductID=987

----------

## ConiKost

 *didymos wrote:*   

> http://www.gigabyte.com.tw/Support/Communication/Firmware_Model.aspx?ProductID=987

 

Ok, thx! But i guess there won't be ever any new Firmware  :Sad: 

What a mess -.- Anybody else an idea? *push*

----------

