diff options
author | 2016-05-23 15:32:48 +0000 | |
---|---|---|
committer | 2016-05-23 15:32:48 +0000 | |
commit | 66a1cd4faac0219cff69672df79b2d747ef1d2f9 (patch) | |
tree | b35d9fed92faf39c6cf36a72a6c775d9bdc820c8 | |
parent | Fix router-id selection if static router-id is not given. (diff) | |
download | wireguard-openbsd-66a1cd4faac0219cff69672df79b2d747ef1d2f9.tar.xz wireguard-openbsd-66a1cd4faac0219cff69672df79b2d747ef1d2f9.zip |
Add support for including additional configuration files.
Pulled from ospfd. Original author: dlg@
-rw-r--r-- | usr.sbin/ldpd/ldpd.conf.5 | 14 | ||||
-rw-r--r-- | usr.sbin/ldpd/parse.y | 20 |
2 files changed, 31 insertions, 3 deletions
diff --git a/usr.sbin/ldpd/ldpd.conf.5 b/usr.sbin/ldpd/ldpd.conf.5 index 02a0f7ef096..69e8b6fee09 100644 --- a/usr.sbin/ldpd/ldpd.conf.5 +++ b/usr.sbin/ldpd/ldpd.conf.5 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ldpd.conf.5,v 1.18 2015/07/21 04:52:29 renato Exp $ +.\" $OpenBSD: ldpd.conf.5,v 1.19 2016/05/23 15:32:48 renato Exp $ .\" .\" Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> .\" Copyright (c) 2005, 2006 Esben Norby <norby@openbsd.org> @@ -18,7 +18,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: July 21 2015 $ +.Dd $Mdocdate: May 23 2016 $ .Dt LDPD.CONF 5 .Os .Sh NAME @@ -48,6 +48,16 @@ Neighbor-specific parameters. .It Sy Layer 2 VPNs Configuration Layer 2 VPNs parameters as per RFC 4447. .El +.Pp +Argument names not beginning with a letter, digit, or underscore +must be quoted. +.Pp +Additional configuration files can be included with the +.Ic include +keyword, for example: +.Bd -literal -offset indent +include "/etc/ldpd.sub.conf" +.Ed .Sh MACROS Much like .Xr cpp 1 diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y index ac54e52d742..c8f971ef8e3 100644 --- a/usr.sbin/ldpd/parse.y +++ b/usr.sbin/ldpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.33 2016/05/23 15:30:43 renato Exp $ */ +/* $OpenBSD: parse.y,v 1.34 2016/05/23 15:32:48 renato Exp $ */ /* * Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org> @@ -136,6 +136,7 @@ typedef struct { %token PSEUDOWIRE NEIGHBOR PWID %token EXTTAG %token YES NO +%token INCLUDE %token ERROR %token <v.string> STRING %token <v.number> NUMBER @@ -147,6 +148,7 @@ typedef struct { %% grammar : /* empty */ + | grammar include '\n' | grammar '\n' | grammar conf_main '\n' | grammar varset '\n' @@ -157,6 +159,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); @@ -650,6 +667,7 @@ lookup(char *s) {"ethernet", ETHERNET}, {"ethernet-tagged", ETHERNETTAGGED}, {"fib-update", FIBUPDATE}, + {"include", INCLUDE}, {"interface", INTERFACE}, {"keepalive", KEEPALIVE}, {"l2vpn", L2VPN}, |