aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/iovctl
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/iovctl')
-rw-r--r--usr.sbin/iovctl/Makefile2
-rw-r--r--usr.sbin/iovctl/Makefile.depend2
-rw-r--r--usr.sbin/iovctl/iovctl.82
-rw-r--r--usr.sbin/iovctl/iovctl.c9
-rw-r--r--usr.sbin/iovctl/iovctl.conf.57
-rw-r--r--usr.sbin/iovctl/iovctl.h2
-rw-r--r--usr.sbin/iovctl/parse.c32
-rw-r--r--usr.sbin/iovctl/validate.c3
8 files changed, 37 insertions, 22 deletions
diff --git a/usr.sbin/iovctl/Makefile b/usr.sbin/iovctl/Makefile
index 42fca7dab71c..3298a6a21217 100644
--- a/usr.sbin/iovctl/Makefile
+++ b/usr.sbin/iovctl/Makefile
@@ -1,5 +1,3 @@
-# $FreeBSD$
-
PROG= iovctl
SRCS= iovctl.c parse.c validate.c
LIBADD= nv ucl m
diff --git a/usr.sbin/iovctl/Makefile.depend b/usr.sbin/iovctl/Makefile.depend
index 2082bfb7951c..552b40d7838b 100644
--- a/usr.sbin/iovctl/Makefile.depend
+++ b/usr.sbin/iovctl/Makefile.depend
@@ -1,8 +1,6 @@
-# $FreeBSD$
# Autogenerated - do NOT edit!
DIRDEPS = \
- gnu/lib/csu \
include \
include/xlocale \
lib/${CSU_DIR} \
diff --git a/usr.sbin/iovctl/iovctl.8 b/usr.sbin/iovctl/iovctl.8
index f22fdab61464..5c7b01c249a0 100644
--- a/usr.sbin/iovctl/iovctl.8
+++ b/usr.sbin/iovctl/iovctl.8
@@ -23,8 +23,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
.Dd May 31, 2020
.Dt IOVCTL 8
.Os
diff --git a/usr.sbin/iovctl/iovctl.c b/usr.sbin/iovctl/iovctl.c
index 0350c732f671..28d2e0a93504 100644
--- a/usr.sbin/iovctl/iovctl.c
+++ b/usr.sbin/iovctl/iovctl.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/iov.h>
#include <sys/dnv.h>
@@ -348,6 +345,12 @@ print_default_value(const nvlist_t *parameter, const char *type)
mac = nvlist_get_binary(parameter, DEFAULT_SCHEMA_NAME, &size);
printf(" (default = %02x:%02x:%02x:%02x:%02x:%02x)", mac[0],
mac[1], mac[2], mac[3], mac[4], mac[5]);
+ } else if (strcasecmp(type, "vlan") == 0) {
+ uint16_t vlan = nvlist_get_number(parameter, DEFAULT_SCHEMA_NAME);
+ if (vlan == VF_VLAN_TRUNK)
+ printf(" (default = trunk)");
+ else
+ printf(" (default = %d)", vlan);
} else
errx(1, "Unexpected type in schema: '%s'", type);
}
diff --git a/usr.sbin/iovctl/iovctl.conf.5 b/usr.sbin/iovctl/iovctl.conf.5
index a9630f3b3b13..1bae96e150ba 100644
--- a/usr.sbin/iovctl/iovctl.conf.5
+++ b/usr.sbin/iovctl/iovctl.conf.5
@@ -23,9 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" $FreeBSD$
-.\"
-.Dd May 29, 2020
+.Dd May 30, 2024
.Dt IOVCTL.CONF 5
.Os
.Sh NAME
@@ -97,6 +95,8 @@ The following option types are supported:
.Bl -tag -width indent
.It boolean
Accepts a boolean value of true or false.
+.It vlan
+Accepts a VLAN ID, or "trunk" to allow any VLAN ID.
.It mac-addr
Accepts a unicast MAC address specified as a string of the form
xx:xx:xx:xx:xx:xx, where xx is one or two hexadecimal digits.
@@ -161,6 +161,7 @@ DEFAULT {
VF-0 {
mac-addr : "02:56:48:7e:d9:f7";
passthrough : false;
+ vlan: 1;
}
.Ed
.Sh SEE ALSO
diff --git a/usr.sbin/iovctl/iovctl.h b/usr.sbin/iovctl/iovctl.h
index 20b2da011c91..5a39092395ca 100644
--- a/usr.sbin/iovctl/iovctl.h
+++ b/usr.sbin/iovctl/iovctl.h
@@ -22,8 +22,6 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
- *
- * $FreeBSD$
*/
#ifndef IOVCTL_H
diff --git a/usr.sbin/iovctl/parse.c b/usr.sbin/iovctl/parse.c
index 347b35fb417a..6b7645f341cc 100644
--- a/usr.sbin/iovctl/parse.c
+++ b/usr.sbin/iovctl/parse.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/iov.h>
#include <sys/nv.h>
@@ -163,9 +160,32 @@ add_unicast_mac_config(const char *key, const ucl_object_t *obj, nvlist_t *confi
nvlist_add_binary(config, key, mac, ETHER_ADDR_LEN);
}
+static void
+add_vlan_config(const char *key, const ucl_object_t *obj, nvlist_t *config)
+{
+ int64_t val;
+ const char *strVal = "";
+
+ if(ucl_object_tostring_safe(obj, &strVal)) {
+ if (strcasecmp(strVal, "trunk") == 0) {
+ nvlist_add_number(config, key, VF_VLAN_TRUNK);
+ return;
+ }
+ report_config_error(key, obj, "vlan");
+ }
+
+ if (!ucl_object_toint_safe(obj, &val))
+ report_config_error(key, obj, "vlan");
+
+ if (val < 0 || val > 4095)
+ report_config_error(key, obj, "vlan");
+
+ nvlist_add_number(config, key, val);
+}
+
/*
- * Validates that the given configuation value has the right type as specified
- * in the schema, and then adds the value to the configuation node.
+ * Validates that the given configuration value has the right type as specified
+ * in the schema, and then adds the value to the configuration node.
*/
static void
add_config(const char *key, const ucl_object_t *obj, nvlist_t *config,
@@ -189,6 +209,8 @@ add_config(const char *key, const ucl_object_t *obj, nvlist_t *config,
add_uint_config(key, obj, config, type, UINT64_MAX);
else if (strcasecmp(type, "unicast-mac") == 0)
add_unicast_mac_config(key, obj, config);
+ else if (strcasecmp(type, "vlan") == 0)
+ add_vlan_config(key, obj, config);
else
errx(1, "Unexpected type '%s' in schema", type);
}
diff --git a/usr.sbin/iovctl/validate.c b/usr.sbin/iovctl/validate.c
index 6658a8c0c281..cd187291c9c7 100644
--- a/usr.sbin/iovctl/validate.c
+++ b/usr.sbin/iovctl/validate.c
@@ -24,9 +24,6 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
#include <sys/param.h>
#include <sys/iov.h>
#include <sys/dnv.h>