as you may have already noticed multi-IPv4/v6/no-IP jails have hit
HEAD. See commit message attached.

The bad news first: expect an update on the rc script to make the
more obscure rc features like configuring IPs on interfaces when
starting jails and giving a possible netmask work with multiple IPs
and IPv6.

The good news:
In case you do not use those features or still only use one IP per
jail everything should just work fine and there are no changes needed.

More news:
In case you want to use multiple IPs or a mix of v4 and v6 addresses
you just give them as a comma separated list on both the command line
or in rc.conf like:
  jail / example,2001:db8::75,2001:db8::99,2001:db8::55,2001:db8::14, 

In case you do want to start a jail without any IP, give an empty
argument on command line:
 jail / noip.example.net "" /bin/sh

Additionally you can give a jail a name now using the -n option:
  jail -n "bz's private noip jail" / noip.example.net "" /bin/sh
You may not want to use special characters or whitespace but it is
just a string, so you can. There are no restrictions and even 10 jails
could have the same name. The jail (inside) cannot change the name.
It's set upon jail creation and unchangeable from then on.

What else is new: the -h option to jail makes it resolve the hostname
to IP addresses and will merge those to the jail IPs. Note: that this
can give you unexpected results on the primary jail IP. See jail(8)
for more information.

jls tries to be as backward compatible as possible. That means it will
only show one IPv4 if called as `jls`; obviously this won't work well
for no-IP or IPv6-only jails. This was done to try to not confuse scripts
people have in their classic setups.

jls -v will give you the full information, including:
- state: usually ACTIVE.
- in case you also give '-a' you will also see jails in other states,
  for example jails hanging around waiting for a socket to timeout
  but with no processes left after it was stopped; it will say DYING.

- Every jail gets its own cpuset inherited from the process that
  started the jail. You can list, etc the mask
  by jail id: cpuset -g -j 8
  or by set id: cpuset -g -s 5
  Or even change it if you want.
  Threads within jails should be able to further restrict themselves
  even within the jail but nothing outside their scope. See the cpuset
  manpages for further information.

The IPs will be listed in the following order:
the primary IP per AF which is the first IP of that AF given to the
jail command and then they should be sorted in ascending order.

jexec now takes the optional jail name to attach to a jail but will
refuse to do anything if the jail cannot be uniquely identifed.
In case you use the jail name you have to give an empty argument for
the jail id like:
  jexec -n "bz's private noip jail" "" /bin/sh
You can also give both jail name and jail ID and both will have to
match, else it will complain. Obviously only giving the jail id still
works.  The -h hostname option is gone again. You should use the jail
name for management purposes now.

A sample full jls output (admittedly a bit ugly this way):

sun$ jls -av
   JID  Hostname                      Path
        Name                          State
        IP Address(es)
    21  sun                           /
        hangtest                      DYING
     8  noip.example.net              /
        bz's private noip jail        ALIVE
     3  j3.sunny.example.net          /local/jails/j1
     2  j2.sunny.example.net          /local/jails/j1
     1  j1.sunny.example.net          /local/jails/j1

In case you have more questions the man pages do not address, or
problem, etc. please follow-up to freebsd-jail@ .


PS: the MFC question was answered in the commit message so do not ask.

Bjoern A. Zeeb              Stop bit received. Insert coin for new game.

---------- Forwarded message ----------
Date: Sat, 29 Nov 2008 14:32:14 +0000 (UTC)
Subject: svn commit: r185435 - in head: lib/libc/sys lib/libkvm share/man/man4
    sys/compat/freebsd32 sys/kern sys/net sys/netinet sys/netinet6
    sys/security/mac_bsdextended sys/sys usr.bin/cpuset usr.sbin/jai...

Author: bz
Date: Sat Nov 29 14:32:14 2008
New Revision: 185435
URL: http://svn.freebsd.org/changeset/base/185435

    Bring in updated jail support from bz_jail branch.

  This enhances the current jail implementation to permit multiple
  addresses per jail. In addtion to IPv4, IPv6 is supported as well.
  Due to updated checks it is even possible to have jails without
  an IP address at all, which basically gives one a chroot with
  restricted process view, no networking,..

  SCTP support was updated and supports IPv6 in jails as well.

  Cpuset support permits jails to be bound to specific processor
  sets after creation.

  Jails can have an unrestricted (no duplicate protection, etc.) name
  in addition to the hostname. The jail name cannot be changed from
  within a jail and is considered to be used for management purposes
  or as audit-token in the future.

  DDB 'show jails' command was added to aid debugging.

  Proper compat support permits 32bit jail binaries to be used on 64bit
  systems to manage jails. Also backward compatibility was preserved where
  possible: for jail v1 syscalls, as well as with user space management

  Both jail as well as prison version were updated for the new features.
  A gap was intentionally left as the intermediate versions had been
  used by various patches floating around the last years.

  Bump __FreeBSD_version for the afore mentioned and in kernel changes.

  Special thanks to:
  - Pawel Jakub Dawidek (pjd) for his multi-IPv4 patches
    and Olivier Houchard (cognet) for initial single-IPv6 patches.
  - Jeff Roberson (jeff) and Randall Stewart (rrs) for their
    help, ideas and review on cpuset and SCTP support.
  - Robert Watson (rwatson) for lots and lots of help, discussions,
    suggestions and review of most of the patch at various stages.
  - John Baldwin (jhb) for his help.
  - Simon L. Nielsen (simon) as early adopter testing changes
    on cluster machines as well as all the testers and people
    who provided feedback the last months on freebsd-jail and
    other channels.
  - My employer, CK Software GmbH, for the support so I could work on this.

  Reviewed by:  (see above)
  MFC after:    3 months (this is just so that I get the mail)
  X-MFC Before:   7.2-RELEASE if possible

freebsd-jail@freebsd.org mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to