Author: cperciva
Date: Sun Sep 13 19:56:53 2020
New Revision: 365696
URL: https://svnweb.freebsd.org/changeset/base/365696

Log:
  Spawn the DHCPv6 client in EC2 instances via rtsold.
  
  Prior to this commit, EC2 AMIs used a "dual-dhclient" tool which was
  launched in place of dhclient and spawned both the base system dhclient
  for IPv4 and the ISC dhclient from ports for IPv6.
  
  Now that rtsold supports the "M bit" (managed configuration), we can go
  back to having the base system dhclient spawned normally, and provide a
  script to rtsold which spawns the ISC dhclient from ports when rtsold
  decides that it is appropriate.
  
  Thanks to:    bz
  MFC after:    1 week
  Sponsored by: https://www.patreon.com/cperciva

Modified:
  head/release/tools/ec2.conf

Modified: head/release/tools/ec2.conf
==============================================================================
--- head/release/tools/ec2.conf Sun Sep 13 19:11:45 2020        (r365695)
+++ head/release/tools/ec2.conf Sun Sep 13 19:56:53 2020        (r365696)
@@ -6,7 +6,7 @@
 # Packages to install into the image we're creating.  This is a deliberately
 # minimalist set, providing only the packages necessary to bootstrap further
 # package installation as specified via EC2 user-data.
-export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs 
dual-dhclient-daemon ebsnvme-id"
+export VM_EXTRA_PACKAGES="ec2-scripts firstboot-freebsd-update firstboot-pkgs 
isc-dhcp44-client ebsnvme-id"
 
 # Include the amazon-ssm-agent package in amd64 images, since some users want
 # to be able to use it on systems which are not connected to the Internet.
@@ -63,9 +63,19 @@ vm_extra_pre_umount() {
        # via EC2 user-data.
        echo 'firstboot_pkgs_list="awscli"' >> ${DESTDIR}/etc/rc.conf
 
-       # Enable IPv6 on all interfaces, and use DHCP on both IPv4 and IPv6.
+       # Enable IPv6 on all interfaces, and spawn DHCPv6 via rtsold
        echo 'ipv6_activate_all_interfaces="YES"' >> ${DESTDIR}/etc/rc.conf
-       echo 'dhclient_program="/usr/local/sbin/dual-dhclient"' >> 
${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
 
        # The EC2 console is output-only, so while printing a backtrace can
        # be useful, there's no point dropping into a debugger or waiting
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to