Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Dec 2015 17:30:22 +0000 (UTC)
From:      Hajimu UMEMOTO <ume@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292441 - head/usr.sbin/ypserv
Message-ID:  <201512181730.tBIHUMCB061695@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ume
Date: Fri Dec 18 17:30:22 2015
New Revision: 292441
URL: https://svnweb.freebsd.org/changeset/base/292441

Log:
  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.
  
  Inspired by:	NetBSD
  MFC after:	1 week

Modified:
  head/usr.sbin/ypserv/Makefile.yp

Modified: head/usr.sbin/ypserv/Makefile.yp
==============================================================================
--- head/usr.sbin/ypserv/Makefile.yp	Fri Dec 18 16:33:15 2015	(r292440)
+++ head/usr.sbin/ypserv/Makefile.yp	Fri Dec 18 17:30:22 2015	(r292441)
@@ -141,6 +141,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
@@ -193,10 +194,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)
@@ -397,6 +396,8 @@ netgroup.byuser: $(NETGROUP)
 # - 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 $@..."
@@ -420,30 +421,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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512181730.tBIHUMCB061695>