Commit Graph

153 Commits

Author SHA1 Message Date
oblique
9d7806882a Minor change in an output message 2014-10-01 12:11:24 +03:00
oblique
3db732ed50 Get the current channel with 'iw dev wlanN link'
With older versions of iw we can not get the channel that we
are currently associated with. So we cannot detect if we have
to fallback to that channel. Because of this, hostapd exits
with the following errors:

    Failed to set beacon parameters
    Interface initialization failed
    ap0: interface state UNINITIALIZED->DISABLED
    ap0: AP-DISABLED
    ap0: Unable to setup interface.
    hostapd_free_hapd_data: Interface ap0 wasn't started

A solution is to get the frequency from 'iw dev wlanN link' and
convert it to the channel number.

Fix #50
2014-10-01 12:04:57 +03:00
oblique
bec1513a07 Make sure that all command outputs are in english, so we can parse them correctly
Fix #49
2014-09-25 08:12:21 +03:00
oblique
ec0df440f8 Add 'managed' virtual interface instead of '__ap', hostapd will change it anyway 2014-09-21 18:28:41 +03:00
oblique
2dcc407000 Show error if udev renamed the interface 2014-09-21 17:57:07 +03:00
oblique
ed78f36f41 Revert 488f84e since f589df0 provides a better solution 2014-09-20 23:45:10 +03:00
oblique
1eb11077d3 Change the mac address of the virtual interface if another interface has the same 2014-09-20 23:18:28 +03:00
oblique
3632f29912 rename can_have(_sta_and)_ap to can_be(_sta_and)_ap 2014-09-20 23:18:28 +03:00
oblique
408e25b732 do not limit bridge interfaces to 100 2014-09-20 23:13:41 +03:00
oblique
757c3d2c1f Use /sys/class/net to get the interfaces and mac addresses 2014-09-20 23:13:41 +03:00
oblique
5b2d7984db get_new_macaddr: add 1 to the mac address instead of starting from 0x14
If someone have 2 adapters with the same hardware, there is a possibility
the first 5 bytes of their mac address to be the same.
I this case we will have mac address collision if we change both of them to
XX:XX:XX:XX:XX:14, one way to avoid this is to add 1 to their last byte.

Fix #47
2014-09-18 20:54:37 +03:00
oblique
ddd6bfad45 Merge pull request #48 from blucell/patch-1 2014-09-18 05:50:46 +00:00
Ahmed Mokhtar
04c5695c8e Update create_ap 2014-09-18 01:54:27 +03:00
Ahmed Mokhtar
f589df0565 Using virtual interface names "ap*" 2014-09-17 16:52:37 +03:00
Ahmed Mokhtar
4516520cf2 Fix virtual drive auto-renaming
In some Linux distributions (e.g. Ubuntu, Debian), udev automatically renames any device with its name prefix is "eth*", "wlan*",... as declared in "/lib/udev/rules.d/75-persistent-net-generator.rules". This made a problem when creating a virtual device on these distributions declaring that device not found. Solution was to change virtual device's name prefix to "ap*" to avoid this collision.
2014-09-17 04:15:34 +03:00
oblique
488f84e14f rename virt. interface if it was renamed by udev at creation
fix #16
2014-09-10 23:12:33 +03:00
oblique
034545483c fix bug: networkmanager_rm_unmanaged_if_needed was ignoring 2nd argument 2014-09-10 23:03:04 +03:00
oblique
6c56e81148 Specify listen-address in dnsmasq instead of listen-interface
Ubuntu has a bit different setup than other distributions and because
of this dnsmasq was failing to retrieve the results of a DNS lookup.
This can be fixed if we specify that the listen-address is the gateway
instead of binding all the addresses of the WIFI_IFACE.

Fix #46
2014-09-09 23:19:16 +03:00
oblique
5ff7503e01 check the length of passphrase and SSID at the beginning 2014-09-07 03:30:41 +03:00
oblique
f66819c145 Check if the user passed a valid interface 2014-09-06 21:49:52 +03:00
oblique
3fe8513d9a Handle the case where `unmanaged-devices=' is empty
Fix #45
2014-09-06 20:33:33 +03:00
oblique
93d479c1eb Fix some messages 2014-09-06 19:26:10 +03:00
oblique
81d861cb46 Reimplementation of 6a3e1d98 commit
With the 6a3e1d98 commit NetworkManager was throwing an assertion so
we take a different approach when we create the bridge interface.
Also if the <interface-with-internet> is already a bridge interface
we skip creation.

The new approach is:

   1) Save the IPs and route table of INTERNET_IFACE
   2) If NetworkManager is running set INTERNET_IFACE as unmanaged
   3) Create BRIDGE_IFACE and add INTERNET_IFACE to it
   4) Set the previously saved IPs and route table to BRIDGE_IFACE

Better fix #19
2014-09-05 02:13:59 +03:00
oblique
14ec50f379 Update Gentoo instructions 2014-09-04 11:03:22 +03:00
oblique
6a3e1d98ab Initialize correctly the bridge interface
To initialize the bridge interface correctly we need to do the following:

   1) duplicate the IPs of INTERNET_IFACE to BRIDGE_IFACE
   2) duplicate routing table of INTERNET_IFACE to BRIDGE_IFACE
   3) delete routing table of INTERNET_IFACE

   NOTE: we don't need to delete the IPs of INTERNET_IFACE

We need the above because BRIDGE_IFACE is the master interface from now on
and it must know where is connected, otherwise connection is lost.

Fix #19
2014-09-04 01:56:09 +03:00
oblique
0ba638f780 Detect if the adapter can be an AP and AP+STA
Fix #9
2014-09-02 23:05:46 +03:00
oblique
718ea69e46 Do not call networkmanager_add_unmanaged if NetworkManager is not running 2014-08-31 18:06:17 +03:00
oblique
25add14aa0 Refactor networkmanager_{add/rm}_unmanaged 2014-08-31 17:40:17 +03:00
oblique
367dd2f939 Use 'interface-name:' to set an interface as unmanaged in NetworkManager.
Form NetworkManager 0.9.10 and above they introduce 'interface-name:'
for 'unmanaged-devices', use this method instead of 'mac:' since it
reduce many problems.

Fix #33
2014-08-31 14:04:19 +03:00
oblique
142c1b76c8 Remove a trailing whitespace 2014-08-31 12:49:45 +03:00
oblique
c6eea21020 Change MAC address only if needed
Some virtual interfaces have a different MAC address from their real
interfaces and their drivers disallow us to change it. In this case
we don't need to change the MAC address anyway.

With this we can avoid errors like 'RTNETLINK answers: Invalid argument'.
2014-08-28 21:34:19 +03:00
oblique
c04f7f0bd8 Redirect iptables output to /dev/null on cleanup 2014-08-28 20:50:09 +03:00
oblique
503e715d4e update README.md 2014-08-28 20:46:52 +03:00
oblique
309b56f5fc Some drivers still use the old WiFi subsystem, use iwconfig/iwlist in these cases
Fixes #43
2014-08-28 20:20:25 +03:00
oblique
6252e6fd88 minor change 2014-08-28 09:01:00 +03:00
oblique
fd75f56635 Do not allow user to use `phyX' of the interface 2014-08-28 08:40:15 +03:00
oblique
3f49258758 Check at the beginning if WIFI_IFACE is a WiFi interface or not 2014-08-28 01:24:10 +03:00
oblique
64790ff5f2 Check in `iw phy phyX info' if we can transmit to the selected channel 2014-08-28 01:24:10 +03:00
oblique
258fbc1f94 increase the sleep of networkmanager_rm/add_unmanaged 2014-08-19 00:06:34 +03:00
oblique
701becace9 fix a typo 2014-08-17 04:43:35 +03:00
oblique
92b696efcf handle service's stop correctly 2014-08-17 04:22:23 +03:00
oblique
d388c593ab disable SIGINT in cleanup(), so the user will not be able to interrupt it 2014-08-17 02:16:12 +03:00
oblique
4758bcf6d9 Merge branch 'hashken-hostapd_bug' 2014-08-17 01:16:50 +03:00
Karthik
d9284c3d6b Check version of NetworkManager
* Check the version of Network Manager and accordingly issue commands
as nmcli >= 0.9.10 is not backwards compatible
* Also, check if NetworkManager is running before issuing related
suggestions
2014-08-17 01:14:24 +03:00
Karthik
0e9a81ff94 Give remedial suggestion for hostapd bug
Hostapd v2 introduces a bug which currently throws the following error
and initialization fails
    nl80211: Could not configure driver mode
    nl80211 driver initialization failed.
    hostapd_free_hapd_data: Interface wlp3s0ap wasn't started

More Info: https://bugs.launchpad.net/ubuntu/+source/wpa/+bug/1289047

Give a suggestive message to the user when hostapd fails because of the
above bug outlining the workaround mentioned in the above bug report.
2014-08-17 01:13:42 +03:00
oblique
9ab97af451 networkmanager_is_running: we don't need to redirect stderr in /dev/null 2014-08-17 01:10:50 +03:00
oblique
89a457d597 Add `version_cmp' function 2014-08-16 23:13:32 +03:00
oblique
38063a6160 systemd service: start create_ap after network.target 2014-08-16 18:31:29 +03:00
oblique
609949d26a make dnsmasq able to run even if another instance exist 2014-08-15 11:41:30 +03:00
oblique
e37caff43d README.md: Update installation section
Fixes #27
2014-08-04 15:17:43 +03:00