]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
bectl: use jail id as the default jail name for a boot environment
authorkevans <kevans@FreeBSD.org>
Tue, 25 Dec 2018 15:18:41 +0000 (15:18 +0000)
committerkevans <kevans@FreeBSD.org>
Tue, 25 Dec 2018 15:18:41 +0000 (15:18 +0000)
commit5234db76104dc41f94e4899413ba19062c03ddce
tree26b9e4ecff1daad245d2bd0b514efce23382d85d
parent04945428e9e2ccfec8d2dd5d369db7b3d95a0392
bectl: use jail id as the default jail name for a boot environment

By default, bectl is setting the jail 'name' parameter to the boot
environment name, which causes an error when the boot environment name is
not a valid jail name. With the attached fix, when no name is supplied, the
default jail name will be the jail id - this is is the same behavior as the
jail command.

Additionally, this commit addresses two other bugs that prevented unjailing
in scenarios where the jail name does not match the boot environment name:

1. In 'bectl_locate_jail', 'mountpoint' is used to resolve the boot
  environment path, but really 'mounted' should be used. 'mountpoint' is the
  path where the zfs dataset will be mounted. 'mounted' is the path where
  the dataset is actually mounted.

2. in 'bectl_search_jail_paths', 'jail_getv' would fail after the first
  call. Which is fine, if the boot environment you're unjailing is the next
  one up. According to 'man jail_getv', it's expecting name and value
  strings. 'jail_getv' is being passed an integer for the lastjid, so amend
  that to use a string instead.

Test cases have been amended to reflect the bugs found.

PR: 233637
Submitted by: Rob <rob.fx907_gmail.com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D18607
sbin/bectl/bectl.8
sbin/bectl/bectl_jail.c
sbin/bectl/tests/bectl_test.sh