summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/vmd/parse.y')
-rw-r--r--usr.sbin/vmd/parse.y30
1 files changed, 24 insertions, 6 deletions
diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y
index 6f1544fbea7..308f9d9d571 100644
--- a/usr.sbin/vmd/parse.y
+++ b/usr.sbin/vmd/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.48 2018/11/01 00:18:44 sashan Exp $ */
+/* $OpenBSD: parse.y,v 1.49 2018/11/21 12:31:47 reyk Exp $ */
/*
* Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org>
@@ -120,9 +120,9 @@ typedef struct {
%token INCLUDE ERROR
-%token ADD ALLOW BOOT CDROM DISABLE DISK DOWN ENABLE FORMAT GROUP INSTANCE
-%token INTERFACE LLADDR LOCAL LOCKED MEMORY NIFS OWNER PATH PREFIX RDOMAIN
-%token SIZE SOCKET SWITCH UP VM VMID
+%token ADD ALLOW BOOT CDROM DISABLE DISK DOWN ENABLE FORMAT GROUP INET6
+%token INSTANCE INTERFACE LLADDR LOCAL LOCKED MEMORY NIFS OWNER PATH PREFIX
+%token RDOMAIN SIZE SOCKET SWITCH UP VM VMID
%token <v.number> NUMBER
%token <v.string> STRING
%type <v.lladdr> lladdr
@@ -181,10 +181,27 @@ varset : STRING '=' STRING {
}
;
-main : LOCAL PREFIX STRING {
+main : LOCAL INET6 {
+ env->vmd_cfg.cfg_flags |= VMD_CFG_INET6;
+ }
+ | LOCAL INET6 PREFIX STRING {
+ struct address h;
+
+ if (host($4, &h) == -1 ||
+ h.ss.ss_family != AF_INET6 ||
+ h.prefixlen > 64 || h.prefixlen < 0) {
+ yyerror("invalid local inet6 prefix: %s", $4);
+ free($4);
+ YYERROR;
+ }
+
+ env->vmd_cfg.cfg_flags |= VMD_CFG_INET6;
+ env->vmd_cfg.cfg_flags &= ~VMD_CFG_AUTOINET6;
+ memcpy(&env->vmd_cfg.cfg_localprefix6, &h, sizeof(h));
+ }
+ | LOCAL PREFIX STRING {
struct address h;
- /* The local prefix is IPv4-only */
if (host($3, &h) == -1 ||
h.ss.ss_family != AF_INET ||
h.prefixlen > 32 || h.prefixlen < 0) {
@@ -747,6 +764,7 @@ lookup(char *s)
{ "group", GROUP },
{ "id", VMID },
{ "include", INCLUDE },
+ { "inet6", INET6 },
{ "instance", INSTANCE },
{ "interface", INTERFACE },
{ "interfaces", NIFS },