Re: nsd 4.1.24

2018-08-15 Thread Paul de Weerd
On Wed, Aug 15, 2018 at 03:12:19PM +0200, Florian Obser wrote:
| When this goes in I think we should switch the default control socket
| and stop listening on localhost.

This makes a lot of sense to me, please make the UDS the default
control socket.

Thanks Florian!

Paul

| OK?
| 
| diff --git etc/nsd.conf etc/nsd.conf
| index 729a5f620ba..94710bfa5ae 100644
| --- etc/nsd.conf
| +++ etc/nsd.conf
| @@ -19,6 +19,7 @@ server:
|  
|  remote-control:
|   control-enable: yes
| + control-interface: /var/run/nsd.sock
|  
|  ## tsig key example
|  #key:
| 
| 
| -- 
| I'm not entirely sure you are real.
| 

-- 
>[<++>-]<+++.>+++[<-->-]<.>+++[<+
+++>-]<.>++[<>-]<+.--.[-]
 http://www.weirdnet.nl/ 



Re: nsd 4.1.24

2018-08-15 Thread Florian Obser
When this goes in I think we should switch the default control socket
and stop listening on localhost.

OK?

diff --git etc/nsd.conf etc/nsd.conf
index 729a5f620ba..94710bfa5ae 100644
--- etc/nsd.conf
+++ etc/nsd.conf
@@ -19,6 +19,7 @@ server:
 
 remote-control:
control-enable: yes
+   control-interface: /var/run/nsd.sock
 
 ## tsig key example
 #key:


-- 
I'm not entirely sure you are real.



nsd 4.1.24

2018-08-15 Thread Florian Obser


Now with systemd support!

A more useful feature for us might be that nsd-control can now
commuicate over a unix domain socket.

OK?

diff --git config.h.in config.h.in
index d3470836f26..eded09dd6b3 100644
--- config.h.in
+++ config.h.in
@@ -317,6 +317,9 @@
 /* Define to 1 if you have the `strtol' function. */
 #undef HAVE_STRTOL
 
+/* Define to 1 if `sun_len' is a member of `struct sockaddr_un'. */
+#undef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
+
 /* Define to 1 if `st_mtimensec' is a member of `struct stat'. */
 #undef HAVE_STRUCT_STAT_ST_MTIMENSEC
 
@@ -350,6 +353,9 @@
 /* Define to 1 if you have the  header file. */
 #undef HAVE_SYS_TYPES_H
 
+/* Define to 1 if you have the  header file. */
+#undef HAVE_SYS_UN_H
+
 /* Define to 1 if you have  that is POSIX.1 compatible. */
 #undef HAVE_SYS_WAIT_H
 
diff --git configlexer.lex configlexer.lex
index 1f2628d7695..7fd4f17363f 100644
--- configlexer.lex
+++ configlexer.lex
@@ -203,6 +203,7 @@ interface{COLON}{ LEXOUT(("v(%s) ", yytext)); return 
VAR_IP_ADDRESS;}
 ip-transparent{COLON}  { LEXOUT(("v(%s) ", yytext)); return 
VAR_IP_TRANSPARENT;}
 ip-freebind{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_IP_FREEBIND;}
 debug-mode{COLON}  { LEXOUT(("v(%s) ", yytext)); return VAR_DEBUG_MODE;}
+use-systemd{COLON} { LEXOUT(("v(%s) ", yytext)); return VAR_USE_SYSTEMD;}
 hide-version{COLON}{ LEXOUT(("v(%s) ", yytext)); return VAR_HIDE_VERSION;}
 ip4-only{COLON}{ LEXOUT(("v(%s) ", yytext)); return 
VAR_IP4_ONLY;}
 ip6-only{COLON}{ LEXOUT(("v(%s) ", yytext)); return 
VAR_IP6_ONLY;}
diff --git configparser.y configparser.y
index b9bf8200f99..547518f88c6 100644
--- configparser.y
+++ configparser.y
@@ -72,6 +72,7 @@ extern config_parser_state_type* cfg_parser;
 %token VAR_MAX_REFRESH_TIME VAR_MIN_REFRESH_TIME
 %token VAR_MAX_RETRY_TIME VAR_MIN_RETRY_TIME
 %token VAR_MULTI_MASTER_CHECK VAR_MINIMAL_RESPONSES VAR_REFUSE_ANY
+%token VAR_USE_SYSTEMD
 
 %%
 toplevelvars: /* empty */ | toplevelvars toplevelvar ;
@@ -103,7 +104,7 @@ content_server: server_ip_address | server_ip_transparent | 
server_debug_mode |
server_zonefiles_check | server_do_ip4 | server_do_ip6 |
server_zonefiles_write | server_log_time_ascii | server_round_robin |
server_reuseport | server_version | server_ip_freebind |
-   server_minimal_responses | server_refuse_any;
+   server_minimal_responses | server_refuse_any | server_use_systemd;
 server_ip_address: VAR_IP_ADDRESS STRING 
{ 
OUTYY(("P(server_ip_address:%s)\n", $2)); 
@@ -150,6 +151,14 @@ server_debug_mode: VAR_DEBUG_MODE STRING
else cfg_parser->opt->debug_mode = (strcmp($2, "yes")==0);
}
;
+server_use_systemd: VAR_USE_SYSTEMD STRING 
+   { 
+   OUTYY(("P(server_use_systemd:%s)\n", $2)); 
+   if(strcmp($2, "yes") != 0 && strcmp($2, "no") != 0)
+   yyerror("expected yes or no.");
+   else cfg_parser->opt->use_systemd = (strcmp($2, "yes")==0);
+   }
+   ;
 server_verbosity: VAR_VERBOSITY STRING 
{ 
OUTYY(("P(server_verbosity:%s)\n", $2)); 
@@ -550,11 +559,18 @@ rc_control_port: VAR_CONTROL_PORT STRING
;
 rc_control_interface: VAR_CONTROL_INTERFACE STRING
{
+   ip_address_option_type* last = NULL;
ip_address_option_type* o = 
(ip_address_option_type*)region_alloc(
cfg_parser->opt->region, 
sizeof(ip_address_option_type));
OUTYY(("P(control_interface:%s)\n", $2));
-   o->next = cfg_parser->opt->control_interface;
-   cfg_parser->opt->control_interface = o;
+   /* append at end */
+   last = cfg_parser->opt->control_interface;
+   while(last && last->next)
+   last = last->next;
+   if(last == NULL)
+   cfg_parser->opt->control_interface = o;
+   elselast->next = o;
+   o->next = NULL;
o->address = region_strdup(cfg_parser->opt->region, $2);
}
;
diff --git configure configure
index 79f500f50fd..13da401ab9b 100644
--- configure
+++ configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for NSD 4.1.23.
+# Generated by GNU Autoconf 2.69 for NSD 4.1.24.
 #
 # Report bugs to .
 #
@@ -580,8 +580,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='NSD'
 PACKAGE_TARNAME='nsd'
-PACKAGE_VERSION='4.1.23'
-PACKAGE_STRING='NSD 4.1.23'
+PACKAGE_VERSION='4.1.24'
+PACKAGE_S