Age | Commit message (Collapse) | Author |
|
Only store the callback reference in the registry once the listener
context was successfully initialized, to avoid keeping a lingering
entry when invalid parameters are passed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- The expected length was incorrect
- An incorrect MCS MAP index was accessed
- The maximum MCS index number were wrong
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The length constraint of 16 byte was incorrect, the attribute is 8 bytes
long; two bytes for the RX MCS set, two bytes for the highest RX rate,
two bytes for the TX MCS set and two bytes for the highest TX rate.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The attributes are arrays of 6 and 11 u8 values respectively.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
Allows other C code to gain access to the ubus context without having to know
the layout of the other fields.
Also reduce the amount of unnecessary pointer indirection
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
uloop: support new interval and signal APIs
|
|
syntax: don't treat `as` and `from` as reserved keywords
|
|
ECMAScript allows using `as` and `from` as identifiers so follow suit
and don't treat them specially while parsing. Extend the compiler logic
instead to check for TK_LABEL tokens with the expected value to properly
parse import and export statements.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add bindings for the new uloop interval and signal handling APIs and extend
the CMake logic to properly detect the presence of these facilities.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Check if `-D_FORTIFY_SOURCE` was already passed via the CFLAGS environment
variable and only add the flag if not already present.
Fixes: ea046bd ("build: enable source fortification by default")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
On macOS, the `memmem()` function returns `NULL` instead of the expected
start of the haystack string when given a zero-length needle argument.
Add special case handling for a zero-length needle argument to ensure
that the expected offset `0` is returned on all systems.
Ref: #176
Suggested-by: Erwan MAS <erwan@mas.nom.fr>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
When compiling with optimizations, gcc reports:
.../nl80211.c: In function ‘uc_nl_convert_rta_vht_mcs’:
.../nl80211.c:1310:31: error: ‘max_idx’ may be used uninitialized [-Werror=maybe-uninitialized]
1310 | for (j = 0; j <= max_idx; j++)
| ~~^~~~~~~~~~
Slightly refactor the code to avoid this issue.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
When building against glibc with enabled source fortification, gcc reports
the following issue:
.../vm.c: In function ‘uc_vm_signal_raise’:
.../vm.c:3161:9: error: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’ [-Werror=unused-result]
3161 | write(vm->signal.sigpipe[1], &signum, sizeof(signum));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since we cannot do any meaningful handling of a potential write error in
the affected signal handler context, simply solve this issue by wrapping
the `write()` call into an empty `if ()` statement.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Also switch debug builds to -Og instead of -O0 in order to make
-D_FORTIFY_SOURCE=2 effective for debug builds.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Switch to a custom fork of the clean jsdoc theme to address a number
of quirks and to directly incorporate CSS and markup changes.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Fix the jsdoc C transpiler plugin to properly detect the start of indented
multi line comment blocks.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add missing documentation for the `require()` function and factor our
the description of the compile options dictionary into a separate typedef.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In case `uci.cursor.configs()` is invoked with a completely empty
configuration directory, the empty configuration list is not free
before returning the `UCI_ERR_NOTFOUND` status.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Various documentation improvements
|
|
Re-trigger workflow runs for pull requests if the source branch is
amended or force pushed.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Consistently use nullable instead of `type|null` expressions
- Use @borrows to reduce some duplicated documentation blocks
- Add typedef for timelocal()/timegm() TimeSpec value
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Add complete JSDoc documentation coverage for the uci module.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
- Reduced margins
- Better visual separation of method descriptions
- Improved display of argument and return value attributes
- Improved display of object and array type descriptions
- Shortened absolute module name paths
The local JavaScript fixups are a stop-gap measure for now, in the long
it likely makes more sense to fork the used JSDoc theme to apply the
desired changes directly to the markup.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
lib: introduce log library
|
|
Introduce a new `log` library which provides bindings for syslog and,
if available, the OpenWrt libubox ulog functions.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Decide based upon the found libraries whether to enable certain, OpenWrt
specific modules by default.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Convert cmake directives into lowercase notation for better readability.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Misc fixes
|
|
We want pull request workflows to run, even if the source branch happens
to be `master` from a forked repository.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Accept char * const *, cast internally. Fixes a compile error
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
The `%g` printf format used for serializing double values into strings
will not include any decimal place if the value happens to be integral,
leading to an unwanted double to integer conversion when serializing
and subsequently deserializing an integral double value as JSON.
Solve this issue by checking the serialized string result for a decimal
point or exponential notation and appending `.0` if neither is found.
Ref: #173
Suggested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
rtnl: add IFLA_IF_NETNSID for operating in other namespaces
|
|
Signed-off-by: Packet Please <pktpls@systemli.org>
|
|
Signed-off-by: Packet Please <pktpls@systemli.org>
|
|
Make the `splice()` documentation match the actual implementation.
Fixes: #170
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Documentation improvements
|
|
Add full documentation coverage for the struct module by utilizing large
parts of the Python struct module documentation for the format string
description.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
types: improve comparison reliability of binary strings
|
|
The existing `ucv_compare()` implementation utilized `strcmp()` to compare
two ucode string values, which may lead to incorrect results for strings
containing null bytes as the comparison prematurely aborts when encountering
the first null.
Rework the string comparison logic to use `memcmp()` for comparing both ucv
strings with each other in order to ensure that expressions such as
`"" == "\u0000"` lead to the expected `false` result.
Ref: https://github.com/openwrt/luci/issues/6530
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce debug library
|
|
Introduce a new debug library which provides introspection facilities
for debugging ucode scripts.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Get rid of most __APPLE__ guards by introducing a central platform.c unit
providing drop-in replacements for missing APIs.
Also move system signal definitions into the new platform file to be able
to share them with the upcoming debug library.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Introduce signal handling
|
|
When the VM instance loading the uloop module has signal dispatching
enabled, implicitly register the signal pipe as file descriptor in the
global uloop and dispatch received signals to the VM instance.
This ensures that the respective managed ucode signal handlers are
invoked immediately and not just after `uloop_run()` returns.
Also end the uloop in case any invoked signal handler threw an
exception, to match the expected behaviour with other kinds of
callbacks.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
The `signal()` standard library function provides functionality for
registering signal handler callbacks, restoring default signal behaviour
or ignoring specific signals.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
Enable signal dispatching by default for standalone ucode programs.
Also adjust the `gc()` testcase output as the default number of
allocations with enabled signal dispatching changes slightly.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
In order to prevent a premature release of the managed ucode signal handler
callbacks, ensure to treat the containing array as GC root to mark the
function values as reachable.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|