From nobody Wed Apr 05 19:56:29 2023 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PsFkm2yrvz444W5 for ; Wed, 5 Apr 2023 19:56:32 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4PsFkl4Zyjz4JPh; Wed, 5 Apr 2023 19:56:31 +0000 (UTC) (envelope-from hps@selasky.org) Authentication-Results: mx1.freebsd.org; dkim=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org; dmarc=none Received: from [10.36.2.154] (unknown [46.212.121.255]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 13D6E260154; Wed, 5 Apr 2023 21:56:30 +0200 (CEST) Message-ID: <263045d4-409a-8a2d-87e1-50b1afcb7338@selasky.org> Date: Wed, 5 Apr 2023 21:56:29 +0200 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: Is it valid to combine CTLFLAG_TUN with CTLFLAG_VNET ? Content-Language: en-US From: Hans Petter Selasky To: freebsd-current@freebsd.org, Zhenlei Huang References: <94C1B333-9C0F-4874-BBB1-3E72F3DF3F6A@FreeBSD.org> <9dc65578-9312-1139-932f-396bc42e66b2@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-2.27 / 15.00]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.966]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWO(0.00)[2]; MLMMJ_DEST(0.00)[freebsd-current@freebsd.org]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; ARC_NA(0.00)[]; DMARC_NA(0.00)[selasky.org]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-Rspamd-Queue-Id: 4PsFkl4Zyjz4JPh X-Spamd-Bar: -- X-ThisMailContainsUnwantedMimeParts: N On 4/5/23 21:44, Hans Petter Selasky wrote: > On 4/5/23 20:23, Gleb Smirnoff wrote: >> What if we remove the CTLFLAG_VNET check from the code you posted above? >> I don't see anything going wrong, rather going right 😄 >> >> CTLFLAG_VNET will not mask away CTLFLAG_TUN. > > Hi Gleb, > > It's possible to bypass that check, but some work needs to be done > first. Then all jails created, will also start from those sysctl tunable > values. > > The problem is, where does the VNET base pointer come from? > > Especially those static sysctl's. You would need to make some design > there I guess and look at the SYSINIT() order. When are SYSINIT's filled > with tunable data's. And when is the default VNET created. > > Because the data pointer passed to the register sysctl function is > simply an offset pointer into a malloc'ed structure. > > --HPS > Hi Zhenlei, Feel free to work on this, and add me as a reviewer and complete phase two of: > commit 3da1cf1e88f8448bb10c5f778ab56ff65c7a6938 > Author: Hans Petter Selasky > Date: Fri Jun 27 16:33:43 2014 +0000 > > Extend the meaning of the CTLFLAG_TUN flag to automatically check if > there is an environment variable which shall initialize the SYSCTL > during early boot. This works for all SYSCTL types both statically and > dynamically created ones, except for the SYSCTL NODE type and SYSCTLs > which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to --HPS