#!/bin/sh # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. # See the License for the specific language governing permissions # and limitations under the License. # # When distributing Covered Code, include this CDDL HEADER in each # file and include the License file at usr/src/OPENSOLARIS.LICENSE. # If applicable, add the following below this CDDL HEADER, with the # fields enclosed by brackets "[]" replaced with your own identifying # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END # # # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # while read src dest do if [ ! -f $dest ] ; then cp $src $dest else tmpdst=/var/run/dhcpagent.dst.$$ # Changes are applied separately to accomodate user updates to # the file. # If the target has the old v4 comments, then update them # to describe v6. grep '# All parameters can be tuned for ' $dest >/dev/null && ( grep '# An interface name alone ' $dest >/dev/null || ( nawk ' /# All parameters can be tuned for / { flag = 1; } /^$/ && flag == 1 { print "#"; print "# An interface name alone specifies IPv4 DHCP. For DHCPv6, append \""\ ".v6\"."; print "# Some examples:"; print "#"; print "# hme0.VERIFIED_LEASE_ONLY=no specify hme0 v4 behavior"; print "# hme0.v6.VERIFIED_LEASE_ONLY=no specify hme0 v6 behavior"; print "# VERIFIED_LEASE_ONLY=no match all v4 interfaces"; print "# .v6.VERIFIED_LEASE_ONLY=no match all v6 interfaces"; flag = 2; } { print $0; } ' $dest > $tmpdst && cp $tmpdst $dest ) ) # If the target has the old SIGTERM documentation, update. if grep ' is sent a SIGTERM, all managed' $dest >/dev/null && grep 'parameter-value pair, all managed' $dest >/dev/null then nawk ' / is sent a SIGTERM, all managed/ { flag = 1; } /parameter-value pair, all managed/ && flag == 1 { print "# By default, when the DHCP agent is sent a SIGTERM (typically when"; print "# the system is shut down), all managed addresses are dropped rather"; print "# than released. Dropping an address does not notify the DHCP server"; print "# that the address is no longer in use, leaving it possibly available"; print "# for subsequent use by the same client. If DHCP is later restarted"; print "# on the interface, the client will ask the server if it can continue"; print "# to use the address. If the server either grants the request, or"; print "# does not answer (and the lease has not yet expired), then the client"; print "# will use the original address."; print "#"; print "# Similarly, when the system is suspended and then woken up or when"; print "# the link status transitions from down to up, DHCP will ask the server"; print "# to continue to use the managed address, in case the lease has changed."; print "#"; print "# By uncommenting the following parameter-value pairs, all managed"; print "# addresses are released on SIGTERM instead, and any that may have been"; print "# saved but cannot be verified will not be used. When SIGTERM is"; print "# received, the DHCP server is notified that the address is available"; print "# for use, and the address will not be saved for a later restart. If"; print "# DHCP receives SIGTHAW or a link-up event, DHCP will attempt to verify"; print "# the previous lease, but if unable to do so, it will not attempt to"; print "# use that lease. This behavior is often preferred for roaming systems."; flag = 2; next; } flag == 1 { next; } { print $0; } ' $dest > $tmpdst && cp $tmpdst $dest fi # If the target has the old RELEASE_ON_SIGTERM variable, update. if grep RELEASE_ON_SIGTERM $dest >/dev/null; then sed 's/RELEASE_ON_SIGTERM/VERIFIED_LEASE_ONLY/g' $dest \ > $tmpdst && cp $tmpdst $dest fi # If the target lacks a v6 PARAM_REQUEST_LIST entry, then # add it. fgrep '.v6.PARAM_REQUEST_LIST' $dest >/dev/null || cat >> $dest <<EOF # The default DHCPv6 parameter request list has preference (7), unicast (12), # DNS addresses (23), DNS search list (24), NIS addresses (27), and # NIS domain (29). This may be changed by altering the following parameter- # value pair. The numbers correspond to the values defined in the IANA # dhcpv6-parameters registry at the time of this writing. Site and standard # option names from /etc/dhcp/inittab6 are also accepted. .v6.PARAM_REQUEST_LIST=7,12,23,24,27,29 EOF # If the target lacks a PARAM_IGNORE_LIST entry, then # add it. fgrep 'PARAM_IGNORE_LIST' $dest >/dev/null || cat >> $dest <<EOF # The parameter ignore list allows you to instruct the DHCP client to discard # optional parameters received from the DHCP server. The format is the same # as the request list above. When discarded, a parameter will not be acted # on by the DHCP client or returned to users via the dhcpinfo(1) command. PARAM_IGNORE_LIST= .v6.PARAM_IGNORE_LIST= EOF fi done exit 0