Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openwrt/luci.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-09-22 10:55:07 +0300
committerJo-Philipp Wich <jo@mein.io>2021-09-22 10:56:09 +0300
commit45a398e1ed86c9706d47ff46be73bdaa303ff661 (patch)
treece42d9553bbaa154583f43d0076e99aef04e4015 /libs
parent93bd93e220714276eff95ea51793bb2f826328e8 (diff)
rpcd-mod-luci: avoid PTR requests for IPv6 link-local and ULA addrs
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'libs')
-rw-r--r--libs/rpcd-mod-luci/src/luci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c
index b89bca494d..53ffff4fd2 100644
--- a/libs/rpcd-mod-luci/src/luci.c
+++ b/libs/rpcd-mod-luci/src/luci.c
@@ -52,6 +52,10 @@
#include <rpcd/plugin.h>
+#ifndef IN6_IS_ADDR_ULA
+#define IN6_IS_ADDR_ULA(a) (((a)->s6_addr[0] & 0xfe) == 0xfc)
+#endif
+
static struct blob_buf blob;
@@ -1720,7 +1724,9 @@ rpc_luci_get_host_hints_rrdns(struct reply_context *rctx)
}
}
avl_for_each_element(&hint->ip6addrs, addr, avl) {
- if (!IN6_IS_ADDR_UNSPECIFIED(&addr->addr.in6)) {
+ if (!IN6_IS_ADDR_UNSPECIFIED(&addr->addr.in6) &&
+ !IN6_IS_ADDR_LINKLOCAL(&addr->addr.in6) &&
+ !IN6_IS_ADDR_ULA(&addr>addr.in6)) {
inet_ntop(AF_INET6, &addr->addr.in6, buf, sizeof(buf));
blobmsg_add_string(&req, NULL, buf);
n++;