Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 06 Jan 2015 20:47:37 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 196574] Bug in parsing jail.conf
Message-ID:  <bug-196574-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196574

            Bug ID: 196574
           Summary: Bug in parsing jail.conf
           Product: Base System
           Version: 10.1-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: conf
          Assignee: freebsd-bugs@FreeBSD.org
          Reporter: logik@centrum.cz

It seems to me, that when one redefines $name variable in jail.conf,
the jail command begin misbehave: i get strange results as 

- segmentation fault 
- bad variables substitution

$name = something
$ip_addr = "192.168.6.210"
$ip = 210
"/sbin/ifconfig epair${ip}b inet ${ip_addr} up" 

results in running
"/sbin/ifconfig epair210b ine192.168.6.210t up" 

- or other strange errors
vnet.interface = epair210b results in calling
ifconfig epair210b vnet 
(instead of ifconfig epair210b vnet <jail-number>)
which naturaly failed on ifconfig: 'vnet' requires argument
o even in some cases 
ifconfig epair210b vnet <content of some other variable>

I think, that the best bugfix is to forbid to change predefined variables as
$name.

-----------------------------------------------------------------------------

jail.conf, that causes one of described errors (ifconfig: 'vnet' requires
argument), when calling:

jail -c dhcp

 *   {
        exec.start          =  "/bin/bash /etc/rc";
        exec.stop           =  "/bin/bash /etc/rc.shutdown";
        exec.consolelog     =  "/var/log/jail/$name";
        path                =  "/usr/jails/$name";
        mount.fstab         =  "/etc/jail.fstab/$name";
        host.hostname       =  "$name.dionyska.cz";
        devfs_ruleset       =  "4";
        mount.devfs;
        mount.fdescfs;
        $ip_addr = "192.168.6.${ip}" ;
}

dhcp   {
        $name='dhcp';
        $ip = "210" ;
        $ip_route = "192.168.6.1" ;

        vnet;
        vnet.interface = "epair${ip}b";

        exec.prestart = "ifconfig epair${ip}a destroy 2>/dev/null || true";
        exec.prestart += "ifconfig epair$ip create up";
        exec.prestart += "ifconfig bridge0 addm epair${ip}a";
        exec.start = "/sbin/ifconfig lo0 127.0.0.1 up";


        exec.start += "/sbin/ifconfig epair${ip}b inet 192.168.6.210   up" ;
        exec.start += "/sbin/route add default $ip_route " ;
        exec.start += "/bin/sh /etc/rc";
        exec.poststop = "ifconfig bridge0 delem epair${ip}";
        exec.poststop = "ifconfig epair${ip}a destroy " ;

        persist;

        devfs_ruleset=5 ;
        allow.raw_sockets=1 ;
        allow.socket_af = 1;
}

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-196574-8>