From owner-freebsd-hackers@freebsd.org Sun Apr 25 16:07:24 2021 Return-Path: Delivered-To: freebsd-hackers@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 89C52626CE7 for ; Sun, 25 Apr 2021 16:07:24 +0000 (UTC) (envelope-from zlei.huang@gmail.com) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4FStG34psYz3md5 for ; Sun, 25 Apr 2021 16:07:23 +0000 (UTC) (envelope-from zlei.huang@gmail.com) Received: by mail-pj1-x1030.google.com with SMTP id md17so197331pjb.0 for ; Sun, 25 Apr 2021 09:07:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=vt+kjhaWfnJ/FYOYKRH6z1tbvXwLHyOc53n4SNVW2X0=; b=R8cxSQgGJUO4fGCZJOZs42WyrIqEKqIslvwxKumP/EtNwKxQsi6Fw1CE70do5Jgq8p a2UwErBj7657LoFJz4eitEyS2yMhTXbEWKw2CMbcoItYaw5gPU/3wOrrgLQqKmAbAe99 ZvY0ZjBQ1fYOu5R/L7kDGyhxHZrGHNS6+/mr3dcPxGLqAwX7HBAMFWq67a+MQvM+ceye wDFzUMI7H3BZk4s/AtKVMZYOku/30m29P/uMl2jyCwPTNv2ntfxSqicl8mNqrBMRcO2u S9H9D7dAMx3sJCpO9PRzG2E4FGO5bz/jEdI5Dgz6+nlEbIx/1tTfUsXUkC5akZUcQFlb 5i9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=vt+kjhaWfnJ/FYOYKRH6z1tbvXwLHyOc53n4SNVW2X0=; b=Y2nOiOVEcFn8QMoEhpX5A2RUytjbH4Sq/oWdtdGl6je18UBZkLmx0p8un/KgsmMkEQ EJyLLL5dY8H5krnOFRlmOB3/RIFoJQJZ8NxVUNnKJjoz29DHyl/TlZVYvuiGKyzlE6sp p5xXwRy3lS2aGmyZUJYX7oQ/nzJzxIKg8OLQvA/K5m4umsgsfLiggiJVz+r+j1G3ZJad 06K8hHv6VcA2lbmLZ7w97GTj2uNR/uf9rsnypWAtXHBOGjh+J6y0tJPBRoFE6VnSYg+b QeMG47agoTcWfQqhn/m2j7YwQLjYqpNG1X3bjkSwyScXzguPHTpceXHtOCIMyhlxx+bf T3qw== X-Gm-Message-State: AOAM531cFfl7lvKBDpyAaY7G+fJszrCoyHMUR05mp2hOPoYRymz87+NY daCwSbn1jpZqdiUQub2I749AQJjDVSU= X-Google-Smtp-Source: ABdhPJz5JQfNzvRJZcyoaUSeyDP7knpBI8sTKcFLd1D8zbpbskb6LQgKlOUyuErDlv5vB/iTp5FNVw== X-Received: by 2002:a17:902:8307:b029:ec:86a4:90fa with SMTP id bd7-20020a1709028307b02900ec86a490famr14347508plb.22.1619366841773; Sun, 25 Apr 2021 09:07:21 -0700 (PDT) Received: from [172.17.252.129] (ns1.oxydns.net. [45.32.91.63]) by smtp.gmail.com with ESMTPSA id p10sm9447690pgn.85.2021.04.25.09.07.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Apr 2021 09:07:21 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: Are there any RFCs for address selection for IPv4 From: Zhenlei Huang In-Reply-To: <202104251340.13PDej0b093486@gndrsh.dnsmgr.net> Date: Mon, 26 Apr 2021 00:07:03 +0800 Cc: freebsd-hackers@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <202104251340.13PDej0b093486@gndrsh.dnsmgr.net> To: "Rodney W. Grimes" X-Mailer: Apple Mail (2.3608.120.23.2.4) X-Rspamd-Queue-Id: 4FStG34psYz3md5 X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=R8cxSQgG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of zleihuang@gmail.com designates 2607:f8b0:4864:20::1030 as permitted sender) smtp.mailfrom=zleihuang@gmail.com X-Spamd-Result: default: False [-3.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::1030:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::1030:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::1030:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-hackers] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Technical discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Apr 2021 16:07:24 -0000 Hi Rod Grimes, > On Apr 25, 2021, at 9:40 PM, Rodney W. Grimes = wrote: >=20 >> Hello hackers, >>=20 >> For IPv6 there's RFC 6724 to clarify the default address selection = procedure,=20 >> both for source address selection and destination address selection. = Are there >> any RFCs like RFC 6724 that are for IPv4?=20 >=20 > The important difference I think here is that in IPv6 it is very = normal to > have both a link local and a routable IP address on an interface. RFC = 3927 > speaks to this for IPv4 with: > IPv4 Link-Local addresses are not suitable for communication with > devices not directly connected to the same physical (or logical) > link, and are only used where stable, routable addresses are not > available (such as on ad hoc or isolated networks). This document > does not recommend that IPv4 Link-Local addresses and routable > addresses be configured simultaneously on the same interface. >=20 > Though technically you have not put a global uniq unicast address on = the > outbound interface the fact your trying to route one via that = interface > to a loopback interface puts you into the situation your attempting > to route global IP over a link local address. =20 >>=20 >> I'm exploring RFC 3927, consider this situation, a host configured = with link-local >> address on NIC and global unicast alias address on loopback = interface, and default route to=20 >> the link-local address of router (some ISPs do this). The current = implementation kernel >> will use the link-local address as the source address when = initializing a connection to=20 >> remote host via the default route. It seems wrong, as link-local = address are not=20 >> routable as per RFC 3927. >=20 > So your wanting the kernel to pick a source address on another = interface > for a packet going out a different interface, that is what seems = wrong. I'm not sure if this is proper for IPv4, but in the IPv6 network stack, = FreeBSD's current implementation select global unicast address over link-local = address, in case the outgoing interface does not have any global unicast addresses. I'm wondering whether it makes sense also for IPv4. >=20 > Though I think this could be solved by applying a technique used in > routers, and that is the concept of a host specific globally routeable > IP address that should be used for all non-local packets. This is = useful > in complex multipath networks as the router is always accessable via > that IP address no mater which interfaces are routing packets = correctly > as long as the routing protocols are maintaining a path to it. >=20 > But before going down that road, why are you putting your desired = globally > routeable IP address on lo0 and not on the upstream interface which = would > eliminate this problem? Is it because you have a complex multipath = network, > or is it from an attempt to save some global IP's that would be needed > to run these on the link? Or? >=20 Reading RFC 3927 2.7, it states link-local addresses are not routable. = The router shall discard those packets from or to link-local addresses. Then it make no = sense for a host to select link-local address as source address when it initialize a = connection, except for=20 an edge case that the destination is also link-local address. >>=20 >> So it is important if there's corresponding RFC clarify the source = address selection=20 >> for IPv4. >=20 > I do not believe you well find anything that speaks to this issue for = IPv4, as > your not really in the situation of RFC6724 which has to do with = multiple IP > addresses on the same interface. >=20 >> Thanks :) >> _______________________________________________ >> freebsd-hackers@freebsd.org mailing list >> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers >> To unsubscribe, send any mail to = "freebsd-hackers-unsubscribe@freebsd.org" >=20 > --=20 > Rod Grimes = rgrimes@freebsd.org Thanks, Zhenlei Huang