summaryrefslogtreecommitdiffstats
path: root/usr.sbin/switchctl/switchctl.c
diff options
context:
space:
mode:
authorakoshibe <akoshibe@openbsd.org>2018-10-21 21:10:24 +0000
committerakoshibe <akoshibe@openbsd.org>2018-10-21 21:10:24 +0000
commit2c04d8eacafe463ff6e7be005ffac86ef49ce3a4 (patch)
tree37045ee74d1b85e7774bf17a612af79bc12c2ff1 /usr.sbin/switchctl/switchctl.c
parentWhen merging sections into the output, lld tries to adjust the alignment of (diff)
downloadwireguard-openbsd-2c04d8eacafe463ff6e7be005ffac86ef49ce3a4.tar.xz
wireguard-openbsd-2c04d8eacafe463ff6e7be005ffac86ef49ce3a4.zip
Add the ability to query a switch(4) instance via its control device. Also
explicitly set the OpenFlow version during the handshake prior to a query. Since switchctl(8) behaves like a controller in this case, a switch can't be connected to switchd(8) while it is being queried in this way. OK claudio@, tb@ and mestre@ for pledge changes
Diffstat (limited to 'usr.sbin/switchctl/switchctl.c')
-rw-r--r--usr.sbin/switchctl/switchctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.sbin/switchctl/switchctl.c b/usr.sbin/switchctl/switchctl.c
index 2d57e47300c..6b828a22901 100644
--- a/usr.sbin/switchctl/switchctl.c
+++ b/usr.sbin/switchctl/switchctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: switchctl.c,v 1.7 2017/01/31 05:53:08 jsg Exp $ */
+/* $OpenBSD: switchctl.c,v 1.8 2018/10/21 21:10:24 akoshibe Exp $ */
/*
* Copyright (c) 2007-2015 Reyk Floeter <reyk@openbsd.org>
@@ -122,11 +122,13 @@ main(int argc, char *argv[])
/*
* pledge in switchctl:
* stdio - for malloc and basic I/O including events.
- * dns - for parsehostport() in the device spec.
+ * rpath - for reading from the /dev/switch device.
+ * wpath - for accessing the /dev/switch device.
* inet - for handling tcp connections with OpenFlow peers.
* unix - for opening the control socket.
+ * dns - for parsehostport() in the device spec.
*/
- if (pledge("stdio dns inet unix", NULL) == -1)
+ if (pledge("stdio rpath wpath inet unix dns", NULL) == -1)
err(1, "pledge");
log_init(quiet ? 0 : 2, LOG_USER);