HomeFreeBSD

jail: consistently populate the KP_JID and KP_NAME parameters

Description

jail: consistently populate the KP_JID and KP_NAME parameters

The gaps here, specifically, were:

  • When we have to discover a running jail's jid from name, we should populate the missing jid param
  • When we populate jid/name from the config, if the name is a jid we wouldn't populate the name; now we do both.
  • When we create a jail, we should populate jid and name with whatever details we have now that we didn't both.

As a consequence, we can cleanup a few things:

  • vnet.interface and zfs.dataset can just always use the jid
  • Trying to populate JNAME should always work now, where it would be a little crashy before if you create a jail that didn't have a name or jid on the command line
  • We can simplify the just-prior JID population now that we'll keep a stringified jid in our intparams.

This primarily fixes the below, but the issues with vnet.interface and
zfs.dataset were pre-existing.

Fixes: d8f021add40c3 ("jail: add JID, JNAME and JPATH to env [...]")
Reviewed by: jamie
Differential Revision: https://reviews.freebsd.org/D51502

Details

Provenance
kevansAuthored on Jul 26 2025, 3:13 AM
Reviewer
jamie
Differential Revision
D51502: jail: consistently populate the KP_JID and KP_NAME parameters
Parents
rG1d8590371049: jls: add a -c mode to check for a jail's existence
Branches
Unknown
Tags
Unknown