From owner-freebsd-net@freebsd.org Tue May 4 23:00:46 2021 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AC42626A53 for ; Tue, 4 May 2021 23:00:46 +0000 (UTC) (envelope-from evgeniy@khramtsov.org) Received: from mxa.khramtsov.org (mxa.khramtsov.org [IPv6:2a0a:e5c0:2:10f::f]) (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 4FZb0s42XGz4byl for ; Tue, 4 May 2021 23:00:45 +0000 (UTC) (envelope-from evgeniy@khramtsov.org) Received: from mxa.khramtsov.org (mxa.khramtsov.org [IPv6:2a0a:e5c0:2:10f::f]) by mxa.khramtsov.org (Postfix) with ESMTP id B6C80125EC1 for ; Tue, 4 May 2021 22:59:36 +0000 (UTC) Date: Wed, 5 May 2021 02:00:29 +0300 From: Evgeniy Khramtsov To: freebsd-net@freebsd.org Subject: Hop limit override Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 4FZb0s42XGz4byl X-Spamd-Bar: --- X-Spamd-Result: default: False [-3.80 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[khramtsov.org:s=rsa]; NEURAL_HAM_LONG(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a0a:e5c0:2:10f::f:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; SPAMHAUS_ZRD(0.00)[2a0a:e5c0:2:10f::f:from:127.0.2.255]; DKIM_TRACE(0.00)[khramtsov.org:+]; DMARC_POLICY_ALLOW(-0.50)[khramtsov.org,reject]; NEURAL_HAM_SHORT(-1.00)[-0.998]; RCVD_COUNT_ONE(0.00)[1]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a0a:e5c0:2:10f::f:from]; ASN(0.00)[asn:207996, ipnet:2a0a:e5c0:2::/48, country:CH]; MAILMAN_DEST(0.00)[freebsd-net]; ONCE_RECEIVED(0.10)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 May 2021 23:00:46 -0000 Hi net, According to in6_selecthlim() in in6_src.c, hlim selection order is: 1. hlim specified via ioctl; 2. interface chlim via nd if outgoing interface; 3. V_ip6_defhlim. Let us suppose one needs to change the default non-ioctl hlim. The obvious way without reading in6_src.c would be to specify it via net.inet6.ip6.hlim. But then it would not work if there is curhlim: # ndp -i foo ... curhlim=255 ... Changing it via 'ndp -i foo curhlim=bar' seems to be temporary. I thought rtsold may refresh it back to the original value, though the value changes back to the original after rtsold was stopped. The first question: is nd behaviour a bug or works as intended? The second question: what would be the best way to override hlim? Currently I patched in6_selecthlim() to always return V_ip6_defhlim, though I am more interested to know a way that already works, or the way networking people would accept as a patch. If it matters, the described behaviour was observed on FreeBSD 14. -- (reachability warning: IPv6-only email address)