Skip to content

Commit

Permalink
11.1.6 rel
Browse files Browse the repository at this point in the history
bhyve: add MTU settings for NIC
bug fixes for vm_ram converter in bconfig dialog
bset/jset: support for jname as mask
  • Loading branch information
olevole committed Sep 17, 2017
1 parent d37e7ab commit b631f2d
Show file tree
Hide file tree
Showing 31 changed files with 356 additions and 86 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -35,6 +35,7 @@ clean:
${RM} -f tools/imghelper
${RM} -f tools/xo
${RM} -f tools/vale-ctl
${RM} -f tools/nic_info
${RM} -f tools/bridge

cbsd:
Expand All @@ -58,6 +59,7 @@ cbsd:
${CC} tools/src/imghelper.c -o tools/imghelper && ${STRIP} tools/imghelper
${CC} tools/src/bridge.c -o tools/bridge && ${STRIP} tools/bridge
${CC} tools/src/vale-ctl.c -o tools/vale-ctl && ${STRIP} tools/vale-ctl
${CC} tools/src/nic_info.c -o tools/nic_info && ${STRIP} tools/nic_info
${MAKE} -C bin/cbsdsh && ${STRIP} bin/cbsdsh/cbsd
${MAKE} -C share/bsdconfig/cbsd

Expand Down
36 changes: 31 additions & 5 deletions bhyve.subr
Expand Up @@ -207,10 +207,12 @@ compile_nic_args()
local sqldelimer=" "
local mybridge
local net_emul=
local _parent_mtu
local _ret=

local errmsg=

eval $( cbsdsql ${jailsysdir}/${jname}/local.sqlite SELECT id,nic_order,nic_driver,nic_slot,nic_type,nic_parent,nic_hwaddr,nic_address FROM bhyvenic WHERE jname=\"${jname}\" |while read nic_id nic_order nic_driver nic_slot nic_type nic_parent nic_hwaddr nic_address; do
eval $( cbsdsql ${jailsysdir}/${jname}/local.sqlite SELECT id,nic_order,nic_driver,nic_slot,nic_type,nic_parent,nic_hwaddr,nic_address,nic_mtu FROM bhyvenic WHERE jname=\"${jname}\" |while read nic_id nic_order nic_driver nic_slot nic_type nic_parent nic_hwaddr nic_address nic_mtu; do

if ! next_pci_id; then
# no free pci bus
Expand Down Expand Up @@ -305,6 +307,26 @@ compile_nic_args()
echo "export nic${_id}=\"-s ${pcislot}:0,${net_emul},${mytap}\" ;"
fi

# MTU management
[ -z "${nic_mtu}" ] && nic_mtu="0" # AUTO
if [ ${nic_mtu} -eq 0 ]; then
# Get parent MTU size
_parent_mtu=$( ${toolsdir}/nic_info --nic=${mybridge} --quiet 2>/dev/null )
_ret=$?
if [ ${_ret} -eq 0 ]; then
[ -n "${_parent_mtu}" ] && _ret=$( /sbin/ifconfig ${mytap} mtu ${_parent_mtu} )
fi
else
# Get parent MTU size
# compare MTU with parent
#_parent_mtu=$( ${toolsdir}/nic_info --nic=${mybridge} --quiet 2>/dev/null )
#_ret=$?
#if [ ${_ret} -eq 0 ]; then
# [ ${nic_mtu} -gt ${_parent_mtu} ]
#fi
_ret=$( /sbin/ifconfig ${mytap} mtu ${nic_mtu} )
fi

echo "export mytap${_id}=\"${mytap}\";"

_id=$(( _id + 1 ))
Expand Down Expand Up @@ -356,7 +378,7 @@ compile_lpc_args()
# export arguments for bhyve pci_passthru_args
compile_pci_passthru_args()
{
local ppt
local ppt _i

ppt=$( cbsdsql local SELECT ppt FROM bhyveppt WHERE jname=\"${jname}\" 2>/dev/null )

Expand All @@ -375,11 +397,15 @@ compile_pci_passthru_args()
pci_passthru_args="${pci_passthru_args} -s ${bhyve_pci_index},passthru,${_i}"
done

pci_passthru_args="${pci_passthru_args} -S"
pci_passthru_args="${pci_passthru_args}"

local _dmar_test=$( /usr/sbin/acpidump -t | /usr/bin/grep DMAR )
[ -z "${_dmar_test}" ] && err 1 "${MAGENTA}I/O MMU / VT-d not enabled. Check you hardware or BIOS setting${NORMAL}"
. ${workdir}/virtual.subr

if check_dmar; then
err 1 "${MAGENTA}I/O MMU / VT-d not enabled. Check you hardware or BIOS setting${NORMAL}"
fi

return 0
}


Expand Down
2 changes: 1 addition & 1 deletion bin/cbsdsh/about.h
@@ -1 +1 @@
#define VERSION "11.1.5"
#define VERSION "11.1.6"
1 change: 0 additions & 1 deletion bsdconfig.subr
Expand Up @@ -7,4 +7,3 @@ BSDCFG_LIBE="/usr/local/libexec/bsdconfig" APP_DIR="cbsd"

ipgm=$( f_index_menusel_keyword $BSDCFG_LIBE/$APP_DIR/INDEX "$pgm" )
[ $? -eq $SUCCESS -a "$ipgm" ] && pgm="$ipgm"

2 changes: 1 addition & 1 deletion cbsd.conf
Expand Up @@ -3,7 +3,7 @@ unset oarch over ostable arch target_arch ver stable

# defines
product="CBSD"
myversion="11.1.5"
myversion="11.1.6"

if [ -z "${workdir}" ]; then
echo "no workdir"
Expand Down
2 changes: 1 addition & 1 deletion cbsd.lua
@@ -1,5 +1,5 @@
product="CBSD"
myversion="11.1.5"
myversion="11.1.6"

if not workdir then
print ( "no workdir" )
Expand Down
31 changes: 0 additions & 31 deletions etc/defaults/vm-freebsd-BSDRP-x64-1.70.conf

This file was deleted.

41 changes: 41 additions & 0 deletions etc/defaults/vm-freebsd-BSDRP-x64-1.80.conf
@@ -0,0 +1,41 @@
# don't remove this line:
vm_profile="BSDRP-x64-1.80"
vm_os_type="freebsd"
# this is one-string additional info strings in dialogue menu
long_description="Embedded free and open source router distribution"

# custom settings:
fetch=1

iso_site="https://vorboss.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
https://10gbps-io.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
https://freefr.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
https://gigenet.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
https://netix.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
https://ncu.dl.sourceforge.net/project/bsdrp/BSD_Router_Project/1.80/amd64/ \
"

iso_img="BSDRP-1.80-full-amd64-vga.img"
iso_img_dist="BSDRP-1.80-full-amd64-vga.img.xz"

# register_iso as:
register_iso_name="cbsd-iso-${iso_img}"
register_iso_as="iso-BSDRP-x64-1.80"

iso_extract="/usr/bin/xz -d "

default_jailname="bsdrp"
vm_package="small1"

# disable profile?
active=0

# Available in ClonOS?
clonos_active=0

# VNC
vm_vnc_port="0"
vm_efi="uefi"

# VirtualBox Area
virtualbox_ostype="FreeBSD_64"
2 changes: 1 addition & 1 deletion etc/defaults/vm-freebsd-FreeBSD-x64-12.0-LATEST.conf
Expand Up @@ -8,7 +8,7 @@ long_description="FreeBSD 12.0 Current"
fetch=1

iso_site="https://download.freebsd.org/ftp/snapshots/amd64/amd64/ISO-IMAGES/12.0/"
iso_img="FreeBSD-12.0-CURRENT-amd64-20170814-r322508-disc1.iso"
iso_img="FreeBSD-12.0-CURRENT-amd64-20170912-r323499-disc1.iso"

# register_iso as:
register_iso_name="cbsd-iso-${iso_img}"
Expand Down
1 change: 1 addition & 0 deletions etc/defaults/vm-freebsd-OPNsense-17-RELEASE-amd64.conf
Expand Up @@ -15,6 +15,7 @@ http://mirror.cedia.org.ec/opnsense/releases/17.7/ \
http://mirrors.nycbug.org/pub/opnsense/releases/mirror/ \
http://mirror.wdc1.us.leaseweb.net/opnsense/releases/17.7/ \
https://opnsense.ieji.de/releases/17.7/ \
https://mirror.dns-root.de/opnsense/releases/17.7/ \
"

iso_img="OPNsense-17.7-OpenSSL-dvd-amd64.iso"
Expand Down
14 changes: 7 additions & 7 deletions etc/defaults/vm-linux-OracleLinux-7.conf
Expand Up @@ -3,7 +3,7 @@ vmlinuz_ver="3.10.0-123.el7.x86_64"
vm_profile="OracleLinux-7"
vm_os_type="linux"
# this is one-string additional info strings in dialogue menu
long_description="Linux Oracle R7-U3"
long_description="Linux Oracle R7-U4"

# custom settings:
fetch=1
Expand All @@ -15,14 +15,14 @@ fetch=1
# grub-bhyve command to boot from ISO
#grub_iso_cmd="echo -e \"linux /isolinux/vmlinuz text\ninitrd /isolinux/initrd.img\nboot\" | /usr/bin/lockf -s -t0 /tmp/bhyveload.${jname}.lock grub-bhyve -r cd0 -m "${_devicemap}" -M ${grubmem} "${jname}""

iso_site="http://ftp5.gwdg.de/pub/linux/oracle/OL7/u3/x86_64/ \
https://mirrors.dotsrc.org/oracle-linux/OL7/u3/x86_64/ \
https://ftp.heanet.ie/mirrors/oracle-linux/OL7/u3/x86_64/ \
http://ftp.icm.edu.pl/pub/Linux/dist/oracle-linux/OL7/u3/x86_64/ \
http://mirror.aarnet.edu.au/pub/oraclelinux/OL7/u3/x86_64/ \
iso_site="http://ftp5.gwdg.de/pub/linux/oracle/OL7/u4/x86_64/ \
https://mirrors.dotsrc.org/oracle-linux/OL7/u4/x86_64/ \
https://ftp.heanet.ie/mirrors/oracle-linux/OL7/u4/x86_64/ \
http://ftp.icm.edu.pl/pub/Linux/dist/oracle-linux/OL7/u4/x86_64/ \
http://mirror.aarnet.edu.au/pub/oraclelinux/OL7/u4/x86_64/ \
"

iso_img="OracleLinux-R7-U3-Server-x86_64-dvd.iso"
iso_img="OracleLinux-R7-U4-Server-x86_64-dvd.iso"

# register_iso as:
register_iso_name="cbsd-iso-${iso_img}"
Expand Down
2 changes: 1 addition & 1 deletion etc/defaults/vm-linux-TinyCore-x86-8.conf
Expand Up @@ -21,7 +21,7 @@ http://mirrors.163.com/tinycorelinux/8.x/x86_64/release/ \
http://mirrors.dotsrc.org/tinycorelinux/8.x/x86_64/release/ \
http://ftp.nluug.nl/os/Linux/distr/tinycorelinux/8.x/x86_64/release/ \
"
iso_img="TinyCorePure64-8.0.iso"
iso_img="TinyCorePure64-8.1.1.iso"

# register_iso as:
register_iso_name="cbsd-iso-${iso_img}"
Expand Down
20 changes: 19 additions & 1 deletion jailctl/bset
@@ -1,5 +1,5 @@
#!/usr/local/bin/cbsd
#v11.1.0
#v11.1.4
MYARG="jname"
CBSDMODULE="bhyve"

Expand All @@ -17,6 +17,24 @@ ADDHELP="mode=force for modification on the running jail\n"
. ${strings}
init $*

emulator="bhyve" # for jname_is_multiple
jname_is_multiple

if [ -n "${jail_list}" ]; then
new_arg=

for i in $*; do
_is_jname=$( substr --pos=0 --len=5 --str=${i} )
[ "${_is_jname}" = "jname" ] && continue
new_arg="${new_arg} ${i}"
done

for jname in ${jail_list}; do
bset jname=${jname} ${new_arg}
done
exit 0
fi

[ -z "${cbsd_queue_name}" ] && cbsd_queue_name="/clonos/bhyvevms/"

update_jails()
Expand Down
24 changes: 14 additions & 10 deletions jailctl/bsetup-tui
@@ -1,5 +1,5 @@
#!/usr/local/bin/cbsd
#v10.0.4
#v11.1.4
globalconf="${workdir}/cbsd.conf";

set -e
Expand Down Expand Up @@ -39,22 +39,26 @@ commit()
fi

if [ "${i}" = "vm_ram" ]; then
# In SQLite3 we store vm_ram in bytes, convert it
# test for human
if is_number ${VAL}; then
if conv2bytes ${VAL}; then
VAL="${convval}"
fi
fi
# test for human for original
if is_number ${OVAL}; then
if conv2bytes ${OVAL}; then
OVAL="${convval}"
fi
else
# Assume than user input in MB, so convert to bytes
VAL=$(( convval * 1024 * 1024 ))
fi
fi

[ "${VAL}" = "${OVAL}" ] && continue
bset mode=quiet jname=${_oldjname} $i="${VAL}"

if [ "${i}" = "vm_ram" ]; then
# In SQLite3 we store vm_ram in bytes, convert it
VAL=$(( VAL / 1024 / 1024 ))
fi

bset mode=quiet jname=${_oldjname} ${i}="${VAL}"
done

[ "${_oldjname}" != "${_newjname}" -a -n "${_newjname}" ] && cbsd brename old=${_oldjname} new=${_newjname}
Expand Down Expand Up @@ -140,11 +144,11 @@ dialog_menu_main()
# test for human
if ! is_number ${VAL}; then
if conv2human "${VAL}"; then
VAL=$convval
VAL=${convval}
vm_ram="${VAL}"
fi
fi
fi
fi

if [ -z "${VAL}" ]; then
menu_list="${menu_list} '${item_let} ${i}' ' ' 'Descr?'"
Expand Down
20 changes: 19 additions & 1 deletion jailctl/jset
@@ -1,5 +1,5 @@
#!/usr/local/bin/cbsd
#v11.0.9
#v11.1.3
MYARG="jname"
CBSDMODULE="jail"
ADDHELP="jconf=<path_to_file> - load and set settings from jconf\n"
Expand All @@ -19,6 +19,24 @@ ADDHELP="mode=force for modification on the running jail\n"

init $*

emulator="jail" # for jname_is_multiple
jname_is_multiple

if [ -n "${jail_list}" ]; then
new_arg=

for i in $*; do
_is_jname=$( substr --pos=0 --len=5 --str=${i} )
[ "${_is_jname}" = "jname" ] && continue
new_arg="${new_arg} ${i}"
done

for jname in ${jail_list}; do
jset jname=${jname} ${new_arg}
done
exit 0
fi

[ -z "${cbsd_queue_name}" ] && cbsd_queue_name="/clonos/jailscontainers/"
[ -z "${autorestart}" ] && autorestart=0

Expand Down
1 change: 0 additions & 1 deletion jcreate.subr
Expand Up @@ -168,7 +168,6 @@ external_exec_master_script()

exec_master_prestop()
{
# eval CMD=\${exec_master_prestop${i}}
eval CMD=\${exec_master_prestop}
[ -z "${CMD}" -o "${CMD}" = "0" ] && return 0

Expand Down
4 changes: 0 additions & 4 deletions nc.subr
Expand Up @@ -6,9 +6,7 @@ _CBSD_NC_SUBR=1
if [ -n "${CBSD_RNODE}" ]; then
rnode="${CBSD_RNODE}"
unset CBSD_RNODE
# echo ">> Remote execution on ${rnode}"
cmd=$( /usr/bin/basename $0 )
# echo ">> cbsd rexe node=${rnode} /usr/local/bin/cbsd ${cmd} $@"
exec /usr/local/bin/cbsd rexe node=${rnode} /usr/local/bin/cbsd ${cmd} $@
fi

Expand All @@ -23,8 +21,6 @@ get_jid() {

[ -z "$jname" -a -z "${path}" ] && return 0

# _res=$( /usr/sbin/jls -h jid name |/usr/bin/tail +2| while read _jid _name; do

_res=$( cbsdjls | while read _jid _name; do
[ "${_name}" = "${jname}" ] && echo ${_jid}
done)
Expand Down
2 changes: 1 addition & 1 deletion rctl.subr
Expand Up @@ -26,7 +26,7 @@ init_rctlconf()
eval ${i}=0
done

_ALLCOL=$( echo ${MYCOL}|tr " " "," )
_ALLCOL=$( echo ${MYCOL}| /usr/bin/tr " " "," )

# empty string on remote node if cbsd version is mistmatch ( diff. jail schema )
_A=$( 2>/dev/null env sqldelimer="|" ${miscdir}/sqlcli ${_sqlfile} "SELECT ${_ALLCOL} FROM rctl WHERE jname=\"$1\"" )
Expand Down

0 comments on commit b631f2d

Please sign in to comment.