dnsmasq: add filter_a option

Signed-off-by: ZiMing Mo <msylgj@immortalwrt.org>
This commit is contained in:
ZiMing Mo 2022-10-20 16:53:10 +08:00
parent 3dda0de8c9
commit fd39deb3b3
No known key found for this signature in database
GPG Key ID: 1BED2E3A77AE5ECF
3 changed files with 16 additions and 4 deletions

View File

@ -20,6 +20,7 @@ config dnsmasq
#list notinterface lo
#list bogusnxdomain '64.94.110.11'
option localservice 1 # disable to allow DNS requests from non-local subnets
option filter_a 0
option filter_aaaa 0
option cachesize 8000
option mini_ttl 3600

View File

@ -944,6 +944,7 @@ dnsmasq_start()
append_bool "$cfg" rapidcommit "--dhcp-rapid-commit"
append_bool "$cfg" scriptarp "--script-arp"
append_bool "$cfg" filter_a "--filter-A"
append_bool "$cfg" filter_aaaa "--filter-AAAA"
append_parm "$cfg" logfacility "--log-facility"

View File

@ -1,18 +1,28 @@
From 966471712184cfb3b067f2ae8dad9d8e2a896cae Mon Sep 17 00:00:00 2001
From: Bearice Ren <bearice@icybear.net>
Date: Tue, 20 Sep 2016 11:52:08 +0800
Subject: [PATCH] add filter-aaaa option
Subject: [PATCH] add filter-a & filter-aaaa option
---
src/rfc1035.c | 10 ++++++++++
1 files changed, 104 insertions(+)
src/rfc1035.c | 20 ++++++++++
1 files changed, 20 insertions(+)
--- a/src/rfc1035.c
+++ b/src/rfc1035.c
@@ -2111,6 +2111,16 @@ size_t answer_request(struct dns_header
@@ -2111,6 +2111,26 @@ size_t answer_request(struct dns_header
}
}
+ /* patch to filter a forwards */
+ if (qtype == T_A && option_bool(OPT_FILTER_A))
+ {
+ /* return a null reply */
+ ans = 1;
+ if (!dryrun)
+ log_query(F_CONFIG | F_IPV4 | F_NEG, name, &addr, NULL, 0);
+ break;
+ }
+
+ /* patch to filter aaaa forwards */
+ if (qtype == T_AAAA && option_bool(OPT_FILTER_AAAA))
+ {