summaryrefslogtreecommitdiffstats
path: root/usr.sbin/switchctl/parser.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/parser.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/parser.c')
-rw-r--r--usr.sbin/switchctl/parser.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/usr.sbin/switchctl/parser.c b/usr.sbin/switchctl/parser.c
index 02870e560bd..01657a938ca 100644
--- a/usr.sbin/switchctl/parser.c
+++ b/usr.sbin/switchctl/parser.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parser.c,v 1.9 2018/10/15 11:30:37 florian Exp $ */
+/* $OpenBSD: parser.c,v 1.10 2018/10/21 21:10:24 akoshibe Exp $ */
/*
* Copyright (c) 2010-2013 Reyk Floeter <reyk@openbsd.org>
@@ -444,7 +444,13 @@ match_token(char *word, const struct token table[], int level)
res.uri.swa_type = SWITCH_CONN_TCP;
else if (strncmp(word, "tls:", len) == 0)
res.uri.swa_type = SWITCH_CONN_TLS;
- else {
+ else if (strncmp(word, "/dev", len) == 0) {
+ res.uri.swa_type = SWITCH_CONN_LOCAL;
+ parse_addr(word, &res.uri.swa_addr);
+ match++;
+ t = &table[i];
+ break;
+ } else {
/* set the default */
res.uri.swa_type = SWITCH_CONN_TCP;
len = 0;