From 5f50e502dcd0fc82337d4ac249b3db3fd2501a00 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Sun, 27 Jun 2010 19:53:35 +0000 Subject: Instead of specifying the control sockets on the command line have them in bgpd.conf. This allows to add/modify restricted control sockets on runtime. Feature request by a few people how often forgot to add -r path when restarting bgpd (including myself). NOTE: this removes the -s and -r arguments from bgpd so pay attention when updateing. jajaja sthen@, OK henning@ --- usr.sbin/bgpd/parse.y | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'usr.sbin/bgpd/parse.y') diff --git a/usr.sbin/bgpd/parse.y b/usr.sbin/bgpd/parse.y index 6660ae92149..6ec94d8f758 100644 --- a/usr.sbin/bgpd/parse.y +++ b/usr.sbin/bgpd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.255 2010/05/17 16:08:20 claudio Exp $ */ +/* $OpenBSD: parse.y,v 1.256 2010/06/27 19:53:34 claudio Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -172,7 +172,7 @@ typedef struct { %token REMOTEAS DESCR LOCALADDR MULTIHOP PASSIVE MAXPREFIX RESTART %token ANNOUNCE CAPABILITIES REFRESH AS4BYTE CONNECTRETRY %token DEMOTE ENFORCE NEIGHBORAS REFLECTOR DEPEND DOWN SOFTRECONFIG -%token DUMP IN OUT +%token DUMP IN OUT SOCKET RESTRICTED %token LOG ROUTECOLL TRANSPARENT %token TCP MD5SIG PASSWORD KEY TTLSECURITY %token ALLOW DENY MATCH @@ -190,8 +190,9 @@ typedef struct { %token NE LE GE XRANGE %token STRING %token NUMBER -%type asnumber as4number optnumber yesno inout +%type asnumber as4number optnumber %type espah family restart origincode nettype +%type yesno inout restricted %type string filter_rib %type address %type prefix addrspec @@ -558,6 +559,15 @@ conf_main : AS as4number { } conf->connectretry = $2; } + | SOCKET STRING restricted { + if ($3) { + free(conf->rcsock); + conf->rcsock = $2; + } else { + free(conf->csock); + conf->csock = $2; + } + } ; mrtdump : DUMP STRING inout STRING optnumber { @@ -627,6 +637,10 @@ inout : IN { $$ = 1; } | OUT { $$ = 0; } ; +restricted : RESTRICTED { $$ = 1; } + | /* nothing */ { $$ = 0; } + ; + address : STRING { u_int8_t len; @@ -2164,6 +2178,7 @@ lookup(char *s) { "reject", REJECT}, { "remote-as", REMOTEAS}, { "restart", RESTART}, + { "restricted", RESTRICTED}, { "rib", RIB}, { "route-collector", ROUTECOLL}, { "route-reflector", REFLECTOR}, @@ -2172,6 +2187,7 @@ lookup(char *s) { "rtlabel", RTLABEL}, { "self", SELF}, { "set", SET}, + { "socket", SOCKET }, { "softreconfig", SOFTRECONFIG}, { "source-as", SOURCEAS}, { "spi", SPI}, @@ -2539,6 +2555,7 @@ parse_config(char *filename, struct bgpd_config *xconf, if ((conf = calloc(1, sizeof(struct bgpd_config))) == NULL) fatal(NULL); conf->opts = xconf->opts; + conf->csock = strdup(SOCKET_NAME); if ((file = pushfile(filename, 1)) == NULL) { free(conf); @@ -2599,6 +2616,9 @@ parse_config(char *filename, struct bgpd_config *xconf, if (errors) { /* XXX more leaks in this case */ + free(conf->csock); + free(conf->rcsock); + while ((la = TAILQ_FIRST(listen_addrs)) != NULL) { TAILQ_REMOVE(listen_addrs, la, entry); free(la); -- cgit v1.2.3