summaryrefslogtreecommitdiff
path: root/usr.sbin/ldomctl
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/ldomctl')
-rw-r--r--usr.sbin/ldomctl/config.c8
-rw-r--r--usr.sbin/ldomctl/ldom.conf.57
-rw-r--r--usr.sbin/ldomctl/ldomctl.h3
-rw-r--r--usr.sbin/ldomctl/parse.y18
4 files changed, 26 insertions, 10 deletions
diff --git a/usr.sbin/ldomctl/config.c b/usr.sbin/ldomctl/config.c
index 7f6104ce3ab..c109b6b1818 100644
--- a/usr.sbin/ldomctl/config.c
+++ b/usr.sbin/ldomctl/config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: config.c,v 1.33 2020/02/20 20:38:44 kn Exp $ */
+/* $OpenBSD: config.c,v 1.34 2020/02/21 19:39:28 kn Exp $ */
/*
* Copyright (c) 2012, 2018 Mark Kettenis
@@ -2586,7 +2586,7 @@ guest_add_vdisk(struct guest *guest, uint64_t id, const char *path,
void
guest_add_vnetwork(struct guest *guest, uint64_t id, uint64_t mac_addr,
- uint64_t mtu)
+ uint64_t mtu, const char *user_devalias)
{
struct guest *primary;
struct ldc_channel *lc;
@@ -2610,6 +2610,8 @@ guest_add_vnetwork(struct guest *guest, uint64_t id, uint64_t mac_addr,
if (id == 0)
guest_add_devalias(guest, "net", devpath);
guest_add_devalias(guest, devalias, devpath);
+ if (user_devalias != NULL)
+ guest_add_devalias(guest, user_devalias, devpath);
free(devalias);
free(devpath);
}
@@ -2857,7 +2859,7 @@ build_config(const char *filename, int noaction)
i = 0;
SIMPLEQ_FOREACH(vnet, &domain->vnet_list, entry)
guest_add_vnetwork(guest, i++, vnet->mac_addr,
- vnet->mtu);
+ vnet->mtu, vnet->devalias);
SIMPLEQ_FOREACH(var, &domain->var_list, entry)
guest_add_variable(guest, var->name, var->str);
SIMPLEQ_FOREACH(iodev, &domain->iodev_list, entry)
diff --git a/usr.sbin/ldomctl/ldom.conf.5 b/usr.sbin/ldomctl/ldom.conf.5
index 75bf38f5de1..1d72ee44a4a 100644
--- a/usr.sbin/ldomctl/ldom.conf.5
+++ b/usr.sbin/ldomctl/ldom.conf.5
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ldom.conf.5,v 1.12 2020/02/20 20:38:44 kn Exp $
+.\" $OpenBSD: ldom.conf.5,v 1.13 2020/02/21 19:39:28 kn Exp $
.\"
.\" Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org>
.\"
@@ -14,7 +14,7 @@
.\" 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 20 2020 $
+.Dd $Mdocdate: February 21 2020 $
.Dt LDOM.CONF 5 sparc64
.Os
.Sh NAME
@@ -81,6 +81,9 @@ Valid options are:
Configure the MAC address of the interface.
.It Ic mtu Ns = Ns Ar number
Configure the MTU of the interface.
+.It Ic devalias Ns = Ns Ar name
+Alias the interface as
+.Ar name .
.El
.El
.Sh EXAMPLES
diff --git a/usr.sbin/ldomctl/ldomctl.h b/usr.sbin/ldomctl/ldomctl.h
index 47545fd9786..a6dd1e688dc 100644
--- a/usr.sbin/ldomctl/ldomctl.h
+++ b/usr.sbin/ldomctl/ldomctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldomctl.h,v 1.13 2020/02/20 20:38:44 kn Exp $ */
+/* $OpenBSD: ldomctl.h,v 1.14 2020/02/21 19:39:28 kn Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis
@@ -165,6 +165,7 @@ struct vnet {
SIMPLEQ_ENTRY(vnet) entry;
uint64_t mac_addr;
uint64_t mtu;
+ const char *devalias;
};
struct var {
diff --git a/usr.sbin/ldomctl/parse.y b/usr.sbin/ldomctl/parse.y
index e50f40721a1..ec28d5d9f72 100644
--- a/usr.sbin/ldomctl/parse.y
+++ b/usr.sbin/ldomctl/parse.y
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.y,v 1.17 2020/02/21 19:29:41 kn Exp $ */
+/* $OpenBSD: parse.y,v 1.18 2020/02/21 19:39:28 kn Exp $ */
/*
* Copyright (c) 2012 Mark Kettenis <kettenis@openbsd.org>
@@ -77,6 +77,7 @@ struct vdisk_opts {
struct vnet_opts {
uint64_t mac_addr;
uint64_t mtu;
+ const char *devalias;
} vnet_opts;
void vcput_opts_default(void);
@@ -105,10 +106,11 @@ typedef struct {
%type <v.number> memory
%type <v.vcpu_opts> vcpu
%type <v.vdisk_opts> vdisk_opts vdisk_opts_l vdisk_opt
-%type <v.vdisk_opts> devalias
+%type <v.vdisk_opts> vdisk_devalias
%type <v.vnet_opts> vnet_opts vnet_opts_l vnet_opt
%type <v.vnet_opts> mac_addr
%type <v.vnet_opts> mtu
+%type <v.vnet_opts> vnet_devalias
%%
grammar : /* empty */
@@ -180,6 +182,7 @@ domainopts : VCPU vcpu {
struct vnet *vnet = xmalloc(sizeof(struct vnet));
vnet->mac_addr = $2.mac_addr;
vnet->mtu = $2.mtu;
+ vnet->devalias = $2.devalias;
SIMPLEQ_INSERT_TAIL(&domain->vnet_list, vnet, entry);
}
| VARIABLE STRING '=' STRING {
@@ -203,10 +206,10 @@ vdisk_opts : { vdisk_opts_default(); }
vdisk_opts_l : vdisk_opts_l vdisk_opt
| vdisk_opt
;
-vdisk_opt : devalias
+vdisk_opt : vdisk_devalias
;
-devalias : DEVALIAS '=' STRING {
+vdisk_devalias : DEVALIAS '=' STRING {
vdisk_opts.devalias = $3;
}
;
@@ -221,6 +224,7 @@ vnet_opts_l : vnet_opts_l vnet_opt
;
vnet_opt : mac_addr
| mtu
+ | vnet_devalias
;
mac_addr : MAC_ADDR '=' STRING {
@@ -246,6 +250,11 @@ mtu : MTU '=' NUMBER {
}
;
+vnet_devalias : DEVALIAS '=' STRING {
+ vnet_opts.devalias = $3;
+ }
+ ;
+
vcpu : STRING {
const char *errstr;
char *colon;
@@ -314,6 +323,7 @@ vnet_opts_default(void)
{
vnet_opts.mac_addr = -1;
vnet_opts.mtu = 1500;
+ vnet_opts.devalias = NULL;
}
struct keywords {