Commit graph

1629 commits

Author SHA1 Message Date
Jo-Philipp Wich
b349428e16 luci-lib-ip: explicitly initialize address scope value
Explicitly initialize the address scope value to zero in parse_cidr() and
L_setaddr() to avoid stray scope identifiers getting added when formatting
the address object as string.

Fixes: 1d2b4c777 ("luci-lib-ip: support scoped IPv6 addresses")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 5cbbfaba3e)
2020-01-23 12:37:40 +01:00
Jo-Philipp Wich
af5d665a70 luci-lib-httpclient: accept scoped IPv6 addresses
Ref: https://github.com/openwrt/luci/issues/3380
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit d87169c0f6)
2019-12-10 12:32:06 +01:00
Jo-Philipp Wich
1d2b4c777f luci-lib-ip: support scoped IPv6 addresses
Ref: https://github.com/openwrt/luci/issues/3380
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit f7a7f89e0c)
2019-12-10 12:31:57 +01:00
Jo-Philipp Wich
3acf072a57 rpcd-mod-luci: bump version
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 956fd4a579)
2019-11-14 13:50:16 +01:00
Jo-Philipp Wich
8a6cf56277 rpcd-mod-luci: handle multiple IPv6 addresses per lease
Ref: https://forum.openwrt.org/t/luci-not-showing-2nd-ipv6-address/48271
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 824cb65840)
2019-11-14 13:50:16 +01:00
Jo-Philipp Wich
bd1e6d65a2 luci-lib-jsonc: store large JSON integer values as Lua doubles
Fixes: #3293
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 8da8f38bf9)
2019-11-13 09:12:08 +01:00
Jo-Philipp Wich
ed3aef0dd5 rpcd-mod-luci: various improvements
- Properly handle infinite dnsmasq leases
 - Use a more efficient approach to free internal AVL trees
 - Remove redundant uci context creation
 - Add new getDUIDHints method

Fixes: #3277
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit b3681bd9dc)
2019-11-08 16:04:18 +01:00
Jo-Philipp Wich
af88f9a006 rpcd-mod-luci: properly deal with failing ubus requests
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 19:57:14 +01:00
e9hack
dbafa93e81 rpcd-mod-luci: handle DHCPv6 leases in dnsmasq lease file
For DHCPv6, the second entry of a lease is the IAID. The parsing code
expects a MAC instead of a IAID.

Reported-by: Hartmut Birr <e9hack@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-03 17:56:58 +01:00
Jo-Philipp Wich
aa5151e2d1 rpcd-mod-luci: bump version
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-02 20:44:22 +01:00
Jo-Philipp Wich
180f6b78a2 rpcd-mod-luci: fix crash on not existing uci options
Checking the return value of uci_lookup_ptr() is not enough to ensure that
the requested optiomn has actually been found.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-02 20:14:25 +01:00
Jo-Philipp Wich
8234d03340 rpcd-mod-luci: depend on libnl-tiny, do not runtime depend on libiwinfo
Also fix package description.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-02 15:06:49 +01:00
Jo-Philipp Wich
b292c1d5fa libs: add rpcd-mod-luci
Add rpcd-mod-luci, a fast rpcd C plugin for speeding up common backend
ubus operations.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-01 12:03:28 +01:00
Patrick Grimm
498b1fe65f luci-lib-luaneightbl: drop package - all functions ar also in luci-lib-ip
Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
2019-10-21 17:37:34 +02:00
Jo-Philipp Wich
d73553e530 luci-lib-ip: support specifying source address in route()
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-08-06 15:19:50 +02:00
Jo-Philipp Wich
16f23de977 luci-lib-nixio: fix compilation
Fixes: #2921
Fixes: f3f42ff09 ("address: Replace ualarm with setitimer")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-07-26 15:11:17 +02:00
Rosen Penev
f3f42ff099
address: Replace ualarm with setitimer
ualarm has been deprecated and may not be available in the libc.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2019-07-19 16:47:38 -07:00
Daniel F. Dickinson
29e01e0e5b luci-app-radicale2: Add v2 of CalDAV/CardDAV server
Radicale 2.x has been out for some time, and has better support for a
number of clients as well as new features, so radicale2 package has
been added to packages, and this is the corresponding UI.

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2019-01-10 05:52:12 -05:00
Jo-Philipp Wich
21db93576a luci-lib-jsonc: prevent infinite recursion in stringify
Also increase the stack size as needed to prevent crashes when serializing
deeply nested tables.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-21 15:41:19 +01:00
Jo-Philipp Wich
a692ca789a luci-lib-httpclient: prevent nil access with invalid IP address literals
Fixes: a54baf7be ("luci-lib-httpclient: revamp URL handling")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-11 09:17:50 +01:00
Jo-Philipp Wich
a54baf7be0 luci-lib-httpclient: revamp URL handling
- Introduce a parse_url() helper which properly deals with literal IPv4
   and IPv6 host parts and returns the decomposed uri string as table
 - Properly format IPv6 literals in autogenerated Host headers
 - Omit default port numbers in Host headers and calculated redirect URLs.

Supersedes PR #2337.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-12-11 09:12:32 +01:00
Jo-Philipp Wich
4bbe32548c luci-lib-ipkg: move out of luci-base
Move the old luci.model.ipkg utility class into a separate package and
let the components using it depend on the new library package.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-11-14 20:46:04 +01:00
Jo-Philipp Wich
0aff452d41 luci-lib-iptparser: fix packaging
The previous commit omitted a subdirectory.

Fixes: 94323a61e ("luci-base: move luci.sys.iptparser into separate package")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-11 08:00:03 +02:00
Hannu Nyman
67fd6b6e5e
Merge pull request #2197 from yangfl/master
treewide: Fix typos in comments
2018-10-10 20:25:11 +03:00
Jo-Philipp Wich
94323a61e1 luci-base: move luci.sys.iptparser into separate package
Since commit f6bfac211 ("luci-mod-status: rework iptables status page"),
nothing in luci-base depends on the iptparser class anymore, so fold it
out into a separate package and let the few apps that require it depend
on the new library package.

Saves about 10K uncompressed in luci-base while the iptables status
rework enlarged the markup by roughly 5KB, saving roughly 5KB of size
overall.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-10-10 13:19:48 +02:00
yangfl
401382a459 treewide: Fix typos in comments
Signed-off-by: David Yang <mmyangfl@gmail.com>
2018-10-10 15:00:07 +08:00
Sophana KOK
f405d23990 restored nixio tls providers
Signed-off-by: Sophana KOK <ml-github@worldspot.net>
2018-09-27 21:12:40 +02:00
Jo-Philipp Wich
cde13dc245 Revert "luci-lib-json: depend on luci-base"
This reverts commit 8ca29efec8.
2018-07-03 12:30:44 +02:00
Jo-Philipp Wich
8ca29efec8 luci-lib-json: depend on luci-base
Fixes #506
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-07-03 11:07:31 +02:00
Jo-Philipp Wich
09de5a74e1 luci-lib-json: support serializing userdata
Fixes the following error when attempting to serialize userdata objects:

    .../json.lua:81: attempt to call local 'parser' (a nil value)

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-05-18 16:59:16 +02:00
Jo-Philipp Wich
b4040aacb0 libs: move http.protocol.{date,mime,conditionals} to luci-lib-httpprotoutils
Also adjust the dependencies of components depending on these classes and
flatten the namespace from luci.http.protocol.* to luci.http.*

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
eb4571c6dc luci-base: fold luci.http.protocol into luci.http
With only the decoder routines remaining in luci.http.protocol, it makes no
sense to keep the low level protocol class around, so fold the remaining code
into the central luci.http class.

Also adjust the few direct users of luci.http.protocol accordingly.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-04-18 16:21:27 +02:00
Jo-Philipp Wich
4f412a76c2 luci-lib-ip: add MAC address calculation support
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:02:55 +01:00
Jo-Philipp Wich
190b32452a luci-lib-nixio: fix spelling mistakes in documentation
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2018-03-12 16:02:27 +01:00
Hannu Nyman
878a64f538 typo: fileystem --> filesystem
fix typo:
sed -i "s/fileystem/filesystem/"

Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
2017-12-28 14:15:16 +02:00
Jo-Philipp Wich
74affdf6f5 rpcd-mod-rrdns: add new rpcd plugin for rapid reverse DNS lookups
The plugin provides a new ubus procedure "network.rrdns.lookup" which
allows looking up the names of a large chunk of IP addresses at once,
within a fixed global timeout.

This is useful to have a guaranteed maximum query time even if the
local DNS setup is broken or timing out.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2017-07-11 14:05:31 +02:00
Quirin Hofstaetter
4a20d2c31a luci-lib-px5g: add license tag
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13 13:40:18 +02:00
Quirin Hofstaetter
3b5a99340b luci-lib-nixio: add license tag
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13 13:40:15 +02:00
Quirin Hofstaetter
eba0900802 luci-lib-json: add license tag
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13 13:40:12 +02:00
Quirin Hofstaetter
ef6729a6bc luci-lib-ip: add license tag
Signed-off-by: Quirin Hofstaetter <qh@dev.tdt.de>
2017-06-13 13:40:09 +02:00
Thorsten M
528f7ab512 changed stat to lstat in nixio_lstat function
Signed-off-by: Thorsten M. <thoto@devtal.de>
2016-09-16 11:06:12 +02:00
Jo-Philipp Wich
ad064f0b03 Merge pull request #563 from cshore/pull-request-app-uhttpd
Pull request app uhttpd
2016-01-15 15:20:41 +01:00
Daniel Dickinson
b130ca554f lib-nixio / luci-base: Fix for reading csrf token prevents file upload
The call to http.formvalue in order to read the csrf token causes
_parse_input to be triggered *before* controllers and cbi maps have
been built.  This results in the failure of file uploads because
the file handler is not yet in place when _parse_input gets called,
and it is in _parse_input that POST data is parsed (including files).

To fix this we add the ability to write file fields to temporary
files (using mkstemp and unlink in nixio.file) and use this to
store file data until the filehandler is registered, with a
fallback to reading the file data into memory.

Once the filehandler callback gets registered we iterate
though all previously parsed (saved) files and copy the
data to the file handler, and then close the temporary
file (which finally removes because we unlinked after
creating the file, but didn't close the file so unlink
was deferred).

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2015-12-15 13:12:29 -05:00
Jan-Philipp Litza
5335f22537 luci-lib-jsonc: Add ltn12-compatible sink factory
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>
2015-09-04 12:21:30 +02:00
Jo-Philipp Wich
daeb2016d6 luci-lib-ip: fix documentation issue
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-09-01 16:49:19 +02:00
Jo-Philipp Wich
ed1a641696 Fix module lines in several luadoc files
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2015-09-01 16:43:19 +02:00
Jan-Philipp Litza
90c841d66e luci-lib-jsonc: Fix memory leak in stringify() 2015-08-31 19:53:51 +02:00
Jan-Philipp Litza
e7645d557c luci-lib-jsonc: allow encoding empty lists
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>
2015-08-30 15:52:33 +02:00
Jan-Philipp Litza
e32a877aa4 luci-lib-jsonc: Ignore non-string-or-number keys in tables
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>
2015-08-30 15:51:17 +02:00
Jo-Philipp Wich
376f038726 luci-lib-nixio: pass exact sockaddr length to getnameinfo()
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>
2015-07-30 22:38:36 +02:00