From owner-freebsd-net@freebsd.org Mon May 4 09:33:11 2020 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 6F9D92CA760 for ; Mon, 4 May 2020 09:33:11 +0000 (UTC) (envelope-from roy@marples.name) Received: from relay2.marples.name (relay2.marples.name [77.68.23.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "relay2.marples.name", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49FyMV3cBdz3xJ0 for ; Mon, 4 May 2020 09:33:10 +0000 (UTC) (envelope-from roy@marples.name) Received: from mail.marples.name (cpc115040-bour7-2-0-cust370.15-1.cable.virginm.net [81.108.15.115]) by relay2.marples.name (Postfix) with ESMTPS id 5FA097A8 for ; Mon, 4 May 2020 09:33:02 +0000 (UTC) Received: from [10.73.0.30] (uberpc.marples.name [10.73.0.30]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by mail.marples.name (Postfix) with ESMTPSA id A8C1A2A3E; Mon, 4 May 2020 10:32:58 +0100 (BST) Subject: Re: Notification about tentative IPv6 address from route socket To: "Alexander V. Chernikov" , Guy Yur , Steffen Christgau , "freebsd-net@freebsd.org" References: <4f3a314a-f938-476b-f75e-e495756a5488@s14u.de> <718441588495188@mail.yandex.ru> <799631588579004@mail.yandex.ru> From: Roy Marples Message-ID: <6e34907c-c24c-5d0f-6871-763d3147d5ff@marples.name> Date: Mon, 4 May 2020 10:32:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <799631588579004@mail.yandex.ru> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 49FyMV3cBdz3xJ0 X-Spamd-Bar: -- X-Spamd-Result: default: False [-2.60 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[marples.name:s=mail]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:relay2.marples.name]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[marples.name:+]; DMARC_POLICY_ALLOW(-0.50)[marples.name,quarantine]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; IP_SCORE(0.40)[asn: 8560(2.03), country: DE(-0.02)]; ASN(0.00)[asn:8560, ipnet:77.68.0.0/17, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 May 2020 09:33:11 -0000 Hi Alexander On 04/05/2020 08:58, Alexander V. Chernikov wrote: > 04.05.2020, 07:23, "Guy Yur" : >> Hi, >> >> ------ Original Message ------ >> From: "Alexander V. Chernikov" >> To: "Steffen Christgau" ; "freebsd-net@freebsd.org" >> >> Sent: 2020-05-03 11:42:07 >> Subject: Re: Notification about tentative IPv6 address from route socket >> >>> 30.04.2020, 17:40, "Steffen Christgau" : >>>>   Hi everybody, >>> Hi Steffen, >>>> ... >>>> >>>>   1) Is there a way to get notified about the address being available for >>>>   usage (i.e. not tentative anymore, not duplicated) without _polling_ via >>> Not that I'm aware of :-( >>>> ... >>>> >>>>   2) I know FreeBSD is not Linux, but on Linux with netlink sockets I get >>>>   notified about a) the address appearing (including flags) and b) some >>>>   time later the address being not tentative anymore (detectable via >>>>   flags). I wonder why the route socket on FreeBSD reports an address that >>>>   is currently hardly to use. On the other hand, I understand that >>>>   RTM_NEWADDR does exactly what is documented, i.e. to notify about an >>>>   "address being added to iface". Nevertheless, wouldn't it make sense to >>>>   tell an application that a change for an address takes place? I couldn't >>>>   observe such a behavior for IPv6 on FreeBSD. If there is currently no >>>>   really such notification, the kernel could emit a new message like >>>>   RTM_ADDRCHANGE or it may repeats the emission of RTM_NEWADDR (which >>> It makes total sense. I have plans to update some rtsock internals and will take a look at this one. >>> Thank you for your suggestion! >> >> There is a phabricator differential written by Roy Marples that does >> this: >> https://reviews.freebsd.org/D5469 > Wow! Thank you for the pointing me to this review. Will look&test in a day or two. Since submitting that change over 4 years ago I have since fixed numerous other issues with how route(4) works on NetBSD and DragonFlyBSD. OpenBSD has some of these as well and to be fair one of my changes is based on theirs. socket: introduce SO_RERROR to detect receive buffer overflow https://gitweb.dragonflybsd.org/dragonfly.git/commit/7eaeff3d5b7170299f570487da1da8a4e87ab072 route: Add support for route(4) message filtering. https://gitweb.dragonflybsd.org/dragonfly.git/commit/8aeffa9f3b32ec4061b6573b6fca75507812a5f1 The same change as prior for NetBSD with an alternative API which can collect all future route message types: http://anonhg.netbsd.org/src/rev/8a3c6cf76b82 Without these changes, route(4) message delivery will always be unreliable. Other related changes to IPv6 DaD: net/if: introduce if_bylla to find an interface by hardware address https://gitweb.dragonflybsd.org/dragonfly.git/commit/c42bebbdd1ab596db6ade9bd27589b0045d0a4d1 inet6: discard NA messages with a lladdress we own https://gitweb.dragonflybsd.org/dragonfly.git/commit/e4c5aabdf0b701bbc3f9926061e79704a64cbce4 There are a lot more things that need fixing though, but this is the bulk of the effort. If FreeBSD can implement that then the deliberate compile time warnings dhcpcd spits out (it's in ports if you want to test) can be removed. Roy