summaryrefslogtreecommitdiff
path: root/usr.sbin/ldpd/parse.y
diff options
context:
space:
mode:
authorRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:43:12 +0000
committerRenato Westphal <renato@cvs.openbsd.org>2016-05-23 15:43:12 +0000
commit89f9f018c4a148d679a54f303d0c7addbb7ca971 (patch)
tree180cc0d487fc576f3aa74dec5b127d7ee8a1ee6f /usr.sbin/ldpd/parse.y
parentc31fb6c24d6f0a07578eaf605e3e23eee777ee5b (diff)
Add knob to configure the transport address.
This will be especially important when we add support for IPv6, because we'll not be able to use the router-id as the transport-address in this case.
Diffstat (limited to 'usr.sbin/ldpd/parse.y')
-rw-r--r--usr.sbin/ldpd/parse.y19
1 files changed, 17 insertions, 2 deletions
diff --git a/usr.sbin/ldpd/parse.y b/usr.sbin/ldpd/parse.y
index 7b2dc2d48a0..1ff60fe3707 100644
--- a/usr.sbin/ldpd/parse.y
+++ b/usr.sbin/ldpd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.35 2016/05/23 15:41:04 renato Exp $ */
+/* $OpenBSD: parse.y,v 1.36 2016/05/23 15:43:11 renato Exp $ */
/*
* Copyright (c) 2004, 2005, 2008 Esben Norby <norby@openbsd.org>
@@ -129,7 +129,7 @@ typedef struct {
%token LHELLOHOLDTIME LHELLOINTERVAL
%token THELLOHOLDTIME THELLOINTERVAL
%token THELLOACCEPT
-%token KEEPALIVE
+%token KEEPALIVE TRANSADDRESS
%token NEIGHBOR PASSWORD
%token L2VPN TYPE VPLS PWTYPE MTU BRIDGE
%token ETHERNET ETHERNETTAGGED STATUSTLV CONTROLWORD
@@ -240,6 +240,18 @@ conf_main : ROUTERID STRING {
}
conf->keepalive = $2;
}
+ | TRANSADDRESS STRING {
+ if (!inet_aton($2, &conf->trans_addr)) {
+ yyerror("error parsing transport-address");
+ free($2);
+ YYERROR;
+ }
+ free($2);
+ if (bad_ip_addr(conf->trans_addr)) {
+ yyerror("invalid transport-address");
+ YYERROR;
+ }
+ }
| iface_defaults
| tnbr_defaults
;
@@ -694,6 +706,7 @@ lookup(char *s)
{"targeted-hello-holdtime", THELLOHOLDTIME},
{"targeted-hello-interval", THELLOINTERVAL},
{"targeted-neighbor", TNEIGHBOR},
+ {"transport-address", TRANSADDRESS},
{"type", TYPE},
{"vpls", VPLS},
{"yes", YES}
@@ -1080,6 +1093,8 @@ parse_config(char *filename, int opts)
if (conf->rtr_id.s_addr == 0)
conf->rtr_id.s_addr = get_rtr_id();
+ if (conf->trans_addr.s_addr == 0)
+ conf->trans_addr.s_addr = conf->rtr_id.s_addr;
return (conf);
}