Commit Graph

38 Commits

Author SHA1 Message Date
Ansuel Smith
f71e9cbd42 rpcd-mod-luci: strip colon from dnsmasq duid
Dnsmasq DHCPv6 use colons in the generated duid present in the lease file. Strip the colon as this is not supported by the OpenWrt config and follow the same way odhcpd use to display duid.

Fixes: #4543

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
2024-07-26 02:13:46 +02:00
Tony Ambardar
8b08b48df9 rpcd-mod-luci: use standard POSIX header for basename()
The musl libc only implements POSIX basename() but provided a GNU header
kludge in <string.h>, which was removed in musl 1.2.5 [1]. Use the standard
<libgen.h> header to avoid compilation errors like:

luci.c: In function 'rpc_luci_parse_network_device_sys':
luci.c:676:53: error: implicit declaration of function 'basename' [-Werror=implicit-function-declaration]
  676 |                 blobmsg_add_string(&blob, "master", basename(link));
      |                                                     ^~~~~~~~
luci.c:676:53: error: passing argument 3 of 'blobmsg_add_string' makes pointer from integer without a cast [-Werror=int-conversion]
  676 |                 blobmsg_add_string(&blob, "master", basename(link));
      |                                                     ^~~~~~~~~~~~~~
      |                                                     |
      |                                                     int
...
cc1: all warnings being treated as errors

Link 1: https://git.musl-libc.org/cgit/musl/log/?qt=grep&q=basename

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2024-03-06 00:26:29 -08:00
Jo-Philipp Wich
2234d0c5dd
Merge pull request #6104 from dhewg/6g
luci-mod-network: enable configuring wifi ax networks on the 6G band
2023-02-07 14:05:17 +01:00
Jo-Philipp Wich
a570e30006 rpcd-mod-luci: fix reporting network device flags
Fix reporting of ceertain flag values larger than 255, such as IFF_PROMISC
by explicitly casting the bit test expression to a boolean result since
the implicit integer truncation to uint8_t will turn the `0x100` result of
a set IFF_PROMISC bit into just `0x0`.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2023-02-07 10:09:42 +01:00
Andre Heider
eb93ea0ac2 rpcd-mod-luci: bump version
Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-01-23 14:51:28 +01:00
Andre Heider
ed2ee96e44 rpcd-mod-luci: add "hwmodes_text" to the iwinfo info output
This is a preformatted string like "ac/ax/b/g/n" for presentation.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-01-23 14:51:28 +01:00
Andre Heider
eae86ee9bd rpcd-mod-luci: reuse infos provided by libiwinfo
Don't hardcode bit/name pairs, instead iterate over what's known to the
library and use that instead.

This automatically adds the missing ad hwmode and HE80+80 htmode - and any
future ones.

The only difference in the output is the order of the 'hwmodes' array.

Signed-off-by: Andre Heider <a.heider@gmail.com>
2023-01-23 14:51:28 +01:00
Christian Marangi
938e54df17
treewide: bump PKG_RELEASE for libiwinfo ABI change
Bump PKG_RELEASE for libiwinfo ABI change for rpcd-mod-luci and
luci-mod-status.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-01-23 14:03:10 +01:00
Joerg Werner
7e4c087f86 rpc-mod-luci: Add support for ccmp-256/gcmp/gcmp-256 ciphers
Signed-off-by: Joerg Werner <schreibubi@gmail.com>
2022-08-25 15:28:11 +03:00
Markus Stockhausen
77d29c9dc0 rpcd-mod-luci: update filter for rpc_luci_get_network_devices
When kernel bonding module is loaded it will create a special
file /sys/class/net/bonding_masters. This is no network device.
Filter it out for getNetworkDevices() call.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2022-06-28 11:06:23 +02:00
Jo-Philipp Wich
4424424366 rpcd-mod-luci: parse prefix size from DHCPv6 leases
Remember the prefix size when parsing odhcpd lease entries and expose
it in the ip6addrs array.

Fixes: #4345
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-10-26 19:40:35 +02:00
Jo-Philipp Wich
af4352c07e rpcd-mod-luci: fix syntax error
Fixes: 45a398e1ed ("rpcd-mod-luci: avoid PTR requests for IPv6 link-local and ULA addrs")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-22 12:42:54 +02:00
Jo-Philipp Wich
45a398e1ed rpcd-mod-luci: avoid PTR requests for IPv6 link-local and ULA addrs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-22 09:56:09 +02:00
Jo-Philipp Wich
93bd93e220 rpcd-mod-luci: let IPv4 hostnames take precedence over IPv6 ones
Do not overwrite IPv4-resolved hostnames with IPv6 ones in case both are
available or resolvable.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-09-22 09:56:09 +02:00
Jo-Philipp Wich
a26b53314d rpcd-mod-luci: bump version
Fixes: a78b74784d ("rpcd-mod-luci: refactor host hint gathering")
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-15 10:02:44 +02:00
Jo-Philipp Wich
a78b74784d 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>
2021-06-14 21:52:56 +02:00
Jo-Philipp Wich
113c0b0d26 rpcd-mod-luci: add link details to ubus netdev information
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-06-11 08:32:03 +02:00
David Bauer
516c58e133
Merge pull request #5070 from blocktrron/pr-luci-wifi6
luci-mod-network: add 802.11ax HE support
2021-06-05 19:04:11 +02:00
David Bauer
7b11e848ac 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>
2021-06-05 16:24:19 +02:00
Niels Widger
a5195e7825 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>
2021-06-03 09:51:09 +02:00
Jo-Philipp Wich
71feaa5285 rpcd-mod-luci: expose devtype and iflink properties in getNetworkDevices
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
2021-03-18 17:28:40 +01:00
Niels Widger
8920a2bf71
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>
2021-02-25 15:31:00 -05: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
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
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
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
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