Age | Commit message (Collapse) | Author |
|
To use the luci-lib-jsonc parser as sink for an ltn12 pump (for example
from stdin), the following code will now do:
require 'luci.ltn12'
require 'luci.jsonc'
local parser = luci.jsonc.new()
luci.ltn12.pump.all(luci.ltn12.source.file(io.input()), parser:sink())
print(parser:get())
Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
To be consistent with the behavior of luci-lib-json, an empty Lua table
should be encoded to an empty JSON list, not an empty JSON object.
To still allow encoding empty JSON objects, the usage of anything other
than a number or a string as a key (for example an empty table or a
function) can be used to force encoding as an object:
json.stringify({}) -- "[]"
json.stringify({[{}] = true}) -- "{}"
Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
|
|
Previously, the following caused a segmentation fault:
json.stringify({[{}] = true})
This was caused by lua_tostring() returning NULL for anything but
strings and numbers, letting json_object_object_add crash.
This patch makes jsonc ignore all keys which have no string
representation altogether.
Signed-off-by: Jan-Philipp Litza <janphilipp@litza.de>
|
|
Musl libc requires the length parameter of getnameinfo() to be exactly
`sizeof(struct sockaddr_in)` or `sizeof(struct sockaddr_in6)`, depending on
the passed sockaddr family.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
There is currently no way to encode an empty object {}, as empty tables are
encoded as empty lists [].
With this patch, encode() will ignore table fields with the key json.null (which
doesn't make sense anyways). This allows adding a field with key json.null to
force encoding it as an object.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
* Add luci.ip.cidr.is6mapped4() to test whether an IPv6 CIDR is a mapped IPv4 one
* Add luci.ip.cidr.mapped4() to derive IPv4 from mapped CIDR
* Remove mapped IPv4 workaround from constructor as it breaks genuine addrs like ::ffff:0
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
* Fix broken neighbor filtering by address range due to uninitialized memory
* Fix wrong sizeof in _cidr_add_sub when adding/substracing IPv6 addresses
* Properly convert numeric values to IPv6 addresses
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
If an ip6gre interface is queried, the resulting link local address string
of 47 byte overflowed the buffer of 32 bytes used to hold the translated
address.
Increase the address string buffer to 48 byte and check the address length
prior to writing it into the buffer to avoid future problems with longs
link local addresses.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Add new luci.ip library which is an api compatible C reimplementation
of ip.lua. It also supports dumping the system routing table and neighbour
entry database via netlink.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
* Rename subdirectories to their repective OpenWrt package names
* Make each LuCI module its own standalone package
* Deploy a shared luci.mk which is used by each module Makefile
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
Merges libs/core, libs/ipkg, libs/web, libs/sys, libs/sgi-cgi, libs/sgi-uhttpd,
modules/admin-core, themes/base and protcols/core into modules/base and renames
luci-lib-core to luci-base.
|
|
|
|
callback is passed (#671)
|
|
implementation
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
env.CONTENT_LENGTH as passed by uhttpd might be a string, so explicitely
convert it using tonumber().
Issue has been reported by Catalin Patulea <cat@vv.carleton.ca>
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
integration
|
|
|
|
return ip,mac table this can use in a for loop "for ip,mac in pairs(t) do" Thanx Cyrus
|
|
|
|
|