Article View: fj.net.ip.dns
Article #522LOCAL_FIRST patch for bind 4.9.7
From: SASABE Tetsuro
Date: Sun, 07 Jun 1998 00:00
Date: Sun, 07 Jun 1998 00:00
177 lines
7921 bytes
7921 bytes
Resolver $B$H$7$F(B BIND $B$r;H$C$F$$$k>l9g$K(B DNS $B$r8+$K9T$/$h$jA0$K(B
/etc/hosts $B$r8+$K9T$/$h$&$K$9$k$?$a$N%Q%C%A$G$9!#$=$N@N$N(B resolve+ $B$H(B
$B$O0c$C$F!"=gHV$rJQ99$9$k$3$H!&(BNIS $B$r8+$K9T$+$;$k$3$H$O=PMh$^$;$s!#F0:n(B
$B$O(B SunOS 4.1.4 $B$G$@$13NG'$7$F$$$^$9$,!"$?$V$sB>$N(B OS $B$G$b;H$($k$H;W$$(B
$B$^$9!#(B
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: README-bind-4.9.7-REL-LOCALFIRST
# bind-4.9.7-REL-LOCALFIRST.diff
# Wrapped by tss@kikori on Sun Jun 7 20:46:14 1998
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README-bind-4.9.7-REL-LOCALFIRST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README-bind-4.9.7-REL-LOCALFIRST'\"
else
echo shar: Extracting \"'README-bind-4.9.7-REL-LOCALFIRST'\" \(1903 characters\)
sed "s/^X//" >'README-bind-4.9.7-REL-LOCALFIRST' <<'END_OF_FILE'
Xhosts file lokup patch for BIND 4.9.7
XReleased at 1998/06/07
XCopyright (C) 1998 by SASABE Tetsuro, All Rights Reserved.
XWritten by SASABE Tetsuro <tss@a.u-tokyo.ac.jp>
X
X Resolver $B$H$7$F(B BIND 4.9.7 $B$r;H$C$F$$$k>l9g$K(B DNS $B$r8+$K9T$/$h$jA0$K(B
X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:FG[I[!&MxMQ$r5vBz$7$^$9!#(B
X
X$B!&$3$NCm0U=q$-$,0l=o$KEO$5$l$k$3$H!#(B
X
X$B!&:n<T$*$h$SG[I[<T$,0l@Z$N@UG$$rIi$o$J$$$3$H$KF10U$9$k$3$H(B
X
X$B!&EE;R%a!<%k!"%F!<%WG[I[$J$I$NG[I[@h$rFCDj$7$?7ABV$G$"$k$3$H!"$b$7$/$O(B
X NetNews $B$^$?$OEE;R7G<(HD$J$I$K$h$kG[I[$G$"$k$3$H!#7QB3$7$?(B NetNews
X $B$NG[I[$N7ABV$H$7$F=q@R$d(B CD-ROM $B$K7G:\$7$F$b9=$$$^$;$s$,!"$3$N%Q%C%A(B
X $B$@$1$r<h$j=P$7$FITFCDj$N?M$KG[I[$7$J$$$G2<$5$$(B(*1)$B!#(B
X
X$B!&2?$+$NLdBj$rH/8+$7$?>l9g!":n<T$KJs9p$9$kEXNO$r$9$k$3$H!#(B
X
X(*1)$B$3$l$O$3$N%=%U%H%&%'%"$N;HMQ$K=EBg$JLdBj$,H/@8$7$?>l9g$KMxMQ<T$KO"(B
X$BMm$r<h$kJ}K!$r;D$9$?$a$N5,Dj$G$9!#(B
X
X--
X$BEl5~Bg3X(B $BBg3X1!G@3X@8L?2J3X8&5f2J!?G@3XIt(B
X$B:{It(B $BE/O:!J$5$5$Y(B $B$F$D$m$&!K(B tss@a.u-tokyo.ac.jp
XPGP Key fingerprint = C9 D8 FD 45 F4 4E 07 58 FA 2A 98 73 9E 97 9A 08
END_OF_FILE
if test 1903 -ne `wc -c <'README-bind-4.9.7-REL-LOCALFIRST'`; then
echo shar: \"'README-bind-4.9.7-REL-LOCALFIRST'\" unpacked with wrong size!
fi
# end of 'README-bind-4.9.7-REL-LOCALFIRST'
fi
if test -f 'bind-4.9.7-REL-LOCALFIRST.diff' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'bind-4.9.7-REL-LOCALFIRST.diff'\"
else
echo shar: Extracting \"'bind-4.9.7-REL-LOCALFIRST.diff'\" \(2500 characters\)
sed "s/^X//" >'bind-4.9.7-REL-LOCALFIRST.diff' <<'END_OF_FILE'
X*** OPTIONS.orig Wed May 22 08:24:57 1996
X--- OPTIONS Sun Jun 7 20:42:29 1998
X***************
X*** 358,363 ****
X--- 358,367 ----
X should responses be sorted in what the server considers an optimal
X order for the client? this is on by default but it does very little good.
X
X+ LOCALFIRST (origin: onoe@sm.sony.co.jp, dirty-hack: tss@a.u-tokyo.ac.jp)
X+ if set, resolver routine (including shared library) looks local
X+ host file (/etc/hosts) first, then looks DNS.
X+
X ## ++Copyright++ 1989
X ## -
X ## Copyright (c) 1989
X*** conf/options.h.orig Wed Apr 22 07:45:18 1998
X--- conf/options.h Sun Jun 7 20:42:29 1998
X***************
X*** 119,124 ****
X--- 119,125 ----
X /*#define BIND_NOTIFY /* experimental - do not enable in customer products */
X #define LOC_RR /* support for LOC record parsing (ckd/vix) */
X #define SORT_RESPONSE /* should we try to sort responses optimally? (vix) */
X+ #define LOCALFIRST /* reslover looks /etc/hosts first (onoe) */
X
X /*--------------------------------------------*
X * no user-servicable parts beyond this point *
X*** res/gethnamaddr.c.orig Tue Apr 7 13:59:46 1998
X--- res/gethnamaddr.c Sun Jun 7 20:42:29 1998
X***************
X*** 591,600 ****
X--- 591,613 ----
X break;
X }
X
X+ #ifdef LOCALFIRST
X+ { register struct hostent *hp;
X+
X+ extern struct hostent *_gethtbyname();
X+ if (hp = _gethtbyname(name))
X+ return (hp);
X+ }
X+ #endif /* LOCALFIRST */
X+
X if ((n = res_search(name, C_IN, type, buf.buf, sizeof(buf))) < 0) {
X dprintf("res_search failed (%d)\n", n);
X if (errno == ECONNREFUSED)
X+ #ifdef LOCALFIRST
X+ h_errno = HOST_NOT_FOUND;
X+ #else /* LOCALFIRST */
X return (_gethtbyname2(name, af));
X+ #endif /* LOCALFIRST */
X return (NULL);
X }
X return (getanswer(&buf, n, name, type));
X***************
X*** 624,629 ****
X--- 637,648 ----
X h_errno = NETDB_INTERNAL;
X return (NULL);
X }
X+
X+ #ifdef LOCALFIRST
X+ if (hp = _gethtbyaddr(addr, len, af))
X+ return (hp);
X+ #endif /* LOCALFIRST */
X+
X if (af == AF_INET6 && len == IN6ADDRSZ &&
X (!bcmp(uaddr, mapped, sizeof mapped) ||
X !bcmp(uaddr, tunnelled, sizeof tunnelled))) {
X***************
X*** 674,680 ****
X--- 693,703 ----
X if (n < 0) {
X dprintf("res_query failed (%d)\n", n);
X if (errno == ECONNREFUSED)
X+ #ifdef LOCALFIRST
X+ h_errno = HOST_NOT_FOUND;
X+ #else /* LOCALFIRST */
X return (_gethtbyaddr(addr, len, af));
X+ #endif /* LOCALFIRST */
X return (NULL);
X }
X if (!(hp = getanswer(&buf, n, qbuf, T_PTR)))
END_OF_FILE
if test 2500 -ne `wc -c <'bind-4.9.7-REL-LOCALFIRST.diff'`; then
echo shar: \"'bind-4.9.7-REL-LOCALFIRST.diff'\" unpacked with wrong size!
fi
# end of 'bind-4.9.7-REL-LOCALFIRST.diff'
fi
echo shar: End of shell archive.
exit 0
--
$B:{It(B $BE/O:!J$5$5$Y(B $B$F$D$m$&!K(B tss@a.u-tokyo.ac.jp
$B!D$N$b$D$l!"0_$N$b$?$l!#(B
PGP Key fingerprint = C9 D8 FD 45 F4 4E 07 58 FA 2A 98 73 9E 97 9A 08
Technical Details
Message-ID:
<6ldtm7$m86@news.nc.u-tokyo.ac.jp>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: Japanese,JIS X-Google-Thread: 1456ae,cbbc503184a639f7,start X-Google-Attributes: gid1456ae,public X-Google-Thread: 10160c,cbbc503184a639f7,start X-Google-Attributes: gid10160c,public X-Google-Thread: 110989,cbbc503184a639f7,start X-Google-Attributes: gid110989,public From: tss@a.u-tokyo.ac.jp (SASABE Tetsuro) Subject: LOCAL_FIRST patch for bind 4.9.7 Date: 1998/06/07 Message-ID: <6ldtm7$m86@news.nc.u-tokyo.ac.jp> X-Deja-AN: 360355890 Distribution: world Followup-To: fj.net.ip.dns Organization: Graduate School of Agricultural and Life Science, the University of Tokyo, JAPAN. Newsgroups: fj.net.ip.dns,fj.sources,fj.archives.programs.sources