Skip to content
Snippets Groups Projects
Commit dbc7872b authored by Jan Včelák's avatar Jan Včelák :rocket:
Browse files

server identification: add hostname into configuration

refs #2463

Change-Id: I1d923b8c985a861d3bbf8afea4c522a5bba48fea
parent 16b64027
Branches
Tags
No related merge requests found
......@@ -20,6 +20,9 @@ system {
# Version of the server (see RFC 4892). Not used yet.
version "1.2";
# Host name of the server (see RFC 4892). Not used yet.
hostname "myserver0";
# Server identifier
# Use string format "text"
# Or hexstring 0x01ab00
......
......@@ -74,6 +74,7 @@ BLANK [ \t\n]
[\!\$\%\^\&\*\(\)\/\+\-\@\{\}\;\,] { return yytext[0]; }
system { lval.t = yytext; return SYSTEM; }
identity { lval.t = yytext; return IDENTITY; }
hostname { lval.t = yytext; return HOSTNAME; }
version { lval.t = yytext; return SVERSION; }
nsid { lval.t = yytext; return NSID; }
storage { lval.t = yytext; return STORAGE; }
......
......@@ -384,7 +384,7 @@ static int conf_mask(void* scanner, int nval, int prefixlen) {
%token <tok> SIZE
%token <tok> BOOL
%token <tok> SYSTEM IDENTITY SVERSION NSID STORAGE KEY KEYS
%token <tok> SYSTEM IDENTITY HOSTNAME SVERSION NSID STORAGE KEY KEYS
%token <tok> TSIG_ALGO_NAME
%token <tok> WORKERS
%token <tok> USER
......@@ -509,6 +509,7 @@ system:
SYSTEM '{'
| system SVERSION TEXT ';' { new_config->version = $3.t; }
| system IDENTITY TEXT ';' { new_config->identity = $3.t; }
| system HOSTNAME TEXT ';' { new_config->hostname = $3.t; }
| system NSID HEXSTR ';' { new_config->nsid = $3.t; new_config->nsid_len = $3.l; }
| system NSID TEXT ';' { new_config->nsid = $3.t; new_config->nsid_len = strlen(new_config->nsid); }
| system STORAGE TEXT ';' { new_config->storage = $3.t; }
......
......@@ -669,6 +669,10 @@ void conf_truncate(conf_t *conf, int unload_hooks)
free(conf->identity);
conf->identity = 0;
}
if (conf->hostname) {
free(conf->hostname);
conf->hostname = 0;
}
if (conf->version) {
free(conf->version);
conf->version = 0;
......
......@@ -191,6 +191,7 @@ typedef struct conf_t {
*/
char *filename; /*!< Name of the config file. */
char *identity; /*!< Identity to return on CH TXT id.server. */
char *hostname; /*!< Host name to return on CH TXT hostname.{bind,server} */
char *version; /*!< Version for CH TXT version.{bind|server} */
char *storage; /*!< Persistent storage path for databases and such. */
char *pidfile; /*!< PID file path. */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment