From owner-freebsd-net@FreeBSD.ORG Fri Apr 3 14:40:08 2015 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E3229453 for ; Fri, 3 Apr 2015 14:40:08 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 6BF1D15B for ; Fri, 3 Apr 2015 14:40:08 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t33Ee6FG073493 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 3 Apr 2015 17:40:06 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t33Ee6tL073492; Fri, 3 Apr 2015 17:40:06 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Fri, 3 Apr 2015 17:40:06 +0300 From: Gleb Smirnoff To: Juan Mojica Subject: Re: Programmatically Creating VLAN in the Kernel Message-ID: <20150403144006.GZ64665@FreeBSD.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Cc: FreeBSD Net X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 03 Apr 2015 14:40:09 -0000 On Mon, Mar 30, 2015 at 09:49:56AM -0400, Juan Mojica wrote: J> I'm trying to programmatically create a VLAN in the kernel via ifioctl, but J> I'm hitting a "copyin" in the ioctl path, and since the address I'm passing J> in is a kernel address and not a user space address, the copyin is failing. J> J> Calling the ioctl from user space is a non-starter at this point, and I J> believe there will be other ioctls that will have to be called from the J> kernel which will hit the same issue. J> J> Any suggestions? J> J> So far I've thought about marking the ifreq flags to indicate the request J> came from the kernel and essentially bypass the copyin. Another option J> would be to make the create functions globally available, but this would J> violate the modularity of the VLAN module. If you really want to do that you need to export the vlan_cloner and its methods, then call vlan_clone_create directly. -- Totus tuus, Glebius.