parent
034545483c
commit
488f84e14f
34
create_ap
34
create_ap
@ -102,7 +102,7 @@ is_bridge_interface() {
|
|||||||
|
|
||||||
get_phy_device() {
|
get_phy_device() {
|
||||||
for x in /sys/class/ieee80211/*; do
|
for x in /sys/class/ieee80211/*; do
|
||||||
[[ ! -d "$x" ]] && continue
|
[[ ! -e "$x" ]] && continue
|
||||||
if [[ "${x##*/}" = "$1" ]]; then
|
if [[ "${x##*/}" = "$1" ]]; then
|
||||||
echo $1
|
echo $1
|
||||||
return 0
|
return 0
|
||||||
@ -118,6 +118,23 @@ get_phy_device() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_virt_interfaces() {
|
||||||
|
PHY=$(get_phy_device "$1")
|
||||||
|
|
||||||
|
if [[ -e "/sys/class/ieee80211/${PHY}/device/net/" ]]; then
|
||||||
|
for x in /sys/class/ieee80211/${PHY}/device/net/*; do
|
||||||
|
[[ ! -e "$x" ]] && continue
|
||||||
|
echo ${x##*/}
|
||||||
|
done
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
for x in /sys/class/ieee80211/${PHY}/device/net:*; do
|
||||||
|
[[ ! -e "$x" ]] && continue
|
||||||
|
echo ${x##*:}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
get_adapter_info() {
|
get_adapter_info() {
|
||||||
PHY=$(get_phy_device "$1")
|
PHY=$(get_phy_device "$1")
|
||||||
[[ $? -ne 0 ]] && return 1
|
[[ $? -ne 0 ]] && return 1
|
||||||
@ -659,8 +676,23 @@ if [[ $NO_VIRT -eq 0 ]]; then
|
|||||||
VIRTDIEMSG="Maybe your WiFi adapter does not fully support virtual interfaces.
|
VIRTDIEMSG="Maybe your WiFi adapter does not fully support virtual interfaces.
|
||||||
Try again with --no-virt."
|
Try again with --no-virt."
|
||||||
echo -n "Creating a virtual WiFi interface... "
|
echo -n "Creating a virtual WiFi interface... "
|
||||||
|
|
||||||
iw dev ${VWIFI_IFACE} del > /dev/null 2>&1
|
iw dev ${VWIFI_IFACE} del > /dev/null 2>&1
|
||||||
|
VIRT_IFACES=" $(get_virt_interfaces ${WIFI_IFACE}) "
|
||||||
if iw dev ${WIFI_IFACE} interface add ${VWIFI_IFACE} type __ap; then
|
if iw dev ${WIFI_IFACE} interface add ${VWIFI_IFACE} type __ap; then
|
||||||
|
# some distributions (such as Ubuntu) have udev rules that they rename
|
||||||
|
# the new virtual interface. in this case, forcefully rename it back
|
||||||
|
# to the name we want
|
||||||
|
if ! is_wifi_interface ${VWIFI_IFACE}; then
|
||||||
|
for x in $(get_virt_interfaces ${WIFI_IFACE}); do
|
||||||
|
if [[ "$VIRT_IFACES" != *\ ${x}\ * ]]; then
|
||||||
|
ip link set dev $x down || die
|
||||||
|
ip link set dev $x name $VWIFI_IFACE || die
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
# now we can call networkmanager_wait_until_unmanaged
|
# now we can call networkmanager_wait_until_unmanaged
|
||||||
networkmanager_is_running && [[ $NM_OLDER_VERSION -eq 0 ]] && networkmanager_wait_until_unmanaged ${VWIFI_IFACE}
|
networkmanager_is_running && [[ $NM_OLDER_VERSION -eq 0 ]] && networkmanager_wait_until_unmanaged ${VWIFI_IFACE}
|
||||||
echo "${VWIFI_IFACE} created."
|
echo "${VWIFI_IFACE} created."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user