From nobody@FreeBSD.org  Mon Oct 24 08:40:02 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E71D4106564A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 24 Oct 2011 08:40:02 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D14B08FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 24 Oct 2011 08:40:02 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p9O8e2VH026061
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 24 Oct 2011 08:40:02 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p9O8e2SF026060;
	Mon, 24 Oct 2011 08:40:02 GMT
	(envelope-from nobody)
Message-Id: <201110240840.p9O8e2SF026060@red.freebsd.org>
Date: Mon, 24 Oct 2011 08:40:02 GMT
From: Alexey Markov <redrat@mail.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: jls -v doesn't show anything if system compiled with WITHOUT_INET6
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         161957
>Category:       bin
>Synopsis:       jls(8): jls -v doesn't show anything if system compiled with WITHOUT_INET6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-jail
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 24 08:50:01 UTC 2011
>Closed-Date:    Wed May 23 15:47:56 UTC 2012
>Last-Modified:  Wed May 23 15:50:03 UTC 2012
>Originator:     Alexey Markov
>Release:        8.2-RELEASE-p4
>Organization:
JSC Complitex
>Environment:
FreeBSD meson.complitex.ru 8.2-RELEASE-p4 FreeBSD 8.2-RELEASE-p4 #0: Mon Oct 17 11:44:31 MSD 2011     redrat@meson.complitex.ru:/arc/obj/arc/src/sys/MESON  amd64
>Description:
I have a server which is compiled with WITHOUT_INET6 in src.conf. There
is some jails on this server. While jls without switches works fine,
with -v switch I got error: "jls: unknown parameter: ip6.addr".

I think jls must omit ip6.addr parameter on systems without IPv6 support
and just output the rest of parameters.
>How-To-Repeat:
# echo "WITHOUT_INET6" >> /etc/src.conf
# cd /usr/src && make world
# shutdown -r now
# jls
   JID  IP Address      Hostname                      Path
     3  127.0.0.2       port.jail                     /arc/jail/port
# jls -v
jls: unknown parameter: ip6.addr

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-jail 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Oct 24 16:39:27 UTC 2011 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161957 
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Thu Oct 27 20:45:37 UTC 2011 
State-Changed-Why:  
This is already fixed in head, and requires r222465, r223224 and 
r224841 to be merged. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161957 
State-Changed-From-To: patched->closed 
State-Changed-By: jamie 
State-Changed-When: Wed May 23 15:47:24 UTC 2012 
State-Changed-Why:  
MFCd as r235841 

