can't fix the error with filter-aaaa, waiting for solving

This commit is contained in:
CN_SZTL 2019-07-02 17:19:53 +08:00
parent e139875c07
commit ddd789b04d
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -1,76 +0,0 @@
From 806b739bf9ac263c60fef915f71890b13a40fe52 Mon Sep 17 00:00:00 2001
From: Totaly FuRy <tfury@free.fr>
Date: Sun, 14 Oct 2018 11:23:38 +0200
Subject: [PATCH 2/2] dnsmasq: add filter-aaaa option
---
src/dnsmasq.h | 3 ++-
src/option.c | 3 +++
src/rfc1035.c | 10 ++++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/dnsmasq.h b/src/dnsmasq.h
index 4229d72..0435a84 100644
--- a/src/dnsmasq.h
+++ b/src/dnsmasq.h
@@ -263,7 +263,8 @@ struct event_desc {
#define OPT_RAPID_COMMIT 57
#define OPT_UBUS 58
#define OPT_METRIC 59
-#define OPT_LAST 60
+#define OPT_FILTER_AAAA 60
+#define OPT_LAST 61
/* extra flags for my_syslog, we use a couple of facilities since they are known
not to occupy the same bits as priorities, no matter how syslog.h is set up. */
diff --git a/src/option.c b/src/option.c
index 552a4c7..998024e 100644
--- a/src/option.c
+++ b/src/option.c
@@ -167,6 +167,7 @@ struct myoption {
#define LOPT_NAME_MATCH 355
#define LOPT_CAA 356
#define LOPT_METRIC_ORDER 357
+#define LOPT_FILTER_AAAA 358
#ifdef HAVE_GETOPT_LONG
static const struct option opts[] =
@@ -333,6 +334,7 @@ static const struct myoption opts[] =
{ "quiet-dhcp6", 0, 0, LOPT_QUIET_DHCP6 },
{ "quiet-ra", 0, 0, LOPT_QUIET_RA },
{ "dns-loop-detect", 0, 0, LOPT_LOOP_DETECT },
+ { "filter-aaaa", 0, 0, LOPT_FILTER_AAAA },
{ "script-arp", 0, 0, LOPT_SCRIPT_ARP },
{ "dhcp-ttl", 1, 0 , LOPT_DHCPTTL },
{ "dhcp-reply-delay", 1, 0, LOPT_REPLY_DELAY },
@@ -518,6 +520,7 @@ static struct {
{ LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL },
{ LOPT_DUMPFILE, ARG_ONE, "<path>", gettext_noop("Path to debug packet dump file"), NULL },
{ LOPT_DUMPMASK, ARG_ONE, "<hex>", gettext_noop("Mask which packets to dump"), NULL },
+ { LOPT_FILTER_AAAA, OPT_FILTER_AAAA, NULL, gettext_noop("Filter all AAAA requests."), NULL },
{ 0, 0, NULL, NULL, NULL }
};
diff --git a/src/rfc1035.c b/src/rfc1035.c
index 6290f22..b160e2c 100644
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -1574,6 +1574,16 @@ size_t answer_request(struct dns_header *header, char *limit, size_t qlen,
break;
#endif
+ //patch to filter aaaa forwards
+ //found : https://gist.github.com/bearice/7d3dc0e63e003d752622
+ if (qtype == T_AAAA && option_bool(OPT_FILTER_AAAA) ){
+ //return a null reply
+ ans = 1;
+ if (!dryrun) log_query(F_CONFIG | F_IPV6 | F_NEG, name, &addr, NULL);
+ break;
+ }
+ //end of patch
+
if (qtype != type && qtype != T_ANY)
continue;
--
2.11.0