mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-08-17 21:25:50 +02:00
Add edns-client-tag configuration option
This commit is contained in:
@@ -1516,6 +1516,12 @@ servers set. The default for fast\-server\-permil is 0.
|
||||
Set the number of servers that should be used for fast server selection. Only
|
||||
use the fastest specified number of servers with the fast\-server\-permil
|
||||
option, that turns this on or off. The default is to use the fastest 3 servers.
|
||||
.TP 5
|
||||
.B edns\-client\-tag: \fI<IP netblock> <tag data>
|
||||
Include an edns-client-tag option in queries with destination address matching
|
||||
the configured IP netblock. This configuration option can be used multiple
|
||||
times. The most specific match will be used. The tag data is configured in
|
||||
decimal format, from 0 to 65535.
|
||||
.SS "Remote Control Options"
|
||||
In the
|
||||
.B remote\-control:
|
||||
|
||||
@@ -315,6 +315,7 @@ config_create(void)
|
||||
cfg->qname_minimisation_strict = 0;
|
||||
cfg->shm_enable = 0;
|
||||
cfg->shm_key = 11777;
|
||||
cfg->edns_client_tags = NULL;
|
||||
cfg->dnscrypt = 0;
|
||||
cfg->dnscrypt_port = 0;
|
||||
cfg->dnscrypt_provider = NULL;
|
||||
@@ -1130,6 +1131,7 @@ config_get_option(struct config_file* cfg, const char* opt,
|
||||
else O_LS3(opt, "access-control-tag-action", acl_tag_actions)
|
||||
else O_LS3(opt, "access-control-tag-data", acl_tag_datas)
|
||||
else O_LS2(opt, "access-control-view", acl_view)
|
||||
else O_LS2(opt, "edns_client_tags", edns_client_tags)
|
||||
#ifdef USE_IPSECMOD
|
||||
else O_YNO(opt, "ipsecmod-enabled", ipsecmod_enabled)
|
||||
else O_YNO(opt, "ipsecmod-ignore-bogus", ipsecmod_ignore_bogus)
|
||||
@@ -1499,6 +1501,7 @@ config_delete(struct config_file* cfg)
|
||||
config_deldblstrlist(cfg->ratelimit_below_domain);
|
||||
config_delstrlist(cfg->python_script);
|
||||
config_delstrlist(cfg->dynlib_file);
|
||||
config_deldblstrlist(cfg->edns_client_tags);
|
||||
#ifdef USE_IPSECMOD
|
||||
free(cfg->ipsecmod_hook);
|
||||
config_delstrlist(cfg->ipsecmod_whitelist);
|
||||
|
||||
@@ -553,6 +553,9 @@ struct config_file {
|
||||
/** SHM data - key for the shm */
|
||||
int shm_key;
|
||||
|
||||
/** list of EDNS client tag entries, linked list */
|
||||
struct config_str2list* edns_client_tags;
|
||||
|
||||
/** DNSCrypt */
|
||||
/** true to enable dnscrypt */
|
||||
int dnscrypt;
|
||||
|
||||
+2071
-2057
File diff suppressed because it is too large
Load Diff
@@ -517,6 +517,7 @@ name-v4{COLON} { YDVAR(1, VAR_IPSET_NAME_V4) }
|
||||
name-v6{COLON} { YDVAR(1, VAR_IPSET_NAME_V6) }
|
||||
udp-upstream-without-downstream{COLON} { YDVAR(1, VAR_UDP_UPSTREAM_WITHOUT_DOWNSTREAM) }
|
||||
tcp-connection-limit{COLON} { YDVAR(2, VAR_TCP_CONNECTION_LIMIT) }
|
||||
edns-client-tag{COLON} { YDVAR(2, VAR_EDNS_CLIENT_TAG) }
|
||||
<INITIAL,val>{NEWLINE} { LEXOUT(("NL\n")); cfg_parser->line++; }
|
||||
|
||||
/* Quoted strings. Strip leading and ending quotes */
|
||||
|
||||
+1048
-1027
File diff suppressed because it is too large
Load Diff
+6
-4
@@ -1,8 +1,8 @@
|
||||
/* A Bison parser, made by GNU Bison 3.5. */
|
||||
/* A Bison parser, made by GNU Bison 3.5.1. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
|
||||
Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
|
||||
Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
@@ -337,7 +337,8 @@ extern int yydebug;
|
||||
VAR_RPZ_LOG = 543,
|
||||
VAR_RPZ_LOG_NAME = 544,
|
||||
VAR_DYNLIB = 545,
|
||||
VAR_DYNLIB_FILE = 546
|
||||
VAR_DYNLIB_FILE = 546,
|
||||
VAR_EDNS_CLIENT_TAG = 547
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
@@ -630,6 +631,7 @@ extern int yydebug;
|
||||
#define VAR_RPZ_LOG_NAME 544
|
||||
#define VAR_DYNLIB 545
|
||||
#define VAR_DYNLIB_FILE 546
|
||||
#define VAR_EDNS_CLIENT_TAG 547
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
@@ -639,7 +641,7 @@ union YYSTYPE
|
||||
|
||||
char* str;
|
||||
|
||||
#line 643 "util/configparser.h"
|
||||
#line 645 "util/configparser.h"
|
||||
|
||||
};
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
|
||||
+17
-2
@@ -175,7 +175,7 @@ extern struct config_parser_state* cfg_parser;
|
||||
%token VAR_IPSET VAR_IPSET_NAME_V4 VAR_IPSET_NAME_V6
|
||||
%token VAR_TLS_SESSION_TICKET_KEYS VAR_RPZ VAR_TAGS VAR_RPZ_ACTION_OVERRIDE
|
||||
%token VAR_RPZ_CNAME_OVERRIDE VAR_RPZ_LOG VAR_RPZ_LOG_NAME
|
||||
%token VAR_DYNLIB VAR_DYNLIB_FILE
|
||||
%token VAR_DYNLIB VAR_DYNLIB_FILE VAR_EDNS_CLIENT_TAG
|
||||
|
||||
%%
|
||||
toplevelvars: /* empty */ | toplevelvars toplevelvar ;
|
||||
@@ -285,7 +285,7 @@ content_server: server_num_threads | server_verbosity | server_port |
|
||||
server_unknown_server_time_limit | server_log_tag_queryreply |
|
||||
server_stream_wait_size | server_tls_ciphers |
|
||||
server_tls_ciphersuites | server_tls_session_ticket_keys |
|
||||
server_tls_use_sni
|
||||
server_tls_use_sni | server_edns_client_tag
|
||||
;
|
||||
stubstart: VAR_STUB_ZONE
|
||||
{
|
||||
@@ -2403,6 +2403,21 @@ server_ipsecmod_strict: VAR_IPSECMOD_STRICT STRING_ARG
|
||||
#endif
|
||||
}
|
||||
;
|
||||
server_edns_client_tag: VAR_EDNS_CLIENT_TAG STRING_ARG STRING_ARG
|
||||
{
|
||||
int tag_data;
|
||||
OUTYY(("P(server_edns_client_tag:%s %s)\n", $2, $3));
|
||||
tag_data = atoi($3);
|
||||
if(tag_data > 65535 || tag_data < 0 ||
|
||||
(tag_data == 0 && (strlen($3) != 1 || $3[0] != '0')))
|
||||
yyerror("edns-client-tag data invalid, needs to be a "
|
||||
"number from 0 to 65535");
|
||||
if(!cfg_str2list_insert(
|
||||
&cfg_parser->cfg->edns_client_tags, $2, $3))
|
||||
fatal_exit("out of memory adding "
|
||||
"edns-client-tag");
|
||||
}
|
||||
;
|
||||
stub_name: VAR_NAME STRING_ARG
|
||||
{
|
||||
OUTYY(("P(name:%s)\n", $2));
|
||||
|
||||
@@ -75,6 +75,7 @@ int edns_tags_apply_cfg(struct edns_tags* edns_tags,
|
||||
|
||||
/* TODO walk over config, create and insert node. */
|
||||
|
||||
addr_tree_init_parents(&edns_tags->client_tags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user