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

2020-05-20 Thread Wes Turner
Would it make sense to integrate support for a wwan interface and zone that
just no-ops when there's no wwan interface defined?

The case of a 4G/5G modem will likely be more popular in the future.

"[OpenWrt-Devel] RFI: OpenWRT for #DisasterRelief: LoRA: ClusterDuck, LTE,
5G, Mesh, Throttling"
https://www.mail-archive.com/openwrt-devel@lists.openwrt.org/msg52055.html

> Are there other [OpenWRT-compatible] devices with LTE and/or LoRa that
> would be useful for disaster relief?
>
> "Table of Hardware: LTE Modem supported"
> https://openwrt.org/toh/views/toh_lte_modem_supported

>
> ## 5G
> Are there any 5G-compatible OpenWRT devices yet?
> Presumably, devices with Mini-PCIe are theoretically compatible given
built
modules.

How would you name interfaces / zones when there's also at least one LoRA
interface?

wan
wwan

wan0
wwan0
lora0 (?)

On Wed, May 20, 2020 at 8:12 PM Jeonghum Joh 
wrote:

> Hello Magnus Kroken,
>
> Thank you for clarifying the license.
> I will use this one in the github gist.
>
> Thank you so much!
> Jeonghum
>
> 2020년 5월 21일 (목) 오전 2:13, Magnus Kroken 님이 작성:
>
>> Hi
>>
>> On 20.05.2020 02:01, Jeonghum Joh wrote:
>> > Hello Magnus Kroken,
>> >
>> > Thank you so much!
>> > Your script works like a charm!
>> >
>> > I'd like to use this script in our board. This board would be our
>> > customer's new product - 5G router.
>> > We are Telesquare Inc. (www.telesquare.co.kr <
>> http://www.telesquare.co.kr>)
>> >
>> > I'd like to write copyright to your name.
>> > And I'd like you to clarify the license of this script.
>> >
>> > Please let me know your opinion.
>> >
>> > Thank you very much!
>> > Jeonghum
>>
>> Appreciate the consideration, although I'm not sure this snippet is
>> substantial enough to be copyrightable. No matter I suppose - if it is
>> copyrightable I can license it, if it is too simple to be copyrightable
>> any claim of copyright is invalid and it can safely be used by anyone.
>>
>> I have put a slightly clarified version as a Gist:
>> https://gist.github.com/mkrkn/4ba4bef3f0d541aa1180bef4156b340c
>>
>> Regards
>> Magnus Kroken
>>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-20 Thread Jeonghum Joh
Hello Magnus Kroken,

Thank you for clarifying the license.
I will use this one in the github gist.

Thank you so much!
Jeonghum

2020년 5월 21일 (목) 오전 2:13, Magnus Kroken 님이 작성:

> Hi
>
> On 20.05.2020 02:01, Jeonghum Joh wrote:
> > Hello Magnus Kroken,
> >
> > Thank you so much!
> > Your script works like a charm!
> >
> > I'd like to use this script in our board. This board would be our
> > customer's new product - 5G router.
> > We are Telesquare Inc. (www.telesquare.co.kr <
> http://www.telesquare.co.kr>)
> >
> > I'd like to write copyright to your name.
> > And I'd like you to clarify the license of this script.
> >
> > Please let me know your opinion.
> >
> > Thank you very much!
> > Jeonghum
>
> Appreciate the consideration, although I'm not sure this snippet is
> substantial enough to be copyrightable. No matter I suppose - if it is
> copyrightable I can license it, if it is too simple to be copyrightable
> any claim of copyright is invalid and it can safely be used by anyone.
>
> I have put a slightly clarified version as a Gist:
> https://gist.github.com/mkrkn/4ba4bef3f0d541aa1180bef4156b340c
>
> Regards
> Magnus Kroken
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-20 Thread Magnus Kroken

Hi

On 20.05.2020 02:01, Jeonghum Joh wrote:

Hello Magnus Kroken,

Thank you so much!
Your script works like a charm!

I'd like to use this script in our board. This board would be our 
customer's new product - 5G router.

We are Telesquare Inc. (www.telesquare.co.kr )

I'd like to write copyright to your name.
And I'd like you to clarify the license of this script.

Please let me know your opinion.

Thank you very much!
Jeonghum


Appreciate the consideration, although I'm not sure this snippet is 
substantial enough to be copyrightable. No matter I suppose - if it is 
copyrightable I can license it, if it is too simple to be copyrightable 
any claim of copyright is invalid and it can safely be used by anyone.


I have put a slightly clarified version as a Gist: 
https://gist.github.com/mkrkn/4ba4bef3f0d541aa1180bef4156b340c


Regards
Magnus Kroken

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Jeonghum Joh
Hello  Magnus Kroken,

Thank you so much!
Your script works like a charm!

I'd like to use this script in our board. This board would be our
customer's new product - 5G router.
We are Telesquare Inc. (www.telesquare.co.kr)

I'd like to write copyright to your name.
And I'd like you to clarify the license of this script.

Please let me know your opinion.

Thank you very much!
Jeonghum
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Magnus Kroken

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.

8<
#!/bin/sh
. /lib/functions.sh

lanzone_var=""
wanzone_var=""

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

config_get zone_name "$config" name

if [ "$zone_name" == "lan" ]
then
lanzone_var="$config"
elif [ "$zone_name" == "wan" ]
then
wanzone_var="$config"
fi

return 0
}

config_load firewall
config_foreach find_firewall_zones zone

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

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 
hint.


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


Regards,
Magnus Kroken

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Jeonghum Joh
Hello Magnus Kroken and Adrianschmutzler,

Thank you! I made it work!

Magnus Kroken's second method works!

Thank you!

But I have another question :

  config zone
  option name   wan
  list   network  'wan'
  list   network  'wan6'
+list   network  'wwan'
  option inputREJECT
  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

2020년 5월 19일 (화) 오후 6:38, Magnus Kroken 님이 작성:

> Hi
>
> On 19.05.2020 08:30, Jeonghum Joh wrote:
>  > config interface 'wwan'
> >  option ifname 'usb0'
> >  option proto 'dhcp'
> >
> > So I added something like below to
> > package/base-files/files/etc/board.d/99-default_network :
> >
> >ucidef_set_interface_lan 'eth0'
> >[ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
> > +[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'
> >
> > But this didn't resolve my problem.
> >
> > I think I can just make some commands into startup script.
> > Isn't there more grace approach for me to automatically add usb0
> > interface into /etc/config/network?
>
> As already suggested, use the files/ directory to include files.
>
> $ cd openwrt # change to the root of your OpenWrt build environment
> $ mkdir -p files/etc/uci-defaults
> $ mkdir -p files/etc/config
>
> Now you have two options.
>
> 1. Put your complete working /etc/config/network file in the files/
> tree, so it resides at files/etc/config/network.
>
> 2. Write a script with the UCI commands needed to change your config,
> and put it in files/etc/uci-defaults. I name mine e.g.
> zzz_33_device_config, so that they are executed as late as possible.
>
> The commands you would need for option 2 is probably:
>
> uci -q set network.wwan=interface
> uci -q set network.wwan.proto='dhcp'
> uci -q set network.wwan.ifname='usb0'
> exit 0
>
> This is very simple, you may want to script checks to ensure the script
> is running on correct device (e.g. by checking for a MAC address), and
> if the usb0 device exists.
>
> Regards
> Magnus Kroken
>
> > Thank you in advance.
> > Jeonghum
>
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Magnus Kroken

Hi

On 19.05.2020 08:30, Jeonghum Joh wrote:
> config interface 'wwan'

         option ifname 'usb0'
         option proto 'dhcp'

So I added something like below to 
package/base-files/files/etc/board.d/99-default_network :


   ucidef_set_interface_lan 'eth0'
   [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
+[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'

But this didn't resolve my problem.

I think I can just make some commands into startup script.
Isn't there more grace approach for me to automatically add usb0 
interface into /etc/config/network?


As already suggested, use the files/ directory to include files.

$ cd openwrt # change to the root of your OpenWrt build environment
$ mkdir -p files/etc/uci-defaults
$ mkdir -p files/etc/config

Now you have two options.

1. Put your complete working /etc/config/network file in the files/ 
tree, so it resides at files/etc/config/network.


2. Write a script with the UCI commands needed to change your config, 
and put it in files/etc/uci-defaults. I name mine e.g. 
zzz_33_device_config, so that they are executed as late as possible.


The commands you would need for option 2 is probably:

uci -q set network.wwan=interface
uci -q set network.wwan.proto='dhcp'
uci -q set network.wwan.ifname='usb0'
exit 0

This is very simple, you may want to script checks to ensure the script 
is running on correct device (e.g. by checking for a MAC address), and 
if the usb0 device exists.


Regards
Magnus Kroken


Thank you in advance.
Jeonghum



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread mail
When you build your own firmware, just add a file in /etc/uci-defaults to it, 
and have it contain the necessary uci command to change /etc/config/network. 
This will be executed on first boot and the settings in /etc/config/network 
before they are evaluated by the system during real startup.

 

 

From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org] On Behalf 
Of Jeonghum Joh
Sent: Dienstag, 19. Mai 2020 03:49
To: OpenWrt Development List 
Subject: [OpenWrt-Devel] How am I supposed to change settings in 
/etc/config/network of default root file system of OpenWRT?

 

I know how to do this for /etc/config/firewall.

It is package/network/config/firewall/files/firewall.config

 

But I cannot find /etc/config/network for default root file system.

 

Where can I find it?

How am I supposed to change settings in /etc/config/network of default root 
file system of OpenWRT?

 

Thank you in advance!

 

Jeonghum


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Jeonghum Joh
Hello list,

Let me clarify my test environment:
Hostname LEDE
Model MediaTek MT7622 AC4300rfb1 board
Firmware Version LEDE Reboot 17.01-SNAPSHOT unknown / LuCI (svn-r75)
Kernel Version 4.4.124

Thank you
Jeonghum

2020년 5월 19일 (화) 오후 3:30, Jeonghum Joh 님이 작성:

> Hello  Moritz Warning and people,
>
> I found a script which looks like something that generate
> /etc/config/network. It is "99-default_network"
> under package/base-files/files/etc/board.d.
>
> Let me post the content of it here :
>
> #!/bin/sh
>> #
>> # Copyright (C) 2013-2015 OpenWrt.org
>> #
>> . /lib/functions/uci-defaults.sh
>> board_config_update
>> json_is_a network object && exit 0
>> ucidef_set_interface_lan 'eth0'
>> [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
>> board_config_flush
>> exit 0
>
>
>
> The content of /etc/config/network is shown below :
>
> config interface 'lan'
> option type 'bridge'
> option ifname 'eth0'
> option proto 'static'
> option ipaddr '192.168.1.1'
> option netmask '255.255.255.0'
> option ip6assign '60'
>
> config interface 'wan'
> option ifname 'eth1'
> option proto 'dhcp'
>
> config interface 'wan6'
> option ifname 'eth1'
> option proto 'dhcpv6'
>
> So I guessed  above of 99-default_network generates above of
> /etc/config/network
>
> I need to add something like below to /etc/config/network :
>
> config interface 'wwan'
> option ifname 'usb0'
> option proto 'dhcp'
>
> So I added something like below to
> package/base-files/files/etc/board.d/99-default_network :
>
>   ucidef_set_interface_lan 'eth0'
>   [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
> +[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'
>
> But this didn't resolve my problem.
>
> I think I can just make some commands into startup script.
> Isn't there more grace approach for me to automatically add usb0 interface
> into /etc/config/network?
>
> Thank you in advance.
> Jeonghum
>
>
>
> 2020년 5월 19일 (화) 오후 12:57, Jeonghum Joh 님이 작성:
>
>> Hello Moritz Warning
>>
>> Thank you very much!
>> I can continue investigating by your hints.
>>
>> Thank you.
>> Jeonghum
>>
>> 2020년 5월 19일 (화) 오전 11:37, Moritz Warning 님이 작성:
>>
>>> On 5/19/20 3:49 AM, Jeonghum Joh wrote:
>>> > I know how to do this for /etc/config/firewall.
>>> > It is package/network/config/firewall/files/firewall.config
>>> >
>>> > But I cannot find /etc/config/network for default root file system.
>>> >
>>> > Where can I find it?
>>> > How am I supposed to change settings in /etc/config/network of default
>>> root
>>> > file system of OpenWRT?
>>> >
>>> > Thank you in advance!
>>> >
>>> > Jeonghum
>>> >
>>> >
>>> > ___
>>> > openwrt-devel mailing list
>>> > openwrt-devel@lists.openwrt.org
>>> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>> >
>>>
>>> In your OpenWrt build root, create a file "files/etc/config/firewall".
>>> When you build OpenWrt, the file will be included in the image (and not
>>> overwritten).
>>>
>>> Btw., /etc/config/network is generated by a script on first boot and
>>> that is then deleted.
>>> But it is still accessible in /rom/etc/uci_defaults/02_network (not
>>> quite sure on the script name).
>>>
>>> - mwarning
>>>
>>> ___
>>> openwrt-devel mailing list
>>> openwrt-devel@lists.openwrt.org
>>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>>
>>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-19 Thread Jeonghum Joh
Hello  Moritz Warning and people,

I found a script which looks like something that generate
/etc/config/network. It is "99-default_network"
under package/base-files/files/etc/board.d.

Let me post the content of it here :

#!/bin/sh
> #
> # Copyright (C) 2013-2015 OpenWrt.org
> #
> . /lib/functions/uci-defaults.sh
> board_config_update
> json_is_a network object && exit 0
> ucidef_set_interface_lan 'eth0'
> [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
> board_config_flush
> exit 0



The content of /etc/config/network is shown below :

config interface 'lan'
option type 'bridge'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.1.1'
option netmask '255.255.255.0'
option ip6assign '60'

config interface 'wan'
option ifname 'eth1'
option proto 'dhcp'

config interface 'wan6'
option ifname 'eth1'
option proto 'dhcpv6'

So I guessed  above of 99-default_network generates above of
/etc/config/network

I need to add something like below to /etc/config/network :

config interface 'wwan'
option ifname 'usb0'
option proto 'dhcp'

So I added something like below to
package/base-files/files/etc/board.d/99-default_network :

  ucidef_set_interface_lan 'eth0'
  [ -d /sys/class/net/eth1 ] && ucidef_set_interface_wan 'eth1'
+[ -d /sys/class/net/usb0 ] && ucidef_set_interface_wan 'usb0'

But this didn't resolve my problem.

I think I can just make some commands into startup script.
Isn't there more grace approach for me to automatically add usb0 interface
into /etc/config/network?

Thank you in advance.
Jeonghum



2020년 5월 19일 (화) 오후 12:57, Jeonghum Joh 님이 작성:

> Hello Moritz Warning
>
> Thank you very much!
> I can continue investigating by your hints.
>
> Thank you.
> Jeonghum
>
> 2020년 5월 19일 (화) 오전 11:37, Moritz Warning 님이 작성:
>
>> On 5/19/20 3:49 AM, Jeonghum Joh wrote:
>> > I know how to do this for /etc/config/firewall.
>> > It is package/network/config/firewall/files/firewall.config
>> >
>> > But I cannot find /etc/config/network for default root file system.
>> >
>> > Where can I find it?
>> > How am I supposed to change settings in /etc/config/network of default
>> root
>> > file system of OpenWRT?
>> >
>> > Thank you in advance!
>> >
>> > Jeonghum
>> >
>> >
>> > ___
>> > openwrt-devel mailing list
>> > openwrt-devel@lists.openwrt.org
>> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>> >
>>
>> In your OpenWrt build root, create a file "files/etc/config/firewall".
>> When you build OpenWrt, the file will be included in the image (and not
>> overwritten).
>>
>> Btw., /etc/config/network is generated by a script on first boot and that
>> is then deleted.
>> But it is still accessible in /rom/etc/uci_defaults/02_network (not quite
>> sure on the script name).
>>
>> - mwarning
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-18 Thread Jeonghum Joh
Hello Moritz Warning

Thank you very much!
I can continue investigating by your hints.

Thank you.
Jeonghum

2020년 5월 19일 (화) 오전 11:37, Moritz Warning 님이 작성:

> On 5/19/20 3:49 AM, Jeonghum Joh wrote:
> > I know how to do this for /etc/config/firewall.
> > It is package/network/config/firewall/files/firewall.config
> >
> > But I cannot find /etc/config/network for default root file system.
> >
> > Where can I find it?
> > How am I supposed to change settings in /etc/config/network of default
> root
> > file system of OpenWRT?
> >
> > Thank you in advance!
> >
> > Jeonghum
> >
> >
> > ___
> > openwrt-devel mailing list
> > openwrt-devel@lists.openwrt.org
> > https://lists.openwrt.org/mailman/listinfo/openwrt-devel
> >
>
> In your OpenWrt build root, create a file "files/etc/config/firewall".
> When you build OpenWrt, the file will be included in the image (and not
> overwritten).
>
> Btw., /etc/config/network is generated by a script on first boot and that
> is then deleted.
> But it is still accessible in /rom/etc/uci_defaults/02_network (not quite
> sure on the script name).
>
> - mwarning
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-18 Thread Moritz Warning
On 5/19/20 3:49 AM, Jeonghum Joh wrote:
> I know how to do this for /etc/config/firewall.
> It is package/network/config/firewall/files/firewall.config
>
> But I cannot find /etc/config/network for default root file system.
>
> Where can I find it?
> How am I supposed to change settings in /etc/config/network of default root
> file system of OpenWRT?
>
> Thank you in advance!
>
> Jeonghum
>
>
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>

In your OpenWrt build root, create a file "files/etc/config/firewall".
When you build OpenWrt, the file will be included in the image (and not 
overwritten).

Btw., /etc/config/network is generated by a script on first boot and that is 
then deleted.
But it is still accessible in /rom/etc/uci_defaults/02_network (not quite sure 
on the script name).

- mwarning

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-18 Thread Jeonghum Joh
I know how to do this for /etc/config/firewall.
It is package/network/config/firewall/files/firewall.config

But I cannot find /etc/config/network for default root file system.

Where can I find it?
How am I supposed to change settings in /etc/config/network of default root
file system of OpenWRT?

Thank you in advance!

Jeonghum
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel