Check that mac address gets generated

This commit is contained in:
Bob Mottram 2017-09-29 22:23:03 +01:00
parent a5d2b6a69e
commit 81c2c54493
1 changed files with 42 additions and 37 deletions

View File

@ -229,13 +229,15 @@ function start {
ifconfig $IFACE down
ifconfig $IFACE mtu 1532
peeraddr=$(assign_peer_address)
ifconfig $IFACE hw ether $peeraddr
echo $"$IFACE assigned MAC address $peeraddr"
peermac=$(assign_peer_address)
if [ ! $peermac ]; then
echo $"Unable to obtain MAC address for $peermac"
return
fi
ifconfig $IFACE hw ether $peermac
echo $"$IFACE assigned MAC address $peermac"
iwconfig $IFACE enc off
iwconfig $IFACE mode ad-hoc essid $WIFI_SSID channel $CHANNEL
sleep 1
iwconfig $IFACE ap $CELLID
modprobe batman-adv
batctl if add $IFACE
@ -264,12 +266,14 @@ function start {
HOTSPOT_NAME=$"${WIFI_SSID}-hotspot"
ifconfig $IFACE_SECONDARY down
ifconfig $IFACE_SECONDARY mtu 1500
peeraddr=$(assign_peer_address)
ifconfig $IFACE_SECONDARY hw ether $peeraddr
echo $"Secondary wifi adaptor $IFACE_SECONDARY assigned to MAC address $peeraddr"
CELLID=$(assign_peer_address)
if [ $CELLID ]; then
ifconfig $IFACE_SECONDARY hw ether $CELLID
echo $"Secondary wifi adaptor $IFACE_SECONDARY assigned to MAC address $CELLID"
iwconfig $IFACE_SECONDARY enc open
iwconfig $IFACE_SECONDARY mode managed essid $HOTSPOT_NAME channel ${HOTSPOT_CHANNEL}
iwconfig $IFACE_SECONDARY ap $CELLID
iwconfig $IFACE ap $CELLID
brctl addbr $BRIDGE_HOTSPOT
brctl addif $BRIDGE_HOTSPOT bat0
@ -303,6 +307,7 @@ function start {
fi
fi
fi
fi
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT