[OpenWrt-Devel] [PATCH] base-files: fix generating network configuration

Jo-Philipp Wich jow at openwrt.org
Wed Dec 30 07:12:24 EST 2015


Hi Yousong.

NAK - thats by design. If a network config is present then there is no
point in regenerating it.

I'd prefer if the Malta target would simply drop its default config and
switch to board.d, this could be useful to e.g. dynamically handle
different amounts of eth* devices:

 eth0 -> lan
 eth0, eth1 -> lan, wan
 eth0, eth1, eth2 -> lan(eth0+eth1), wan(eth2)

~ Jow

On 30.12.2015 13:00, Yousong Zhou wrote:
> With the default /e/c/network present, board_detect won't create a new
> config from board.json.  Move this default configuration to
> generate_static_network of config_generate instead.
> 
> This should fix the issue on malta target and should not affect other
> targets that provide its own default network config
> 
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
>  package/base-files/files/bin/config_generate |  8 ++++++++
>  package/base-files/files/etc/config/network  | 18 ------------------
>  2 files changed, 8 insertions(+), 18 deletions(-)
>  delete mode 100644 package/base-files/files/etc/config/network
> 
> diff --git a/package/base-files/files/bin/config_generate b/package/base-files/files/bin/config_generate
> index 9218788..39a0c60 100755
> --- a/package/base-files/files/bin/config_generate
> +++ b/package/base-files/files/bin/config_generate
> @@ -14,6 +14,14 @@ generate_static_network() {
>  		set network.loopback.proto='static'
>  		set network.loopback.ipaddr='127.0.0.1'
>  		set network.loopback.netmask='255.0.0.0'
> +		delete network.lan
> +		network.lan=interface
> +		network.lan.type='bridge'
> +		network.lan.ifname='eth1'
> +		network.lan.proto='static'
> +		network.lan.ipaddr='192.168.1.1'
> +		network.lan.netmask='255.255.255.0'
> +		network.lan.ip6assign='60'
>  		delete network.globals
>  		set network.globals='globals'
>  		set network.globals.ula_prefix='auto'
> diff --git a/package/base-files/files/etc/config/network b/package/base-files/files/etc/config/network
> deleted file mode 100644
> index d3cd3c6..0000000
> --- a/package/base-files/files/etc/config/network
> +++ /dev/null
> @@ -1,18 +0,0 @@
> -# Copyright (C) 2006 OpenWrt.org
> -
> -config interface loopback
> -	option ifname	lo
> -	option proto	static
> -	option ipaddr	127.0.0.1
> -	option netmask	255.0.0.0
> -
> -config interface lan
> -	option ifname	eth0
> -	option type 	bridge
> -	option proto	static
> -	option ipaddr	192.168.1.1
> -	option netmask	255.255.255.0
> -	option ip6assign 60
> -
> -config globals globals
> -	option ula_prefix auto
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20151230/3db0f255/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list