[PATCH] splits configuration and implementation for different ubnt setups

Tim Niemeyer tim.niemeyer at mastersword.de
So Sep 27 11:28:19 CEST 2015


Hi

Gefällt mir sehr gut.

Reviewed und applied.

Tim

Am Montag, den 21.09.2015, 23:02 +0200 schrieb tk+ff at meskal.net:
> * introduces new file network.mode currently only used for nanostation
> * network.mode is added to sysupgrade.conf
> => once configured the the setting should survive an upgrade
> ---
>  bsp/default/root_file_system/etc/sysupgrade.conf   |  3 +-
>  bsp/ubnt-nano-m/root_file_system/etc/network.mode  | 18 ++++++++++
>  .../root_file_system/etc/network.nanostation-m     | 38 ++++++++++------------
>  3 files changed, 37 insertions(+), 22 deletions(-)
>  create mode 100644 bsp/ubnt-nano-m/root_file_system/etc/network.mode
> 
> diff --git a/bsp/default/root_file_system/etc/sysupgrade.conf b/bsp/default/root_file_system/etc/sysupgrade.conf
> index e5e29bb..5b9c689 100644
> --- a/bsp/default/root_file_system/etc/sysupgrade.conf
> +++ b/bsp/default/root_file_system/etc/sysupgrade.conf
> @@ -1 +1,2 @@
> -/etc/shadow
> \ No newline at end of file
> +/etc/shadow
> +/etc/network.mode
> diff --git a/bsp/ubnt-nano-m/root_file_system/etc/network.mode b/bsp/ubnt-nano-m/root_file_system/etc/network.mode
> new file mode 100644
> index 0000000..7199dbc
> --- /dev/null
> +++ b/bsp/ubnt-nano-m/root_file_system/etc/network.mode
> @@ -0,0 +1,18 @@
> +#what should the one eth0 ethernet port be used for?
> +#directly connect to other mesh nodes - this is the default
> +ETHMODE="BATMAN"
> +
> +#Connect with fastd vpn
> +#ETHMODE="WAN"
> +
> +#connect normal ff-clients
> +#ETHMODE="CLIENT"
> +
> +################
> +## If you want to change the behavior of eth0, you can change it above.
> +## After that you have to reset the config with following commands.
> +#cp /rom/etc/sysctl.conf /etc/sysctl.conf
> +#cp /rom/etc/config/network /etc/config/network
> +#reboot
> +################
> +
> diff --git a/bsp/ubnt-nano-m/root_file_system/etc/network.nanostation-m b/bsp/ubnt-nano-m/root_file_system/etc/network.nanostation-m
> index fd6cc23..1e9223f 100644
> --- a/bsp/ubnt-nano-m/root_file_system/etc/network.nanostation-m
> +++ b/bsp/ubnt-nano-m/root_file_system/etc/network.nanostation-m
> @@ -4,6 +4,8 @@ CLIENT_PORTS=""
>  WAN_PORTS=""
>  BATMAN_PORTS=""
>  
> +. /etc/network.mode
> +
>  CLIENTIF="w2ap"
>  ETHMESHMAC=
>  ROUTERMAC=w2mesh
> @@ -12,24 +14,18 @@ uci set network.$SWITCHDEV=interface
>  uci set network.$SWITCHDEV.ifname=$SWITCHDEV
>  uci set network.mesh.ifname="bat0"
>  
> -################
> -## If you want to change the behavior of eth0, you can change it here.
> -## After that you have to reset the config with following commands.
> -#cp /rom/etc/sysctl.conf /etc/sysctl.conf
> -#cp /rom/etc/config/network /etc/config/network
> -#reboot
> -################
> -
> -## 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
> -
> -## Activate for BATMAN:
> -uci set network.ethmesh.ifname="$SWITCHDEV"
> -
> -## Activate for Client:
> -#CLIENTIF="w2ap eth0"
> -#uci set network.mesh.ifname="bat0 $SWITCHDEV"
> +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:
> +  CLIENTIF="w2ap eth0"
> +  uci set network.mesh.ifname="bat0 $SWITCHDEV"
> +else
> +  ## Activate BATMAN:
> +  uci set network.ethmesh.ifname="$SWITCHDEV"
> +fi
> -- 
> 2.5.3
> 

-------------- nächster Teil --------------
Ein Dateianhang mit Binärdaten wurde abgetrennt...
Dateiname   : signature.asc
Dateityp    : application/pgp-signature
Dateigröße  : 819 bytes
Beschreibung: This is a digitally signed message part
URL         : <http://lists.freifunk.net/pipermail/franken-dev-freifunk.net/attachments/20150927/5bab0bf8/attachment-0002.sig>


Mehr Informationen über die Mailingliste franken-dev