From nobody Wed Oct 05 10:24:56 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 4Mj9gF1M3cz4dvVp; Wed, 5 Oct 2022 10:24:57 +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 4Mj9gF0bpkz3GMF; Wed, 5 Oct 2022 10:24:57 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664965497; 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=wNl/EJbLWK59ykqyLzjZGUDrWaOu9gpXlI6DP9fWfMI=; b=can0fPEJtEOxC78JY821z4xkCG0ltth4FOwEaUxoefbElhUzF7lKCeowLojPcVeGpgDMuy c1TljpFHBXdHYvB+S6XIB4RZIR7Wfi9m302PQrZWbK6zLY6UOJOoL2dhLSh7oLE1ENWd3H hoaPWR9TSpb4U8Q8d5CXL2Ub2bff9grqNmee9KLkvMYQeTMmyY8Xsp3Pu9RviNPyWlTQSo azHPxBLjzjfa6ybiOBRYJFvcPtvq3a4tT5LQUTIadFGpT0uujjmUeyKsWMcZJWVjUi5H4q E6g5H7kQueAWOMZWYFDJIn2hC5eo/VLSAAchdyZ/TZGxtUPTgepn3tAaePZ9OQ== 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 4Mj9gD6nXYzsFl; Wed, 5 Oct 2022 10:24:56 +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 295AOujk093235; Wed, 5 Oct 2022 10:24:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 295AOuGQ093234; Wed, 5 Oct 2022 10:24:56 GMT (envelope-from git) Date: Wed, 5 Oct 2022 10:24:56 GMT Message-Id: <202210051024.295AOuGQ093234@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fd6ecc184dbc - main - 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/main X-Git-Reftype: branch X-Git-Commit: fd6ecc184dbc64b9b3f7866b34812fb93df62925 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1664965497; 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=wNl/EJbLWK59ykqyLzjZGUDrWaOu9gpXlI6DP9fWfMI=; b=nyzhp5baip2Fsg3i+PghQRk8Blm62zGzRHzMc1dCF8c9gW5mQihECeypls+dJzFbIZrqY6 nu2PbiXYiNV8YYewDxyPCfHxvKVTU50XS6DWabPKomBH+8aWjHJy61ke56acRuFvvhdLv8 aVfFPnxmeBonuzBLvurrLm/HMlDsZDcUzsRbgZL87G+Tv9dKwIJf9yZ7o81F6hdz3rOIn2 OfNdABp+48ma5zYIQZ5YKvp36PZleI59aob2AMYbAcuEa2sTQOQxeRNtpJ//0rH/xmu7AL t+Hjeg03sjqY+qAPPZzEtREYOrbWouzh24i1rPHny9Jp1aOK6wZc0pGBBKNyPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1664965497; a=rsa-sha256; cv=none; b=NkzG/3OfcpYBi/xY7jVNzOMDTh2zJycfaTj6Wu5RcEdgOPj8HxDwcMXv2ix+nXvAsNJK92 duQVCNvmp3k5s2QbuC9N5RQGzGKXZN8wPX3wr7bdhFjJ2CLSyIab/F/JNCF+tPas6Ce6Ym XtTx68iXSo2ezXTAkUiDge+N+1lR6c8U5e9DXR1hqtoD4vWfp6SR4QnDgzWDOIVZGPwAC1 OysipIOWroFvs3s+FAx40OZgMcZONWMVaF9thGhUqHtNW5bcGUaKJMW7x10pXGGqAN4Ndp OMPniCAjFJCjRyzie/V7xgjVYkcdNR0OkYfn20PsEvz3JKP/GN46O1glaDEtBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd6ecc184dbc64b9b3f7866b34812fb93df62925 commit fd6ecc184dbc64b9b3f7866b34812fb93df62925 Author: Kristof Provost AuthorDate: 2022-10-05 10:11:07 +0000 Commit: Kristof Provost CommitDate: 2022-10-05 10:24:31 +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 --- 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