Allow mesh on an interface other than wlanX
This commit is contained in:
parent
9f14c00645
commit
e209eef34e
|
@ -74,6 +74,7 @@ function stop {
|
||||||
|
|
||||||
# shellcheck disable=SC2153
|
# shellcheck disable=SC2153
|
||||||
if [ "$EIFACE" ]; then
|
if [ "$EIFACE" ]; then
|
||||||
|
if [[ "$EIFACE" != "$IFACE" ]] ; then
|
||||||
brctl delif "$BRIDGE" bat0
|
brctl delif "$BRIDGE" bat0
|
||||||
ifconfig "$BRIDGE" down || true
|
ifconfig "$BRIDGE" down || true
|
||||||
ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
|
ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
|
||||||
|
@ -84,13 +85,16 @@ function stop {
|
||||||
fi
|
fi
|
||||||
brctl delbr "$BRIDGE"
|
brctl delbr "$BRIDGE"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
ifconfig bat0 down -promisc
|
ifconfig bat0 down -promisc
|
||||||
|
|
||||||
batctl if del "$IFACE"
|
batctl if del "$IFACE"
|
||||||
ifconfig "$IFACE" mtu 1500
|
ifconfig "$IFACE" mtu 1500
|
||||||
ifconfig "$IFACE" down
|
ifconfig "$IFACE" down
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
|
||||||
iwconfig "$IFACE" mode managed
|
iwconfig "$IFACE" mode managed
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$IFACE_SECONDARY" ]; then
|
if [ "$IFACE_SECONDARY" ]; then
|
||||||
systemctl stop hostapd
|
systemctl stop hostapd
|
||||||
|
@ -98,8 +102,10 @@ function stop {
|
||||||
batctl if del "$IFACE_SECONDARY"
|
batctl if del "$IFACE_SECONDARY"
|
||||||
ifconfig "$IFACE_SECONDARY" mtu 1500
|
ifconfig "$IFACE_SECONDARY" mtu 1500
|
||||||
ifconfig "$IFACE_SECONDARY" down
|
ifconfig "$IFACE_SECONDARY" down
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
|
||||||
iwconfig "$IFACE_SECONDARY" mode managed
|
iwconfig "$IFACE_SECONDARY" mode managed
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
rmmod batman-adv
|
rmmod batman-adv
|
||||||
|
|
||||||
|
@ -149,8 +155,10 @@ function add_wifi_interface {
|
||||||
fi
|
fi
|
||||||
ifconfig "$ifname" hw ether "$peermac"
|
ifconfig "$ifname" hw ether "$peermac"
|
||||||
echo $"$ifname assigned MAC address $peermac"
|
echo $"$ifname assigned MAC address $peermac"
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
|
||||||
iwconfig "$ifname" enc off
|
iwconfig "$ifname" enc off
|
||||||
iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel"
|
iwconfig "$ifname" mode "$ifmode" essid "$ifssid" channel "$ifchannel"
|
||||||
|
fi
|
||||||
|
|
||||||
batctl if add "$ifname"
|
batctl if add "$ifname"
|
||||||
ifconfig "$ifname" up
|
ifconfig "$ifname" up
|
||||||
|
@ -184,6 +192,7 @@ function start {
|
||||||
rfkill unblock "$(rfkill list|awk -F: "/phy/ {print $1}")" || true
|
rfkill unblock "$(rfkill list|awk -F: "/phy/ {print $1}")" || true
|
||||||
|
|
||||||
secondary_wifi_available=
|
secondary_wifi_available=
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
|
||||||
if [ "$IFACE_SECONDARY" ]; then
|
if [ "$IFACE_SECONDARY" ]; then
|
||||||
if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then
|
if [[ "$IFACE" != "$IFACE_SECONDARY" ]]; then
|
||||||
if [ -d /etc/hostapd ]; then
|
if [ -d /etc/hostapd ]; then
|
||||||
|
@ -195,6 +204,7 @@ function start {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
modprobe batman-adv
|
modprobe batman-adv
|
||||||
|
|
||||||
|
@ -219,6 +229,7 @@ function start {
|
||||||
ifconfig bat0 0.0.0.0
|
ifconfig bat0 0.0.0.0
|
||||||
ethernet_connected='0'
|
ethernet_connected='0'
|
||||||
if [ "$EIFACE" ] ; then
|
if [ "$EIFACE" ] ; then
|
||||||
|
if [[ "$EIFACE" != "$IFACE" ]] ; then
|
||||||
ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
|
ethernet_connected=$(cat "/sys/class/net/$EIFACE/carrier")
|
||||||
if [[ "$ethernet_connected" != "0" ]]; then
|
if [[ "$ethernet_connected" != "0" ]]; then
|
||||||
echo $'Trying ethernet bridge to the internet'
|
echo $'Trying ethernet bridge to the internet'
|
||||||
|
@ -236,6 +247,7 @@ function start {
|
||||||
echo $"$EIFACE is not connected"
|
echo $"$EIFACE is not connected"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
ifconfig "$BRIDGE" up
|
ifconfig "$BRIDGE" up
|
||||||
dhclient "$BRIDGE"
|
dhclient "$BRIDGE"
|
||||||
|
|
||||||
|
@ -292,6 +304,9 @@ function start {
|
||||||
}
|
}
|
||||||
|
|
||||||
function monitor {
|
function monitor {
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" != 'wlan'* ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
if [ -z "$IFACE" ] ; then
|
if [ -z "$IFACE" ] ; then
|
||||||
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
echo 'error: unable to find wifi interface, not enabling batman-adv mesh'
|
||||||
exit 723657
|
exit 723657
|
||||||
|
@ -360,6 +375,11 @@ if [ -f "$mesh_interface_type_file" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mesh_protocol_init
|
mesh_protocol_init
|
||||||
|
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'eth'* ]]; then
|
||||||
|
MESH_INTERFACE_TYPE='eth'
|
||||||
|
fi
|
||||||
|
|
||||||
update_wifi_adaptors "${MESH_INTERFACE_TYPE}"
|
update_wifi_adaptors "${MESH_INTERFACE_TYPE}"
|
||||||
|
|
||||||
if [ ! "$IFACE" ]; then
|
if [ ! "$IFACE" ]; then
|
||||||
|
|
|
@ -99,12 +99,14 @@ function mesh_protocol_init {
|
||||||
IFACE=
|
IFACE=
|
||||||
IFACE_SECONDARY=
|
IFACE_SECONDARY=
|
||||||
EIFACE=eth0
|
EIFACE=eth0
|
||||||
|
if [[ "$MESH_INTERFACE_TYPE" == 'wlan'* ]]; then
|
||||||
WLAN_ADAPTORS=$(count_wlan)
|
WLAN_ADAPTORS=$(count_wlan)
|
||||||
|
|
||||||
if [ "$WLAN_ADAPTORS" -eq 0 ]; then
|
if [ "$WLAN_ADAPTORS" -eq 0 ]; then
|
||||||
echo $'No wlan adaptors found'
|
echo $'No wlan adaptors found'
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_ipv6_wlan {
|
function get_ipv6_wlan {
|
||||||
|
|
Loading…
Reference in New Issue