From nobody@FreeBSD.org  Fri Jul 12 19:14:38 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	by hub.freebsd.org (Postfix) with ESMTP id 51CA329F
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Jul 2013 19:14:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121])
	by mx1.freebsd.org (Postfix) with ESMTP id 4458D1A00
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Jul 2013 19:14:38 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r6CJEbva093732
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 12 Jul 2013 19:14:37 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r6CJEbj5093731;
	Fri, 12 Jul 2013 19:14:37 GMT
	(envelope-from nobody)
Message-Id: <201307121914.r6CJEbj5093731@oldred.freebsd.org>
Date: Fri, 12 Jul 2013 19:14:37 GMT
From: Frank Leonhardt <freebsd-doc@fjl.co.uk>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Configuring jail in rc.conf fails to set the jail name correctly
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         180521
>Category:       misc
>Synopsis:       Configuring jail in rc.conf fails to set the jail name correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Jul 12 19:20:01 UTC 2013
>Closed-Date:    Mon Jul 15 15:52:12 UTC 2013
>Last-Modified:  Mon Jul 15 15:52:12 UTC 2013
>Originator:     Frank Leonhardt
>Release:        9.0 (and others)
>Organization:
>Environment:
n/a
>Description:
When you configure a jail in rc.conf you give the jail a name and refer to this when using the "service" command to turn it on and off subsequently. However, the jail name is not set as far as the jail system is concerned - if you use jls -v, for example, it will be seen that the name is the same as the jail-ID. This is the default for the "jail" command when no name is specified, but it's not helpful when you've named a jail and might reasonably want to go on referring to it by that name.

>How-To-Repeat:
Create a jailed environments in /usr/jail1, jail2, jail3 &c

Add the following to rc.conf:

jail_enable="YES" 
jail_list="jail1 jail2 jail3"

jail_jail1_rootdir="/usr/jail1"
jail_jail1_hostname="jail1.yourdomain"
jail_jail1_ip="192.168.1.211"

And so on...

Boot the machine or start a jail with:

service jail start jail1
or
/etc/rc.d/jail start jail1

Check to see if it's actually called jail1:

jls -v

Output will be:

bsd9-1# jls -v
   JID  Hostname                      Path
        Name                          State
        CPUSetID
        IP Address(es)
     5  jail1.yourdomain              /usr/jail1
        4                             ACTIVE
        5
        192.168.1.215

It should say "jail1" in the position where it says "4" This fails every time!
>Fix:
Easy...

On line 647 of /etc/rc.d/jail add the -n option.

Current:

       eval ${_setfib} jail ${_flags} -i ${_rootdir} ${_hostname} \
              \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
              </dev/null

Fixed:

       eval ${_setfib} jail ${_flags} -n ${_jail} -i ${_rootdir} ${_hostname} \
              \"${_addrl}\" ${_exec_start} > ${_tmp_jail} 2>&1 \
              </dev/null



>Release-Note:
>Audit-Trail:

From: Frank Leonhardt <freebsd-doc@fjl.co.uk>
To: bug-followup@FreeBSD.org, freebsd-doc@fjl.co.uk
Cc:  
Subject: Re: misc/180521: Configuring jail in rc.conf fails to set the jail
 name correctly
Date: Sat, 13 Jul 2013 01:56:55 +0100

 This is a multi-part message in MIME format.
 --------------050600060506040809070807
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 Content-Transfer-Encoding: 7bit
 
 I see this has now been fixed in 9.1 and have tracked the change to 
 revision 238102 - the wording meant I didn't find it when I searched 
 earlier. Please ignore!
 
 
 --------------050600060506040809070807
 Content-Type: text/html; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 
 <html>
   <head>
 
     <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
   </head>
   <body text="#000000" bgcolor="#FFFFFF">
     I see this has now been fixed in 9.1 and have tracked the change to
     revision 238102 - the wording meant I didn't find it when I searched
     earlier. Please ignore!<br>
     <br>
   </body>
 </html>
 
 --------------050600060506040809070807--
State-Changed-From-To: open->closed 
State-Changed-By: linimon 
State-Changed-When: Mon Jul 15 15:51:57 UTC 2013 
State-Changed-Why:  
Closed at submitter's request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=180521 
>Unformatted:
