Skip to content

Commit

Permalink
Verify if nmdm(4) is available for creation of virtual ports.
Browse files Browse the repository at this point in the history
Mention the dependency on the nmdm(4) kernel module in the
documentation.
  • Loading branch information
pgj committed Aug 8, 2021
1 parent 34df4b0 commit 06a9d43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
15 changes: 9 additions & 6 deletions man/wifibox.8
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.Dd August 6, 2021
.Dd August 8, 2021
.Dt WIFIBOX 8
.Os
.Sh NAME
Expand Down Expand Up @@ -135,10 +135,12 @@ kernel module and restarting the guest.
.It Cm console
Attach to the running guest with
.Xr cu 1
through a virtual serial port. This is recommended for
troubleshooting problems with the guest in an interactive fashion. It
can also be used to perform updates, install or remove packages. This
has to be configured specifically in order to work.
through a virtual serial port, implemented by
.Xr nmdm 4 .
This is recommended for troubleshooting problems with the guest in an
interactive fashion. It can also be used to perform updates, install
or remove packages. This has to be configured specifically in order
to work.
.It Cm version
Display version of
.Nm
Expand Down Expand Up @@ -173,7 +175,8 @@ The exit status is 0 on success, and >0 if any of the commands fail.
.Xr resolv.conf 5 ,
.Xr devd.conf 5 ,
.Xr devd 8 ,
.Xr cu 1
.Xr cu 1 ,
.Xr nmdm 4
.Sh CAVEATS
.Nm
supports only a single wireless network device at a time, and it has
Expand Down
12 changes: 8 additions & 4 deletions sbin/wifibox
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ sysctl_value() {
${SYSCTL} -nq "$1"
}

check_vmm() {
if ! ${KLDSTAT} -q -m vmm; then
${ECHO} "ERROR: vmm.ko is not loaded."
check_kmod() {
local _kmod="$1"

if ! ${KLDSTAT} -q -m ${_kmod}; then
${ECHO} "ERROR: ${_kmod}.ko is not loaded."
exit 127
fi
}
Expand All @@ -74,7 +76,7 @@ check_iommu() {
}

assert_vm_can_run() {
check_vmm
check_kmod "vmm"
check_iommu
check_virtfs
}
Expand Down Expand Up @@ -111,6 +113,8 @@ create_nmdm() {

[ "${console}" != "yes" ] && return 0

check_kmod "nmdm"

[ ! -c ${NMDM_A} ] && ${MKNOD} ${NMDM_A}
[ ! -c ${NMDM_B} ] && ${MKNOD} ${NMDM_B}
}
Expand Down

0 comments on commit 06a9d43

Please sign in to comment.