The logic for handling "host", "vnet", "ip4" and "ip6" in kern_jail
is somewhat confused: it tries to define a "new" and "disable" flag
for each subsystem, but the disable flag is either 0 or the same as
the enable flag. Then, when checking valid flags, it unconditionally
sets the 'new' flag in ch_flags.
This means that if, say, 'vnet' is set to 'inherit', the jail will
fail to start, because PR_VNET is set in ch_flags, even though the
jail should not have PR_VNET enabled.
There is additionally some confused handling of pr_flags that tries
to determine if an option is 'disable', 'new' or 'inherit' based on
the subsystem flags, but this can never work, because it can only
indicate either enabled or not enabled. This leads to 'jls -n'
showing incorrect values, e.g. a jail with 'ip4.addr' explicitly
set will show as 'ip4=disable'.
Fix this up within the limits of what's possible without refactoring
the entire thing. jailsys_flags now has name, immutable, can_disable
and flag members. Disallow changing immutable flags, or disabling
can_disable flags. Where we try to report the value of a subsystem,
return either "new" or "inherit" based on whether the flag is set.
This is probably still not entirely consistent with how it's meant
to work, but it fixes some obvious issues with jail(8).
MFC after: 4 weeks