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
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
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'.
* 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
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.
Inserted the ExecStop directive to kill the hostapd process in order for the script to be able to receive the SIGINT signal. This enables the cleaning process to work when requesting the service to stop.