create_ap

create a nat-ed wifi ap
git clone git://git.2f30.org/create_ap.git
Log | Files | Refs | LICENSE

commit c6eea2102020a426e589125e5a50e41978924cf5
parent c04f7f0bd8b22ea0b9662c4c71f74672003b0923
Author: oblique <psyberbits@gmail.com>
Date:   Thu Aug 28 21:28:36 +0300

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'.

Diffstat:
create_ap | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/create_ap b/create_ap @@ -488,7 +488,7 @@ if [[ $NO_VIRT -eq 0 ]]; then die "$VIRTDIEMSG" fi OLD_MACADDR=$(get_macaddr ${VWIFI_IFACE}) - NEW_MACADDR=$(get_new_macaddr ${VWIFI_IFACE}) + [[ ${OLD_MACADDR} == $(get_macaddr ${WIFI_IFACE}) ]] && NEW_MACADDR=$(get_new_macaddr ${VWIFI_IFACE}) WIFI_IFACE=${VWIFI_IFACE} else [[ "$WIFI_IFACE" == "$INTERNET_IFACE" ]] && die "You can not share your connection from the same interface if you are using --no-virt option." @@ -553,7 +553,7 @@ EOF fi # initialize WiFi interface -if [[ $NO_VIRT -eq 0 ]]; then +if [[ $NO_VIRT -eq 0 && -n "$NEW_MACADDR" ]]; then ip link set dev ${WIFI_IFACE} address ${NEW_MACADDR} || die "$VIRTDIEMSG" fi ip link set down dev ${WIFI_IFACE} || die "$VIRTDIEMSG"