1*01049ae6Schristosdiff --git a/daemon/worker.c b/daemon/worker.c 2*01049ae6Schristosindex 263fcdd..f787b70 100644 3*01049ae6Schristos--- a/daemon/worker.c 4*01049ae6Schristos+++ b/daemon/worker.c 5*01049ae6Schristos@@ -1213,6 +1213,15 @@ worker_handle_request(struct comm_point* c, void* arg, int error, 6*01049ae6Schristos addr_to_str(&repinfo->addr, repinfo->addrlen, ip, sizeof(ip)); 7*01049ae6Schristos log_query_in(ip, qinfo.qname, qinfo.qtype, qinfo.qclass); 8*01049ae6Schristos } 9*01049ae6Schristos+ 10*01049ae6Schristos+ if(worker->env.cfg->drop_tld) { 11*01049ae6Schristos+ int lab = dname_count_labels(qinfo.qname); 12*01049ae6Schristos+ if (lab == 2) { 13*01049ae6Schristos+ comm_point_drop_reply(repinfo); 14*01049ae6Schristos+ verbose(VERB_ALGO, "Dropping one label query."); 15*01049ae6Schristos+ return 0; 16*01049ae6Schristos+ } 17*01049ae6Schristos+ } 18*01049ae6Schristos if(qinfo.qtype == LDNS_RR_TYPE_AXFR || 19*01049ae6Schristos qinfo.qtype == LDNS_RR_TYPE_IXFR) { 20*01049ae6Schristos verbose(VERB_ALGO, "worker request: refused zone transfer."); 21*01049ae6Schristosdiff --git a/util/config_file.h b/util/config_file.h 22*01049ae6Schristosindex b3ef930..2791541 100644 23*01049ae6Schristos--- a/util/config_file.h 24*01049ae6Schristos+++ b/util/config_file.h 25*01049ae6Schristos@@ -274,6 +274,8 @@ struct config_file { 26*01049ae6Schristos int prefetch_key; 27*01049ae6Schristos /** deny queries of type ANY with an empty answer */ 28*01049ae6Schristos int deny_any; 29*01049ae6Schristos+ /** Drop TLD queries from clients **/ 30*01049ae6Schristos+ int drop_tld; 31*01049ae6Schristos 32*01049ae6Schristos /** chrootdir, if not "" or chroot will be done */ 33*01049ae6Schristos char* chrootdir; 34*01049ae6Schristosdiff --git a/util/configlexer.lex b/util/configlexer.lex 35*01049ae6Schristosindex a86ddf5..9bbedbb 100644 36*01049ae6Schristos--- a/util/configlexer.lex 37*01049ae6Schristos+++ b/util/configlexer.lex 38*01049ae6Schristos@@ -299,6 +299,7 @@ private-domain{COLON} { YDVAR(1, VAR_PRIVATE_DOMAIN) } 39*01049ae6Schristos prefetch-key{COLON} { YDVAR(1, VAR_PREFETCH_KEY) } 40*01049ae6Schristos prefetch{COLON} { YDVAR(1, VAR_PREFETCH) } 41*01049ae6Schristos deny-any{COLON} { YDVAR(1, VAR_DENY_ANY) } 42*01049ae6Schristos+drop-tld{COLON} { YDVAR(1, VAR_DROP_TLD) } 43*01049ae6Schristos stub-zone{COLON} { YDVAR(0, VAR_STUB_ZONE) } 44*01049ae6Schristos name{COLON} { YDVAR(1, VAR_NAME) } 45*01049ae6Schristos stub-addr{COLON} { YDVAR(1, VAR_STUB_ADDR) } 46*01049ae6Schristosdiff --git a/util/configparser.y b/util/configparser.y 47*01049ae6Schristosindex 10227a2..567d68e 100644 48*01049ae6Schristos--- a/util/configparser.y 49*01049ae6Schristos+++ b/util/configparser.y 50*01049ae6Schristos@@ -164,6 +164,7 @@ extern struct config_parser_state* cfg_parser; 51*01049ae6Schristos %token VAR_FAST_SERVER_PERMIL VAR_FAST_SERVER_NUM 52*01049ae6Schristos %token VAR_ALLOW_NOTIFY VAR_TLS_WIN_CERT VAR_TCP_CONNECTION_LIMIT 53*01049ae6Schristos %token VAR_FORWARD_NO_CACHE VAR_STUB_NO_CACHE VAR_LOG_SERVFAIL VAR_DENY_ANY 54*01049ae6Schristos+%token VAR_DROP_TLD 55*01049ae6Schristos %token VAR_UNKNOWN_SERVER_TIME_LIMIT VAR_LOG_TAG_QUERYREPLY 56*01049ae6Schristos %token VAR_STREAM_WAIT_SIZE VAR_TLS_CIPHERS VAR_TLS_CIPHERSUITES 57*01049ae6Schristos %token VAR_TLS_SESSION_TICKET_KEYS 58*01049ae6Schristos@@ -266,6 +267,7 @@ content_server: server_num_threads | server_verbosity | server_port | 59*01049ae6Schristos server_tls_cert_bundle | server_tls_additional_port | server_low_rtt | 60*01049ae6Schristos server_fast_server_permil | server_fast_server_num | server_tls_win_cert | 61*01049ae6Schristos server_tcp_connection_limit | server_log_servfail | server_deny_any | 62*01049ae6Schristos+ server_drop_tld | 63*01049ae6Schristos server_unknown_server_time_limit | server_log_tag_queryreply | 64*01049ae6Schristos server_stream_wait_size | server_tls_ciphers | 65*01049ae6Schristos server_tls_ciphersuites | server_tls_session_ticket_keys 66*01049ae6Schristos@@ -1466,6 +1468,16 @@ server_deny_any: VAR_DENY_ANY STRING_ARG 67*01049ae6Schristos free($2); 68*01049ae6Schristos } 69*01049ae6Schristos ; 70*01049ae6Schristos+ 71*01049ae6Schristos+server_drop_tld: VAR_DROP_TLD STRING_ARG 72*01049ae6Schristos+ { 73*01049ae6Schristos+ OUTYY(("P(server_drop_tld:%s)\n", $2)); 74*01049ae6Schristos+ if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0) 75*01049ae6Schristos+ yyerror("expected yes or no."); 76*01049ae6Schristos+ else cfg_parser->cfg->drop_tld = (strcmp($2, "yes")==0); 77*01049ae6Schristos+ free($2); 78*01049ae6Schristos+ } 79*01049ae6Schristos+ ; 80*01049ae6Schristos server_unwanted_reply_threshold: VAR_UNWANTED_REPLY_THRESHOLD STRING_ARG 81*01049ae6Schristos { 82*01049ae6Schristos OUTYY(("P(server_unwanted_reply_threshold:%s)\n", $2)); 83