http://www.freebsd.org/cgi/query-pr.cgi?pr=161957 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/161957: commit references a PR
Date: Wed, 23 May 2012 15:47:28 +0000 (UTC)

 Author: jamie
 Date: Wed May 23 15:47:07 2012
 New Revision: 235841
 URL: http://svn.freebsd.org/changeset/base/235841
 
 Log:
   MFC r222465, r223224, r224841, r232613:
   
    Check for IPv4 or IPv6 to be available by the kernel to not
    provoke errors trying to query options not available.
    Make it possible to compile out INET or INET6 only parts.
   
   PR:		bin/161957
 
 Modified:
   stable/8/usr.sbin/jls/Makefile
   stable/8/usr.sbin/jls/jls.c
 Directory Properties:
   stable/8/usr.sbin/jls/   (props changed)
 
 Modified: stable/8/usr.sbin/jls/Makefile
 ==============================================================================
 --- stable/8/usr.sbin/jls/Makefile	Wed May 23 15:30:13 2012	(r235840)
 +++ stable/8/usr.sbin/jls/Makefile	Wed May 23 15:47:07 2012	(r235841)
 @@ -1,5 +1,7 @@
  # $FreeBSD$
  
 +.include <bsd.own.mk>
 +
  PROG=	jls
  MAN=	jls.8
  DPADD=	${LIBJAIL}
 @@ -7,4 +9,11 @@ LDADD=	-ljail
  
  WARNS?=	6
  
 +.if ${MK_INET6_SUPPORT} != "no"
 +CFLAGS+= -DINET6
 +.endif
 +.if ${MK_INET_SUPPORT} != "no"
 +CFLAGS+= -DINET
 +.endif
 +
  .include <bsd.prog.mk>
 
 Modified: stable/8/usr.sbin/jls/jls.c
 ==============================================================================
 --- stable/8/usr.sbin/jls/jls.c	Wed May 23 15:30:13 2012	(r235840)
 +++ stable/8/usr.sbin/jls/jls.c	Wed May 23 15:47:07 2012	(r235841)
 @@ -59,6 +59,12 @@ __FBSDID("$FreeBSD$");
  static struct jailparam *params;
  static int *param_parent;
  static int nparams;
 +#ifdef INET6
 +static int ip6_ok;
 +#endif
 +#ifdef INET
 +static int ip4_ok;
 +#endif
  
  static int add_param(const char *name, void *value, size_t valuelen,
  		struct jailparam *source, unsigned flags);
 @@ -112,6 +118,13 @@ main(int argc, char **argv)
  			errx(1, "usage: jls [-dhnqv] [-j jail] [param ...]");
  		}
  
 +#ifdef INET6
 +	ip6_ok = feature_present("inet6");
 +#endif
 +#ifdef INET
 +	ip4_ok = feature_present("inet");
 +#endif
 +
  	/* Add the parameters to print. */
  	if (optind == argc) {
  		if (pflags & (PRINT_HEADER | PRINT_NAMEVAL))
 @@ -124,13 +137,24 @@ main(int argc, char **argv)
  			add_param("name", NULL, (size_t)0, NULL, JP_USER);
  			add_param("dying", NULL, (size_t)0, NULL, JP_USER);
  			add_param("cpuset.id", NULL, (size_t)0, NULL, JP_USER);
 -			add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER);
 -			add_param("ip6.addr", NULL, (size_t)0, NULL,
 -			    JP_USER | JP_OPT);
 +#ifdef INET
 +			if (ip4_ok)
 +				add_param("ip4.addr", NULL, (size_t)0, NULL,
 +				    JP_USER);
 +#endif
 +#ifdef INET6
 +			if (ip6_ok)
 +				add_param("ip6.addr", NULL, (size_t)0, NULL,
 +				    JP_USER | JP_OPT);
 +#endif
  		} else {
  			pflags |= PRINT_DEFAULT;
  			add_param("jid", NULL, (size_t)0, NULL, JP_USER);
 -			add_param("ip4.addr", NULL, (size_t)0, NULL, JP_USER);
 +#ifdef INET
 +			if (ip4_ok)
 +				add_param("ip4.addr", NULL, (size_t)0, NULL,
 +				    JP_USER);
 +#endif
  			add_param("host.hostname", NULL, (size_t)0, NULL,
  			    JP_USER);
  			add_param("path", NULL, (size_t)0, NULL, JP_USER);
 @@ -327,7 +351,7 @@ print_jail(int pflags, int jflags)
  {
  	char *nname;
  	char **param_values;
 -	int i, ai, jid, count, spc;
 +	int i, ai, jid, count, n, spc;
  	char ipbuf[INET6_ADDRSTRLEN];
  
  	jid = jailparam_get(params, nparams, jflags);
 @@ -345,31 +369,47 @@ print_jail(int pflags, int jflags)
  		    *(int *)params[4].jp_value ? "DYING" : "ACTIVE",
  		    "",
  		    *(int *)params[5].jp_value);
 -		count = params[6].jp_valuelen / sizeof(struct in_addr);
 -		for (ai = 0; ai < count; ai++)
 -			if (inet_ntop(AF_INET,
 -			    &((struct in_addr *)params[6].jp_value)[ai],
 -			    ipbuf, sizeof(ipbuf)) == NULL)
 -				err(1, "inet_ntop");
 -			else
 -				printf("%6s  %-15.15s\n", "", ipbuf);
 -		if (!strcmp(params[7].jp_name, "ip6.addr")) {
 -			count = params[7].jp_valuelen / sizeof(struct in6_addr);
 +		n = 6;
 +#ifdef INET
 +		if (ip4_ok && !strcmp(params[n].jp_name, "ip4.addr")) {
 +			count = params[n].jp_valuelen / sizeof(struct in_addr);
 +			for (ai = 0; ai < count; ai++)
 +				if (inet_ntop(AF_INET,
 +				    &((struct in_addr *)params[n].jp_value)[ai],
 +				    ipbuf, sizeof(ipbuf)) == NULL)
 +					err(1, "inet_ntop");
 +				else
 +					printf("%6s  %-15.15s\n", "", ipbuf);
 +			n++;
 +		}
 +#endif
 +#ifdef INET6
 +		if (ip6_ok && !strcmp(params[n].jp_name, "ip6.addr")) {
 +			count = params[n].jp_valuelen / sizeof(struct in6_addr);
  			for (ai = 0; ai < count; ai++)
  				if (inet_ntop(AF_INET6,
 -				    &((struct in6_addr *)params[7].jp_value)[ai],
 +				    &((struct in6_addr *)
 +					params[n].jp_value)[ai],
  				    ipbuf, sizeof(ipbuf)) == NULL)
  					err(1, "inet_ntop");
  				else
  					printf("%6s  %s\n", "", ipbuf);
 +			n++;
  		}
 +#endif
  	} else if (pflags & PRINT_DEFAULT)
  		printf("%6d  %-15.15s %-29.29s %.74s\n",
  		    *(int *)params[0].jp_value,
 -		    params[1].jp_valuelen == 0 ? "-"
 +#ifdef INET
 +		    (!ip4_ok || params[1].jp_valuelen == 0) ? "-"
  		    : inet_ntoa(*(struct in_addr *)params[1].jp_value),
 -		    (char *)params[2].jp_value,
 -		    (char *)params[3].jp_value);
 +		    (char *)params[2-!ip4_ok].jp_value,
 +		    (char *)params[3-!ip4_ok].jp_value);
 +#else
 +		    "-",
 +		    (char *)params[1].jp_value,
 +		    (char *)params[2].jp_value);
 +#endif
  	else {
  		param_values = alloca(nparams * sizeof(*param_values));
  		for (i = 0; i < nparams; i++) {
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
