From owner-freebsd-hackers@FreeBSD.ORG Fri Aug 14 19:01:43 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A8670106568C for ; Fri, 14 Aug 2009 19:01:43 +0000 (UTC) (envelope-from bertwiley@gmail.com) Received: from mail-yx0-f206.google.com (mail-yx0-f206.google.com [209.85.210.206]) by mx1.freebsd.org (Postfix) with ESMTP id 4FEBE8FC41 for ; Fri, 14 Aug 2009 19:01:42 +0000 (UTC) Received: by yxe19 with SMTP id 19so652251yxe.19 for ; Fri, 14 Aug 2009 12:01:42 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20090814080915.J93661@maildrop.int.zabbadoz.net> Received: by 10.91.100.11 with SMTP id c11mr811009agm.1.1250276502305; Fri, 14 Aug 2009 12:01:42 -0700 (PDT) Message-ID: <0016e640d1e0ca8bd304711eaeb7@google.com> Date: Fri, 14 Aug 2009 19:01:42 +0000 From: bertwiley@gmail.com To: "Bjoern A. Zeeb" , bert wiley Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Re: Need help trying to to use the ntohl() call with in_addr X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Aug 2009 19:01:43 -0000 Thanks guys On Aug 14, 2009 4:11am, "Bjoern A. Zeeb" wrote: > On Fri, 14 Aug 2009, Max Laier wrote: > On Friday 14 August 2009 05:29:19 bert wiley wrote: > Hi everyone > Im new to list and this question may be out of place. This is my first > post. Im new to freebsd and trying to understand how to create a jail from > some system calls. I followed the jail subsystem description from the > handbook and im having a problem or may be using the call incorrectly. But > here is what im trying to do. > int main() > { > struct in_addr ipaddr; > struct jail myjail; > char path[PATH_MAX]; > realpath("/tmp", path); > myjail.version = 1; > myjail.path = path; > myjail.hostname = "testjail"; > const char *ip; > ip = "192.168.1.142"; > inet_aton(ip, &ipaddr); > myjail.ip4 = ntohl(ipaddr.s_addr); // I get and error here, invalid > conversion from _uint32_t' to in_addr* > myjail.ip4 = ipaddr.s_addr; // and and error here, invlid > conversion from in_addr_t to in_addr* > } > I know that there is more that needs to be done but this just a test stub > as im trying to work thru the calls and understand whats going on. > Any would be appreciated thanks. > Take a look at the jail(2) man page: > The ``ip4s'' and ``ip6s'' give the numbers of IPv4 and IPv6 addresses > that will be passed via their respective pointers. > The ``ip4'' and ``ip6'' pointers can be set to an arrays of IPv4 and IPv6 > addresses to be assigned to the prison, or NULL if none. IPv4 addresses > must be in network byte order. > So you'd do something like the following: > myjail.ip4s = 1; > inet_aton(ip, &ipaddr); > myjail.ip4 = &ipaddr; > You don't have to switch byte order. > and in that case of 7.2-R or later multi-IP jails the version should > not be 1 either. > I fixed tools/regressions/priv the other day; maybe this helps a bit > as well: > http://svn.freebsd.org/viewvc/base/head/tools/regression/priv/main.c?r1=173679&r2=196172 > /bz > -- > Bjoern A. Zeeb What was I talking about and who are you again?