diff options
Diffstat (limited to 'usr.sbin/vmd/parse.y')
-rw-r--r-- | usr.sbin/vmd/parse.y | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/usr.sbin/vmd/parse.y b/usr.sbin/vmd/parse.y index be326146516..d44a02c60a1 100644 --- a/usr.sbin/vmd/parse.y +++ b/usr.sbin/vmd/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.54 2019/12/12 19:52:10 kn Exp $ */ +/* $OpenBSD: parse.y,v 1.55 2020/09/23 15:52:06 martijn Exp $ */ /* * Copyright (c) 2007-2016 Reyk Floeter <reyk@openbsd.org> @@ -48,6 +48,7 @@ #include <fcntl.h> #include <pwd.h> #include <grp.h> +#include <subagentx.h> #include "proc.h" #include "vmd.h" @@ -120,7 +121,8 @@ typedef struct { %token INCLUDE ERROR -%token ADD ALLOW BOOT CDROM DEVICE DISABLE DISK DOWN ENABLE FORMAT GROUP +%token ADD AGENTX ALLOW BOOT CDROM CONTEXT DEVICE DISABLE DISK DOWN ENABLE +%token FORMAT GROUP %token INET6 INSTANCE INTERFACE LLADDR LOCAL LOCKED MEMORY NET NIFS OWNER %token PATH PREFIX RDOMAIN SIZE SOCKET SWITCH UP VM VMID STAGGERED START %token PARALLEL DELAY @@ -218,6 +220,14 @@ main : LOCAL INET6 { env->vmd_ps.ps_csock.cs_uid = $3.uid; env->vmd_ps.ps_csock.cs_gid = $3.gid == -1 ? 0 : $3.gid; } + | AGENTX { + env->vmd_cfg.cfg_agentx.enabled = 1; + } agentxopts { + if (env->vmd_cfg.cfg_agentx.path[0] == '\0') + strlcpy(env->vmd_cfg.cfg_agentx.path, + SUBAGENTX_AGENTX_MASTER, + sizeof(env->vmd_cfg.cfg_agentx.path)); + } | STAGGERED START PARALLEL NUMBER DELAY NUMBER { env->vmd_cfg.cfg_flags |= VMD_CFG_STAGGERED_START; env->vmd_cfg.delay.tv_sec = $6; @@ -596,6 +606,35 @@ owner_id : NUMBER { } ; +agentxopt : CONTEXT STRING { + if (strlcpy(env->vmd_cfg.cfg_agentx.context, $2, + sizeof(env->vmd_cfg.cfg_agentx.context)) >= + sizeof(env->vmd_cfg.cfg_agentx.context)) { + yyerror("agentx context too large"); + free($2); + YYERROR; + } + free($2); + } + | PATH STRING { + if (strlcpy(env->vmd_cfg.cfg_agentx.path, $2, + sizeof(env->vmd_cfg.cfg_agentx.path)) >= + sizeof(env->vmd_cfg.cfg_agentx.path)) { + yyerror("agentx path too large"); + free($2); + YYERROR; + } + free($2); + if (env->vmd_cfg.cfg_agentx.path[0] != '/') { + yyerror("agentx path is not absolute"); + YYERROR; + } + } + +agentxopts : /* none */ + | agentxopts agentxopt + ; + image_format : /* none */ { $$ = 0; } @@ -767,9 +806,11 @@ lookup(char *s) /* this has to be sorted always */ static const struct keywords keywords[] = { { "add", ADD }, + { "agentx", AGENTX }, { "allow", ALLOW }, { "boot", BOOT }, { "cdrom", CDROM }, + { "context", CONTEXT}, { "delay", DELAY }, { "device", DEVICE }, { "disable", DISABLE }, @@ -791,6 +832,7 @@ lookup(char *s) { "net", NET }, { "owner", OWNER }, { "parallel", PARALLEL }, + { "path", PATH }, { "prefix", PREFIX }, { "rdomain", RDOMAIN }, { "size", SIZE }, @@ -1147,6 +1189,10 @@ parse_config(const char *filename) /* Set the default switch type */ (void)strlcpy(vsw_type, VMD_SWITCH_TYPE, sizeof(vsw_type)); + env->vmd_cfg.cfg_agentx.enabled = 0; + env->vmd_cfg.cfg_agentx.context[0] = '\0'; + env->vmd_cfg.cfg_agentx.path[0] = '\0'; + yyparse(); errors = file->errors; popfile(); |