From nobody Thu Oct 13 08:08:38 2022 X-Original-To: dev-commits-src-branches@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 4Mp2GG3MWDz4fNfn; 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 4Mp2GG2tVnz3n57; 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=7YqIwC+Zb0yJDvTQXpZBA6Ig1BuvT8adSAO4A7/2xvE=; b=E4j5jFKV2VvSifavnmrJygJcB0h9XksovxgOUolBhZPRy+losPZYi6aYZia2XEx2Ap/BE3 HtfvGG454MKgV+U2B7FCtOSdq4X3uZS16jSJwHSCt7v77inbVHItOSoaqCMbhJKgikFPyp YbOFAtugs4sEzI4fVwf4PftAOJ8OP68BXn2qskfHS5BOGPZdXWkkT65tpLUbf3RDM/aQbb vIulzkbZsONEKxAHhQkNI/4k90gUbI0AKKRTl+sTl9G0c9knpKMCZUuVEtqaH+ry7MN7gM O17Zp10wa3Z6eFqT46Yr+i+4+FYb6n3SqXiHYCH7NBSTIYTWVtEPb7/wGNcdcQ== 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 4Mp2GG1kWczMKM; 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 29D88cUu050418; 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 29D88cpf050417; Thu, 13 Oct 2022 08:08:38 GMT (envelope-from git) Date: Thu, 13 Oct 2022 08:08:38 GMT Message-Id: <202210130808.29D88cpf050417@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: 80e991888d79 - stable/13 - dhclient-script: cope with /32 address leases List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/13 X-Git-Reftype: branch X-Git-Commit: 80e991888d79e036c03461d8264eea08a1dc67d8 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=7YqIwC+Zb0yJDvTQXpZBA6Ig1BuvT8adSAO4A7/2xvE=; b=vpNy2jU/kVjIvspyCAOZM+6GjU1clOoynz8dA32VIzBZQw6D5wvh6i164xqt0T5uGvOBP/ lPJ2ws2czI7Zi2/RGiYCgdI54XtDAHU5zkZVq5r9D4q15yGK2Bfvy0yRHJ/iwtc2rNJVP+ 57C9IB29JPvlRAK59Pyxu+5+nD/yxC8bxIYENCAy/zVcXzRRUunAZvf8GKQv5wFRCdivd+ TwFgjy3jJFCIkth1lIVYraAFY2HOTqqGrWKZrIcAafOSTZ93QQ6SI5Bh0iyOgIJkW/omMs UFNQNPVDz1GvmRBugOCrBNCbJIj2/oAq2R0fq5wA9xY7Er4ccIb0ZdBDeV4veg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665648518; a=rsa-sha256; cv=none; b=TGK28JVJoSbFz1ys0QS30x4jHKzhlT8zyDOnuFXuzE71TTT4AjvQX0M+DpavWa8RmJcIOH w8dYhB8G99y5JOXFDodmPKapJfFGORqEVUcpU5lYZrRQhgJHHw4yp0erxkbOix2xPhFL+l dyRxJIZLlm+mT802OzEVJVp5VlIl/od4W7kc1bzi0Slb0x5q+vXmIeMocKuHrKy6yBylNK /ep9e2yzB4CyH1WdaJ+ex3KG4MbgrxGur89cUWbNNIEq5JJLBFqXhOZ5UcwqHKz2UbxLkY N2siW9qZ3/Mox//oRTvN1EC53CIR1/Tkg4GbAjt+QtHUJuXIps+jek+NRv20aA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=80e991888d79e036c03461d8264eea08a1dc67d8 commit 80e991888d79e036c03461d8264eea08a1dc67d8 Author: Kristof Provost AuthorDate: 2022-10-05 10:11:07 +0000 Commit: Kristof Provost CommitDate: 2022-10-13 07:56:54 +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