forked from freifunk-franken/firmware
Fixed Problems with Port mode changing
cleaned up config files (moved commands to script) Signed-off-by: Jan Kraus <mayosemmel@gmail.com> Tested-by: Christian Dresel <fff@chrisi01.de> Reviewed-by: Christian Dresel <fff@chrisi01.de> Tested-by: Jan Kraus <mayosemmel@gmail.com>
This commit is contained in:
parent
c1d30140f1
commit
b78e5b4ac0
|
@ -3,8 +3,7 @@
|
|||
## if the routers interfaces differ from the standard WAN+4LAN-Ports
|
||||
## +2Wireless APs.
|
||||
## If you want to change their behavior, you can do so below.
|
||||
## After that you have to reset the config with following commands.
|
||||
#cp /rom/etc/sysctl.conf /etc/sysctl.conf
|
||||
## After that you have to reboot the router with following command.
|
||||
#reboot
|
||||
#
|
||||
### The canonical syntax of this file is:
|
||||
|
|
|
@ -3,28 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=eth0
|
||||
ROUTERMAC=eth0
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
ETH0MAC="w2ap"
|
||||
fi
|
||||
ROUTERMAC=eth0
|
|
@ -3,28 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
ETH0MAC="w2ap"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -3,28 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
ETH0MAC="w2ap"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -3,27 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -3,29 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
uci set network.eth0.mtu="1500"
|
||||
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -3,27 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -3,27 +3,9 @@ SWITCHDEV=eth0
|
|||
CLIENT_PORTS=""
|
||||
WAN_PORTS=""
|
||||
BATMAN_PORTS=""
|
||||
ONE_PORT="YES"
|
||||
|
||||
. /etc/network.mode
|
||||
|
||||
ETHMESHMAC=
|
||||
ROUTERMAC=w2mesh
|
||||
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
uci set network.mesh.ifname="bat0"
|
||||
|
||||
if [ "$ETHMODE" = "WAN" ] ; then
|
||||
## Activate for WAN:
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.wan.ifname=$WANDEV
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
## Activate Client:
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
else
|
||||
## Activate BATMAN:
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
fi
|
||||
ROUTERMAC=w2mesh
|
|
@ -65,6 +65,41 @@ if ! uci get network.$SWITCHDEV.ifname; then
|
|||
/etc/init.d/network restart
|
||||
fi
|
||||
|
||||
if [ "$ONE_PORT" = "YES" ]; then
|
||||
uci set network.$SWITCHDEV=interface
|
||||
uci set network.$SWITCHDEV.ifname=$SWITCHDEV
|
||||
if [ "$ETHMODE" = "WAN" ]; then
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 1" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 1" >> /etc/sysctl.conf
|
||||
uci set network.mesh.ifname="bat0"
|
||||
uci set network.wan.ifname="$WANDEV"
|
||||
uci del uci set network.ethmesh.ifname
|
||||
uci del network.eth0.macaddr
|
||||
elif [ "$ETHMODE" = "CLIENT" ] ; then
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 0" >> /etc/sysctl.conf
|
||||
uci set network.mesh.ifname="bat0 $SWITCHDEV"
|
||||
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
|
||||
uci del network.ethmesh.ifname
|
||||
uci del network.eth0.macaddr
|
||||
elif [ "$ETHMODE" = "BATMAN" ] ; then
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_defrtr = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_pinfo = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.autoconf = 0" >> /etc/sysctl.conf
|
||||
echo "net.ipv6.conf.$WANDEV.accept_ra_rtr_pref = 0" >> /etc/sysctl.conf
|
||||
uci set network.mesh.ifname="bat0"
|
||||
uci set network.wan.ifname="eth1" #eth1 because it is default in config file
|
||||
uci set network.ethmesh.ifname="$SWITCHDEV"
|
||||
ETH0MAC="w2ap"
|
||||
fi
|
||||
uci commit
|
||||
/etc/init.d/network restart
|
||||
fi
|
||||
|
||||
if [[ -n "$ETHMESHMAC" ]]; then
|
||||
if uci get network.ethmesh.macaddr
|
||||
then
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
if [ "$REQUEST_METHOD" == "POST" ] ; then
|
||||
sed -i '/^.*# set via WebUI/d' /etc/network.mode
|
||||
echo "ETHMODE=\"${POST_mode}\" # set via WebUI" >> /etc/network.mode
|
||||
cp /rom/etc/sysctl.conf /etc/sysctl.conf
|
||||
do_reboot=1
|
||||
MSG='<span class="green">Port Modus geändert! Router startet neu...</span>'
|
||||
fi
|
||||
|
@ -67,12 +66,8 @@ fi
|
|||
<th style="width: 1em;">Anschluss Modus:</th>
|
||||
<td>
|
||||
<select name="mode">
|
||||
<% if grep ETHMODE /etc/network.$(uci -q get board.model.name) | grep -q WAN ; then %>
|
||||
<option value="WAN" <% [ "$ETHMODE" == "WAN" ] && echo -n selected %>>WAN</option>
|
||||
<% fi %>
|
||||
<% if grep ETHMODE /etc/network.$(uci -q get board.model.name) | grep -q CLIENT ; then %>
|
||||
<option value="CLIENT" <% [ "$ETHMODE" == "CLIENT" ] && echo -n selected %>>Client</option>
|
||||
<% fi %>
|
||||
<option value="WAN" <% [ "$ETHMODE" == "WAN" ] && echo -n selected %>>WAN</option>
|
||||
<option value="CLIENT" <% [ "$ETHMODE" == "CLIENT" ] && echo -n selected %>>Client</option>
|
||||
<option value="BATMAN" <% [ "$ETHMODE" == "BATMAN" ] && echo -n selected %>>BATMAN</option>
|
||||
</select>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue