Commit graph

1655 commits

Author SHA1 Message Date
David Bauer
5b4eb1dff7 rpcd-mod-luci: support parsing 11ax HW / HT modes
Add support for parsing 11ax modes returned from UBUS. This is required
so the frontend can display information about supported 11ax operation.

Signed-off-by: David Bauer <mail@david-bauer.net>
(cherry picked from commit 7b11e848ac)
2021-10-12 23:00:29 +02:00
Jo-Philipp Wich
5ca9e86cbf rpcd-mod-luci: bump version
Fixes: a78b74784d ("rpcd-mod-luci: refactor host hint gathering")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a26b53314d)
2021-06-15 10:03:22 +02:00
Jo-Philipp Wich
e0a32b2749 rpcd-mod-luci: refactor host hint gathering
- Do not incorrectly put the IP addresses from the rrdns reply into the
   first hint, instead distribute hostnames to the appropriate hints.

 - Avoid returning stale lease information from previously parsed records
   by clearing the static struct before each parse attempt.

 - Improve existing checks for empty MAC addresses and unspecified IPv6
   addresses.

Fixes: #5126
Fixes: 87bcf9e923 ("rpcd-mod-luci: Return array of addresses in getHostHints")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a78b74784d)
2021-06-14 21:53:32 +02:00
Jo-Philipp Wich
aea75e6593 rpcd-mod-luci: add link details to ubus netdev information
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 113c0b0d26)
2021-06-12 20:01:57 +02:00
Niels Widger
87bcf9e923 rpcd-mod-luci: Return array of addresses in getHostHints
Update luci-rpc's getHostHints method to return two string arrays for
each host, `ipaddrs` and `ip6addrs`, each containing the host's IPv4
and IPv6 addresses, respectively.  Each array is sorted by a priority
derived from the source from which the address was discovered.  The
current address sources and their priority is as follows (a
higher (larger) priority is listed first):

    - neighbor table entries: 10
    - /etc/ethers entries:    50
    - DHCP leasefile:        100
    - RRDNS queries:         100
    - getifaddrs():          200
    - UCI static leases:     200

The existing `ipv4` and `ipv6` string fields for each host in
`getHostHints` has been removed.  Downstream users of getHostHints
still need to be updated.

Fixes: #4838
Signed-off-by: Niels Widger <niels@qacafe.com>
[squash commits, reformat fixes tag]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit a5195e7825)
2021-06-12 19:23:25 +02:00
Jo-Philipp Wich
e5900b3bfe rpcd-mod-luci: expose devtype and iflink properties in getNetworkDevices
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 71feaa5285)
2021-06-12 19:20:50 +02:00
Niels Widger
bf34ccdfc0 rpcd-mod-luci: Fix parsing of DUID-LLT's in duid2ea
Fix parsing of DUID-LLT's in duid2ea.  Unlike DUID-LL's, DUID-LLT's have a 32-bit time field between the hardware type and link-layer address fields, see RFC 3315 Sections 9.2 and 9.4:

https://tools.ietf.org/html/rfc3315#section-9.2
https://tools.ietf.org/html/rfc3315#section-9.4

therefore, the link-layer address starts at offset 16 instead of 8.

Signed-off-by: Niels Widger <niels@qacafe.com>
(cherry picked from commit 8920a2bf71)
2021-03-01 08:55:46 +01:00
Andre Heider
8b90932329 rpcd-mod-luci: get rid of now unused getDSLStatus ubus rpc
Good riddance.

Signed-off-by: Andre Heider <a.heider@gmail.com>
Tested-by: Martin Schiller <ms@dev.tdt.de>
2021-01-26 07:10:19 +01:00
Jo-Philipp Wich
bc121a5a45 rpcd-mod-luci: allow finding suffixed libwinfo.so
Recent versions ship a version suffixed libiwinfo.so, therefor we cannot
rely on a fixed path name anymore. Use globbing to find matching libraries
and load the first one we find.

Fixes: #4718
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-01-08 18:34:17 +01:00
Karel Kočí
2e0a445ed5
rpcd-mod-*: improve postinst script
Usage of killall is replaced with init script. This is cleaner solution
as it does not consider some implementation detail but rather passes
that on to init script implementation.

IPKG_INSTROOT was added to prevent execution when not running in current
root. It is invalid to request reload if install-root is not current
root. In this case it can be considered harmless but it is invalid
nonetheless.

Last change is removal of `exit 0`. This caused skip of default
postinst. Execution of default postinst does no harm and is more
standard considering possible future expansion of it.

Signed-off-by: Karel Kočí <karel.koci@nic.cz>
2020-12-07 17:01:17 +01:00
Jo-Philipp Wich
d9b4f036ea rpcd-mod-luci: bump version
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-07 22:10:25 +01:00
Jo-Philipp Wich
0c7a335230 rpcd-mod-luci: handle lease files from all dnsmasq/odhcpd sections
Fixes: #911, #4303, #4308
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-11-07 00:25:22 +01:00
Jo-Philipp Wich
bd40525a69
Merge pull request #4373 from wjowsa/ubus-connect-args
luci-base: Add possiblity to set path and timeout of ubus connection
2020-10-30 21:28:02 +01:00
Santiago Piccinini
62505bdd2d luci-lib-ip: fix tolinklocal invalid ipv6 result
Force zeroing uninitialized memory.

Signed-off-by: Santiago Piccinini <spiccinini@altermundi.net>
2020-09-06 18:15:29 -03:00
Paul Spooren
c4a4e43e2e treewide: replace which with command -v
Fix shellcheck SC2230
> which is non-standard. Use builtin 'command -v' instead.

Once applied to everything concerning OpenWrt we can disable the busybox
feature `which` and save 3.8kB.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2020-08-20 15:54:54 -10:00
Wojciech Jowsa
1f6dc29f74 luci-base: Add possiblity to set path and timeout of ubus connection
It might happen (e.g. when downloading a large file with low speed
connection) that the ubus connection will time out.
The ubus_connect function allows to specify
ubus socket path and ubus connection timeout
so it should allowed to set these arguments from luci.

Signed-off-by: Wojciech Jowsa <wojciech.jowsa@gmail.com>
2020-08-19 13:00:49 +02:00
Sven Roederer
68521fca04 luci-base(-libs): move pcdata() and striptags() from util- to xml-class
To complete the previous commit these functions are defined in the resulting
luci-base package but are also used in the new luci-base-libs package. So
move them into the new xml-module of the new package.

Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
2020-07-19 20:14:35 +02:00
Sven Roederer
8b8d83e42d luci-base: move some generic classes into a separate luci-base-libs package
The new package luci-base-libs provides the modules that not strictly relate
to the web-interface of luci. By separating these libs they can be used by
other packages without having to install the web-components.
This change was inspired by providing a shell-only interface for 4MB-flash
devices, by keeping as much code common with a full install.

Signed-off-by: Sven Roederer <freifunk@it-solutions.geroedel.de>
2020-07-19 20:14:22 +02:00
Rosen Penev
6555d3f587
move nixio__bin2hex to header and make static
This fixes compilation under GCC10.

There's no reason for this to be in a C file anyway.

Also fixed a -Wmissing-prototypes warning with nixio__addr_prefix.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-06-21 19:58:53 -07:00
Jo-Philipp Wich
d1134c1a40
Merge pull request #3676 from Tarnyko/master
luci-lib-nixio: allow building with Lua5.2/LuaJIT
2020-06-16 17:27:01 +02:00
Daniel F. Dickinson
119166ddba treewide: Remove myself as maintainer
Life changes, I'm no longer avaiable to be an sufficiently active
OpenWrt developer.  Therefore removing myself from maintainer from
all packages I maintained in OpenWrt.

All the best for those who keep up the good work!

Signed-off-by: Daniel F. Dickinson <cshored@thecshore.com>
2020-03-20 14:49:07 -04:00
Jo-Philipp Wich
ff4111f657 rpcd-mod-luci: use correct dlopen() flags
Fixes: #3707
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-03-02 08:18:30 +01:00
Manuel BACHMANN
6c0b8a40f7 luci-lib-nixio: allow building with Lua5.2/LuaJIT
Lua 5.1 defines a "luaL_Reg" alias for deprecated
"luaL_reg", but Lua >= 5.2 and LuaJIT do not.
Replace by "luaL_Reg", and define a "luaL_reg"
alias in case we build with old Lua 5.0.

Signed-off-by: Manuel BACHMANN <tarnyko@tarnyko.net>
2020-02-24 11:04:54 +01:00
Jo-Philipp Wich
3702e13f54 rpcd-mod-luci: honour dhcp leases without ip address for host hints
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-13 19:26:33 +01:00
Jo-Philipp Wich
c2eeb09bd9 luci-lib-ip: explicitly clear scope when allocating new userdata
Fixes: #3609
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2020-02-08 11:03:56 +01:00
Jo-Philipp Wich
5cbbfaba3e 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>
2020-01-23 12:33:49 +01:00
Balázs Úr
39196b0de9 luci-app-fwknopd: fix typos
Signed-off-by: Balázs Úr <balazs@urbalazs.hu>
2019-12-20 23:12:48 +01:00
Jo-Philipp Wich
d87169c0f6 luci-lib-httpclient: accept scoped IPv6 addresses
Ref: https://github.com/openwrt/luci/issues/3380
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-09 17:36:05 +01:00
Jo-Philipp Wich
f7a7f89e0c luci-lib-ip: support scoped IPv6 addresses
Ref: https://github.com/openwrt/luci/issues/3380
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-12-09 17:31:51 +01:00
Jo-Philipp Wich
956fd4a579 rpcd-mod-luci: bump version
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-14 13:49:40 +01:00
Jo-Philipp Wich
824cb65840 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>
2019-11-14 13:46:07 +01:00
Jo-Philipp Wich
8da8f38bf9 luci-lib-jsonc: store large JSON integer values as Lua doubles
Fixes: #3293
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2019-11-13 09:11:09 +01:00
Jo-Philipp Wich
b3681bd9dc 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>
2019-11-08 10:02:37 +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