Assign unique peer address
This commit is contained in:
parent
2fa22c4d04
commit
7702692aec
|
@ -141,6 +141,22 @@ function verify {
|
||||||
rm $tempfile
|
rm $tempfile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function assign_peer_address {
|
||||||
|
for i in {1..6}; do
|
||||||
|
number=$RANDOM
|
||||||
|
let "number %= 255"
|
||||||
|
octet=$(echo "obase=16;$number" | bc)
|
||||||
|
if [ ${#octet} -lt 2 ]; then
|
||||||
|
octet="0${octet}"
|
||||||
|
fi
|
||||||
|
if [ $i -gt 1 ]; then
|
||||||
|
echo -n ":"
|
||||||
|
fi
|
||||||
|
echo -n "${octet}"
|
||||||
|
done
|
||||||
|
echo ''
|
||||||
|
}
|
||||||
|
|
||||||
function start {
|
function start {
|
||||||
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'
|
||||||
|
@ -161,6 +177,7 @@ function start {
|
||||||
|
|
||||||
ifconfig $IFACE down
|
ifconfig $IFACE down
|
||||||
ifconfig $IFACE mtu 1532
|
ifconfig $IFACE mtu 1532
|
||||||
|
ifconfig $IFACE hw ether $(assign_peer_address)
|
||||||
iwconfig $IFACE enc off
|
iwconfig $IFACE enc off
|
||||||
iwconfig $IFACE mode ad-hoc essid $WIFI_SSID channel $CHANNEL
|
iwconfig $IFACE mode ad-hoc essid $WIFI_SSID channel $CHANNEL
|
||||||
sleep 1
|
sleep 1
|
||||||
|
|
Loading…
Reference in New Issue