From nobody Thu Oct 13 08:08:38 2022 X-Original-To: dev-commits-src-all@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 4Mp2GG3MVVz4fNV6; Thu, 13 Oct 2022 08:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mp2GG2lDjz3mmC; Thu, 13 Oct 2022 08:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665648518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=48oH+9khszEFrqwxbTGmKDH7gwEJAb76CmyyBp8x0bc=; b=Vr9oaGOwGDYS6sr4wCX+rkzaeV6li1N2793ZPmn8hY2gZIfpZ5NdsOq9IAM1aNWo7fmYzU vSxpupMNXj1N67+GU/T2EYR4eADz4MWD2dShJSSpUcwcWp4d4IR+yMssASYQ0XaQTdg99+ FgXtBPPuPYtrrNiw+uvlqJAs6DjOTSNKRhjchghIZqLgDE4VuweUOBYdb5BgEt7wiwfMh3 nweG77Bpf6cJG6gwAJdpviJGWuBSAlNErDwvCQZ7O+zlIlvpzAD4c3XRP9dVXJFb842/1W e/bagdDKUKMBCzoeWEdxdr8GWPYYnsQVew1gA/aGtEFWIJWVlcYr7jkXfeXFcg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Mp2GG1cwczMK0; Thu, 13 Oct 2022 08:08:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 29D88cmA050413; Thu, 13 Oct 2022 08:08:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29D88cLM050404; Thu, 13 Oct 2022 08:08:38 GMT (envelope-from git) Date: Thu, 13 Oct 2022 08:08:38 GMT Message-Id: <202210130808.29D88cLM050404@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 7ca75b93b9fa - stable/12 - dhclient-script: cope with /32 address leases List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 7ca75b93b9facd6dd0a733f25f577a1c9862a46b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665648518; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=48oH+9khszEFrqwxbTGmKDH7gwEJAb76CmyyBp8x0bc=; b=wW6USLqmx5XjCnAilKcOSskidst5zRdL0DyzYHl2jmQA92ZQZO1BxVwWHBZVDg2RaLaAyx Swf0aYB0nLiEvqaIyeQKeths/IfqOvFryRw3gcqFdzOTXH/hXaiVCmcTFjqsS+1EuAALOp US8uBWActv27I4vyvKqDHAzRJ8DWhdVUVe6WrvPSfvlcrkNHOnQX8oh4Cg/g6dpnaDiSza +PXSDjz96Uz5gBSZO+YNuUvlH7Gko+GTRruZK8pdg0Ww3RiMB9Q5/rENLwfbju/61tRL0T qjJVJHFXTtIVLj0YlJEIiNJdbS3Ziuxj+EUBSJzE7FsdPIbUqR30FN7dt8vjnA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665648518; a=rsa-sha256; cv=none; b=hfD249ny0JLl0DJEx7V75UhIQzLeZqf8HQPjaekmo6E2RmsDLKiA3+ItUEDY+pyyXQP7O7 EU01/kf8W7MEpyKBOpMJxgsZQbl7txIjgm83bxXRZvlZDoqCBPy6a0pYJ+3VJfTugaB+GA Oe7Khhq1bfSiMADn3StYhSMhIYpFgif+aztwkSE6QPjYisNtlh0F3PoD0oPbdUs0w5vR1R oI1vHZKDbZRIEaz/m6Zr93f8saSL4kx/4ZFSf1LvRvkcl4EVd/ayWjgMCYgljhU71A+amB HD2ooiyYT4B/VHTIBzw4so9jJnWvoc9QSdgMnqi4T5b8DP46ds1rNfUDj9ENdg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=7ca75b93b9facd6dd0a733f25f577a1c9862a46b commit 7ca75b93b9facd6dd0a733f25f577a1c9862a46b Author: Kristof Provost AuthorDate: 2022-10-05 10:11:07 +0000 Commit: Kristof Provost CommitDate: 2022-10-13 07:56:50 +0000 dhclient-script: cope with /32 address leases On certain cloud platforms (Google Cloud, Packet.net and others) the DHCP server offers a /32 address. This makes adding the default route fail since it is not reachable via any interface. Linux's dhclient-script seem to usually have a special case for that and explicitly adds an interface route to the router's address. FreeBSD's dhclient-script already has a special case for when the router address is the same as the leased address. Now also add one for when it's a different address that doesn't fall in the interface's subnet. PR: 241792 Event: Aberdeen hackathon 2022 Submitted by: sigsys@gmail.com Reviewed by: dch, kp, bz (+1 on the idea, not reviewed), thj MFC after: 1 week (cherry picked from commit fd6ecc184dbc64b9b3f7866b34812fb93df62925) --- sbin/dhclient/dhclient-script | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sbin/dhclient/dhclient-script b/sbin/dhclient/dhclient-script index 3439fd960773..c5649e1a1d2a 100755 --- a/sbin/dhclient/dhclient-script +++ b/sbin/dhclient/dhclient-script @@ -173,6 +173,10 @@ add_new_routes() { if [ "$new_ip_address" = "$router" ]; then route add default -iface $router >/dev/null 2>&1 else + if [ "$new_subnet_mask" = "255.255.255.255" ]; then + route add "$router" -iface "$interface" >/dev/null 2>&1 + fi + route add default $router >/dev/null 2>&1 fi fi