From owner-svn-src-all@FreeBSD.ORG Wed Jan 6 20:07:19 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D570106566B; Wed, 6 Jan 2010 20:07:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFE028FC13; Wed, 6 Jan 2010 20:07:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o06K7Im1026016; Wed, 6 Jan 2010 20:07:18 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o06K7IlA026014; Wed, 6 Jan 2010 20:07:18 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201001062007.o06K7IlA026014@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 6 Jan 2010 20:07:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r201663 - stable/6/sys/netinet X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jan 2010 20:07:19 -0000 Author: bz Date: Wed Jan 6 20:07:18 2010 New Revision: 201663 URL: http://svn.freebsd.org/changeset/base/201663 Log: MFC r186948 (w/o the IPv6 parts): Make SIOCGIFADDR and related, jail-aware. Up to now we returned the first address of the interface for SIOCGIFADDR w/o an ifr_addr in the query. This caused problems for programs querying for an address but running inside a jail, as the address returned usually did not belong to the jail. If there was an ifr_addr given on v4, you could probe for more addresses on the interfaces that you were not allowed to see from inside a jail. Return an error (EADDRNOTAVAIL) in that case now unless the address is on the given interface and valid for the jail. PR: kern/114325 Thanks to: Axel Scheepers (axel.scheepers nl.clara.net) Modified: stable/6/sys/netinet/in.c Directory Properties: stable/6/sys/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/netinet/in.c ============================================================================== --- stable/6/sys/netinet/in.c Wed Jan 6 20:04:36 2010 (r201662) +++ stable/6/sys/netinet/in.c Wed Jan 6 20:07:18 2010 (r201663) @@ -38,7 +38,9 @@ #include #include #include +#include #include +#include #include #include @@ -254,13 +256,19 @@ in_control(so, cmd, data, ifp, td) LIST_FOREACH(iap, INADDR_HASH(dst.s_addr), ia_hash) if (iap->ia_ifp == ifp && iap->ia_addr.sin_addr.s_addr == dst.s_addr) { - ia = iap; + if (td == NULL || !prison_ip( + td->td_ucred, 0, &dst.s_addr)) + ia = iap; break; } if (ia == NULL) TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { + if (td != NULL && + prison_ip(td->td_ucred, 0, + &iap->ia_addr.sin_addr.s_addr)) + continue; ia = iap; break; }