#!/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 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # 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.RELEASE_ON_SIGTERM=no specify hme0 v4 behavior"; print "# hme0.v6.RELEASE_ON_SIGTERM=no specify hme0 v6 behavior"; print "# RELEASE_ON_SIGTERM=no match all v4 interfaces"; print "# .v6.RELEASE_ON_SIGTERM=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 "# By uncommenting the following parameter-value pairs, all managed"; print "# interfaces are released on SIGTERM instead. In that case, the DHCP"; print "# server is notified that the address is available for use. Further,"; print "# if DHCP is later restarted on the interface, the client will not"; print "# request its previous address from the server, nor will it attempt to"; print "# reuse the previous lease. This behavior is often preferred for"; print "# roaming systems."; flag = 2; next; } flag == 1 { next; } { print $0; } ' $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 <