From 1cc204b97b9317e681958da0e91abeb27bcc6f82 Mon Sep 17 00:00:00 2001 From: Mohamed Khalfella Date: Thu, 5 Sep 2019 21:06:28 +0000 Subject: OS-7975 bhyve should require exactly one primary nic Reviewed by: Mike Gerdts Approved by: Mike Gerdts --- usr/src/lib/brand/bhyve/zone/boot.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'usr') diff --git a/usr/src/lib/brand/bhyve/zone/boot.c b/usr/src/lib/brand/bhyve/zone/boot.c index 6e6f3dc640..51aab83daf 100644 --- a/usr/src/lib/brand/bhyve/zone/boot.c +++ b/usr/src/lib/brand/bhyve/zone/boot.c @@ -10,7 +10,7 @@ */ /* - * Copyright (c) 2018, Joyent, Inc. + * Copyright (c) 2019, Joyent, Inc. */ /* @@ -382,7 +382,8 @@ add_nets(int *argc, char **argv) char slotconf[MAXNAMELEN]; char *primary = NULL; - if ((nets = get_zcfg_var("net", "resources", NULL)) == NULL) { + if ((nets = get_zcfg_var("net", "resources", NULL)) == NULL || + strcmp(nets, "") == 0) { return (0); } @@ -423,6 +424,12 @@ add_nets(int *argc, char **argv) } } + /* Make sure there is a "primary" net */ + if (primary == NULL) { + (void) printf("Error: no primary net has been specified\n"); + return (-1); + } + return (0); } -- cgit v1.2.3