From nobody Tue Nov 30 16:27:16 2021 X-Original-To: freebsd-questions@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 35BC918BA434 for ; Tue, 30 Nov 2021 16:27:19 +0000 (UTC) (envelope-from stefan+freebsd@stha.de) Received: from deponia.stha.de (deponia.stha.de [IPv6:2001:8d8:1801:133::1]) (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-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mx1.stha.de", Issuer "mx1.stha.de" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J3SKy4VmBz3wLM for ; Tue, 30 Nov 2021 16:27:18 +0000 (UTC) (envelope-from stefan+freebsd@stha.de) Received: from mail.stha.de (mail.stha.de [IPv6:2a03:4000:24:7d0:100::15]) by deponia.stha.de (Postfix) with ESMTPS id A15C4D32 for ; Tue, 30 Nov 2021 16:27:17 +0000 (UTC) Received: from mail.stha.de ( [fec0::2]) by mail.stha.de (OpenSMTPD) with ESMTP id bb9dc37a for ; Tue, 30 Nov 2021 16:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=stha.de; h=date :from:to:subject:message-id:mime-version:content-type; s= 20200509; bh=U2oDIUXErwIvXPAUlMFFJRtXNwc=; b=BSQkag32XiRQexY4ug5 yRffeNNJP3orD/cdF21CdDi5D4If5wMUiCngRCW4wDxtb4vq0JzSC6by4xTyHgDo CUriBXMFtGsK5ttnlTD7o/PuQ7gN3zsQFJ/HlCXMT+/eZEmC7OfV+wx71QmmJV+L owHgk+lKNNCh+WuU5DKj3/sI9q2nqly60tEc4lIX+0XM3p6Oe1hCPqcUcnTKP34A Z4Iaf21Srwill9I65buqi8u7MSr/KUbN3MQDCcMN99ftaFwwS5PQic+oqrJEdehJ 5MhnoXMbcxsW17uUWEI2yOmnVqrEN2nDBHTuN10glk8HkHANEFadkRP5ZOnaRITO Fug== Received: by mail.stha.de (OpenSMTPD) with ESMTPSA id ea16ed2d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Tue, 30 Nov 2021 16:27:17 +0000 (UTC) Date: Tue, 30 Nov 2021 17:27:16 +0100 From: Stefan Haller To: freebsd-questions@freebsd.org Subject: ifconfig - access pltime/vltime for IPv6 address Message-ID: List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 4J3SKy4VmBz3wLM X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=stha.de header.s=20200509 header.b=BSQkag32; dmarc=pass (policy=none) header.from=stha.de; spf=pass (mx1.freebsd.org: domain of stefan@stha.de designates 2001:8d8:1801:133::1 as permitted sender) smtp.mailfrom=stefan@stha.de X-Spamd-Result: default: False [-3.60 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[stha.de:s=20200509]; FREEFALL_USER(0.00)[stefan]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+mx:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-0.60)[-0.599]; RCVD_COUNT_THREE(0.00)[4]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[stha.de:+]; DMARC_POLICY_ALLOW(-0.50)[stha.de,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:8560, ipnet:2001:8d8::/32, country:DE]; TAGGED_FROM(0.00)[freebsd]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Hi everyone! Is it possible to read out the values for pltime (preferred lifetime) or vltime (valid lifetime) for an IPv6 address configured on an interface with normal system tools (ifconfig)? According to ifconfig(8) one can set both lifetimes. There doesn't seem to be a way to obtain the current values though. The man page is actually somewhat vague about the whole topic (Is it a relative or absolute value? Is it a value in seconds?). My precise problem is as follows: The router provided by my ISP is announcing its /64 prefix with relatively long lifetimes. However, the router is restarting automatically if it detects connectivity problems or firmware/configuration updates. Usually the IPv6 prefix changes after the router reboots. My FreeBSD box is therefore accumulating multiple IPv6 addresses, most of them being invalid while still waiting for lifetime expiry. Sometimes this results in connectivity problems (Wireguard is using wrong source address). I wrote a script that drops all IPv6 addresses if this case is detected. After a few seconds the latest prefix is reconfigured due to a NDP router advertisement. However, I would prefer a more robust solution that drops all prefixes except the one with the highest vltime value. Maybe someone has an idea how I could achieve this. Thanks in advance! Best regards, Stefan Haller