| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Return the resolved name in addition to the type when looking up sections
through `get()` - for example a `cursor:get("firewall", "@rule[0]")` will
now return two values in the form ("rule", "cfg0a92bd") instead of only
the type name.
This is mainly useful to resolve extended section names without having to
reimplement the section count logic in Lua code.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5beb95da3dbec6db11a6bdfaab7807ee2daf41e6)
|
|
|
|
|
|
|
|
|
|
|
|
| |
Wrap uci_lookup_ptr() to enable extended section format lookups
when the passed section literal is in "@" notation.
This allows calls in the form `cursor:get("conf", "@stype[0]", "opt")`
which is useful to resolve options in numerically indexed anonymous
sections.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit ff33bb219bc409ce3071734a1c28d9165392d6ea)
|
|
|
|
|
|
|
|
| |
Different distributions have different names for the lua 5.1 package.
Use cmake's built in pkg-config support to search for the first one,
rather than running it explicitly and searching for a single version.
Signed-off-by: Karl Palsson <karlp@remake.is>
|
|
|
|
|
|
|
|
| |
The rename() syscall operates on the destination path directly, therfore
resolve the real path before doing the rename to not clobber the destination
in case it is a symlink pointing to another file.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
| |
Otherwise cmake uses files from system which sometimes isn't wanted, ie.
for testing.
Signed-off-by: Petr Å tetiar <ynezz@true.cz>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If strict mode is enabled and we're parsing a config file with multiple
sections of the same name but different types, then raise a parse error
to notify the user that the subsequent section declaration would shadow
all prior ones of the same name.
The error would be triggered by a config like that:
config typeA example
option test 1
config typeB example
option test 2
In such a case, libuci will raise this error:
uci: Parse error (section of different type overwrites prior section with same name) at line 4, byte 23
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
| |
Avoids creating useless entries in the kernel dentry cache
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
|
|
|
|
| |
In e2b1433b the autoload param went from being an enumerated type to a
simple boolean. Drop the pointless double check of this flag.
Signed-off-by: Karl Palsson <karlp@remake.is>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
|
|
|
|
|
|
|
| |
The check for nil on the 2nd argument misses the offset in order to skip over
implicit self which results in
`bad argument #2 to 'foreach' (string expected, got nil)`
when invoking `uci.cursor():foreach("test", nil, function(s) end)`.
The same call works fine when using dot instead of colon notation.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
|
| |
It can be too expensive during filesystem initialization, and it is not
required for atomic handling of config changes.
If the write gets interrupted, the config file will always contain
either the new state or the old state
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
| |
Reported by sarumpaet [1]
[1] uci fails to handle long values properly,
https://github.com/openwrt/packages/issues/1231
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
| |
- Introduce cli_error() for printing local errors.
- Convert existing fprintf(stderr, ) and perror() to cli_error().
- N.B. error messages will still be printed if they occured before -q
flag was parsed.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
| |
Newly added savedir should be at the last position while
uci_add_delta_path() will add it to the position second to the last.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
| |
- With "uci -P xxx/ export", changes in "xxx/" should be applied last.
- With "uci -p xxx/ commit", changes in "xxx/" should be applied before
ctx->savedir.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
| |
- Make ctx->savedir sit at the end of ctx->delta_path.
- Add notes to uci_set_savedir() and uci_add_delta_path() to document
the behaviour changes.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before commit "b121dd lua: add lua 5.2 compatibility changes", the
module table was filled by luaL_register() which would leave the table
at the top of the stack. But in current code the module table will be
popped by lua_setglobal() causing the return value defaulting to boolean
value true.
Also fix the return value of luaopen_uci() to 1 to indicate the number
of return value on stack.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
| |
It's a bug revealed by commit 446e774 "cli: properly unload package
before quit". The current code would exit with value 1 even if
uci_export() succceeded.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
| |
While at it, use UCI_OK instead of literal integer 0 for return value of
uci_lookup_ptr().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
|
|
| |
When doing "uci show network.nilsection", the current behaviour is that
uci will emit a error message complaining "Entry not found", then
continue to show all content of the package network itself. This is
couter-intuition.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
| |
Also fix the false error message about absence of uci-static.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
| |
- Remove unreachable call to uci_parse_error().
- Fix false claim of unterminated double quote to single quote.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
| |
Currently, it's possible that pointers returned by next_arg() could be
invalidated by another call to next_arg() due to uci_realloc().
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
|
|
|
| |
- Remove deprecated uci-static and ucimap-example from .gitignore.
- Minor code formatting fix.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
|
|
|
|
| |
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
|