From de43e5bee661fee4167709e66c9e71dec9b3af24 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 9 Nov 2019 09:39:00 +0800 Subject: [PATCH] dnsmasq: add filter-aaaa patch --- .../patches/996-dnsmasq-filter-aaaa.patch | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 package/network/services/dnsmasq/patches/996-dnsmasq-filter-aaaa.patch diff --git a/package/network/services/dnsmasq/patches/996-dnsmasq-filter-aaaa.patch b/package/network/services/dnsmasq/patches/996-dnsmasq-filter-aaaa.patch new file mode 100644 index 0000000000..8d6a1777cb --- /dev/null +++ b/package/network/services/dnsmasq/patches/996-dnsmasq-filter-aaaa.patch @@ -0,0 +1,74 @@ +From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001 +From: Bearice Ren +Date: Tue, 20 Sep 2016 11:52:08 +0800 +Subject: [PATCH] add filter-aaaa option + +--- + src/dnsmasq.h | 3 ++- + src/option.c | 3 +++ + src/rfc1035.c | 9 +++++++++ + 3 files changed, 14 insertions(+), 1 deletion(-) + +diff --git a/src/dnsmasq.h b/src/dnsmasq.h +index 1896a64..e10d6c4 100644 +--- a/src/dnsmasq.h ++++ b/src/dnsmasq.h +@@ -259,7 +259,8 @@ struct event_desc { + #define OPT_TFTP_APREF_MAC 56 + #define OPT_RAPID_COMMIT 57 + #define OPT_UBUS 58 +-#define OPT_LAST 59 ++#define OPT_FILTER_AAAA 59 ++#define OPT_LAST 60 + + #define OPTION_BITS (sizeof(unsigned int)*8) + #define OPTION_SIZE ( (OPT_LAST/OPTION_BITS)+((OPT_LAST%OPTION_BITS)!=0) ) +diff --git a/src/option.c b/src/option.c +index d8c57d6..1cc65bf 100644 +--- a/src/option.c ++++ b/src/option.c +@@ -166,6 +166,7 @@ struct myoption { + #define LOPT_UBUS 354 + #define LOPT_NAME_MATCH 355 + #define LOPT_CAA 356 ++#define LOPT_FILTER_AAAA 357 + + #ifdef HAVE_GETOPT_LONG + static const struct option opts[] = +@@ -337,6 +338,7 @@ static const struct myoption opts[] = + { "dhcp-rapid-commit", 0, 0, LOPT_RAPID_COMMIT }, + { "dumpfile", 1, 0, LOPT_DUMPFILE }, + { "dumpmask", 1, 0, LOPT_DUMPMASK }, ++ { "filter-aaaa", 0, 0, LOPT_FILTER_AAAA }, + { NULL, 0, 0, 0 } + }; + +@@ -515,6 +517,7 @@ static struct { + { LOPT_RAPID_COMMIT, OPT_RAPID_COMMIT, NULL, gettext_noop("Enables DHCPv4 Rapid Commit option."), NULL }, + { LOPT_DUMPFILE, ARG_ONE, "", gettext_noop("Path to debug packet dump file"), NULL }, + { LOPT_DUMPMASK, ARG_ONE, "", 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 24d08c1..1594962 100644 +--- a/src/rfc1035.c ++++ b/src/rfc1035.c +@@ -1970,6 +1970,15 @@ size_t answer_request(struct dns_header + } + } + ++ //patch to filter aaaa forwards ++ 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 (!ans) + return 0; /* failed to answer a question */ + } +-- \ No newline at end of file