summaryrefslogtreecommitdiff
path: root/usr.sbin/ospf6d/parse.y
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2011-06-27 03:07:27 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2011-06-27 03:07:27 +0000
commit49de6f8d6227a3cb7c733fb2b7ab574fab991912 (patch)
tree97d05e61ac6d6f405d31d03189b9e1a60cf59a63 /usr.sbin/ospf6d/parse.y
parentc56afff25b563ba311f67abdf35c2c69f6fcb61f (diff)
bring include support for config files in from ospfd.
sure deraadt@
Diffstat (limited to 'usr.sbin/ospf6d/parse.y')
-rw-r--r--usr.sbin/ospf6d/parse.y20
1 files changed, 19 insertions, 1 deletions
diff --git a/usr.sbin/ospf6d/parse.y b/usr.sbin/ospf6d/parse.y
index 7afae43a814..30405a1d3d7 100644
--- a/usr.sbin/ospf6d/parse.y
+++ b/usr.sbin/ospf6d/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.20 2010/12/13 13:43:37 bluhm Exp $ */
+/* $OpenBSD: parse.y,v 1.21 2011/06/27 03:07:26 dlg Exp $ */
/*
* Copyright (c) 2004, 2005 Esben Norby <norby@openbsd.org>
@@ -121,6 +121,7 @@ typedef struct {
%token SET TYPE
%token YES NO
%token DEMOTE
+%token INCLUDE
%token ERROR
%token <v.string> STRING
%token <v.number> NUMBER
@@ -131,6 +132,7 @@ typedef struct {
%%
grammar : /* empty */
+ | grammar include '\n'
| grammar '\n'
| grammar conf_main '\n'
| grammar varset '\n'
@@ -138,6 +140,21 @@ grammar : /* empty */
| grammar error '\n' { file->errors++; }
;
+include : INCLUDE STRING {
+ struct file *nfile;
+
+ if ((nfile = pushfile($2, 1)) == NULL) {
+ yyerror("failed to include file %s", $2);
+ free($2);
+ YYERROR;
+ }
+ free($2);
+
+ file = nfile;
+ lungetc('\n');
+ }
+ ;
+
string : string STRING {
if (asprintf(&$$, "%s %s", $1, $2) == -1) {
free($1);
@@ -526,6 +543,7 @@ lookup(char *s)
{"external-tag", EXTTAG},
{"fib-update", FIBUPDATE},
{"hello-interval", HELLOINTERVAL},
+ {"include", INCLUDE},
{"interface", INTERFACE},
{"metric", METRIC},
{"no", NO},