summaryrefslogtreecommitdiffhomepage
AgeCommit message (Collapse)Author
2023-06-06Merge pull request #156 from nbd168/nl80211-iftypesJo-Philipp Wich
nl80211: add constants for iftypes
2023-06-05nl80211: add constants for iftypesFelix Fietkau
Useful for adding/removing interfaces Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-30Merge pull request #155 from luizluca/luizluca-patch-1Jo-Philipp Wich
README.md: fix debian dependencies
2023-05-30compiler: fix memory leak in uc_compiler_compile_import on early exitChristian Marangi
Fix Coverity Scan CID 1521107 reporting a memory leak in uc_compiler_compile_import on early exit due to namelist not correctly put before return. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> [add empty line before return] Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-05-29README.md: fix debian dependenciesLuiz Angelo Daros de Luca
Build fails without pkg-config. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
2023-05-28vm: immediately release arguments on calls with invalid spreadsJo-Philipp Wich
Ensure to release the `this` context and the temporary argument stash when we raise a non iterable type exception due to non-iterable values while precessing spread operations in function call arguments. Those values would've been garbage collected eventually but explicitly releasing them here will allow the vm to free them immediately. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-05-27Merge pull request #150 from nbd168/misc-improvementsJo-Philipp Wich
2023-05-27vm: clear vm->alloc_refs in uc_gc_commonFelix Fietkau
This avoids unnecessary gc calls when configuring a gc interval while also explicitly calling ucv_gc from C code embedding a vm at convenient points in time. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-27ubus: add support for strings containing null bytesFelix Fietkau
When converting ucode strings to blobmsg, use blobmsg_add_field in order to explicltly pass the length of the data. In the other direction, use ucv_string_new_length based on the attribute length. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-27struct: remove state->lenFelix Fietkau
It is unused and I couldn't find any purpose for it Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-27main: add user specified library search paths before default pathFelix Fietkau
Allow -L to add library paths that take precedence over the built-in ones. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-05-27Merge pull request #152 from Ansuel/fix-memory-leakJo-Philipp Wich
program: fix memory leak in read_sourceinfo
2023-05-27program: fix memory leak in read_sourceinfoChristian Marangi
Fix Coverty Scan CID 1521109 reporting a memory leak for path not freed on read_size_t fail. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-05-26Merge pull request #151 from ynezz/ynezz/unbreak-ciJo-Philipp Wich
ci: unbreak failing builds by using fixed gh-actions-openwrt-ci-sdk
2023-05-26ci: update the workflowsPetr Štetiar
* use mediatek/mt7622 SDK to have arm64 build test coverage * use latest Ubuntu container to stay current * use v3 of checkout action to stay current Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-05-26ci: cancel concurrent buildsPetr Štetiar
To save some build resources, lets cancel ongoing builds after force pushing new sources into the pull request branch. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-05-26ci: fix broken imx6-generic SDK buildPetr Štetiar
imx6-generic was renamed to imx-cortexa9 Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-05-26ci: unbreak failing builds by using fixed gh-actions-openwrt-ci-sdkPetr Štetiar
SDK containers hosted under `openwrtorg` Docker organization were deprecated so lets use fixed action which uses new `openwrt` organization. References: https://lists.openwrt.org/pipermail/openwrt-devel/2023-March/040728.html Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-04-03Merge pull request #148 from jow-/uci-fix-commitJo-Philipp Wich
uci: fix ctx.commit() without arguments
2023-04-03uci: fix ctx.commit() without argumentsJo-Philipp Wich
A uci commit operation may invalidate the package pointer, leading to an infinite loop while iterating the packages to commit. Refactor the code to first build a string list of configurations, then iterating it in order to avoid the iterator invalidation. While we're at it, also allow restricting save and revert operations to single configs, which was rejected as invalid before. Fixes: #146 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-03-17ucode: also link libresolv if ns_initparse() is not foundJo-Philipp Wich
Recent glibc versions require linking libresolv to obtain ns_initparse(). Fixes: #144 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-03-17ubus: support multiple call return valuesJo-Philipp Wich
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-02-13Merge pull request #143 from nbd168/rtnl-fixJo-Philipp Wich
rtnl: add missing uc_vm_registry_set call
2023-02-13rtnl: add missing uc_vm_registry_set callFelix Fietkau
Fixes maintaining the listener array Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-13Merge pull request #142 from nbd168/ref-fixesJo-Philipp Wich
Fix reference count issues
2023-02-13rtnl: add missing ucv_get() callsFelix Fietkau
Arguments stored in the registry need an extra reference Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-13nl80211: add missing ucv_get() callsFelix Fietkau
Arguments stored in the registry need an extra reference Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-02-12Merge pull request #141 from dhewg/masterJo-Philipp Wich
nl80211: fix NL80211_ATTR_SURVEY_INFO
2023-02-12nl80211: fix NL80211_ATTR_SURVEY_INFOAndre Heider
This is the last attribute, adapt .nattr to include it so it gets parsed. Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-02-01Merge pull request #140 from nbd168/rtnlJo-Philipp Wich
rtnl: add support for registering an uloop based listener
2023-01-31rtnl: add support for registering an uloop based listenerFelix Fietkau
Similar to nl80211 uloop listener Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-23Merge pull request #138 from nbd168/nl80211Jo-Philipp Wich
nl80211: add support for registering an uloop based listener
2023-01-23types: fix array unshift operations and add test coverageJo-Philipp Wich
- Fix `ucv_array_unshift()` improperly rejecting operation on empty arrays - Fix `uc_unshift()` improperly reversing maintaining argument order - Add missing test coverage for `push()`, `pop()`, `unshift()` and `shift()` array operations. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-01-20fs: implement `fs.pipe()`Jo-Philipp Wich
The `pipe()` function takes no arguments and will return a two element array containing open read- and write file descriptors for a newly created pipe. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-01-19nl80211: add support for registering an uloop based listenerFelix Fietkau
Can be used to capture nl80211 messages in an event driven program Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-19nl80211: refactor command bitmask handlingFelix Fietkau
- add missing overflow check - make array size dynamic - set all bits if command id is not specified - add helper function for filling command bits Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-16style: add .editorconfig fileJo-Philipp Wich
Add an `.editorconfig` file to the source root in order to document the preferred source code indentation style. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-01-09Merge pull request #137 from ynezz/ynezz/isattyJo-Philipp Wich
fs: add `isatty()` function
2023-01-09fs: add `isatty()` functionPetr Štetiar
Expose the `isatty(3)` libc function in the fs module to allow checking whether a file descriptor refers to a terminal. Signed-off-by: Petr Štetiar <ynezz@true.cz>
2023-01-09Merge pull request #136 from blogic/masterJo-Philipp Wich
nl80211: add support for NL80211_ATTR_MPATH_INFO
2023-01-09nl80211: add support for NL80211_ATTR_MPATH_INFOJohn Crispin
Signed-off-by: John Crispin <john@phrozen.org>
2023-01-07Merge pull request #134 from nbd168/thisvalJo-Philipp Wich
include: add uc_fn_thisval()
2023-01-06include: add uc_fn_thisval()Felix Fietkau
Can be used to get rid of a layer of pointer indirection in resource type handlers. Signed-off-by: Felix Fietkau <nbd@nbd.name>
2023-01-06build: make rtnl/nl80211 depend on linux instead of !APPLEFelix Fietkau
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2022-12-13README.md: various spelling and documentation fixesJo-Philipp Wich
Fixes: #132 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-12-02tests: fixup testcasesJo-Philipp Wich
Adjust expected testcase outputs after double format change in the previous commit. Fixes: 4c654df ("types: adjust double printing format") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-12-02types: adjust double printing formatJo-Philipp Wich
Change the printf format for formatting doubles from `%g` to `%.14g`. This matches the behaviour of Lua 5.1.5 with LNUM used on OpenWrt and ensures that expressions such as `print(31764740.0 / 100)` yield the expected `317647.4` result and not a truncated (rounded down) value of `317647`. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-29Merge pull request #131 from jow-/fix-logical-assignment-operators-2Jo-Philipp Wich
2022-11-29compiler: fix bytecode for logical assignments of propertiesJo-Philipp Wich
The compiler emitted incorrect bytecode for logical assignment operations on property expressions. The generated instructions left the stack in an unclean state when the assignment condition was not fulfilled, causing a stack layout mismatch between compiler and vm, leading to undefined variable accesses and other non-deterministic behavior. Solve this issue by rewriting the bytecode generation to yield an instruction sequence that does not leave garbage on the stack. The implementation is not optimal yet, as an expression in the form `obj.prop ||= val` will load `obj.prop` twice. This is acceptable for now as the load operation has no side effect, but should be solved in a better way by introducing new instructions that allow for swapping stack slots, allowing the vm to operate on a copy of the loaded value. Also rewrite the corresponding test case to trigger a runtime error on code versions before this fix. Fixes: fdc9b6a ("compiler: fix `??=`, `||=` and `&&=` logical assignment semantics") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2022-11-29Merge pull request #130 from jow-/fs-add-realpathJo-Philipp Wich
fs: add `realpath()` function