My goal is to set entry's with the same naming scheme with uci like it is done via LuCI.
This is an example for wireguard.
Of course I have read the doc's. But they are very unclear in this point.
Just to confuse beginners since the samples use other naming conventions then then web GUI ...
https://openwrt.org/docs/guide-user/base-system/uci
https://openwrt.org/docs/guide-user/services/vpn/wireguard/server
Global entries set by LuCI:
network.wg_srv0=interface
network.wg_srv0.proto='wireguard'
network.wg_srv0.private_key='mJBT9SSpC8+1J7te7iWifzbJ1RCSwCfuHLGbk+CwQEo='
network.wg_srv0.listen_port='12345'
network.wg_srv0.addresses='10.140.140.1/24' 'fdf1::1/64'
Peer 1 & 2 set by luci
network.@wireguard_wg_srv0[0]=wireguard_wg_srv0
network.@wireguard_wg_srv0[0].description='Peer1'
network.@wireguard_wg_srv0[0].public_key='hLIRbZTClIDMEmjmdZkN3tyNRvOpcBV4crapB3OjcXg='
network.@wireguard_wg_srv0[0].allowed_ips='10.140.140.10/32'
network.@wireguard_wg_srv0[1]=wireguard_wg_srv0
network.@wireguard_wg_srv0[1].description='Peer2'
network.@wireguard_wg_srv0[1].public_key='hLIRbZTClIDMEmjmdZkN3tyNRvOpcBV4crapB3OjcXg='
network.@wireguard_wg_srv0[1].allowed_ips='10.140.140.12/32'
If the values are set via LuCI, I can change them with uci afterwards.
# uci set network.@wireguard_wg_srv0[0].allowed_ips="10.140.140.11/32"
I'm able to set the global entries by uci instead of LuCI. No problem so far.
# uci set network.wg_srv0="interface"
# uci set network.wg_srv0.proto="wireguard"
# uci set network.wg_srv0.private_key="mJBT9SSpC8+1J7te7iWifzbJ1RCSwCfuHLGbk+CwQEo="
# uci set network.wg_srv0.listen_port="12345"
# uci add_list network.wg_srv0.addresses="10.140.140.1/24"
# uci add_list network.wg_srv0.addresses="fdf1::1/64"
But I dont understand to add a peer with uci.
Let's try to add the first entry. The first line seems to be ok, since I got not error message.
But the second line gives me an error. Why that?
# uci set network.@wireguard_wg_srv0[0]=wireguard_wg_srv0
# uci set network.@wireguard_wg_srv0[0].description='Peer1'
uci: Invalid argument
When looking for the entries I get only the global values. No peer entries.
The first added line is not there ...
# uci show network |grep wg
network.wg_srv0=interface
network.wg_srv0.proto='wireguard'
network.wg_srv0.private_key='mJBT9SSpC8+1J7te7iWifzbJ1RCSwCfuHLGbk+CwQEo='
network.wg_srv0.listen_port='10000'
network.wg_srv0.addresses='10.140.140.1/24' 'fdf1::1/64'
So my final question is: How to add the peer (list) entries in LuCI style with uci?
Henning