From nobody Wed Sep 11 05:29:32 2024 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 4X3Tf51F0Pz5WDJV; Wed, 11 Sep 2024 05:29:33 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X3Tf472ZVz4mbb; Wed, 11 Sep 2024 05:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726032573; 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=6x/lNkMtZEYJWw54hIEACWNiMbwOfkdFXpDyUxWng3g=; b=l2tsh0Eysyv2m6rsIRaaRwh+aJ9RTxf7itfg6q9q2mTOQwxBYQMr2Hef0KGlHEwmTDl13m TyWJJkE3VTX6cn2wFI3M00WiU121IF174QGIb1ml2iHBocdLwyh+s4qjvIGdxvGAxShiwf +IyMAvW0gKDFJfjdOaRouZ3bdh41PVC4z3i09E3FueBLwVVVRtnUnXwrWZ7+W616niWUK7 9kSL77v4Y2P9bm579jKy2QOiUXZPkk4ITQpAJrFdqrIf6tzqokYAIIYRC9b4ysy6p2vqc1 OR4rqqjfj1mpLEvPgCAvb3jEnJ7UTi1RCzHEYwv5BYX7Z8o5qI3LAmpaGcBIMw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726032573; a=rsa-sha256; cv=none; b=G+/o2qPns4Tupk5N/HDEqi/W204g6DorDHK5IDjjRGVCR7LUSQ7XQJbrXHEAAQjMX55h3A djwnqOQ+HUDLYHa4lb7fuObbyq4B+TBZnRe1FlKWSUy61ZAClu5GqWrjuBaX3mIh4HcF0u tiv/0L6DvZa1fBMqEgAF7eNnBegIgSsKT0D9gPsu8dYhUs1m2H3r0Fs15Yb7Q/jbcRoETB CkfOIimuPDsxgET4AzgvDolkjnX1wVxpg/3TzDm2c3T4ntXAjVdCamhOa2HA/g3ujuN+10 R0wG1GQgJLsIykd9nW1DHpiyNIWR4Fm05WCcbAuzFrsWJG2ogzBcIgPLvQ0JAQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726032573; 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=6x/lNkMtZEYJWw54hIEACWNiMbwOfkdFXpDyUxWng3g=; b=wbQe3br2yT9JIBL0vmNey0+T5oQjSyVpVzHm9tqznlCip7gpJsImoolHR6pL7/4hBh38f3 nsa9NNHjggZowCbbefuZ1ZrTZ4/hQxRYzr5L+PoDPnaz6rxEpF+CGN8T4YyTVIJ9JkyEJa aR/kBVsejuvcsrMt0JThoOHJNbTa2ln7JrHFSJ5LqS/oBrDx4vfG+ABvZm9tnc95pIjEcP Cq+QbAZ3gsLEm1gB5Kv/WbDXVdRW8oZ9bZAoahpN7eeCXvAmmt/rm+srfcCNpzFZ3f7asa R9ituztzXWxQocTQUBpD6P2nUxv9JXcY7oUsYbN9DmRw8dVCv/T5nwz8kuwc5Q== 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 4X3Tf46X1BzJJc; Wed, 11 Sep 2024 05:29:32 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48B5TWXj065139; Wed, 11 Sep 2024 05:29:32 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48B5TW8A065135; Wed, 11 Sep 2024 05:29:32 GMT (envelope-from git) Date: Wed, 11 Sep 2024 05:29:32 GMT Message-Id: <202409110529.48B5TW8A065135@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Colin Percival Subject: git: 1dd6f34fb78f - stable/14 - EC2: Move network config into a separate function 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cperciva X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 1dd6f34fb78f4f1d2233a62e6be26c9bcbaf5d27 Auto-Submitted: auto-generated The branch stable/14 has been updated by cperciva: URL: https://cgit.FreeBSD.org/src/commit/?id=1dd6f34fb78f4f1d2233a62e6be26c9bcbaf5d27 commit 1dd6f34fb78f4f1d2233a62e6be26c9bcbaf5d27 Author: Colin Percival AuthorDate: 2024-08-31 23:46:51 +0000 Commit: Colin Percival CommitDate: 2024-09-11 05:28:59 +0000 EC2: Move network config into a separate function Having the "base" FreeBSD network configuration (aka. what is used when not using cloud-init) in ec2.conf will allow us to reuse it in other AMIs. Sponsored by: Amazon Differential Revision: https://reviews.freebsd.org/D46507 (cherry picked from commit f961ddb28d6909d4c67e3e0b6b60498bbcbf64cb) --- release/tools/ec2-base.conf | 26 +++----------------------- release/tools/ec2.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/release/tools/ec2-base.conf b/release/tools/ec2-base.conf index d80035e11ed7..bd2c510cd1a7 100644 --- a/release/tools/ec2-base.conf +++ b/release/tools/ec2-base.conf @@ -22,29 +22,6 @@ vm_extra_pre_umount() { # via EC2 user-data. echo 'firstboot_pkgs_list="devel/py-awscli"' >> ${DESTDIR}/etc/rc.conf - # EC2 instances use DHCP to get their network configuration. IPv6 - # requires accept_rtadv. - echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> ${DESTDIR}/etc/rc.conf - - # The EC2 DHCP server can be trusted to know whether an IP address is - # assigned to us; we don't need to ARP to check if anyone else is using - # the address before we start using it. - echo 'dhclient_arpwait="NO"' >> ${DESTDIR}/etc/rc.conf - - # Enable IPv6 on all interfaces, and spawn DHCPv6 via rtsold - echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf - echo 'rtsold_enable="YES"' >> ${DESTDIR}/etc/rc.conf - echo 'rtsold_flags="-M /usr/local/libexec/rtsold-M -a"' >> ${DESTDIR}/etc/rc.conf - - # Provide a script which rtsold can use to launch DHCPv6 - mkdir -p ${DESTDIR}/usr/local/libexec - cat > ${DESTDIR}/usr/local/libexec/rtsold-M <<'EOF' -#!/bin/sh - -/usr/local/sbin/dhclient -6 -nw -N -cf /dev/null $1 -EOF - chmod 755 ${DESTDIR}/usr/local/libexec/rtsold-M - # Any EC2 ephemeral disks seen when the system first boots will # be "new" disks; there is no "previous boot" when they might have # been seen and used already. @@ -53,5 +30,8 @@ EOF # Configuration common to all EC2 AMIs ec2_common + # Standard FreeBSD network configuration + ec2_base_networking + return 0 } diff --git a/release/tools/ec2.conf b/release/tools/ec2.conf index 602216d3c2d4..09cf1ce0017f 100644 --- a/release/tools/ec2.conf +++ b/release/tools/ec2.conf @@ -104,3 +104,30 @@ EOF return 0 } + +ec2_base_networking () { + # EC2 instances use DHCP to get their network configuration. IPv6 + # requires accept_rtadv. + echo 'ifconfig_DEFAULT="SYNCDHCP accept_rtadv"' >> ${DESTDIR}/etc/rc.conf + + # The EC2 DHCP server can be trusted to know whether an IP address is + # assigned to us; we don't need to ARP to check if anyone else is using + # the address before we start using it. + echo 'dhclient_arpwait="NO"' >> ${DESTDIR}/etc/rc.conf + + # Enable IPv6 on all interfaces, and spawn DHCPv6 via rtsold + echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'rtsold_enable="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'rtsold_flags="-M /usr/local/libexec/rtsold-M -a"' >> ${DESTDIR}/etc/rc.conf + + # Provide a script which rtsold can use to launch DHCPv6 + mkdir -p ${DESTDIR}/usr/local/libexec + cat > ${DESTDIR}/usr/local/libexec/rtsold-M <<'EOF' +#!/bin/sh + +/usr/local/sbin/dhclient -6 -nw -N -cf /dev/null $1 +EOF + chmod 755 ${DESTDIR}/usr/local/libexec/rtsold-M + + return 0 +}