It is a long time since I last "repeated" a radio using my laptop as I typically use a OpenWRT small device, so... I had to look it all up again, hey, we are on the nl80211 days.
So... I tried to look this up starting from one of my working setups, a OpenWRT device, and what did I find there? I found they are using a patched wpa_supplicant which says:
-H = connect to a hostapd instance to manage state changes
However this patch doesn't seem to have reached upstream, so... is it needed? Well I don't think it is, at least one can make a setup which works without it. BTW, if somebody can clarify on this option and why it hasn't reached upstream it would be great.
Well, here is my setup which seems to work OK on my Debian Jessie.
I'll be using hostapd and dnsmasq, what I do is disable them so that they are not started on boot and I start them whenever I need them (use update-rc.d for this or any other method you like).
I have defined an interface (ap0) which is not automatic or hotplug and which I ifup manually when I want to repeat a wifi:
iface ap0 inet static
hwaddress XX:XX:XX:XX:XX:XX
address XX.XX.XX.XX
netmask 255.255.255.0
pre-up iw phy phy0 interface add ap0 type __ap || true
up cp /etc/hostapd/hostapd.conf.nochannel /etc/hostapd/hostapd.conf
up iw dev ath0 info|sed -n "s/.*channel \([^ ]*\) .*/channel=\1/p" >> /etc/hostapd/hostapd.conf
up /etc/init.d/hostapd start
up /etc/init.d/dnsmasq start
up iptables-restore /etc/iptables.masq
up echo 1 > /proc/sys/net/ipv4/conf/ap0/forwarding;echo 1 > /proc/sys/net/ipv4/conf/ath0/forwarding
down echo 0 > /proc/sys/net/ipv4/conf/ap0/forwarding;echo 0 > /proc/sys/net/ipv4/conf/ath0/forwarding
down /etc/init.d/dnsmasq stop
down /etc/init.d/hostapd stop
post-down iw dev ap0 del || true
On the interfaces file what I do is: I create the new AP interface, set up a hostapd.conf file adding the current channel for my client interface (ath0), start hostapd and dnsmasq and set up masquerading and forwarding.
The /etc/hostapd/hostapd.conf.nochannel file is a simple config file, something like this works:
interface=ap0
ctrl_interface=/run/hostapd-phy0
driver=nl80211
ssid=Whatever
hw_mode=g
wpa=2
wpa_pairwise=CCMP
wpa_passphrase=BlaBlaBla
country_code=ES
ignore_broadcast_ssid=0
And of course you can add all the parameters you want, for example, for my 802.11N radio I use:
wmm_enabled=1
ieee80211n=1
ht_capab=[HT40+][SHORT-GI-40][DSSS_CCK-40]
I won't get to dnsmasq details, I don't use it much, but I think I should know it better, I only added this couple of lines to the default config:
interface=ap0
dhcp-range=StartingIP,EndingIP,12h
Well, I guess that pretty much is it, as for the iptables rules... you know, allow forwarding from your AP to your client wifi and add a POSTROUTING with -j MASQUERADE to traffic going out and that's it.
Hope you find this usefull, and if you want to enlighten the -H parameter history feel free to comment.
What I think after reading the commit (https://dev.openwrt.org/browser/trunk/package/network/services/hostapd/patches/453-ap_sta_support.patch?rev=37738) is that they are having wpa_supplicant reload any time the client reconnects or whatever, but this can also be done on wpa_cli, so that must be why it hasn't reached upstream (but that's just what I'm guessing, any light out there?).
It feels nice to write after such a long time :-) Regards.