-.\" $OpenBSD: bgpctl.8,v 1.73 2017/02/13 14:48:44 phessler Exp $
+.\" $OpenBSD: bgpctl.8,v 1.74 2017/05/29 09:56:33 benno Exp $
.\"
.\" Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
.\"
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: February 13 2017 $
+.Dd $Mdocdate: May 29 2017 $
.Dt BGPCTL 8
.Os
.Sh NAME
.It Fl s Ar socket
Use
.Ar socket
-instead of the default
-.Pa /var/run/bgpd.sock
to communicate with
-.Xr bgpd 8 .
+.Xr bgpd 8
+instead of the default
+.Pa /var/run/bgpd.sock.<rdomain>
+where
+.Ar <rdomain>
+is the routing domain
+.Xr bgpctl 8
+is running in.
.El
.Pp
The commands are as follows:
-/* $OpenBSD: bgpctl.c,v 1.193 2017/01/23 23:38:51 claudio Exp $ */
+/* $OpenBSD: bgpctl.c,v 1.194 2017/05/29 09:56:33 benno Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/stat.h>
#include <sys/un.h>
#include <net/if.h>
#include <net/if_media.h>
main(int argc, char *argv[])
{
struct sockaddr_un sun;
- int fd, n, done, ch, nodescr = 0, verbose = 0;
+ int fd, n, done, ch, nodescr = 0, verbose = 0, r;
struct imsg imsg;
struct network_config net;
struct parse_result *res;
char *sockname;
enum imsg_type type;
+ r = getrtable();
+ if (asprintf(&sockname, "%s.%d", SOCKET_NAME, r) == -1)
+ err(1, "asprintf");
+
if (pledge("stdio rpath wpath cpath unix inet dns", NULL) == -1)
err(1, "pledge");
- sockname = SOCKET_NAME;
while ((ch = getopt(argc, argv, "ns:")) != -1) {
switch (ch) {
case 'n':
-.\" $OpenBSD: bgpd.conf.5,v 1.157 2017/05/28 16:52:27 jmc Exp $
+.\" $OpenBSD: bgpd.conf.5,v 1.158 2017/05/29 09:56:33 benno Exp $
.\"
.\" Copyright (c) 2004 Claudio Jeker <claudio@openbsd.org>
.\" Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: May 28 2017 $
+.Dd $Mdocdate: May 29 2017 $
.Dt BGPD.CONF 5
.Os
.Sh NAME
.Ic restricted
is specified a restricted control socket will be created.
By default
-.Pa /var/run/bgpd.sock
-is used and no restricted socket is created.
+.Pa /var/run/bgpd.sock.<rdomain>
+is used where
+.Ar <rdomain>
+is the routing domain in which bgpd has been started.
+By default, no restricted socket is created.
.Pp
.It Xo
.Ic transparent-as
-/* $OpenBSD: config.c,v 1.66 2017/05/28 15:16:33 henning Exp $ */
+/* $OpenBSD: config.c,v 1.67 2017/05/29 09:56:33 benno Exp $ */
/*
* Copyright (c) 2003, 2004, 2005 Henning Brauer <henning@openbsd.org>
#include <ifaddrs.h>
#include <netdb.h>
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <unistd.h>
struct bgpd_config *
new_config(void)
{
- struct bgpd_config *conf;
+ struct bgpd_config *conf;
if ((conf = calloc(1, sizeof(struct bgpd_config))) == NULL)
fatal(NULL);
conf->fib_priority = RTP_BGP;
conf->default_tableid = getrtable();
- if ((conf->csock = strdup(SOCKET_NAME)) == NULL)
+ if (asprintf(&conf->csock, "%s.%d", SOCKET_NAME,
+ conf->default_tableid) == -1)
fatal(NULL);
if ((conf->filters = calloc(1, sizeof(struct filter_head))) == NULL)