rpcd-mod-luci: Return array of addresses in getHostHints
authorNiels Widger <niels@qacafe.com>
Mon, 1 Mar 2021 19:33:33 +0000 (14:33 -0500)
committerJo-Philipp Wich <jo@mein.io>
Sat, 12 Jun 2021 17:23:25 +0000 (19:23 +0200)
commit87bcf9e923cfc873ed4f6ecb61d034b639685a61
tree8e585952b2ce781684d62b083885795d6af9ec47
parent127b896a5272fe2e3e29f1d5330a88aacc03215d
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 a5195e7825cbbc3942ca6e571ae0020c1cf080c4)
libs/rpcd-mod-luci/src/luci.c