summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-25 10:53:30 +0000
committerume <ume@FreeBSD.org>2015-12-25 10:53:30 +0000
commit8feffa60ae68c48c771c3384447148f6102f0010 (patch)
treea69f16d6c32acd4beef00a1147678faf57d8aa66
parent93f5797f20247cb0f049f94d4a71260a99141e79 (diff)
downloadFreeBSD-src-8feffa60ae68c48c771c3384447148f6102f0010.zip
FreeBSD-src-8feffa60ae68c48c771c3384447148f6102f0010.tar.gz
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.
-rw-r--r--usr.sbin/ypserv/Makefile.yp32
1 files changed, 18 insertions, 14 deletions
diff --git a/usr.sbin/ypserv/Makefile.yp b/usr.sbin/ypserv/Makefile.yp
index fc207b6..17eabe5 100644
--- a/usr.sbin/ypserv/Makefile.yp
+++ b/usr.sbin/ypserv/Makefile.yp
@@ -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)
@@ -387,9 +386,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
@@ -399,7 +411,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
@@ -409,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)
OpenPOWER on IntegriCloud