From owner-svn-src-stable-9@freebsd.org Fri Dec 25 10:55:41 2015 Return-Path: Delivered-To: svn-src-stable-9@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD537A5042A; Fri, 25 Dec 2015 10:55:40 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B875814C2; Fri, 25 Dec 2015 10:55:40 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id tBPAtdlA050185; Fri, 25 Dec 2015 10:55:39 GMT (envelope-from ume@FreeBSD.org) Received: (from ume@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id tBPAtdQG050184; Fri, 25 Dec 2015 10:55:39 GMT (envelope-from ume@FreeBSD.org) Message-Id: <201512251055.tBPAtdQG050184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ume set sender to ume@FreeBSD.org using -f From: Hajimu UMEMOTO Date: Fri, 25 Dec 2015 10:55:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r292721 - stable/9/usr.sbin/ypserv X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-9@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for only the 9-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Dec 2015 10:55:41 -0000 Author: ume Date: Fri Dec 25 10:55:39 2015 New Revision: 292721 URL: https://svnweb.freebsd.org/changeset/base/292721 Log: MFC r292435, r292441: - Keep hosts.by{name,addr} IPv4 only. - Add comment how we handle hosts and ipnodes. - Generate ipnodes.by{addr,name} from /etc/hosts for compatibility with FreeBSD local name resolution. If /var/yp/ipnodes exists, we generate them from it for backward compatibility. Modified: stable/9/usr.sbin/ypserv/Makefile.yp Directory Properties: stable/9/usr.sbin/ypserv/ (props changed) Modified: stable/9/usr.sbin/ypserv/Makefile.yp ============================================================================== --- stable/9/usr.sbin/ypserv/Makefile.yp Fri Dec 25 10:53:30 2015 (r292720) +++ stable/9/usr.sbin/ypserv/Makefile.yp Fri Dec 25 10:55:39 2015 (r292721) @@ -140,6 +140,7 @@ target: # If you want to omit some of them, feel free to comment # them out from this list. TARGETS= servers hosts networks protocols rpc services shells group +TARGETS+= ipnodes #TARGETS+= aliases # Sanity checks: filter out targets we can't build @@ -186,10 +187,8 @@ TARGETS+= amd.map AMDHOST= /dev/null .endif -.if exists($(IPNODES)) -TARGETS+= ipnodes -.else -IPNODES= /dev/null +.if !exists($(IPNODES)) +IPNODES= $(HOSTS) .endif all: $(TARGETS) @@ -353,9 +352,22 @@ netgroup.byuser: $(NETGROUP) .endif +# Solaris 8 does the following: +# - /etc/hosts and hosts.{byname,byaddr} are IPv4 only. +# - /etc/inet/ipnodes and ipnodes.{byname,byaddr} are used for protocol +# independent name-to-address mapping. +# +# For local name resolution, we made /etc/hosts protocol independent. +# For NIS name resolution, we obey Solaris 8 practice. +# - We keep hosts.{byname,byaddr} IPv4 only, to be friendly with Solaris 8 +# clients. +# - ipnodes.{byname,byaddr} is used for protocol independent mapping. +# We generate all the mappings from /etc/hosts unless /var/yp/ipnodes +# exists, for compatibility with FreeBSD local name resolution. +# hosts.byname: $(HOSTS) @echo "Updating $@..." - @$(AWK) '/^[0-9]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ + @$(AWK) '/^[0-9.]+[\t ]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ print $$n"\t"$$0 }' $(HOSTS) | $(DBLOAD) ${B} -i $(HOSTS) \ -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ @$(DBLOAD) -c @@ -365,7 +377,7 @@ hosts.byname: $(HOSTS) hosts.byaddr: $(HOSTS) @echo "Updating $@..." - @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(HOSTS) \ + @$(AWK) '/^[0-9.]+[\t ]/ { print $$1"\t"$$0 }' $(HOSTS) \ | $(DBLOAD) ${B} -i $(HOSTS) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c @@ -375,30 +387,22 @@ hosts.byaddr: $(HOSTS) ipnodes.byname: $(IPNODES) @echo "Updating $@..." -.if ${IPNODES} == "/dev/null" - @echo "Ipnodes source file not found -- skipping" -.else @$(AWK) '/^[0-9a-fA-F:]/ { for (n=2; n<=NF && $$n !~ "^#.*"; n++) \ print $$n"\t"$$0 }' $(IPNODES) | $(DBLOAD) ${B} -i $(IPNODES) \ -o $(YPMAPDIR)/$@ - $(TMP); $(RMV) $(TMP) $@ @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi -.endif ipnodes.byaddr: $(IPNODES) @echo "Updating $@..." -.if ${IPNODES} == "/dev/null" - @echo "Ipnodes source file not found -- skipping" -.else @$(AWK) '$$1 !~ "^#.*" { print $$1"\t"$$0 }' $(IPNODES) \ | $(DBLOAD) ${B} -i $(IPNODES) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c @if [ ! $(NOPUSH) ]; then $(YPPUSH) -d $(DOMAIN) $@; fi @if [ ! $(NOPUSH) ]; then echo "Pushed $@ map." ; fi -.endif networks.byname: $(NETWORKS)