Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Mar 2009 11:23:09 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bzeeb+freebsdports@zabbadoz.net>
To:        FreeBSD-gnats-submit@FreeBSD.org
Cc:        "Bjoern A. Zeeb" <bzeeb+freebsdports@zabbadoz.net>, stef@memberwebs.com
Subject:   ports/132929: [patch] unbreak sysutils/jailutils after jail changes
Message-ID:  <20090322112309.1B3084899B5@storage.int.zabbadoz.net>
Resent-Message-ID: <200903221130.n2MBUGTb006429@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         132929
>Category:       ports
>Synopsis:       [patch] unbreak sysutils/jailutils after jail changes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Sun Mar 22 11:30:16 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Bjoern A. Zeeb
>Release:        FreeBSD 7-STABLE amd64
>Organization:
Zabbadoz.NeT
>Environment:

>Description:
	The MFC of multi-IPv4/v6/no-IP jails broke the API as it had
	for the commit to HEAD end of last year.

>How-To-Repeat:
	Build the port on an up-to-date 7-STABLE or HEAD and it
	will fail.

>Fix:
	The attach patch is also temporary available from
	http://people.freebsd.org/~bz/20090322-01-ports-sysutils-jailutils.diff

	It only intends to make jailutils/jstart compile again but
	does not bring in all the new features supported - that is
	it supports multi-IPv4 jails as jstart had before for the
	patches floating around, but it does not support v6, no-IP
	jail, jailname etc. yet.

	I hope the author (CC:ed) will find the time to bring those
	in if jstart is still needed, which I am unsure as it seems
	to basically be jail(8) + jail v1 multi-IPv4 patch support
	but maybe I missed something.  jail(8) has placeholders
	for those so maybe it might be easier to fetch the sources
	from /usr/src or the SCM and patch those for the special
	patch intended to be supported.  Same should apply to jexec
	and jls.

Index: sysutils/jailutils/Makefile
===================================================================
RCS file: /shared/mirror/FreeBSD/r/pcvs/ports/sysutils/jailutils/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sysutils/jailutils/Makefile	4 Sep 2008 14:20:21 -0000	1.8
+++ sysutils/jailutils/Makefile	22 Mar 2009 10:51:39 -0000
@@ -7,12 +7,14 @@
 
 PORTNAME=	jailutils
 PORTVERSION=	1.3
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	http://memberwebs.com/stef/freebsd/jails/jailutils/
 
 MAINTAINER=	skv@FreeBSD.org
 COMMENT=	Several utilities for managing jails
 
+USE_AUTOCONF=	autotools
 GNU_CONFIGURE=	YES
 
 .include <bsd.port.pre.mk>
Index: sysutils/jailutils/files/patch-configure.ac
===================================================================
RCS file: sysutils/jailutils/files/patch-configure.ac
diff -N sysutils/jailutils/files/patch-configure.ac
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysutils/jailutils/files/patch-configure.ac	22 Mar 2009 10:51:39 -0000
@@ -0,0 +1,26 @@
+--- ./configure.ac.orig	2008-09-03 21:16:58.000000000 +0000
++++ ./configure.ac	2009-03-22 10:42:13.000000000 +0000
+@@ -82,6 +82,15 @@
+ #include <sys/jail.h>
+ ]])
+ 
++# We should check for JAIL_API_VERSION == 2.
++AC_CHECK_MEMBER([struct jail.ip6s], 
++	[ JAIL_V2=yes; AC_DEFINE_UNQUOTED(JAIL_V2, 1, [Multiple IPv4/v6/no-IP support])], [],
++[[
++#include <sys/types.h>
++#include <sys/param.h>
++#include <sys/jail.h>
++]])
++
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+ AC_TYPE_SIZE_T
+@@ -115,3 +124,7 @@
+     echo "Your version of FreeBSD supports multiple IPs per jail via the patch."
+ fi
+ 
++if test "$JAIL_V2" = "yes"; then
++    echo "Your version of FreeBSD supports v2 jails (multi-IPv4/v6/no-IPs)."
++fi
++
Index: sysutils/jailutils/files/patch-srcx__jstart.c
===================================================================
RCS file: sysutils/jailutils/files/patch-srcx__jstart.c
diff -N sysutils/jailutils/files/patch-srcx__jstart.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sysutils/jailutils/files/patch-srcx__jstart.c	22 Mar 2009 10:51:39 -0000
@@ -0,0 +1,69 @@
+--- ./srcx/jstart.c.orig	2008-05-02 17:36:49.000000000 +0000
++++ ./srcx/jstart.c	2009-03-22 10:46:36.000000000 +0000
+@@ -54,6 +54,7 @@
+ #include <unistd.h>
+ #include <limits.h>
+ #include <string.h>
++#include <stdlib.h>
+ 
+ #include "util.h"
+ 
+@@ -101,7 +102,48 @@
+     free(j->ips);
+ }
+ 
+-#else /* !JAIL_MULTIPATCH */
++#elif defined(JAIL_V2)
++
++static void allocate_address(char* arg, struct jail* j)
++{
++    struct in_addr in, *iap;
++    char *ip;
++    int i;
++
++    /*
++     * XXX FIXME we still only support IPv4.
++     * See jail(8) source code how to possibly support IPv6 as well.
++     */
++
++    /* Count number of ips */
++    for(i = 1, ip = arg; *ip; ip++) 
++    { 
++        if(*ip == ',') 
++            i++; 
++    }
++
++    /* Allocate memory */
++    if((j->ip4 = iap = malloc(i * sizeof(struct in_addr))) == NULL)
++        errx(1, "out of memory"); 
++
++    for(ip = strtok(arg, ","); ip; ip = strtok(NULL, ",")) 
++    { 
++        if(inet_aton(ip, &in) == 0) 
++            errx(1, "invalid ip address: %s", ip); 
++	iap->s_addr = in.s_addr;
++	iap++;
++    } 
++
++    j->ip4s = i; 
++    j->version = JAIL_API_VERSION;
++}
++
++static void free_address(struct jail* j)
++{
++    free(j->ip4);
++}
++
++#else /* !JAIL_MULTIPATCH && !JAIL_V2 */
+ 
+ static void allocate_address(char* arg, struct jail* j)
+ {
+@@ -198,7 +240,7 @@
+ 
+ static void usage()
+ {
+-#ifdef JAIL_MULTIPATCH
++#if defined(JAIL_MULTIPATCH) || defined(JAIL_V2)
+     fprintf(stderr, "usage: jstart [-i] path hostname ip[,ip...] [command ...]\n");
+ #else
+     fprintf(stderr, "usage: jstart [-i] path hostname ip-number [command ...]\n");
>Release-Note:
>Audit-Trail:
>Unformatted:



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