[OpenWrt-Devel] How am I supposed to change settings in /etc/config/network of default root file system of OpenWRT?

Magnus Kroken mkroken at gmail.com
Tue May 19 10:48:05 EDT 2020

Sorry, forgot reply-to list.

On 19.05.2020 13:23, Jeonghum Joh wrote:
> Thank you!
> But I have another question :
>    config zone
>            option name       wan
>            list   network          'wan'
>            list   network          'wan6'
> +        list   network          'wwan'
>            option input            REJECT
>            option output           ACCEPT
>            option forward          REJECT
> Above is part of /etc/config/firewall.
> And as you see, I'd like to add new interface wwan into zone wan.
> How can I write uci command script for this?
> Thank you very much!
> Jeonghum

Here is an untested snippet I found in an old uci-defaults script of mine.

. /lib/functions.sh


find_firewall_zones () {
         local config="$1"
         local zone_name

         config_get zone_name "$config" name

         if [ "$zone_name" == "lan" ]
         elif [ "$zone_name" == "wan" ]

         return 0

config_load firewall
config_foreach find_firewall_zones zone

uci -q add_list firewall.${wanzone_var}.network='wwan'

I don't think I actually used this, I wrote it because I thought I might 
need it and it followed the same pattern as manipulating network.vlan 
sections. I do know it doesn't work in my current device script, 
although I attempted to fix that error in the code above. Consider it a 

In addition, I've not mentioned 'uci commit' or commands to reload 
configuration/services, which you probably also want to add in these 

Magnus Kroken

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list