summaryrefslogtreecommitdiff
path: root/usr.sbin/relayd
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2007-10-22 12:18:16 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2007-10-22 12:18:16 +0000
commitdddd30e92965cc3160647e2f94dafaa0d51c08f5 (patch)
tree7825f0329ff73d54c7423bc31e98988e28fbb3db /usr.sbin/relayd
parentb9e78472b37dcc063d68443a34a7e2b581bcf4be (diff)
add support for the include directive to the configuration file parser,
based on the existing hostapd/pfctl code. ok pyr@
Diffstat (limited to 'usr.sbin/relayd')
-rw-r--r--usr.sbin/relayd/parse.y20
-rw-r--r--usr.sbin/relayd/relayd.conf.514
2 files changed, 30 insertions, 4 deletions
diff --git a/usr.sbin/relayd/parse.y b/usr.sbin/relayd/parse.y
index da3d5b81b68..02fbd69e545 100644
--- a/usr.sbin/relayd/parse.y
+++ b/usr.sbin/relayd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.73 2007/10/22 08:52:19 reyk Exp $ */
+/* $OpenBSD: parse.y,v 1.74 2007/10/22 12:18:15 reyk Exp $ */
/*
* Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -114,7 +114,7 @@ typedef struct {
%}
-%token SERVICE TABLE BACKUP HOST REAL
+%token SERVICE TABLE BACKUP HOST REAL INCLUDE
%token CHECK TCP ICMP EXTERNAL REQUEST RESPONSE
%token TIMEOUT CODE DIGEST PORT TAG INTERFACE
%token VIRTUAL INTERVAL DISABLE STICKYADDR BACKLOG PATH SCRIPT
@@ -134,6 +134,7 @@ typedef struct {
%%
grammar : /* empty */
+ | grammar include '\n'
| grammar '\n'
| grammar varset '\n'
| grammar main '\n'
@@ -144,6 +145,20 @@ grammar : /* empty */
| grammar error '\n' { file->errors++; }
;
+include : INCLUDE STRING {
+ struct file *nfile;
+
+ if ((nfile = pushfile($2, 0)) == NULL) {
+ yyerror("failed to include file %s", $2);
+ free($2);
+ YYERROR;
+ }
+ free($2);
+
+ file = nfile;
+ lungetc('\n');
+ }
+
optssl : /*empty*/ { $$ = 0; }
| SSL { $$ = 1; }
;
@@ -1205,6 +1220,7 @@ lookup(char *s)
{ "header", HEADER },
{ "host", HOST },
{ "icmp", ICMP },
+ { "include", INCLUDE },
{ "interface", INTERFACE },
{ "interval", INTERVAL },
{ "ip", IP },
diff --git a/usr.sbin/relayd/relayd.conf.5 b/usr.sbin/relayd/relayd.conf.5
index e8d8f073c73..c0e626d3cdc 100644
--- a/usr.sbin/relayd/relayd.conf.5
+++ b/usr.sbin/relayd/relayd.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: relayd.conf.5,v 1.52 2007/09/28 13:29:56 pyr Exp $
+.\" $OpenBSD: relayd.conf.5,v 1.53 2007/10/22 12:18:15 reyk Exp $
.\"
.\" Copyright (c) 2006, 2007 Reyk Floeter <reyk@openbsd.org>
.\" Copyright (c) 2006, 2007 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: September 28 2007 $
+.Dd $Mdocdate: October 22 2007 $
.Dt HOSTSTATED.CONF 5
.Os
.Sh NAME
@@ -63,6 +63,16 @@ The port name to number mappings are found in the file
see
.Xr services 5
for details.
+.Pp
+Comments can be put anywhere in the file using a hash mark
+.Pq Sq # ,
+and extend to the end of the current line.
+.Pp
+Additional configuration files can be included with the
+.Ic include
+keyword, for example:
+.Bd -literal -offset indent
+include "/etc/hoststated.conf.local"
.Sh MACROS
Macros can be defined that will later be expanded in context.
Macro names must start with a letter, and may contain letters, digits,