How to find the anonymous-name in uci

I'm reading this documentation here and I'm looking at the UCI data/object model section regarding anonymous-name. I'm trying to create some uci-defaults scripts to pre-configure some settings from my compiled images and I'm having trouble with upnpd and uci.

I simply want to change the Internal addresses. If I click the Save button without applying, I can see the command UCI will use:

uci set upnpd.cfg02ed70.int_addr=''

I need to change cfg02ed70 to one of these anonymous names. I tried simply removing the auto generated name

uci set upnpd.int_addr=''
uci commit

but this has no effect.

I've only recently started using UCI commands, and I have tried using them in the past and I think I was off-put by not being able to workout how to use the commands without the autogenerated ID/CFGIDs.

Any help much appreciated

1 Like

Use section IDs:

uci show upnpd

Or rename the section and address it by name.


I'm trying to add another SQM section and I'm getting a uci: Invalid argument

uci batch
set sqm.queue[1]=queue
set sqm.queue[1].interface='br-guest'
set sqm.queue[1].download='2000'
set sqm.queue[1].upload='10000'
set sqm.queue[1].verbosity='0'
set sqm.queue[1].qdisc='cake'
set sqm.queue[1].script='layer_cake.qos'
set sqm.queue[1].enabled='1'
# Add named section
uci batch << EOF
set sqm.queue1='queue'
set sqm.queue1.enabled='1'
set sqm.queue1.qdisc='cake'
commit sqm

# Add anonymous section
uci batch << EOF
add sqm queue
set sqm.@queue[-1].enabled='1'
set sqm.@queue[-1].qdisc='cake'
commit sqm

Generating a full UCI section with a simple copy-paste

1 Like

What does the -1 refer to? If I wanted to add a third section would I use -2?

So it's bit like an identifier for rules that are the same?

That's an identifier for the sections of the same type.
It can be used with both named and anonymous sections.

Well thank you for your help @vgaetera. UCI commands are all new to me as I've only just started automating uci-defaults scripts to automate custom firmware images. I will say it's pretty powerful stuff...

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.