{{{ # all-in-one config script for WBMv3 test case 1 set -a #set -x cp /rom/etc/config/network /etc/config/ rm /etc/config/wireless wifi detect > /etc/config/wireless HOSTNAME="@PARAM1@" SUFFIX="@PARAM1@" RADIO="@PARAM2@" CELLSUFFIX0="@PARAM3@" let CHANNEL0=$(( $CELLSUFFIX0 + 0 )) TXP0="@PARAM4@" CELLSUFFIX1="@PARAM5@" let CHANNEL1=$(( $CELLSUFFIX1 + 0 )) TXP1="@PARAM6@" CELLSUFFIX2="@PARAM7@" let CHANNEL2=$(( $CELLSUFFIX2 + 0 )) TXP2="@PARAM8@" echo "tpowers: $TXP0 $TXP1 $TXP2" RADIO0="${RADIO}0" RADIO1="${RADIO}1" RADIO2="${RADIO}2" echo "radios: $RADIO0 $RADIO1 $RADIO2" CELL0="02:02:02:02:02:$CELLSUFFIX0" CELL1="02:02:02:02:02:$CELLSUFFIX1" CELL2="02:02:02:02:02:$CELLSUFFIX2" echo "cells: $CELL0 $CELL1 $CELL2" sysctl -w kernel.hostname=$HOSTNAME uci set system.@system[0].hostname=$HOSTNAME # setting wireless config for radio0 DEVICE0=`uci get wireless.@wifi-iface[0].device` uci delete wireless.@wifi-iface[0].network uci set wireless.$DEVICE0.country=276 uci set wireless.$DEVICE0.channel=$CHANNEL0 uci set wireless.$DEVICE0.disabled=0 uci set wireless.$DEVICE0.txpower=$TXP0 uci set wireless.@wifi-iface[0].network=wlan0 uci set wireless.@wifi-iface[0].ssid=$CELLSUFFIX0.wbmv3.3 uci set wireless.@wifi-iface[0].encryption=none uci set wireless.@wifi-iface[0].bssid=$CELL0 uci set wireless.@wifi-iface[0].rate=24M uci set wireless.@wifi-iface[0].bgscan=0 uci set wireless.@wifi-iface[0].mode=adhoc # setting wireless config for radio0 DEVICE1=`uci get wireless.@wifi-iface[1].device` uci delete wireless.@wifi-iface[1].network uci set wireless.$DEVICE1.country=276 uci set wireless.$DEVICE1.channel=$CHANNEL1 uci set wireless.$DEVICE1.disabled=0 uci set wireless.$DEVICE1.txpower=$TXP1 uci set wireless.@wifi-iface[1].network=wlan1 uci set wireless.@wifi-iface[1].ssid=$CELLSUFFIX1.wbmv3.3 uci set wireless.@wifi-iface[1].encryption=none uci set wireless.@wifi-iface[1].bssid=$CELL1 uci set wireless.@wifi-iface[1].rate=24M uci set wireless.@wifi-iface[1].bgscan=0 uci set wireless.@wifi-iface[1].mode=adhoc # setting wireless config for radio0 DEVICE2=`uci get wireless.@wifi-iface[2].device` uci delete wireless.@wifi-iface[2].network uci set wireless.$DEVICE2.country=276 uci set wireless.$DEVICE2.channel=$CHANNEL2 uci set wireless.$DEVICE2.disabled=0 uci set wireless.$DEVICE2.txpower=$TXP2 uci set wireless.@wifi-iface[2].network=wlan2 uci set wireless.@wifi-iface[2].ssid=$CELLSUFFIX2.wbmv3.3 uci set wireless.@wifi-iface[2].encryption=none uci set wireless.@wifi-iface[2].bssid=$CELL2 uci set wireless.@wifi-iface[2].rate=24M uci set wireless.@wifi-iface[2].bgscan=0 uci set wireless.@wifi-iface[2].mode=adhoc #we don't want bridged interface uci delete network.lan.type uci delete network.wan uci set network.lan.ifname=eth0 uci set network.wlan0=interface uci set network.wlan0.ifname=$RADIO0 uci set network.wlan0.proto=static uci set network.wlan0.ipaddr=10.10.100.$SUFFIX uci set network.wlan0.netmask=255.255.255.0 uci set network.wlan1=interface uci set network.wlan1.ifname=$RADIO1 uci set network.wlan1.proto=static uci set network.wlan1.ipaddr=10.10.110.$SUFFIX uci set network.wlan1.netmask=255.255.255.0 uci set network.wlan2=interface uci set network.wlan2.ifname=$RADIO2 uci set network.wlan2.proto=static uci set network.wlan2.ipaddr=10.10.120.$SUFFIX uci set network.wlan2.netmask=255.255.255.0 # batmand uci set network.zlan01=alias uci set network.zlan01.interface=lan uci set network.zlan01.proto=static uci set network.zlan01.ipaddr=10.10.201.$SUFFIX uci set network.zlan01.netmask=255.255.255.0 uci set network.wlan01=alias uci set network.wlan01.interface=wlan0 uci set network.wlan01.proto=static uci set network.wlan01.ipaddr=10.10.101.$SUFFIX uci set network.wlan01.netmask=255.255.255.0 uci set network.wlan11=alias uci set network.wlan11.interface=wlan1 uci set network.wlan11.proto=static uci set network.wlan11.ipaddr=10.10.111.$SUFFIX uci set network.wlan11.netmask=255.255.255.0 uci set network.wlan21=alias uci set network.wlan21.interface=wlan2 uci set network.wlan21.proto=static uci set network.wlan21.ipaddr=10.10.121.$SUFFIX uci set network.wlan21.netmask=255.255.255.0 uci set batmand.general.interface="eth0:1 $RADIO0:1 $RADIO1:1 $RADIO2:1" # babel sed -i "s/\/usr\/sbin\/babeld -D/\/usr\/sbin\/babeld -z 2,10 -D/g" /etc/init.d/babeld uci set network.zlan02=alias uci set network.zlan02.interface=lan uci set network.zlan02.proto=static uci set network.zlan02.ipaddr=10.10.202.$SUFFIX uci set network.zlan02.netmask=255.255.255.0 uci set network.wlan02=alias uci set network.wlan02.interface=wlan0 uci set network.wlan02.proto=static uci set network.wlan02.ipaddr=10.10.102.$SUFFIX uci set network.wlan02.netmask=255.255.255.0 uci set network.wlan12=alias uci set network.wlan12.interface=wlan1 uci set network.wlan12.proto=static uci set network.wlan12.ipaddr=10.10.112.$SUFFIX uci set network.wlan12.netmask=255.255.255.0 uci set network.wlan22=alias uci set network.wlan22.interface=wlan2 uci set network.wlan22.proto=static uci set network.wlan22.ipaddr=10.10.122.$SUFFIX uci set network.wlan22.netmask=255.255.255.0 uci set babeld.wlan02=interface uci set babeld.wlan02.ignore=false uci set babeld.w1=filter uci set babeld.w1.type=redistribute uci set babeld.w1.local=true uci set babeld.w1.ip='10.10.102.0/24' uci set babeld.w1.action=allow uci set babeld.w2=filter uci set babeld.w2.type=in uci set babeld.w2.ip='10.10.102.0/24' uci set babeld.w2.action=allow uci set babeld.zlan02=interface uci set babeld.zlan02.ignore=false uci set babeld.z1=filter uci set babeld.z1.type=redistribute uci set babeld.z1.local=true uci set babeld.z1.ip='10.10.202.0/24' uci set babeld.z1.action=allow uci set babeld.z2=filter uci set babeld.z2.type=in uci set babeld.z2.ip='10.10.202.0/24' uci set babeld.z2.action=allow uci set babeld.f1=filter uci set babeld.f1.type=redistribute uci set babeld.f1.local=true uci set babeld.f1.ip='fdba:1943:e753::/64' uci set babeld.f1.action=allow uci set babeld.f2=filter uci set babeld.f2.type=in uci set babeld.f2.ip='fdba:1943:e753::/64' uci set babeld.f2.action=allow uci set babeld.f3=filter uci set babeld.f3.type=redistribute uci set babeld.f3.local=true uci set babeld.f3.action=deny uci set babeld.f4=filter uci set babeld.f4.type=in uci set babeld.f4.action=deny # olsr uci set network.zlan03=alias uci set network.zlan03.interface=lan uci set network.zlan03.proto=static uci set network.zlan03.ipaddr=10.10.203.$SUFFIX uci set network.zlan03.netmask=255.255.255.0 uci set network.wlan03=alias uci set network.wlan03.interface=wlan0 uci set network.wlan03.proto=static uci set network.wlan03.ipaddr=10.10.103.$SUFFIX uci set network.wlan03.netmask=255.255.255.0 uci set network.wlan13=alias uci set network.wlan13.interface=wlan1 uci set network.wlan13.proto=static uci set network.wlan13.ipaddr=10.10.113.$SUFFIX uci set network.wlan13.netmask=255.255.255.0 uci set network.wlan23=alias uci set network.wlan23.interface=wlan2 uci set network.wlan23.proto=static uci set network.wlan23.ipaddr=10.10.123.$SUFFIX uci set network.wlan23.netmask=255.255.255.0 rm -f /etc/config/olsrd touch /etc/config/olsrd uci add olsrd olsrd uci set olsrd.@olsrd[0].IpVersion=4 uci set olsrd.@olsrd[0].DebugLevel=9 uci add olsrd LoadPlugin uci set olsrd.@LoadPlugin[0]=LoadPlugin uci set olsrd.@LoadPlugin[0].library=olsrd_txtinfo.so.0.1 uci set olsrd.@LoadPlugin[0].accept="127.0.0.1" uci set olsrd.@LoadPlugin[0].port="10001" uci add olsrd Interface uci set olsrd.@Interface[0]=Interface uci set olsrd.@Interface[0].interface=zlan03 uci set olsrd.@Interface[0].Ip4Broadcast=10.10.203.255 uci add olsrd Interface uci set olsrd.@Interface[1]=Interface uci set olsrd.@Interface[1].interface=wlan03 uci set olsrd.@Interface[1].Ip4Broadcast=10.10.103.255 uci add olsrd Interface uci set olsrd.@Interface[2]=Interface uci set olsrd.@Interface[2].interface=wlan13 uci set olsrd.@Interface[2].Ip4Broadcast=10.10.113.255 uci add olsrd Interface uci set olsrd.@Interface[3]=Interface uci set olsrd.@Interface[3].interface=wlan23 uci set olsrd.@Interface[3].Ip4Broadcast=10.10.123.255 # bmx6 uci set network.zlan04=alias uci set network.zlan04.interface=lan uci set network.zlan04.proto=static uci set network.zlan04.ipaddr=10.10.204.$SUFFIX uci set network.zlan04.netmask=255.255.255.0 uci set network.wlan04=alias uci set network.wlan04.interface=wlan0 uci set network.wlan04.proto=static uci set network.wlan04.ipaddr=10.10.104.$SUFFIX uci set network.wlan04.netmask=255.255.255.0 uci set network.wlan14=alias uci set network.wlan14.interface=wlan1 uci set network.wlan14.proto=static uci set network.wlan14.ipaddr=10.10.114.$SUFFIX uci set network.wlan14.netmask=255.255.255.0 uci set network.wlan24=alias uci set network.wlan24.interface=wlan2 uci set network.wlan24.proto=static uci set network.wlan24.ipaddr=10.10.124.$SUFFIX uci set network.wlan24.netmask=255.255.255.0 rm -f /etc/config/bmx6 touch /etc/config/bmx6 uci set bmx6.general=bmx6 uci add bmx6 dev uci set bmx6.@dev[0].dev=eth0:4 uci add bmx6 dev uci set bmx6.@dev[1].dev=$RADIO0:4 uci add bmx6 dev uci set bmx6.@dev[2].dev=$RADIO1:4 uci add bmx6 dev uci set bmx6.@dev[3].dev=$RADIO2:4 uci commit echo "exit 0" > /etc/rc.local [ -x /etc/init.d/batmand ] && /etc/init.d/batmand enable [ -x /etc/init.d/babeld ] && /etc/init.d/babeld enable [ -x /etc/init.d/olsrd ] && /etc/init.d/olsrd enable [ -x /etc/init.d/bmx6 ] && /etc/init.d/bmx6 enable [ -x /etc/init.d/bmxd ] && /etc/init.d/bmxd disable [ -x /etc/init.d/dnsmasq ] && /etc/init.d/dnsmasq disable [ -x /etc/init.d/impd4e ] && /etc/init.d/impd4e disable [ -x /etc/init.d/firewall ] && /etc/init.d/firewall stop [ -x /etc/init.d/firewall ] && /etc/init.d/firewall disable rm /bin/ping uci commit wireless && wifi }}}