diff --git a/CHANGES b/CHANGES index 0e7e16adb9..0e12aa6daa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +3550. [func] Unified the internal and export versions of the + BIND libraries, allowing external clients to use + the same libraries as BIND. [RT #33131] + 3549. [doc] Documentation for "request-nsid" was missing. [RT #33153] diff --git a/README b/README index 07bb843353..80e5c89086 100644 --- a/README +++ b/README @@ -61,8 +61,9 @@ BIND 9.10.0 - New zone file format "map" is an image of a zone database that can be loaded directly into memory, allowing much faster zone loading. - - Up to 32 response-policy zones (RPZ) can now be configured. - RPZ performance has been substantially improved. + - Substantial improvement in response-policy zone (RPZ) + performance. Up to 32 response-policy zones can be + configured with minimal performance loss. - ACLs can now be specified based on geographic location using the MacMind GeoIP databases. - New XML schema (version 3) for the statistics channel @@ -73,6 +74,9 @@ BIND 9.10.0 browsers. - The statistics channel can now provide data in JSON format as well as XML. + - The internal and export versions of the BIND libraries + (libisc, libdns, etc) have been unified so that external + library clients can use the same libraries as BIND itself. - New 'dnssec-coverage' tool to check DNSSEC key coverage for a zone and report if a lapse in signing coverage has been inadvertently scheduled. diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index b8c17a4fa1..e505d74d7f 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -53,7 +53,7 @@ PK11DEL="$TOP/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p 1234" JOURNALPRINT=$TOP/bin/tools/named-journalprint VERIFY=$TOP/bin/dnssec/dnssec-verify ARPANAME=$TOP/bin/tools/arpaname -SAMPLE=$TOP/lib/export/samples/sample +RESOLVE=$TOP/lib/samples/resolve # The "stress" test is not run by default since it creates enough # load on the machine to make it unusable to other users. @@ -84,4 +84,4 @@ fi export NAMED LWRESD DIG NSUPDATE KEYGEN KEYFRLAB SIGNER KEYSIGNER KEYSETTOOL \ PERL SUBDIRS RNDC CHECKZONE PK11GEN PK11LIST PK11DEL TESTSOCK6 \ - JOURNALPRINT ARPANAME SAMPLE + JOURNALPRINT ARPANAME RESOLVE diff --git a/bin/tests/system/dnssec/clean.sh b/bin/tests/system/dnssec/clean.sh index f188ad461e..4e737d7336 100644 --- a/bin/tests/system/dnssec/clean.sh +++ b/bin/tests/system/dnssec/clean.sh @@ -31,7 +31,7 @@ rm -f ns2/single-nsec3.db rm -f ns2/nsec3chain-test.db rm -f */example.bk rm -f dig.out.* -rm -f sample.out* +rm -f resolve.out* rm -f random.data rm -f ns2/dlv.db rm -f ns3/multiple.example.db ns3/nsec3-unknown.example.db ns3/nsec3.example.db @@ -68,3 +68,4 @@ rm -f ns6/optout-tld.db rm -f nosign.before rm -f signing.out* rm -f canonical?.* +rm -f ns1/resolve.key diff --git a/bin/tests/system/dnssec/ns1/sign.sh b/bin/tests/system/dnssec/ns1/sign.sh index 1dfd0c0c3d..8fac885868 100644 --- a/bin/tests/system/dnssec/ns1/sign.sh +++ b/bin/tests/system/dnssec/ns1/sign.sh @@ -77,4 +77,4 @@ cat $keyname.key | grep -v '^; ' | $PERL -n -e ' local ($dn, $class, $type, $flags, $proto, $alg, @rest) = split; local $key = join("", @rest); print "-a $alg -e -k $dn -K $key\n" -' > sample.key +' > resolve.key diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh index 9a57063c6b..57b9d67f48 100644 --- a/bin/tests/system/dnssec/tests.sh +++ b/bin/tests/system/dnssec/tests.sh @@ -28,7 +28,7 @@ n=1 rm -f dig.out.* DIGOPTS="+tcp +noadd +nosea +nostat +nocmd +dnssec -p 5300" -SAMPLEKEY=`cat ns1/sample.key` +RESKEY=`cat ns1/resolve.key` # convert private-type records to readable form showprivate () { @@ -134,12 +134,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking postive validation NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.example > sample.out$n || ret=1 - grep "a.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 - grep "a.example..*.RRSIG.A 3 2 300 .*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.example > resolve.out$n || ret=1 + grep "a.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 + grep "a.example..*.RRSIG.A 3 2 300 .*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -157,12 +157,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking positive validation NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.nsec3.example > sample.out$n || ret=1 - grep "a.nsec3.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 - grep "a.nsec3.example..*RRSIG.A 7 3 300.*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.nsec3.example > resolve.out$n || ret=1 + grep "a.nsec3.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 + grep "a.nsec3.example..*RRSIG.A 7 3 300.*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -180,12 +180,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking positive validation OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.optout.example > sample.out$n || ret=1 - grep "a.optout.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 - grep "a.optout.example..*RRSIG.A 7 3 300.*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.optout.example > resolve.out$n || ret=1 + grep "a.optout.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 + grep "a.optout.example..*RRSIG.A 7 3 300.*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -202,12 +202,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking positive wildcard validation NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.wild.example > sample.out$n || ret=1 - grep "a.wild.example..*10.0.0.27" sample.out$n > /dev/null || ret=1 - grep "a.wild.example..*RRSIG.A 3 2 300.*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.wild.example > resolve.out$n || ret=1 + grep "a.wild.example..*10.0.0.27" resolve.out$n > /dev/null || ret=1 + grep "a.wild.example..*RRSIG.A 3 2 300.*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -242,12 +242,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking positive wildcard validation NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.wild.nsec3.example > sample.out$n || ret=1 - grep "a.wild.nsec3.example..*10.0.0.6" sample.out$n > /dev/null || ret=1 - grep "a.wild.nsec3.example..*RRSIG.A 7 3 300.*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.wild.nsec3.example > resolve.out$n || ret=1 + grep "a.wild.nsec3.example..*10.0.0.6" resolve.out$n > /dev/null || ret=1 + grep "a.wild.nsec3.example..*RRSIG.A 7 3 300.*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -266,12 +266,12 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking positive wildcard validation OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.wild.optout.example > sample.out$n || ret=1 - grep "a.wild.optout.example..*10.0.0.6" sample.out$n > /dev/null || ret=1 - grep "a.wild.optout.example..*RRSIG.A 7 3 300.*" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.wild.optout.example > resolve.out$n || ret=1 + grep "a.wild.optout.example..*10.0.0.6" resolve.out$n > /dev/null || ret=1 + grep "a.wild.optout.example..*RRSIG.A 7 3 300.*" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -288,11 +288,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NXDOMAIN NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -311,11 +311,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NXDOMAIN NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.nsec3.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.nsec3.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -335,11 +335,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NXDOMAIN OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.optout.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.optout.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -357,11 +357,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NODATA OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 a.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 a.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -381,11 +381,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NODATA NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 a.nsec3.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 a.nsec3.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -405,11 +405,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative validation NODATA OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 a.optout.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 a.optout.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -426,11 +426,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative wildcard validation NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 b.wild.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 b.wild.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -446,11 +446,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative wildcard validation NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 b.wild.nsec3.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 b.wild.nsec3.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -470,11 +470,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking negative wildcard validation OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t txt 10.53.0.4 b.optout.nsec3.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxrrset" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t txt -s 10.53.0.4 b.optout.nsec3.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -494,11 +494,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server insecurity proof NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.insecure.example > sample.out$n || ret=1 - grep "a.insecure.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.insecure.example > resolve.out$n || ret=1 + grep "a.insecure.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -516,11 +516,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server insecurity proof NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.insecure.nsec3.example > sample.out$n || ret=1 - grep "a.insecure.nsec3.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.insecure.nsec3.example > resolve.out$n || ret=1 + grep "a.insecure.nsec3.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -538,11 +538,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server insecurity proof OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.insecure.optout.example > sample.out$n || ret=1 - grep "a.insecure.optout.example..*10.0.0.1" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.insecure.optout.example > resolve.out$n || ret=1 + grep "a.insecure.optout.example..*10.0.0.1" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -562,11 +562,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server negative insecurity proof NSEC using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.insecure.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.insecure.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -586,11 +586,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server negative insecurity proof NSEC3 using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.insecure.nsec3.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.insecure.nsec3.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -610,11 +610,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking 1-server negative insecurity proof OPTOUT using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 q.insecure.optout.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: ncache nxdomain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 q.insecure.optout.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -807,11 +807,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking failed validation using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.bogus.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: no valid RRSIG" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.bogus.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: no valid RRSIG" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` @@ -852,11 +852,11 @@ n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then ret=0 echo "I:checking that validation fails when key record is missing using dns_client ($n)" - $SAMPLE $SAMPLEKEY -p 5300 -t a 10.53.0.4 a.b.keyless.example > /dev/null 2> sample.out$n || ret=1 - grep "resolution failed: broken trust chain" sample.out$n > /dev/null || ret=1 + $RESOLVE $RESKEY -p 5300 -t a -s 10.53.0.4 a.b.keyless.example > /dev/null 2> resolve.out$n || ret=1 + grep "resolution failed: broken trust chain" resolve.out$n > /dev/null || ret=1 n=`expr $n + 1` if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` diff --git a/bin/tests/system/resolver/clean.sh b/bin/tests/system/resolver/clean.sh index 36d17ec0d0..e6f37f956d 100644 --- a/bin/tests/system/resolver/clean.sh +++ b/bin/tests/system/resolver/clean.sh @@ -31,4 +31,4 @@ rm -f ns6/dsset-example.net. ns6/example.net.db.signed.jnl rm -f ns6/to-be-removed.tld.db ns6/to-be-removed.tld.db.jnl rm -f ns7/server.db ns7/server.db.jnl rm -f random.data -rm -f sample.out +rm -f resolve.out diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index 32a1665849..5e72fc0758 100644 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -30,11 +30,11 @@ grep "status: NXDOMAIN" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking non-cachable NXDOMAIN response handling using dns_client" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 nxdomain.example.net 2> sample.out || ret=1 - grep "resolution failed: ncache nxdomain" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 nxdomain.example.net 2> resolve.out || ret=1 + grep "resolution failed: ncache nxdomain" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -46,11 +46,11 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking non-cachable NODATA response handling using dns_client" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 nodata.example.net 2> sample.out || ret=1 - grep "resolution failed: ncache nxrrset" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 nodata.example.net 2> resolve.out || ret=1 + grep "resolution failed: ncache nxrrset" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -59,11 +59,11 @@ echo "I:checking handling of bogus referrals" # If the server has the "INSIST(!external)" bug, this query will kill it. $DIG +tcp www.example.com. a @10.53.0.1 -p 5300 >/dev/null || status=1 -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking handling of bogus referrals using dns_client" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 www.example.com 2> sample.out || ret=1 - grep "resolution failed: failure" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 www.example.com 2> resolve.out || ret=1 + grep "resolution failed: failure" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -99,11 +99,11 @@ if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking answer IPv4 address filtering using dns_client (accept)" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 www.example.org > sample.out || ret=1 - grep "www.example.org..*.192.0.2.1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 www.example.org > resolve.out || ret=1 + grep "www.example.org..*.192.0.2.1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -115,11 +115,11 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking answer IPv6 address filtering using dns_client (accept)" ret=0 - ${SAMPLE} -p 5300 -t aaaa 10.53.0.1 www.example.org > sample.out || ret=1 - grep "www.example.org..*.2001:db8:beef::1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t aaaa -s 10.53.0.1 www.example.org > resolve.out || ret=1 + grep "www.example.org..*.2001:db8:beef::1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -138,12 +138,12 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking CNAME target filtering using dns_client (accept)" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 goodcname.example.net > sample.out || ret=1 - grep "goodcname.example.net..*.goodcname.example.org." sample.out > /dev/null || ret=1 - grep "goodcname.example.org..*.192.0.2.1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 goodcname.example.net > resolve.out || ret=1 + grep "goodcname.example.net..*.goodcname.example.org." resolve.out > /dev/null || ret=1 + grep "goodcname.example.org..*.192.0.2.1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -155,12 +155,12 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking CNAME target filtering using dns_client (accept due to subdomain)" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 cname.sub.example.org > sample.out || ret=1 - grep "cname.sub.example.org..*.ok.sub.example.org." sample.out > /dev/null || ret=1 - grep "ok.sub.example.org..*.192.0.2.1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 cname.sub.example.org > resolve.out || ret=1 + grep "cname.sub.example.org..*.ok.sub.example.org." resolve.out > /dev/null || ret=1 + grep "ok.sub.example.org..*.192.0.2.1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -179,12 +179,12 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking DNAME target filtering using dns_client (accept)" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 foo.gooddname.example.net > sample.out || ret=1 - grep "foo.gooddname.example.net..*.gooddname.example.org" sample.out > /dev/null || ret=1 - grep "foo.gooddname.example.org..*.192.0.2.1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 foo.gooddname.example.net > resolve.out || ret=1 + grep "foo.gooddname.example.net..*.gooddname.example.org" resolve.out > /dev/null || ret=1 + grep "foo.gooddname.example.org..*.192.0.2.1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi @@ -196,12 +196,12 @@ grep "status: NOERROR" dig.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` -if [ -x ${SAMPLE} ] ; then +if [ -x ${RESOLVE} ] ; then echo "I:checking DNAME target filtering using dns_client (accept due to subdomain)" ret=0 - ${SAMPLE} -p 5300 -t a 10.53.0.1 www.dname.sub.example.org > sample.out || ret=1 - grep "www.dname.sub.example.org..*.ok.sub.example.org." sample.out > /dev/null || ret=1 - grep "www.ok.sub.example.org..*.192.0.2.1" sample.out > /dev/null || ret=1 + ${RESOLVE} -p 5300 -t a -s 10.53.0.1 www.dname.sub.example.org > resolve.out || ret=1 + grep "www.dname.sub.example.org..*.ok.sub.example.org." resolve.out > /dev/null || ret=1 + grep "www.ok.sub.example.org..*.192.0.2.1" resolve.out > /dev/null || ret=1 if [ $ret != 0 ]; then echo "I:failed"; fi status=`expr $status + $ret` fi diff --git a/configure b/configure index fd1ff12b28..25050c96d1 100755 --- a/configure +++ b/configure @@ -1278,10 +1278,7 @@ LWRES_PLATFORM_NEEDNETINETIN6H ISC_PLATFORM_NEEDNETINETIN6H LWRES_PLATFORM_HAVEIPV6 ISC_PLATFORM_HAVEIPV6 -export_includedir -export_libdir BIND9_CO_RULE -LIBEXPORT LIBTOOL_IN_MAIN LIBTOOL_ALLOW_UNDEFINED LIBTOOL_MODE_LINK @@ -1474,9 +1471,6 @@ with_purify with_libtool enable_backtrace enable_symtable -enable_exportlib -with_export_libdir -with_export_includedir enable_ipv6 with_kame enable_getifaddrs @@ -2144,8 +2138,6 @@ Optional Features: --enable-backtrace log stack backtrace on abort [default=yes] --enable-symtable use internal symbol table for backtrace [all|minimal(default)|none] - --enable-exportlib build exportable library (GNU make required) - [default=no] --enable-ipv6 use IPv6 default=autodetect --enable-getifaddrs Enable the use of getifaddrs() [yes|no]. --disable-isc-spnego use SPNEGO from GSSAPI library @@ -2182,12 +2174,6 @@ Optional Packages: --with-libjson=PATH Build with libjson0 library yes|no|path --with-purify=PATH use Rational purify --with-libtool use GNU libtool - --with-export-libdir=PATH - installation directory for the export library - [EPREFIX/lib/bind9] - --with-export-includedir=PATH - installation directory for the header files of the - export library [PREFIX/include/bind9] --with-kame=PATH use Kame IPv6 default path /usr/local/v6 --with-readline=LIBSPEC specify readline library default -lreadline @@ -11871,14 +11857,6 @@ yes) test "${with_atf+set}" = set || with_atf=yes test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes - case "$host" in - *-darwin*) - test "${enable_exportlib+set}" = set || enable_exportlib=yes - ;; - *-linux*) - test "${enable_exportlib+set}" = set || enable_exportlib=yes - ;; - esac ;; esac # @@ -16627,56 +16605,7 @@ SA=a -# -# build exportable DNS library? -# -# Check whether --enable-exportlib was given. -if test "${enable_exportlib+set}" = set; then : - enableval=$enable_exportlib; -fi - -case "$enable_exportlib" in - yes) - gmake= - for x in gmake gnumake make; do - if $x --version 2>/dev/null | grep GNU > /dev/null; then - gmake=$x - break; - fi - done - if test -z "$gmake"; then - as_fn_error $? "exportlib requires GNU make. Install it or disable the feature." "$LINENO" 5 - fi - LIBEXPORT=lib/export - - BIND9_CO_RULE="%.$O: \${srcdir}/%.c" - ;; - no|*) - BIND9_CO_RULE=".c.$O:" - ;; -esac - - - -# Check whether --with-export-libdir was given. -if test "${with_export_libdir+set}" = set; then : - withval=$with_export_libdir; export_libdir="$withval" -fi - -if test -z "$export_libdir"; then - export_libdir="\${exec_prefix}/lib/bind9/" -fi - - - -# Check whether --with-export-includedir was given. -if test "${with_export_includedir+set}" = set; then : - withval=$with_export_includedir; export_includedir="$withval" -fi - -if test -z "$export_includedir"; then - export_includedir="\${prefix}/include/bind9/" -fi +BIND9_CO_RULE=".c.$O:" # @@ -20843,7 +20772,7 @@ ac_config_commands="$ac_config_commands chmod" # elsewhere if there's a good reason for doing so. # -ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/rndc/Makefile bin/tests/Makefile bin/tests/atomic/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/hashes/Makefile bin/tests/headerdep_test.sh bin/tests/master/Makefile bin/tests/mem/Makefile bin/tests/names/Makefile bin/tests/net/Makefile bin/tests/rbt/Makefile bin/tests/resolver/Makefile bin/tests/sockaddr/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/named.conf bin/tests/system/dsdigest/prereq.sh bin/tests/system/ecdsa/prereq.sh bin/tests/system/dlzredir/prereq.sh bin/tests/system/filter-aaaa/Makefile bin/tests/system/geoip/Makefile bin/tests/system/gost/prereq.sh bin/tests/system/lwresd/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/system/tsiggss/Makefile bin/tests/tasks/Makefile bin/tests/timers/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/check-secure-delegation.pl contrib/zone-edit.sh doc/Makefile doc/arm/Makefile doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-docbook-latex.xsl doc/xsl/isc-manpage.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/export/Makefile lib/export/dns/Makefile lib/export/dns/include/Makefile lib/export/dns/include/dns/Makefile lib/export/dns/include/dst/Makefile lib/export/irs/Makefile lib/export/irs/include/Makefile lib/export/irs/include/irs/Makefile lib/export/isc/$thread_dir/Makefile lib/export/isc/$thread_dir/include/Makefile lib/export/isc/$thread_dir/include/isc/Makefile lib/export/isc/Makefile lib/export/isc/include/Makefile lib/export/isc/include/isc/Makefile lib/export/isc/nls/Makefile lib/export/isc/unix/Makefile lib/export/isc/unix/include/Makefile lib/export/isc/unix/include/isc/Makefile lib/export/isccfg/Makefile lib/export/isccfg/include/Makefile lib/export/isccfg/include/isccfg/Makefile lib/export/samples/Makefile lib/export/samples/Makefile-postinstall lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile unit/Makefile unit/unittest.sh" +ac_config_files="$ac_config_files make/Makefile make/mkdep Makefile bin/Makefile bin/check/Makefile bin/confgen/Makefile bin/confgen/unix/Makefile bin/dig/Makefile bin/dnssec/Makefile bin/named/Makefile bin/named/unix/Makefile bin/nsupdate/Makefile bin/pkcs11/Makefile bin/python/Makefile bin/python/dnssec-checkds.py bin/python/dnssec-coverage.py bin/rndc/Makefile bin/tests/Makefile bin/tests/atomic/Makefile bin/tests/db/Makefile bin/tests/dst/Makefile bin/tests/dst/Kdh.+002+18602.key bin/tests/dst/Kdh.+002+18602.private bin/tests/dst/Kdh.+002+48957.key bin/tests/dst/Kdh.+002+48957.private bin/tests/dst/Ktest.+001+00002.key bin/tests/dst/Ktest.+001+54622.key bin/tests/dst/Ktest.+001+54622.private bin/tests/dst/Ktest.+003+23616.key bin/tests/dst/Ktest.+003+23616.private bin/tests/dst/Ktest.+003+49667.key bin/tests/dst/dst_2_data bin/tests/dst/t2_data_1 bin/tests/dst/t2_data_2 bin/tests/dst/t2_dsasig bin/tests/dst/t2_rsasig bin/tests/hashes/Makefile bin/tests/headerdep_test.sh bin/tests/master/Makefile bin/tests/mem/Makefile bin/tests/names/Makefile bin/tests/net/Makefile bin/tests/rbt/Makefile bin/tests/resolver/Makefile bin/tests/sockaddr/Makefile bin/tests/system/Makefile bin/tests/system/conf.sh bin/tests/system/dlz/prereq.sh bin/tests/system/dlzexternal/Makefile bin/tests/system/dlzexternal/ns1/named.conf bin/tests/system/dsdigest/prereq.sh bin/tests/system/ecdsa/prereq.sh bin/tests/system/dlzredir/prereq.sh bin/tests/system/filter-aaaa/Makefile bin/tests/system/geoip/Makefile bin/tests/system/gost/prereq.sh bin/tests/system/lwresd/Makefile bin/tests/system/rpz/Makefile bin/tests/system/rsabigexponent/Makefile bin/tests/system/tkey/Makefile bin/tests/system/tsiggss/Makefile bin/tests/tasks/Makefile bin/tests/timers/Makefile bin/tests/virtual-time/Makefile bin/tests/virtual-time/conf.sh bin/tools/Makefile contrib/check-secure-delegation.pl contrib/zone-edit.sh doc/Makefile doc/arm/Makefile doc/doxygen/Doxyfile doc/doxygen/Makefile doc/doxygen/doxygen-input-filter doc/misc/Makefile doc/xsl/Makefile doc/xsl/isc-docbook-chunk.xsl doc/xsl/isc-docbook-html.xsl doc/xsl/isc-docbook-latex.xsl doc/xsl/isc-manpage.xsl isc-config.sh lib/Makefile lib/bind9/Makefile lib/bind9/include/Makefile lib/bind9/include/bind9/Makefile lib/dns/Makefile lib/dns/include/Makefile lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile lib/irs/include/irs/netdb.h lib/irs/include/irs/platform.h lib/isc/$arch/Makefile lib/isc/$arch/include/Makefile lib/isc/$arch/include/isc/Makefile lib/isc/$thread_dir/Makefile lib/isc/$thread_dir/include/Makefile lib/isc/$thread_dir/include/isc/Makefile lib/isc/Makefile lib/isc/include/Makefile lib/isc/include/isc/Makefile lib/isc/include/isc/platform.h lib/isc/tests/Makefile lib/isc/nls/Makefile lib/isc/unix/Makefile lib/isc/unix/include/Makefile lib/isc/unix/include/isc/Makefile lib/isccc/Makefile lib/isccc/include/Makefile lib/isccc/include/isccc/Makefile lib/isccfg/Makefile lib/isccfg/include/Makefile lib/isccfg/include/isccfg/Makefile lib/lwres/Makefile lib/lwres/include/Makefile lib/lwres/include/lwres/Makefile lib/lwres/include/lwres/netdb.h lib/lwres/include/lwres/platform.h lib/lwres/man/Makefile lib/lwres/unix/Makefile lib/lwres/unix/include/Makefile lib/lwres/unix/include/lwres/Makefile lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile lib/samples/Makefile lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh" # @@ -21925,29 +21854,6 @@ do "lib/dns/include/dns/Makefile") CONFIG_FILES="$CONFIG_FILES lib/dns/include/dns/Makefile" ;; "lib/dns/include/dst/Makefile") CONFIG_FILES="$CONFIG_FILES lib/dns/include/dst/Makefile" ;; "lib/dns/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lib/dns/tests/Makefile" ;; - "lib/export/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/Makefile" ;; - "lib/export/dns/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/dns/Makefile" ;; - "lib/export/dns/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/dns/include/Makefile" ;; - "lib/export/dns/include/dns/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/dns/include/dns/Makefile" ;; - "lib/export/dns/include/dst/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/dns/include/dst/Makefile" ;; - "lib/export/irs/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/irs/Makefile" ;; - "lib/export/irs/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/irs/include/Makefile" ;; - "lib/export/irs/include/irs/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/irs/include/irs/Makefile" ;; - "lib/export/isc/$thread_dir/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/$thread_dir/Makefile" ;; - "lib/export/isc/$thread_dir/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/$thread_dir/include/Makefile" ;; - "lib/export/isc/$thread_dir/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/$thread_dir/include/isc/Makefile" ;; - "lib/export/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/Makefile" ;; - "lib/export/isc/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/include/Makefile" ;; - "lib/export/isc/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/include/isc/Makefile" ;; - "lib/export/isc/nls/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/nls/Makefile" ;; - "lib/export/isc/unix/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/unix/Makefile" ;; - "lib/export/isc/unix/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/unix/include/Makefile" ;; - "lib/export/isc/unix/include/isc/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isc/unix/include/isc/Makefile" ;; - "lib/export/isccfg/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isccfg/Makefile" ;; - "lib/export/isccfg/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isccfg/include/Makefile" ;; - "lib/export/isccfg/include/isccfg/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/isccfg/include/isccfg/Makefile" ;; - "lib/export/samples/Makefile") CONFIG_FILES="$CONFIG_FILES lib/export/samples/Makefile" ;; - "lib/export/samples/Makefile-postinstall") CONFIG_FILES="$CONFIG_FILES lib/export/samples/Makefile-postinstall" ;; "lib/irs/Makefile") CONFIG_FILES="$CONFIG_FILES lib/irs/Makefile" ;; "lib/irs/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/irs/include/Makefile" ;; "lib/irs/include/irs/Makefile") CONFIG_FILES="$CONFIG_FILES lib/irs/include/irs/Makefile" ;; @@ -21986,6 +21892,8 @@ do "lib/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tests/Makefile" ;; "lib/tests/include/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tests/include/Makefile" ;; "lib/tests/include/tests/Makefile") CONFIG_FILES="$CONFIG_FILES lib/tests/include/tests/Makefile" ;; + "lib/samples/Makefile") CONFIG_FILES="$CONFIG_FILES lib/samples/Makefile" ;; + "lib/samples/Makefile-postinstall") CONFIG_FILES="$CONFIG_FILES lib/samples/Makefile-postinstall" ;; "unit/Makefile") CONFIG_FILES="$CONFIG_FILES unit/Makefile" ;; "unit/unittest.sh") CONFIG_FILES="$CONFIG_FILES unit/unittest.sh" ;; diff --git a/configure.in b/configure.in index f61395e8be..be8cdb14b8 100644 --- a/configure.in +++ b/configure.in @@ -71,14 +71,6 @@ yes) test "${with_atf+set}" = set || with_atf=yes test "${enable_filter_aaaa+set}" = set || enable_filter_aaaa=yes test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes - case "$host" in - *-darwin*) - test "${enable_exportlib+set}" = set || enable_exportlib=yes - ;; - *-linux*) - test "${enable_exportlib+set}" = set || enable_exportlib=yes - ;; - esac ;; esac # @@ -1834,54 +1826,9 @@ AC_SUBST(LIBTOOL_MODE_LINK) AC_SUBST(LIBTOOL_ALLOW_UNDEFINED) AC_SUBST(LIBTOOL_IN_MAIN) -# -# build exportable DNS library? -# -AC_ARG_ENABLE(exportlib, - [ --enable-exportlib build exportable library (GNU make required) - [[default=no]]]) -case "$enable_exportlib" in - yes) - gmake= - for x in gmake gnumake make; do - if $x --version 2>/dev/null | grep GNU > /dev/null; then - gmake=$x - break; - fi - done - if test -z "$gmake"; then - AC_MSG_ERROR([exportlib requires GNU make. Install it or disable the feature.]) - fi - LIBEXPORT=lib/export - AC_SUBST(LIBEXPORT) - BIND9_CO_RULE="%.$O: \${srcdir}/%.c" - ;; - no|*) - BIND9_CO_RULE=".c.$O:" - ;; -esac +BIND9_CO_RULE=".c.$O:" AC_SUBST(BIND9_CO_RULE) -AC_ARG_WITH(export-libdir, - [ --with-export-libdir[=PATH] - installation directory for the export library - [[EPREFIX/lib/bind9]]], - export_libdir="$withval",) -if test -z "$export_libdir"; then - export_libdir="\${exec_prefix}/lib/bind9/" -fi -AC_SUBST(export_libdir) - -AC_ARG_WITH(export-includedir, - [ --with-export-includedir[=PATH] - installation directory for the header files of the - export library [[PREFIX/include/bind9]]], - export_includedir="$withval",) -if test -z "$export_includedir"; then - export_includedir="\${prefix}/include/bind9/" -fi -AC_SUBST(export_includedir) - # # Here begins a very long section to determine the system's networking # capabilities. The order of the tests is significant. @@ -3856,29 +3803,6 @@ AC_CONFIG_FILES([ lib/dns/include/dns/Makefile lib/dns/include/dst/Makefile lib/dns/tests/Makefile - lib/export/Makefile - lib/export/dns/Makefile - lib/export/dns/include/Makefile - lib/export/dns/include/dns/Makefile - lib/export/dns/include/dst/Makefile - lib/export/irs/Makefile - lib/export/irs/include/Makefile - lib/export/irs/include/irs/Makefile - lib/export/isc/$thread_dir/Makefile - lib/export/isc/$thread_dir/include/Makefile - lib/export/isc/$thread_dir/include/isc/Makefile - lib/export/isc/Makefile - lib/export/isc/include/Makefile - lib/export/isc/include/isc/Makefile - lib/export/isc/nls/Makefile - lib/export/isc/unix/Makefile - lib/export/isc/unix/include/Makefile - lib/export/isc/unix/include/isc/Makefile - lib/export/isccfg/Makefile - lib/export/isccfg/include/Makefile - lib/export/isccfg/include/isccfg/Makefile - lib/export/samples/Makefile - lib/export/samples/Makefile-postinstall lib/irs/Makefile lib/irs/include/Makefile lib/irs/include/irs/Makefile @@ -3917,6 +3841,8 @@ AC_CONFIG_FILES([ lib/tests/Makefile lib/tests/include/Makefile lib/tests/include/tests/Makefile + lib/samples/Makefile + lib/samples/Makefile-postinstall unit/Makefile unit/unittest.sh ]) diff --git a/lib/Makefile.in b/lib/Makefile.in index 8dc1d38498..51f740a344 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -23,7 +23,7 @@ top_srcdir = @top_srcdir@ # Attempt to disable parallel processing. .NOTPARALLEL: .NO_PARALLEL: -SUBDIRS = isc isccc dns isccfg bind9 lwres tests +SUBDIRS = isc isccc dns isccfg bind9 lwres irs tests samples TARGETS = @BIND9_MAKE_RULES@ diff --git a/lib/dns/Makefile.in b/lib/dns/Makefile.in index 9e4a562c15..00285dc7ad 100644 --- a/lib/dns/Makefile.in +++ b/lib/dns/Makefile.in @@ -78,8 +78,10 @@ DNSOBJS = acache.@O@ acl.@O@ adb.@O@ byaddr.@O@ \ stats.@O@ tcpmsg.@O@ time.@O@ timer.@O@ tkey.@O@ \ tsec.@O@ tsig.@O@ ttl.@O@ update.@O@ validator.@O@ \ version.@O@ view.@O@ xfrin.@O@ zone.@O@ zonekey.@O@ zt.@O@ +PORTDNSOBJS = client.@O@ ecdb.@O@ -OBJS= ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} @GEOIPLINKOBJS@ +OBJS= ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} ${PORTDNSOBJS} \ + @GEOIPLINKOBJS@ # Alphabetically @@ -108,8 +110,9 @@ DNSSRCS = acache.c acl.c adb.c byaddr.c \ stats.c tcpmsg.c time.c timer.c tkey.c \ tsec.c tsig.c ttl.c update.c validator.c \ version.c view.c xfrin.c zone.c zonekey.c zt.c ${OTHERSRCS} +PORTDNSSRCS = client.c ecdb.c -SRCS = ${DSTSRCS} ${DNSSRCS} @GEOIPLINKSRCS@ +SRCS = ${DSTSRCS} ${DNSSRCS} ${PORTDNSSRCS} @GEOIPLINKSRCS@ SUBDIRS = include TARGETS = include/dns/enumtype.h include/dns/enumclass.h \ @@ -184,7 +187,7 @@ gen: gen.c ${BUILD_CC} ${BUILD_CFLAGS} -I${top_srcdir}/lib/isc/include \ ${BUILD_CPPFLAGS} ${BUILD_LDFLAGS} -o $@ ${srcdir}/gen.c ${BUILD_LIBS} -rbtdb64.@O@: rbtdb.c +rbtdb64.@O@: rbtdb64.c rbtdb.c depend: include/dns/enumtype.h include/dns/enumclass.h \ include/dns/rdatastruct.h code.h diff --git a/lib/dns/byaddr.c b/lib/dns/byaddr.c index eb05f9f80f..fb4ebdd1a7 100644 --- a/lib/dns/byaddr.c +++ b/lib/dns/byaddr.c @@ -109,7 +109,6 @@ dns_byaddr_createptrname2(isc_netaddr_t *address, unsigned int options, return (dns_name_fromtext(name, &buffer, dns_rootname, 0, NULL)); } -#ifdef BIND9 struct dns_byaddr { /* Unlocked. */ unsigned int magic; @@ -315,4 +314,3 @@ dns_byaddr_destroy(dns_byaddr_t **byaddrp) { *byaddrp = NULL; } -#endif /* BIND9 */ diff --git a/lib/dns/cache.c b/lib/dns/cache.c index 9eb989c3b8..c1a94ed7b6 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -509,7 +509,6 @@ dns_cache_setfilename(dns_cache_t *cache, const char *filename) { return (ISC_R_SUCCESS); } -#ifdef BIND9 isc_result_t dns_cache_load(dns_cache_t *cache) { isc_result_t result; @@ -525,28 +524,21 @@ dns_cache_load(dns_cache_t *cache) { return (result); } -#endif /* BIND9 */ isc_result_t dns_cache_dump(dns_cache_t *cache) { -#ifdef BIND9 isc_result_t result; -#endif REQUIRE(VALID_CACHE(cache)); if (cache->filename == NULL) return (ISC_R_SUCCESS); -#ifdef BIND9 LOCK(&cache->filelock); result = dns_master_dump(cache->mctx, cache->db, NULL, &dns_master_style_cache, cache->filename); UNLOCK(&cache->filelock); return (result); -#else - return (ISC_R_NOTIMPLEMENTED); -#endif } diff --git a/lib/dns/db.c b/lib/dns/db.c index ede3e23f24..7e4f35719b 100644 --- a/lib/dns/db.c +++ b/lib/dns/db.c @@ -64,18 +64,14 @@ struct dns_dbimplementation { */ #include "rbtdb.h" -#ifdef BIND9 #include "rbtdb64.h" -#endif static ISC_LIST(dns_dbimplementation_t) implementations; static isc_rwlock_t implock; static isc_once_t once = ISC_ONCE_INIT; static dns_dbimplementation_t rbtimp; -#ifdef BIND9 static dns_dbimplementation_t rbt64imp; -#endif static void initialize(void) { @@ -87,19 +83,15 @@ initialize(void) { rbtimp.driverarg = NULL; ISC_LINK_INIT(&rbtimp, link); -#ifdef BIND9 rbt64imp.name = "rbt64"; rbt64imp.create = dns_rbtdb64_create; rbt64imp.mctx = NULL; rbt64imp.driverarg = NULL; ISC_LINK_INIT(&rbt64imp, link); -#endif ISC_LIST_INIT(implementations); ISC_LIST_APPEND(implementations, &rbtimp, link); -#ifdef BIND9 ISC_LIST_APPEND(implementations, &rbt64imp, link); -#endif } static inline dns_dbimplementation_t * @@ -301,7 +293,6 @@ dns_db_class(dns_db_t *db) { return (db->rdclass); } -#ifdef BIND9 isc_result_t dns_db_beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) { /* @@ -399,7 +390,6 @@ dns_db_dump2(dns_db_t *db, dns_dbversion_t *version, const char *filename, return ((db->methods->dump)(db, version, filename, masterformat)); } -#endif /* BIND9 */ /*** *** Version Methods diff --git a/lib/dns/dispatch.c b/lib/dns/dispatch.c index bf95970485..b87e022b67 100644 --- a/lib/dns/dispatch.c +++ b/lib/dns/dispatch.c @@ -455,7 +455,6 @@ request_log(dns_dispatch_t *disp, dns_dispentry_t *resp, * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#ifdef BIND9 static void dispatch_initrandom(arc4ctx_t *actx, isc_entropy_t *entropy, isc_mutex_t *lock) @@ -564,35 +563,6 @@ dispatch_random(arc4ctx_t *actx) { return (result); } -#else -/* - * For general purpose library, we don't have to be too strict about the - * quality of random values. Performance doesn't matter much, either. - * So we simply use the isc_random module to keep the library as small as - * possible. - */ - -static void -dispatch_initrandom(arc4ctx_t *actx, isc_entropy_t *entropy, - isc_mutex_t *lock) -{ - UNUSED(actx); - UNUSED(entropy); - UNUSED(lock); - - return; -} - -static isc_uint16_t -dispatch_random(arc4ctx_t *actx) { - isc_uint32_t r; - - UNUSED(actx); - - isc_random_get(&r); - return (r & 0xffff); -} -#endif /* BIND9 */ static isc_uint16_t dispatch_uniformrandom(arc4ctx_t *actx, isc_uint16_t upper_bound) { @@ -1039,7 +1009,6 @@ deactivate_dispsocket(dns_dispatch_t *disp, dispsocket_t *dispsock) { INSIST(dispsock->portentry != NULL); deref_portentry(disp, &dispsock->portentry); -#ifdef BIND9 if (disp->nsockets > DNS_DISPATCH_POOLSOCKS) destroy_dispsocket(disp, &dispsock); else { @@ -1063,13 +1032,6 @@ deactivate_dispsocket(dns_dispatch_t *disp, dispsocket_t *dispsock) { destroy_dispsocket(disp, &dispsock); } } -#else - /* This kind of optimization isn't necessary for normal use */ - UNUSED(qid); - UNUSED(result); - - destroy_dispsocket(disp, &dispsock); -#endif } /* @@ -1858,10 +1820,8 @@ destroy_mgr(dns_dispatchmgr_t **mgrp) { DESTROYLOCK(&mgr->rpool_lock); DESTROYLOCK(&mgr->depool_lock); -#ifdef BIND9 if (mgr->entropy != NULL) isc_entropy_detach(&mgr->entropy); -#endif /* BIND9 */ if (mgr->qid != NULL) qid_destroy(mctx, &mgr->qid); @@ -1895,13 +1855,9 @@ open_socket(isc_socketmgr_t *mgr, isc_sockaddr_t *local, sock = *sockp; if (sock != NULL) { -#ifdef BIND9 result = isc_socket_open(sock); if (result != ISC_R_SUCCESS) return (result); -#else - INSIST(0); -#endif } else if (dup_socket != NULL) { result = isc_socket_dup(dup_socket, &sock); if (result != ISC_R_SUCCESS) @@ -1927,11 +1883,7 @@ open_socket(isc_socketmgr_t *mgr, isc_sockaddr_t *local, if (*sockp == NULL) isc_socket_detach(&sock); else { -#ifdef BIND9 isc_socket_close(sock); -#else - INSIST(0); -#endif } return (result); } @@ -2086,12 +2038,8 @@ dns_dispatchmgr_create(isc_mem_t *mctx, isc_entropy_t *entropy, if (result != ISC_R_SUCCESS) goto kill_dpool; -#ifdef BIND9 if (entropy != NULL) isc_entropy_attach(entropy, &mgr->entropy); -#else - UNUSED(entropy); -#endif dispatch_initrandom(&mgr->arc4ctx, mgr->entropy, &mgr->arc4_lock); diff --git a/lib/dns/dlz.c b/lib/dns/dlz.c index 6adcd1a343..1a90d0929a 100644 --- a/lib/dns/dlz.c +++ b/lib/dns/dlz.c @@ -253,12 +253,9 @@ dns_dlzdestroy(dns_dlzdb_t **dbp) { */ REQUIRE(dbp != NULL && DNS_DLZ_VALID(*dbp)); -#ifdef BIND9 if ((*dbp)->ssutable != NULL) { dns_ssutable_detach(&(*dbp)->ssutable); } -#endif - /* call the drivers destroy method */ if ((*dbp) != NULL) { @@ -484,7 +481,6 @@ dns_dlzunregister(dns_dlzimplementation_t **dlzimp) { RWUNLOCK(&dlz_implock, isc_rwlocktype_write); } -#ifdef BIND9 /* * Create a writeable DLZ zone. This can be called by DLZ drivers * during configure() to create a zone that can be updated. The zone @@ -569,7 +565,6 @@ dns_dlz_writeablezone(dns_view_t *view, dns_dlzdb_t *dlzdb, return (result); } -#endif /*% * Configure a DLZ driver. This is optional, and if supplied gives diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 730497e951..79c8240078 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -75,9 +75,7 @@ #define DST_AS_STR(t) ((t).value.as_textregion.base) static dst_func_t *dst_t_func[DST_MAX_ALGS]; -#ifdef BIND9 static isc_entropy_t *dst_entropy_pool = NULL; -#endif static unsigned int dst_entropy_flags = 0; static isc_boolean_t dst_initialized = ISC_FALSE; @@ -135,7 +133,7 @@ static isc_result_t addsuffix(char *filename, int len, return (_r); \ } while (0); \ -#if defined(OPENSSL) && defined(BIND9) +#if defined(OPENSSL) static void * default_memalloc(void *arg, size_t size) { UNUSED(arg); @@ -162,11 +160,6 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, isc_result_t result; REQUIRE(mctx != NULL); -#ifdef BIND9 - REQUIRE(ectx != NULL); -#else - UNUSED(ectx); -#endif REQUIRE(dst_initialized == ISC_FALSE); #ifndef OPENSSL @@ -175,7 +168,7 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, dst__memory_pool = NULL; -#if defined(OPENSSL) && defined(BIND9) +#if defined(OPENSSL) UNUSED(mctx); /* * When using --with-openssl, there seems to be no good way of not @@ -193,13 +186,13 @@ dst_lib_init2(isc_mem_t *mctx, isc_entropy_t *ectx, #ifndef OPENSSL_LEAKS isc_mem_setdestroycheck(dst__memory_pool, ISC_FALSE); #endif -#else +#else /* OPENSSL */ isc_mem_attach(mctx, &dst__memory_pool); -#endif -#ifdef BIND9 - isc_entropy_attach(ectx, &dst_entropy_pool); -#endif - dst_entropy_flags = eflags; +#endif /* OPENSSL */ + if (ectx != NULL) { + isc_entropy_attach(ectx, &dst_entropy_pool); + dst_entropy_flags = eflags; + } dst_result_register(); @@ -262,10 +255,8 @@ dst_lib_destroy(void) { #endif if (dst__memory_pool != NULL) isc_mem_detach(&dst__memory_pool); -#ifdef BIND9 if (dst_entropy_pool != NULL) isc_entropy_detach(&dst_entropy_pool); -#endif } isc_boolean_t @@ -1824,9 +1815,11 @@ addsuffix(char *filename, int len, const char *odirname, isc_result_t dst__entropy_getdata(void *buf, unsigned int len, isc_boolean_t pseudo) { -#ifdef BIND9 unsigned int flags = dst_entropy_flags; + if (dst_entropy_pool == NULL) + return (ISC_R_FAILURE); + if (len == 0) return (ISC_R_SUCCESS); if (pseudo) @@ -1834,24 +1827,19 @@ dst__entropy_getdata(void *buf, unsigned int len, isc_boolean_t pseudo) { else flags |= ISC_ENTROPY_BLOCKING; return (isc_entropy_getdata(dst_entropy_pool, buf, len, NULL, flags)); -#else - UNUSED(buf); - UNUSED(len); - UNUSED(pseudo); - - return (ISC_R_NOTIMPLEMENTED); -#endif } unsigned int dst__entropy_status(void) { -#ifdef BIND9 #ifdef GSSAPI unsigned int flags = dst_entropy_flags; isc_result_t ret; unsigned char buf[32]; static isc_boolean_t first = ISC_TRUE; + if (dst_entropy_pool == NULL) + return (0); + if (first) { /* Someone believes RAND_status() initializes the PRNG */ flags &= ~ISC_ENTROPY_GOODONLY; @@ -1864,9 +1852,6 @@ dst__entropy_status(void) { } #endif return (isc_entropy_status(dst_entropy_pool)); -#else - return (0); -#endif } isc_buffer_t * diff --git a/lib/dns/include/dns/dlz.h b/lib/dns/include/dns/dlz.h index 02e1b6ccd0..e6147b3620 100644 --- a/lib/dns/include/dns/dlz.h +++ b/lib/dns/include/dns/dlz.h @@ -225,9 +225,7 @@ struct dns_dlzdb { isc_boolean_t search; char *dlzname; ISC_LINK(dns_dlzdb_t) link; -#ifdef BIND9 dns_ssutable_t *ssutable; -#endif }; diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index 7b0d966af1..ad4042af64 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -191,13 +191,16 @@ struct dns_view { dns_zone_t * managed_keys; dns_zone_t * redirect; -#ifdef BIND9 - /* File in which to store configuration for newly added zones */ + /* + * File and configuration data for zones added at runtime + * (only used in BIND9). + * + * XXX: This should be a pointer to an opaque type that + * named implements. + */ char * new_zone_file; - void * new_zone_config; void (*cfg_destroy)(void **); -#endif }; #define DNS_VIEW_MAGIC ISC_MAGIC('V','i','e','w') @@ -315,6 +318,24 @@ dns_view_weakdetach(dns_view_t **targetp); *\li *viewp is NULL. */ +isc_result_t +dns_view_createzonetable(dns_view_t *view); +/*%< + * Create a zonetable for the view. + * + * Requires: + * + *\li 'view' is a valid, unfrozen view. + * + *\li 'view' does not have a zonetable already. + * + * Returns: + * + *\li #ISC_R_SUCCESS + * + *\li Any error that dns_zt_create() can return. + */ + isc_result_t dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr, diff --git a/lib/dns/lib.c b/lib/dns/lib.c index df16fa22d0..c1208c02b2 100644 --- a/lib/dns/lib.c +++ b/lib/dns/lib.c @@ -75,9 +75,7 @@ dns_lib_initmsgcat(void) { static isc_once_t init_once = ISC_ONCE_INIT; static isc_mem_t *dns_g_mctx = NULL; -#ifndef BIND9 static dns_dbimplementation_t *dbimp = NULL; -#endif static isc_boolean_t initialize_done = ISC_FALSE; static isc_mutex_t reflock; static unsigned int references = 0; @@ -92,11 +90,9 @@ initialize(void) { if (result != ISC_R_SUCCESS) return; dns_result_register(); -#ifndef BIND9 result = dns_ecdb_register(dns_g_mctx, &dbimp); if (result != ISC_R_SUCCESS) goto cleanup_mctx; -#endif result = isc_hash_create(dns_g_mctx, NULL, DNS_NAME_MAXWIRE); if (result != ISC_R_SUCCESS) goto cleanup_db; @@ -117,11 +113,11 @@ initialize(void) { cleanup_hash: isc_hash_destroy(); cleanup_db: -#ifndef BIND9 - dns_ecdb_unregister(&dbimp); + if (dbimp != NULL) + dns_ecdb_unregister(&dbimp); cleanup_mctx: -#endif - isc_mem_detach(&dns_g_mctx); + if (dns_g_mctx != NULL) + isc_mem_detach(&dns_g_mctx); } isc_result_t @@ -161,8 +157,8 @@ dns_lib_shutdown(void) { dst_lib_destroy(); isc_hash_destroy(); -#ifndef BIND9 - dns_ecdb_unregister(&dbimp); -#endif - isc_mem_detach(&dns_g_mctx); + if (dbimp != NULL) + dns_ecdb_unregister(&dbimp); + if (dns_g_mctx != NULL) + isc_mem_detach(&dns_g_mctx); } diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index d59c0248bd..033da213b4 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -165,7 +165,6 @@ static char spaces[N_SPACES+1] = " "; #define N_TABS 10 static char tabs[N_TABS+1] = "\t\t\t\t\t\t\t\t\t\t"; -#ifdef BIND9 struct dns_dumpctx { unsigned int magic; isc_mem_t *mctx; @@ -194,7 +193,6 @@ struct dns_dumpctx { dns_totext_ctx_t *ctx, isc_buffer_t *buffer, FILE *f); }; -#endif /* BIND9 */ #define NXDOMAIN(x) (((x)->attributes & DNS_RDATASETATTR_NXDOMAIN) != 0) @@ -702,7 +700,6 @@ dns_master_questiontotext(dns_name_t *owner_name, ISC_FALSE, target)); } -#ifdef BIND9 /* * Print an rdataset. 'buffer' is a scratch buffer, which must have been * dynamically allocated by the caller. It must be large enough to @@ -1910,7 +1907,6 @@ dns_master_dumpnode(isc_mem_t *mctx, dns_db_t *db, dns_dbversion_t *version, return (result); } -#endif /* BIND9 */ isc_result_t dns_master_stylecreate(dns_master_style_t **stylep, unsigned int flags, diff --git a/lib/dns/nsec3.c b/lib/dns/nsec3.c index 935f515d23..81172ba5c4 100644 --- a/lib/dns/nsec3.c +++ b/lib/dns/nsec3.c @@ -968,7 +968,6 @@ dns_nsec3param_toprivate(dns_rdata_t *src, dns_rdata_t *target, ISC_LINK_INIT(target, link); } -#ifdef BIND9 static isc_result_t rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, const dns_rdata_t *rdata, isc_boolean_t *flag) @@ -1011,9 +1010,7 @@ rr_exists(dns_db_t *db, dns_dbversion_t *ver, dns_name_t *name, dns_db_detachnode(db, &node); return (result); } -#endif -#ifdef BIND9 isc_result_t dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, dns_zone_t *zone, isc_boolean_t nonsec, @@ -1138,7 +1135,6 @@ dns_nsec3param_deletechains(dns_db_t *db, dns_dbversion_t *ver, dns_db_detachnode(db, &node); return (result); } -#endif isc_result_t dns_nsec3_addnsec3sx(dns_db_t *db, dns_dbversion_t *version, diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index fca49a98c5..77e684bd85 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -691,9 +691,7 @@ typedef struct rbtdb_dbiterator { static void free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event); static void overmem(dns_db_t *db, isc_boolean_t overmem); -#ifdef BIND9 static void setnsec3parameters(dns_db_t *db, rbtdb_version_t *version); -#endif /*% * 'init_count' is used to initialize 'newheader->count' which inturn @@ -1054,7 +1052,6 @@ free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { if (rbtdb->cachestats != NULL) isc_stats_detach(&rbtdb->cachestats); -#ifdef BIND9 if (rbtdb->load_rpzs != NULL) { /* * We must be cleaning up after a failed zone loading. @@ -1067,7 +1064,6 @@ free_rbtdb(dns_rbtdb_t *rbtdb, isc_boolean_t log, isc_event_t *event) { REQUIRE(rbtdb->rpz_num < rbtdb->rpzs->p.num_zones); dns_rpz_detach_rpzs(&rbtdb->rpzs); } -#endif isc_mem_put(rbtdb->common.mctx, rbtdb->node_locks, rbtdb->node_lock_count * sizeof(rbtdb_nodelock_t)); @@ -1657,14 +1653,12 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) switch (node->nsec) { case DNS_RBT_NSEC_NORMAL: -#ifdef BIND9 if (rbtdb->rpzs != NULL) { dns_fixedname_init(&fname); name = dns_fixedname_name(&fname); dns_rbt_fullnamefromnode(node, name); dns_rpz_delete(rbtdb->rpzs, rbtdb->rpz_num, name); } -#endif result = dns_rbt_deletenode(rbtdb->tree, node, ISC_FALSE); break; case DNS_RBT_NSEC_HAS_NSEC: @@ -1699,10 +1693,8 @@ delete_node(dns_rbtdb_t *rbtdb, dns_rbtnode_t *node) } } result = dns_rbt_deletenode(rbtdb->tree, node, ISC_FALSE); -#ifdef BIND9 if (rbtdb->rpzs != NULL) dns_rpz_delete(rbtdb->rpzs, rbtdb->rpz_num, name); -#endif break; case DNS_RBT_NSEC_NSEC: result = dns_rbt_deletenode(rbtdb->nsec, node, ISC_FALSE); @@ -2136,13 +2128,6 @@ cleanup_nondirty(rbtdb_version_t *version, rbtdb_changedlist_t *cleanup_list) { static void iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { -#ifndef BIND9 - UNUSED(db); - UNUSED(version); - UNUSED(origin); - - return; -#else dns_rdataset_t keyset; dns_rdataset_t nsecset, signsecset; isc_boolean_t haszonekey = ISC_FALSE; @@ -2192,14 +2177,12 @@ iszonesecure(dns_db_t *db, rbtdb_version_t *version, dns_dbnode_t *origin) { version->secure = dns_db_secure; else version->secure = dns_db_insecure; -#endif } /*%< * Walk the origin node looking for NSEC3PARAM records. * Cache the nsec3 parameters. */ -#ifdef BIND9 static void setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) { dns_rbtnode_t *node; @@ -2291,7 +2274,6 @@ setnsec3parameters(dns_db_t *db, rbtdb_version_t *version) { isc_rwlocktype_read); RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_read); } -#endif static void cleanup_dead_nodes_callback(isc_task_t *task, isc_event_t *event) { @@ -2680,7 +2662,6 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, dns_name_t *name, node = NULL; result = dns_rbt_addnode(tree, name, &node); if (result == ISC_R_SUCCESS) { -#ifdef BIND9 if (rbtdb->rpzs != NULL && tree == rbtdb->tree) { dns_fixedname_t fnamef; dns_name_t *fname; @@ -2695,7 +2676,6 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, dns_name_t *name, return (result); } } -#endif dns_rbt_namefromnode(node, &nodename); #ifdef DNS_RBT_USEHASH node->locknum = node->hashval % rbtdb->node_lock_count; @@ -4692,7 +4672,6 @@ find_coveringnsec(rbtdb_search_t *search, dns_dbnode_t **nodep, return (result); } -#ifdef BIND9 /* * Connect this RBTDB to the response policy zone summary data for the view. */ @@ -4732,7 +4711,6 @@ rpz_ready(dns_db_t *db) { RWUNLOCK(&rbtdb->tree_lock, isc_rwlocktype_write); return (result); } -#endif static isc_result_t cache_find(dns_db_t *db, dns_name_t *name, dns_dbversion_t *version, @@ -6832,11 +6810,9 @@ loadnode(dns_rbtdb_t *rbtdb, dns_name_t *name, dns_rbtnode_t **nodep, noderesult = dns_rbt_addnode(rbtdb->tree, name, nodep); -#ifdef BIND9 if (rbtdb->rpzs != NULL && noderesult == ISC_R_SUCCESS) noderesult = dns_rpz_add(rbtdb->load_rpzs, rbtdb->rpz_num, name); -#endif if (!hasnsec) return (noderesult); @@ -7124,7 +7100,6 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) { RBTDB_LOCK(&rbtdb->lock, isc_rwlocktype_write); -#ifdef BIND9 if (rbtdb->rpzs != NULL) { isc_result_t result; @@ -7136,7 +7111,6 @@ beginload(dns_db_t *db, dns_rdatacallbacks_t *callbacks) { return (result); } } -#endif REQUIRE((rbtdb->attributes & (RBTDB_ATTR_LOADED|RBTDB_ATTR_LOADING)) == 0); @@ -7366,17 +7340,9 @@ dump(dns_db_t *db, dns_dbversion_t *version, const char *filename, REQUIRE(VALID_RBTDB(rbtdb)); INSIST(rbtversion == NULL || rbtversion->rbtdb == rbtdb); -#ifdef BIND9 return (dns_master_dump2(rbtdb->common.mctx, db, version, &dns_master_style_default, filename, masterformat)); -#else - UNUSED(version); - UNUSED(filename); - UNUSED(masterformat); - - return (ISC_R_NOTIMPLEMENTED); -#endif /* BIND9 */ } static void @@ -7738,13 +7704,8 @@ static dns_dbmethods_t zone_methods = { resigned, isdnssec, NULL, -#ifdef BIND9 rpz_attach, rpz_ready, -#else - NULL, - NULL, -#endif NULL, NULL, NULL, @@ -9100,21 +9061,6 @@ rdataset_getadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_name_t *fname, dns_message_t *msg, isc_stdtime_t now) { -#ifndef BIND9 - UNUSED(rdataset); - UNUSED(type); - UNUSED(qtype); - UNUSED(acache); - UNUSED(zonep); - UNUSED(dbp); - UNUSED(versionp); - UNUSED(nodep); - UNUSED(fname); - UNUSED(msg); - UNUSED(now); - - return (ISC_R_NOTIMPLEMENTED); -#else dns_rbtdb_t *rbtdb = rdataset->private1; dns_rbtnode_t *rbtnode = rdataset->private2; unsigned char *raw = rdataset->private3; /* RDATASLAB */ @@ -9230,10 +9176,8 @@ acache_callback(dns_acacheentry_t *entry, void **arg) { dns_db_detach((dns_db_t **)(void*)&rbtdb); *arg = NULL; -#endif /* BIND9 */ } -#ifdef BIND9 static void acache_cancelentry(isc_mem_t *mctx, dns_acacheentry_t *entry, acache_cbarg_t **cbargp) @@ -9254,7 +9198,6 @@ acache_cancelentry(isc_mem_t *mctx, dns_acacheentry_t *entry, *cbargp = NULL; } -#endif /* BIND9 */ static isc_result_t rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, @@ -9263,19 +9206,6 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_dbversion_t *version, dns_dbnode_t *node, dns_name_t *fname) { -#ifndef BIND9 - UNUSED(rdataset); - UNUSED(type); - UNUSED(qtype); - UNUSED(acache); - UNUSED(zone); - UNUSED(db); - UNUSED(version); - UNUSED(node); - UNUSED(fname); - - return (ISC_R_NOTIMPLEMENTED); -#else dns_rbtdb_t *rbtdb = rdataset->private1; dns_rbtnode_t *rbtnode = rdataset->private2; unsigned char *raw = rdataset->private3; /* RDATASLAB */ @@ -9400,21 +9330,12 @@ rdataset_setadditional(dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, } return (result); -#endif } static isc_result_t rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset, dns_rdatasetadditional_t type, dns_rdatatype_t qtype) { -#ifndef BIND9 - UNUSED(acache); - UNUSED(rdataset); - UNUSED(type); - UNUSED(qtype); - - return (ISC_R_NOTIMPLEMENTED); -#else dns_rbtdb_t *rbtdb = rdataset->private1; dns_rbtnode_t *rbtnode = rdataset->private2; unsigned char *raw = rdataset->private3; /* RDATASLAB */ @@ -9479,7 +9400,6 @@ rdataset_putadditional(dns_acache_t *acache, dns_rdataset_t *rdataset, } return (ISC_R_SUCCESS); -#endif } /*% diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 625170acee..36f46e02cc 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -7867,7 +7867,6 @@ dns_resolver_create(dns_view_t *view, return (result); } -#ifdef BIND9 static void prime_done(isc_task_t *task, isc_event_t *event) { dns_resolver_t *res; @@ -7973,7 +7972,6 @@ dns_resolver_prime(dns_resolver_t *res) { } } } -#endif /* BIND9 */ void dns_resolver_freeze(dns_resolver_t *res) { diff --git a/lib/dns/view.c b/lib/dns/view.c index fafacf3c31..24d49be076 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -37,9 +37,7 @@ #include #include #include -#ifdef BIND9 #include -#endif #include #include #include @@ -101,16 +99,16 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, goto cleanup_name; view->zonetable = NULL; -#ifdef BIND9 - result = dns_zt_create(mctx, rdclass, &view->zonetable); - if (result != ISC_R_SUCCESS) { - UNEXPECTED_ERROR(__FILE__, __LINE__, - "dns_zt_create() failed: %s", - isc_result_totext(result)); - result = ISC_R_UNEXPECTED; - goto cleanup_mutex; + if (isc_bind9) { + result = dns_zt_create(mctx, rdclass, &view->zonetable); + if (result != ISC_R_SUCCESS) { + UNEXPECTED_ERROR(__FILE__, __LINE__, + "dns_zt_create() failed: %s", + isc_result_totext(result)); + result = ISC_R_UNEXPECTED; + goto cleanup_mutex; + } } -#endif view->secroots_priv = NULL; view->fwdtable = NULL; result = dns_fwdtable_create(mctx, &view->fwdtable); @@ -204,15 +202,15 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, dns_fixedname_init(&view->dlv_fixed); view->managed_keys = NULL; view->redirect = NULL; -#ifdef BIND9 view->new_zone_file = NULL; view->new_zone_config = NULL; view->cfg_destroy = NULL; - result = dns_order_create(view->mctx, &view->order); - if (result != ISC_R_SUCCESS) - goto cleanup_dynkeys; -#endif + if (isc_bind9) { + result = dns_order_create(view->mctx, &view->order); + if (result != ISC_R_SUCCESS) + goto cleanup_dynkeys; + } result = dns_peerlist_new(view->mctx, &view->peers); if (result != ISC_R_SUCCESS) @@ -240,28 +238,29 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, return (ISC_R_SUCCESS); cleanup_peerlist: - dns_peerlist_detach(&view->peers); + if (view->peers != NULL) + dns_peerlist_detach(&view->peers); cleanup_order: -#ifdef BIND9 - dns_order_detach(&view->order); + if (view->order != NULL) + dns_order_detach(&view->order); cleanup_dynkeys: -#endif - dns_tsigkeyring_detach(&view->dynamickeys); + if (view->dynamickeys != NULL) + dns_tsigkeyring_detach(&view->dynamickeys); cleanup_references: isc_refcount_destroy(&view->references); cleanup_fwdtable: - dns_fwdtable_destroy(&view->fwdtable); + if (view->fwdtable != NULL) + dns_fwdtable_destroy(&view->fwdtable); cleanup_zt: -#ifdef BIND9 - dns_zt_detach(&view->zonetable); + if (view->zonetable != NULL) + dns_zt_detach(&view->zonetable); cleanup_mutex: -#endif DESTROYLOCK(&view->lock); cleanup_name: @@ -275,10 +274,8 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, static inline void destroy(dns_view_t *view) { -#ifdef BIND9 dns_dns64_t *dns64; dns_dlzdb_t *dlzdb; -#endif REQUIRE(!ISC_LINK_LINKED(view, link)); REQUIRE(isc_refcount_current(&view->references) == 0); @@ -287,10 +284,8 @@ destroy(dns_view_t *view) { REQUIRE(ADBSHUTDOWN(view)); REQUIRE(REQSHUTDOWN(view)); -#ifdef BIND9 if (view->order != NULL) dns_order_detach(&view->order); -#endif if (view->peers != NULL) dns_peerlist_detach(&view->peers); @@ -332,7 +327,6 @@ destroy(dns_view_t *view) { dns_adb_detach(&view->adb); if (view->resolver != NULL) dns_resolver_detach(&view->resolver); -#ifdef BIND9 if (view->acache != NULL) { if (view->cachedb != NULL) dns_acache_putdb(view->acache, view->cachedb); @@ -353,13 +347,6 @@ destroy(dns_view_t *view) { ISC_LIST_UNLINK(view->dlz_unsearched, dlzdb, link); dns_dlzdestroy(&dlzdb); } -#else - INSIST(view->acache == NULL); - INSIST(view->rpzs == NULL); - INSIST(ISC_LIST_EMPTY(view->dlz_searched)); - INSIST(ISC_LIST_EMPTY(view->dlz_unsearched)); - INSIST(view->rrl == NULL); -#endif if (view->requestmgr != NULL) dns_requestmgr_detach(&view->requestmgr); if (view->task != NULL) @@ -449,7 +436,6 @@ destroy(dns_view_t *view) { dns_stats_detach(&view->resquerystats); if (view->secroots_priv != NULL) dns_keytable_detach(&view->secroots_priv); -#ifdef BIND9 for (dns64 = ISC_LIST_HEAD(view->dns64); dns64 != NULL; dns64 = ISC_LIST_HEAD(view->dns64)) { @@ -461,7 +447,6 @@ destroy(dns_view_t *view) { if (view->redirect != NULL) dns_zone_detach(&view->redirect); dns_view_setnewzones(view, ISC_FALSE, NULL, NULL); -#endif dns_fwdtable_destroy(&view->fwdtable); dns_aclenv_destroy(&view->aclenv); DESTROYLOCK(&view->lock); @@ -510,9 +495,7 @@ view_flushanddetach(dns_view_t **viewp, isc_boolean_t flush) { view->flush = ISC_TRUE; isc_refcount_decrement(&view->references, &refs); if (refs == 0) { -#ifdef BIND9 dns_zone_t *mkzone = NULL, *rdzone = NULL; -#endif LOCK(&view->lock); if (!RESSHUTDOWN(view)) @@ -521,13 +504,14 @@ view_flushanddetach(dns_view_t **viewp, isc_boolean_t flush) { dns_adb_shutdown(view->adb); if (!REQSHUTDOWN(view)) dns_requestmgr_shutdown(view->requestmgr); -#ifdef BIND9 if (view->acache != NULL) dns_acache_shutdown(view->acache); - if (view->flush) - dns_zt_flushanddetach(&view->zonetable); - else - dns_zt_detach(&view->zonetable); + if (view->zonetable != NULL) { + if (view->flush) + dns_zt_flushanddetach(&view->zonetable); + else + dns_zt_detach(&view->zonetable); + } if (view->managed_keys != NULL) { mkzone = view->managed_keys; view->managed_keys = NULL; @@ -540,18 +524,15 @@ view_flushanddetach(dns_view_t **viewp, isc_boolean_t flush) { if (view->flush) dns_zone_flush(rdzone); } -#endif done = all_done(view); UNLOCK(&view->lock); -#ifdef BIND9 /* Need to detach zones outside view lock */ if (mkzone != NULL) dns_zone_detach(&mkzone); if (rdzone != NULL) dns_zone_detach(&rdzone); -#endif } *viewp = NULL; @@ -570,7 +551,6 @@ dns_view_detach(dns_view_t **viewp) { view_flushanddetach(viewp, ISC_FALSE); } -#ifdef BIND9 static isc_result_t dialup(dns_zone_t *zone, void *dummy) { UNUSED(dummy); @@ -581,9 +561,9 @@ dialup(dns_zone_t *zone, void *dummy) { void dns_view_dialup(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); - (void)dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL); + if (view->zonetable != NULL) + (void)dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL); } -#endif void dns_view_weakattach(dns_view_t *source, dns_view_t **targetp) { @@ -693,6 +673,16 @@ req_shutdown(isc_task_t *task, isc_event_t *event) { destroy(view); } +isc_result_t +dns_view_createzonetable(dns_view_t *view) { + + REQUIRE(DNS_VIEW_VALID(view)); + REQUIRE(!view->frozen); + REQUIRE(view->zonetable == NULL); + + return (dns_zt_create(view->mctx, view->rdclass, &view->zonetable)); +} + isc_result_t dns_view_createresolver(dns_view_t *view, isc_taskmgr_t *taskmgr, @@ -775,10 +765,8 @@ dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { view->cacheshared = shared; if (view->cache != NULL) { -#ifdef BIND9 if (view->acache != NULL) dns_acache_putdb(view->acache, view->cachedb); -#endif dns_db_detach(&view->cachedb); dns_cache_detach(&view->cache); } @@ -786,10 +774,8 @@ dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) { dns_cache_attachdb(cache, &view->cachedb); INSIST(DNS_DB_VALID(view->cachedb)); -#ifdef BIND9 if (view->acache != NULL) dns_acache_setdb(view->acache, view->cachedb); -#endif } isc_boolean_t @@ -874,7 +860,6 @@ dns_view_freeze(dns_view_t *view) { view->frozen = ISC_TRUE; } -#ifdef BIND9 void dns_view_thaw(dns_view_t *view) { REQUIRE(DNS_VIEW_VALID(view)); @@ -889,14 +874,13 @@ dns_view_addzone(dns_view_t *view, dns_zone_t *zone) { REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(!view->frozen); + REQUIRE(view->zonetable != NULL); result = dns_zt_mount(view->zonetable, zone); return (result); } -#endif -#ifdef BIND9 isc_result_t dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep) { isc_result_t result; @@ -914,7 +898,6 @@ dns_view_findzone(dns_view_t *view, dns_name_t *name, dns_zone_t **zonep) { return (result); } -#endif isc_result_t dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, @@ -940,12 +923,6 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, dns_rdataset_t zrdataset, zsigrdataset; dns_zone_t *zone; -#ifndef BIND9 - UNUSED(use_hints); - UNUSED(use_static_stub); - UNUSED(zone); -#endif - /* * Find an rdataset whose owner name is 'name', and whose type is * 'type'. @@ -971,13 +948,14 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, db = NULL; node = NULL; is_staticstub_zone = ISC_FALSE; -#ifdef BIND9 zone = NULL; - result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); - if (zone != NULL && dns_zone_gettype(zone) == dns_zone_staticstub && - !use_static_stub) { + if (view->zonetable != NULL) { + result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); + if (zone != NULL && !use_static_stub && + dns_zone_gettype(zone) == dns_zone_staticstub) + result = ISC_R_NOTFOUND; + } else result = ISC_R_NOTFOUND; - } if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { result = dns_zone_getdb(zone, &db); if (result != ISC_R_SUCCESS && view->cachedb != NULL) @@ -990,11 +968,6 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, } } else if (result == ISC_R_NOTFOUND && view->cachedb != NULL) dns_db_attach(view->cachedb, &db); -#else - result = ISC_R_NOTFOUND; - if (view->cachedb != NULL) - dns_db_attach(view->cachedb, &db); -#endif /* BIND9 */ else goto cleanup; @@ -1079,7 +1052,6 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, result = ISC_R_SUCCESS; } -#ifdef BIND9 if (result == ISC_R_NOTFOUND && use_hints && view->hints != NULL) { if (dns_rdataset_isassociated(rdataset)) dns_rdataset_disassociate(rdataset); @@ -1114,7 +1086,6 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, if (db == NULL && node != NULL) dns_db_detachnode(view->hints, &node); } -#endif /* BIND9 */ cleanup: if (dns_rdataset_isassociated(&zrdataset)) { @@ -1143,10 +1114,8 @@ dns_view_find2(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type, } else INSIST(node == NULL); -#ifdef BIND9 if (zone != NULL) dns_zone_detach(&zone); -#endif return (result); } @@ -1220,10 +1189,6 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, dns_rdataset_t zrdataset, zsigrdataset; dns_fixedname_t zfixedname; -#ifndef BIND9 - UNUSED(zone); -#endif - REQUIRE(DNS_VIEW_VALID(view)); REQUIRE(view->frozen); @@ -1242,14 +1207,13 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, /* * Find the right database. */ -#ifdef BIND9 zone = NULL; - result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); + if (view->zonetable != NULL) + result = dns_zt_find(view->zonetable, name, 0, NULL, &zone); + else + result = ISC_R_NOTFOUND; if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) result = dns_zone_getdb(zone, &db); -#else - result = ISC_R_NOTFOUND; -#endif if (result == ISC_R_NOTFOUND) { /* * We're not directly authoritative for this query name, nor @@ -1383,10 +1347,8 @@ dns_view_findzonecut2(dns_view_t *view, dns_name_t *name, dns_name_t *fname, } if (db != NULL) dns_db_detach(&db); -#ifdef BIND9 if (zone != NULL) dns_zone_detach(&zone); -#endif return (result); } @@ -1413,7 +1375,6 @@ dns_viewlist_find(dns_viewlist_t *list, const char *name, return (ISC_R_SUCCESS); } -#ifdef BIND9 isc_result_t dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, isc_boolean_t allclasses, dns_rdataclass_t rdclass, @@ -1436,7 +1397,11 @@ dns_viewlist_findzone(dns_viewlist_t *list, dns_name_t *name, * treat it as not found. */ zp = (zone1 == NULL) ? &zone1 : &zone2; - result = dns_zt_find(view->zonetable, name, 0, NULL, zp); + if (view->zonetable != NULL) + result = dns_zt_find(view->zonetable, name, 0, NULL, + zp); + else + result = ISC_R_NOTFOUND; INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND || result == DNS_R_PARTIALMATCH); @@ -1490,9 +1455,6 @@ dns_view_asyncload(dns_view_t *view, dns_zt_allloaded_t callback, void *arg) { return (dns_zt_asyncload(view->zonetable, callback, arg)); } - -#endif /* BIND9 */ - isc_result_t dns_view_gettsig(dns_view_t *view, dns_name_t *keyname, dns_tsigkey_t **keyp) { @@ -1536,7 +1498,6 @@ dns_view_checksig(dns_view_t *view, isc_buffer_t *source, dns_message_t *msg) { view->dynamickeys)); } -#ifdef BIND9 isc_result_t dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) { isc_result_t result; @@ -1552,7 +1513,6 @@ dns_view_dumpdbtostream(dns_view_t *view, FILE *fp) { dns_resolver_printbadcache(view->resolver, fp); return (ISC_R_SUCCESS); } -#endif isc_result_t dns_view_flushcache(dns_view_t *view) { @@ -1572,18 +1532,14 @@ dns_view_flushcache2(dns_view_t *view, isc_boolean_t fixuponly) { if (result != ISC_R_SUCCESS) return (result); } -#ifdef BIND9 if (view->acache != NULL) dns_acache_putdb(view->acache, view->cachedb); -#endif dns_db_detach(&view->cachedb); dns_cache_attachdb(view->cache, &view->cachedb); -#ifdef BIND9 if (view->acache != NULL) dns_acache_setdb(view->acache, view->cachedb); if (view->resolver != NULL) dns_resolver_flushbadcache(view->resolver, NULL); -#endif dns_adb_flush(view->adb); return (ISC_R_SUCCESS); @@ -1724,13 +1680,13 @@ dns_view_getrootdelonly(dns_view_t *view) { return (view->rootdelonly); } -#ifdef BIND9 isc_result_t dns_view_freezezones(dns_view_t *view, isc_boolean_t value) { REQUIRE(DNS_VIEW_VALID(view)); + REQUIRE(view->zonetable != NULL); + return (dns_zt_freezezones(view->zonetable, value)); } -#endif void dns_view_setadbstats(dns_view_t *view, isc_stats_t *stats) { @@ -1856,7 +1812,6 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, REQUIRE(DNS_VIEW_VALID(view)); REQUIRE((cfgctx != NULL && cfg_destroy != NULL) || !allow); -#ifdef BIND9 if (view->new_zone_file != NULL) { isc_mem_free(view->mctx, view->new_zone_file); view->new_zone_file = NULL; @@ -1876,11 +1831,6 @@ dns_view_setnewzones(dns_view_t *view, isc_boolean_t allow, void *cfgctx, view->new_zone_config = cfgctx; view->cfg_destroy = cfg_destroy; } -#else - UNUSED(allow); - UNUSED(cfgctx); - UNUSED(cfg_destroy); -#endif } isc_result_t diff --git a/lib/dns/zone.c b/lib/dns/zone.c index bfebe1a1ba..0bdd57bf00 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -1062,13 +1062,11 @@ zone_free(dns_zone_t *zone) { zone_detachdb(zone); if (zone->acache != NULL) dns_acache_detach(&zone->acache); -#ifdef BIND9 if (zone->rpzs != NULL) { REQUIRE(zone->rpz_num < zone->rpzs->p.num_zones); dns_rpz_detach_rpzs(&zone->rpzs); zone->rpz_num = DNS_RPZ_INVALID_NUM; } -#endif zone_freedbargs(zone); RUNTIME_CHECK(dns_zone_setmasterswithkeys(zone, NULL, NULL, 0) == ISC_R_SUCCESS); @@ -2131,12 +2129,10 @@ zone_startload(dns_db_t *db, dns_zone_t *zone, isc_time_t loadtime) { isc_result_t tresult; unsigned int options; -#ifdef BIND9 if (zone->rpz_num != DNS_RPZ_INVALID_NUM) { REQUIRE(zone->rpzs != NULL); dns_db_rpz_attach(db, zone->rpzs, zone->rpz_num); } -#endif options = get_master_options(zone); if (DNS_ZONE_OPTION(zone, DNS_ZONEOPT_MANYERRORS)) @@ -4190,11 +4186,9 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime, if (result != ISC_R_SUCCESS) goto cleanup; } else { -#ifdef BIND9 result = dns_db_rpz_ready(db); if (result != ISC_R_SUCCESS) goto cleanup; -#endif zone_attachdb(zone, db); ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_write); DNS_ZONE_SETFLAG(zone, @@ -13293,11 +13287,9 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) { REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(LOCKED_ZONE(zone)); -#ifdef BIND9 result = dns_db_rpz_ready(db); if (result != ISC_R_SUCCESS) return (result); -#endif result = zone_get_from_db(zone, db, &nscount, &soacount, NULL, NULL, NULL, NULL, NULL, NULL); @@ -14651,7 +14643,6 @@ dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones) { if (result == ISC_R_SUCCESS) zmgr->loadtasks = pool; -#ifdef BIND9 /* * We always set all tasks in the zone-load task pool to * privileged. This prevents other tasks in the system from @@ -14666,7 +14657,6 @@ dns_zonemgr_setsize(dns_zonemgr_t *zmgr, int num_zones) { * set it and forget it. */ isc_taskpool_setprivilege(zmgr->loadtasks, ISC_TRUE); -#endif /* Create or resize the zone memory context pool. */ if (zmgr->mctxpool == NULL) diff --git a/lib/export/Makefile.in b/lib/export/Makefile.in deleted file mode 100644 index 1fd72168ed..0000000000 --- a/lib/export/Makefile.in +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -# Note: the order of SUBDIRS is important. -# Attempt to disable parallel processing. -.NOTPARALLEL: -.NO_PARALLEL: -SUBDIRS = isc dns isccfg irs samples -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/dns/.gitignore b/lib/export/dns/.gitignore deleted file mode 100644 index 8644f52ffc..0000000000 --- a/lib/export/dns/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -code.h -gen -.libs -enumclass.h -enumtype.h -rdatastruct.h diff --git a/lib/export/dns/Makefile.in b/lib/export/dns/Makefile.in deleted file mode 100644 index 1d5c42ef5f..0000000000 --- a/lib/export/dns/Makefile.in +++ /dev/null @@ -1,184 +0,0 @@ -# Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/dns -export_srcdir = @top_srcdir@/lib/export - -# Attempt to disable parallel processing. -.NOTPARALLEL: -.NO_PARALLEL: - -@BIND9_VERSION@ -@BIND9_MAJOR@ - -@LIBDNS_MAPAPI@ - -@LIBDNS_API@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I. -Iinclude ${DNS_INCLUDES} -I${export_srcdir}/isc/include \ - ${ISC_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@ - -CDEFINES = -DUSE_MD5 @USE_OPENSSL@ @USE_GSSAPI@ - -CWARNINGS = - -ISCLIBS = ../isc/libisc.@A@ - -ISCDEPLIBS = ../isc/libisc.@A@ - -LIBS = @LIBS@ - -# Alphabetically - -OPENSSLGOSTLINKOBJS = opensslgost_link.@O@ -OPENSSLLINKOBJS = openssl_link.@O@ openssldh_link.@O@ openssldsa_link.@O@ \ - opensslecdsa_link.@O@ @OPENSSLGOSTLINKOBJS@ opensslrsa_link.@O@ - -DSTOBJS = @OPENSSLLINKOBJS@ \ - dst_api.@O@ dst_lib.@O@ dst_parse.@O@ dst_result.@O@ \ - gssapi_link.@O@ gssapictx.@O@ hmac_link.@O@ key.@O@ - -DNSOBJS = acl.@O@ adb.@O@ byaddr.@O@ \ - cache.@O@ callbacks.@O@ client.@O@ compress.@O@ \ - db.@O@ dbiterator.@O@ diff.@O@ dispatch.@O@ dlz.@O@ dnssec.@O@ \ - ds.@O@ \ - forward.@O@ geoip.@O@ iptable.@O@ keytable.@O@ \ - lib.@O@ log.@O@ master.@O@ masterdump.@O@ message.@O@ \ - name.@O@ ncache.@O@ nsec.@O@ nsec3.@O@ \ - peer.@O@ portlist.@O@ \ - rbt.@O@ rbtdb.@O@ rcode.@O@ rdata.@O@ \ - rdatalist.@O@ rdataset.@O@ rdatasetiter.@O@ rdataslab.@O@ \ - request.@O@ resolver.@O@ result.@O@ soa.@O@ stats.@O@ \ - tcpmsg.@O@ time.@O@ tsec.@O@ tsig.@O@ ttl.@O@ \ - validator.@O@ version.@O@ view.@O@ -PORTDNSOBJS = ecdb.@O@ -GEOIPLINKOBJS = geoip.@O@ - -OBJS= ${DNSOBJS} ${OTHEROBJS} ${DSTOBJS} ${PORTDNSOBJS} @GEOIPLINKOBJS@ - -# Alphabetically - -OPENSSLGOSTLINKSRCS = opensslgost_link.c -OPENSSLLINKSRCS = openssl_link.c openssldh_link.c openssldsa_link.c \ - opensslecdsa_link.c @OPENSSLGOSTLINKSRCS@ opensslrsa_link.c - -DSTSRCS = @OPENSSLLINKSRCS@ \ - dst_api.c dst_lib.c dst_parse.c \ - dst_result.c gssapi_link.c gssapictx.c \ - hmac_link.c key.c - -DNSSRCS = acl.c adb.c byaddr.c \ - cache.c callbacks.c client.c compress.c \ - db.c dbiterator.c diff.c dispatch.c dlz.c dnssec.c ds.c \ - forward.c geoip.c iptable.c keytable.c \ - lib.c log.c master.c masterdump.c message.c \ - name.c ncache.c nsec.c nsec3.c \ - peer.c portlist.c \ - rbt.c rbtdb.c rcode.c rdata.c \ - rdatalist.c rdataset.c rdatasetiter.c rdataslab.c \ - request.c res.c resolver.c result.c soa.c stats.c \ - tcpmsg.c time.c tsec.c tsig.c ttl.c \ - validator.c version.c view.c -PORTDNSSRCS = ecdb.c -GEOIPLINKSRCS = geoip.c - -SRCS = ${DSTSRCS} ${DNSSRCS} ${PORTDNSSRCS} @GEOIPLINKSRCS@ - -SUBDIRS = include -TARGETS = include/dns/enumtype.h include/dns/enumclass.h \ - include/dns/rdatastruct.h timestamp - -DEPENDEXTRA = ./gen -F include/dns/rdatastruct.h \ - -s ${srcdir} -d >> Makefile ; - -@BIND9_MAKE_RULES@ - -version.@O@: ${srcdir}/version.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ - -DMAJOR=\"${MAJOR}\" \ - -DMAPAPI=\"${MAPAPI}\" \ - -DLIBINTERFACE=${LIBINTERFACE} \ - -DLIBREVISION=${LIBREVISION} \ - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - -libdns.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - -libdns.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libdns.la \ - -rpath ${export_libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${ISCLIBS} @DNS_CRYPTO_LIBS@ ${LIBS} - -timestamp: libdns.@A@ - touch timestamp - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir} - -install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libdns.@A@ \ - ${DESTDIR}${export_libdir}/ - -clean distclean:: - rm -f libdns.@A@ timestamp - rm -f gen code.h include/dns/enumtype.h include/dns/enumclass.h - rm -f include/dns/rdatastruct.h - -newrr:: - rm -f code.h include/dns/enumtype.h include/dns/enumclass.h - rm -f include/dns/rdatastruct.h - -include: include/dns/enumtype.h include/dns/enumclass.h \ - include/dns/rdatastruct.h - -rdata.@O@: code.h - -include/dns/enumtype.h: gen - ./gen -s ${srcdir} -t > $@ - -include/dns/enumclass.h: gen - ./gen -s ${srcdir} -c > $@ - -include/dns/rdatastruct.h: gen \ - ${srcdir}/rdata/rdatastructpre.h \ - ${srcdir}/rdata/rdatastructsuf.h - ./gen -s ${srcdir} -i \ - -P ${srcdir}/rdata/rdatastructpre.h \ - -S ${srcdir}/rdata/rdatastructsuf.h > $@ - -code.h: gen - ./gen -s ${srcdir} > code.h - -gen: ${srcdir}/gen.c - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o $@ ${srcdir}/gen.c ${LIBS} - -#We don't need rbtdb64 for this library -#rbtdb64.@O@: rbtdb.c - -depend: include/dns/enumtype.h include/dns/enumclass.h \ - include/dns/rdatastruct.h code.h -subdirs: include/dns/enumtype.h include/dns/enumclass.h \ - include/dns/rdatastruct.h code.h -${OBJS}: include/dns/enumtype.h include/dns/enumclass.h \ - include/dns/rdatastruct.h diff --git a/lib/export/dns/include/Makefile.in b/lib/export/dns/include/Makefile.in deleted file mode 100644 index 6bf1205340..0000000000 --- a/lib/export/dns/include/Makefile.in +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -SUBDIRS = dns dst -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/dns/include/dns/Makefile.in b/lib/export/dns/include/dns/Makefile.in deleted file mode 100644 index 8748372441..0000000000 --- a/lib/export/dns/include/dns/Makefile.in +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.4 2009/09/18 07:18:04 jinmei Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = acl.h adb.h byaddr.h \ - cache.h callbacks.h cert.h client.h compress.h \ - db.h dbiterator.h diff.h dispatch.h dlz.h dnssec.h \ - ds.h dsdigest.h events.h fixedname.h ecdb.h \ - forward.h iptable.h \ - keytable.h keyvalues.h \ - lib.h log.h \ - master.h masterdump.h message.h \ - name.h ncache.h nsec.h nsec3.h \ - peer.h portlist.h \ - rbt.h rcode.h rdata.h rdataclass.h \ - rdatalist.h rdataset.h rdatasetiter.h rdataslab.h rdatatype.h \ - request.h resolver.h result.h \ - secalg.h secproto.h soa.h stats.h \ - tcpmsg.h time.h tsec.h tsig.h ttl.h types.h \ - validator.h version.h view.h - -GENHEADERS = enumclass.h enumtype.h rdatastruct.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/dns - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${top_srcdir}/lib/dns/include/dns/$$i \ - ${DESTDIR}${export_includedir}/dns ; \ - done - for i in ${GENHEADERS}; do \ - ${INSTALL_DATA} $$i ${DESTDIR}${export_includedir}/dns ; \ - done diff --git a/lib/export/dns/include/dst/Makefile.in b/lib/export/dns/include/dst/Makefile.in deleted file mode 100644 index f6f540a2ea..0000000000 --- a/lib/export/dns/include/dst/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = dst.h gssapi.h lib.h result.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/dst - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${top_srcdir}/lib/dns/include/dst/$$i \ - ${DESTDIR}${export_includedir}/dst ; \ - done diff --git a/lib/export/irs/Makefile.in b/lib/export/irs/Makefile.in deleted file mode 100644 index b2520f9eb7..0000000000 --- a/lib/export/irs/Makefile.in +++ /dev/null @@ -1,87 +0,0 @@ -# Copyright (C) 2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/irs -export_srcdir = @top_srcdir@/lib/export - -@BIND9_VERSION@ - -@LIBIRS_API@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I. -I./include -I${srcdir}/include -I ../../irs/include \ - ${ISCCFG_INCLUDES} -I../dns/include ${DNS_INCLUDES} \ - -I../dns/include ${DNS_INCLUDES} \ - -I${export_srcdir}/isc/include ${ISC_INCLUDES} -CDEFINES = -CWARNINGS = - -# Alphabetically -OBJS = context.@O@ \ - dnsconf.@O@ \ - gai_strerror.@O@ getaddrinfo.@O@ getnameinfo.@O@ \ - resconf.@O@ - -# Alphabetically -SRCS = context.c \ - dnsconf.c \ - gai_sterror.c getaddrinfo.c getnameinfo.c \ - resconf.c - -ISCLIBS = ../isc/libisc.@A@ -DNSLIBS = ../dns/libdns.@A@ -ISCCFGLIBS = ../isccfg/libisccfg.@A@ - -LIBS = @LIBS@ - -SUBDIRS = include -TARGETS = timestamp - -@BIND9_MAKE_RULES@ - -version.@O@: ${srcdir}/version.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ - -DLIBINTERFACE=${LIBINTERFACE} \ - -DLIBREVISION=${LIBREVISION} \ - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - -libirs.@SA@: ${OBJS} version.@O@ - ${AR} ${ARFLAGS} $@ ${OBJS} version.@O@ - ${RANLIB} $@ - -libirs.la: ${OBJS} version.@O@ - ${LIBTOOL_MODE_LINK} \ - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libirs.la \ - -rpath ${export_libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} version.@O@ ${LIBS} ${ISCCFGLIBS} ${DNSLIBS} ${ISCLIBS} - -timestamp: libirs.@A@ - touch timestamp - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir} - -install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libirs.@A@ \ - ${DESTDIR}${export_libdir}/ - -clean distclean:: - rm -f libirs.@A@ libirs.la timestamp diff --git a/lib/export/irs/include/Makefile.in b/lib/export/irs/include/Makefile.in deleted file mode 100644 index 2c167d1763..0000000000 --- a/lib/export/irs/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = irs -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/irs/include/irs/Makefile.in b/lib/export/irs/include/irs/Makefile.in deleted file mode 100644 index 530e67c847..0000000000 --- a/lib/export/irs/include/irs/Makefile.in +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -# -# Only list headers that are to be installed and are not -# machine generated. The latter are handled specially in the -# install target below. -# -HEADERS = context.h dnsconf.h resconf.h types.h version.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/irs - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${top_srcdir}/lib/irs/include/irs/$$i \ - ${DESTDIR}${export_includedir}/irs ; \ - done - ${INSTALL_DATA} ${top_srcdir}/lib/irs/include/irs/netdb.h \ - ${DESTDIR}${export_includedir}/irs - ${INSTALL_DATA} ${top_srcdir}/lib/irs/include/irs/platform.h \ - ${DESTDIR}${export_includedir}/irs - -distclean:: - rm -f netdb.h platform.h diff --git a/lib/export/isc/Makefile.in b/lib/export/isc/Makefile.in deleted file mode 100644 index c04a9073dc..0000000000 --- a/lib/export/isc/Makefile.in +++ /dev/null @@ -1,138 +0,0 @@ -# Copyright (C) 2009, 2010, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.8 2010/06/09 23:50:58 tbox Exp $ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isc -export_srcdir = @top_srcdir@/lib/export - -@BIND9_VERSION@ - -@LIBISC_API@ - -CINCLUDES = -I${srcdir}/unix/include \ - -I${srcdir}/@ISC_THREAD_DIR@/include \ - -I${srcdir}/@ISC_ARCH_DIR@/include \ - -I${export_srcdir}/isc/include -I${srcdir}/include \ - @ISC_OPENSSL_INC@ -CDEFINES = @USE_OPENSSL@ -DUSE_APPIMPREGISTER -DUSE_MEMIMPREGISTER \ - -DUSE_SOCKETIMPREGISTER -DUSE_TASKIMPREGISTER \ - -DUSE_TIMERIMPREGISTER -CWARNINGS = - -# Alphabetically -# {file,dir}.c is necessary for isclog -# symtab.c is necessary for isccfg -APIOBJS = app_api.@O@ mem_api.@O@ socket_api.@O@ \ - task_api.@O@ timer_api.@O@ - -ISCDRIVEROBJS = mem.@O@ unix/socket.@O@ task.@O@ timer.@O@ lib.@O@ \ - heap.@O@ #timer module depends on this - -UNIXOBJS = @ISC_ISCIPV6_O@ \ - unix/app.@O@ \ - unix/dir.@O@ \ - unix/errno2result.@O@ \ - unix/file.@O@ \ - unix/fsaccess.@O@ \ - unix/stdio.@O@ \ - unix/stdtime.@O@ unix/strerror.@O@ unix/time.@O@ - -NLSOBJS = nls/msgcat.@O@ - -THREADOPTOBJS = @ISC_THREAD_DIR@/condition.@O@ @ISC_THREAD_DIR@/mutex.@O@ - -THREADOBJS = @THREADOPTOBJS@ @ISC_THREAD_DIR@/thread.@O@ - -WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ - win32/fsaccess.@O@ win32/once.@O@ win32/stdtime.@O@ \ - win32/thread.@O@ win32/time.@O@ - -# Alphabetically -OBJS = @ISC_EXTRA_OBJS@ \ - assertions.@O@ backtrace.@O@ backtrace-emptytbl.@O@ base32.@O@ \ - base64.@O@ buffer.@O@ bufferlist.@O@ \ - error.@O@ event.@O@ \ - hash.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ - inet_aton.@O@ iterated_hash.@O@ lex.@O@ lfsr.@O@ log.@O@ \ - md5.@O@ mutexblock.@O@ netaddr.@O@ netscope.@O@ \ - ondestroy.@O@ parseint.@O@ portset.@O@ radix.@O@ \ - random.@O@ refcount.@O@ region.@O@ regex.@O@ result.@O@ \ - rwlock.@O@ serial.@O@ sha1.@O@ sha2.@O@ sockaddr.@O@ \ - stats.@O@ string.@O@ \ - symtab.@O@ \ - version.@O@ \ - ${APIOBJS} ${ISCDRIVEROBJS} \ - ${UNIXOBJS} ${NLSOBJS} ${THREADOBJS} - -# Alphabetically -APISRCS = app_api.c mem_api.c socket_api.c \ - task_api.c timer_api.c - -ISCDRIVERSRCS = mem.c task.c lib.c timer.c heap.c - -SRCS = @ISC_EXTRA_SRCS@ \ - assertions.c backtrace.c backtrace-emptytbl.c base32.c \ - base64.c buffer.c bufferlist.c \ - error.c event.c \ - hash.c hex.c hmacmd5.c hmacsha.c \ - inet_aton.c iterated_hash.c lex.c log.c lfsr.c \ - md5.c mutexblock.c \ - netaddr.c netscope.c \ - ondestroy.c \ - parseint.c portset.c radix.c \ - random.c refcount.c region.c regex.c result.c rwlock.c \ - serial.c sha1.c sha2.c sockaddr.c stats.c string.c symtab.c \ - version.c \ - ${APISRCS} ${ISCDRIVERSRCS} - -LIBS = @LIBS@ - -SUBDIRS = include unix nls @ISC_THREAD_DIR@ -TARGETS = timestamp - -@BIND9_MAKE_RULES@ - -version.@O@: ${srcdir}/version.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ - -DLIBINTERFACE=${LIBINTERFACE} \ - -DLIBREVISION=${LIBREVISION} \ - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - -libisc.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - -libisc.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisc.la \ - -rpath ${export_libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${LIBS} - -timestamp: libisc.@A@ - touch timestamp - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir} - -install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisc.@A@ \ - ${DESTDIR}${export_libdir} - -clean distclean:: - rm -f libisc.@A@ libisc.la timestamp diff --git a/lib/export/isc/include/Makefile.in b/lib/export/isc/include/Makefile.in deleted file mode 100644 index 1b7c659745..0000000000 --- a/lib/export/isc/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/include/isc/Makefile.in b/lib/export/isc/include/isc/Makefile.in deleted file mode 100644 index a00f2db001..0000000000 --- a/lib/export/isc/include/isc/Makefile.in +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2009, 2012, 2013 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/12/05 23:31:41 each Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -export_srcdir = @top_srcdir@/lib/export - -@BIND9_VERSION@ - -# -# Only list headers that are to be installed and are not -# machine generated. The latter are handled specially in the -# install target below. -# -HEADERS = app.h assertions.h base64.h bitstring.h boolean.h \ - buffer.h bufferlist.h commandline.h entropy.h error.h event.h \ - eventclass.h file.h formatcheck.h fsaccess.h \ - hash.h heap.h hex.h hmacmd5.h \ - httpd.h \ - interfaceiter.h @ISC_IPV6_H@ iterated_hash.h json.h lang.h lex.h \ - lfsr.h lib.h list.h log.h \ - magic.h md5.h mem.h msgcat.h msgs.h \ - mutexblock.h namespace.h netaddr.h ondestroy.h os.h parseint.h \ - print.h quota.h radix.h random.h ratelimiter.h \ - refcount.h regex.h region.h resource.h \ - result.h resultclass.h rwlock.h serial.h sha1.h sha2.h \ - sockaddr.h socket.h stdio.h stdlib.h string.h \ - symtab.h \ - task.h taskpool.h timer.h types.h util.h version.h \ - xml.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${top_srcdir}/lib/isc/include/isc/$$i \ - ${DESTDIR}${export_includedir}/isc ; \ - done - ${INSTALL_DATA} ${top_srcdir}/lib/isc/include/isc/platform.h \ - ${DESTDIR}${export_includedir}/isc - ${INSTALL_DATA} ${top_srcdir}/lib/isc/@ISC_ARCH_DIR@/include/isc/atomic.h \ - ${DESTDIR}${export_includedir}/isc - ${INSTALL_DATA} ${export_srcdir}/isc/include/isc/bind9.h \ - ${DESTDIR}${export_includedir}/isc - -distclean:: - rm -f platform.h diff --git a/lib/export/isc/nls/Makefile.in b/lib/export/isc/nls/Makefile.in deleted file mode 100644 index 16a6a863c6..0000000000 --- a/lib/export/isc/nls/Makefile.in +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isc/nls -export_srcdir = @top_srcdir@/lib/export - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I${srcdir}/unix/include \ - -I${export_srcdir}/isc/include \ - ${ISC_INCLUDES} - -CDEFINES = -CWARNINGS = - -OBJS = msgcat.@O@ - -SRCS = msgcat.c - -SUBDIRS = -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/nothreads/Makefile.in b/lib/export/isc/nothreads/Makefile.in deleted file mode 100644 index 464099399c..0000000000 --- a/lib/export/isc/nothreads/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2009, 2010, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.5 2010/06/09 23:50:58 tbox Exp $ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isc/nothreads -export_srcdir = @top_srcdir@/lib/export - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I${srcdir}/include \ - -I${srcdir}/../unix/include \ - -I${export_srcdir}/isc/include \ - -I../include \ - -I${srcdir}/../include \ - -I${srcdir}/.. - -CDEFINES = -CWARNINGS = - -THREADOPTOBJS = condition.@O@ mutex.@O@ -OBJS = @THREADOPTOBJS@ thread.@O@ - -THREADOPTSRCS = condition.c mutex.c -SRCS = @THREADOPTSRCS@ thread.c - -SUBDIRS = include -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/nothreads/include/Makefile.in b/lib/export/isc/nothreads/include/Makefile.in deleted file mode 100644 index 1b7c659745..0000000000 --- a/lib/export/isc/nothreads/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/nothreads/include/isc/Makefile.in b/lib/export/isc/nothreads/include/isc/Makefile.in deleted file mode 100644 index 9bda987ddc..0000000000 --- a/lib/export/isc/nothreads/include/isc/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.2 2009/09/01 00:22:27 jinmei Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = condition.h mutex.h once.h thread.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(top_srcdir)/lib/isc/nothreads/include/isc/$$i \ - ${DESTDIR}${export_includedir}/isc ; \ - done diff --git a/lib/export/isc/pthreads/Makefile.in b/lib/export/isc/pthreads/Makefile.in deleted file mode 100644 index 80c5e3bb20..0000000000 --- a/lib/export/isc/pthreads/Makefile.in +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isc/pthreads -export_srcdir = @top_srcdir@/lib/export - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I${srcdir}/include \ - -I${srcdir}/../unix/include \ - -I${export_srcdir}/isc/include \ - -I../include \ - -I${srcdir}/../include \ - -I${srcdir}/.. - -CDEFINES = -CWARNINGS = - -OBJS = condition.@O@ mutex.@O@ thread.@O@ - -SRCS = condition.c mutex.c thread.c - -SUBDIRS = include -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/pthreads/include/Makefile.in b/lib/export/isc/pthreads/include/Makefile.in deleted file mode 100644 index 1b7c659745..0000000000 --- a/lib/export/isc/pthreads/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/pthreads/include/isc/Makefile.in b/lib/export/isc/pthreads/include/isc/Makefile.in deleted file mode 100644 index 4319768537..0000000000 --- a/lib/export/isc/pthreads/include/isc/Makefile.in +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.2 2009/09/01 00:22:27 jinmei Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = condition.h mutex.h once.h thread.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(top_srcdir)/lib/isc/pthreads/include/isc/$$i \ - ${DESTDIR}${export_includedir}/isc ; \ - done diff --git a/lib/export/isc/unix/Makefile.in b/lib/export/isc/unix/Makefile.in deleted file mode 100644 index 18732028ec..0000000000 --- a/lib/export/isc/unix/Makefile.in +++ /dev/null @@ -1,59 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isc/unix -export_srcdir = @top_srcdir@/lib/export - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I${srcdir}/include \ - -I${srcdir}/../@ISC_THREAD_DIR@/include \ - -I${export_srcdir}/isc/include \ - -I../include \ - -I${srcdir}/../include \ - -I${srcdir}/.. - -CDEFINES = -DUSE_SOCKETIMPREGISTER -DUSE_APPIMPREGISTER - -CWARNINGS = - -# Alphabetically -ISCDRIVEROBJS = app.@O@ socket.@O@ - -OBJS = @ISC_IPV6_O@ \ - dir.@O@ \ - errno2result.@O@ \ - file.@O@ fsaccess.@O@ \ - stdio.@O@ stdtime.@O@ strerror.@O@ \ - time.@O@ \ - ${ISCDRIVEROBJS} - -# Alphabetically -ISCDRIVERSRCS = app.c socket.c - -SRCS = @ISC_IPV6_C@ \ - dir.c \ - errno2result.c \ - file.c fsaccess.c \ - stdio.c stdtime.c strerror.c \ - time.c \ - ${ISCDRIVERSRCS} - -SUBDIRS = include -TARGETS = ${OBJS} - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/unix/include/Makefile.in b/lib/export/isc/unix/include/Makefile.in deleted file mode 100644 index 1b7c659745..0000000000 --- a/lib/export/isc/unix/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = isc -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isc/unix/include/isc/Makefile.in b/lib/export/isc/unix/include/isc/Makefile.in deleted file mode 100644 index 7159c76865..0000000000 --- a/lib/export/isc/unix/include/isc/Makefile.in +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.2 2009/09/01 00:22:27 jinmei Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -HEADERS = dir.h int.h net.h netdb.h offset.h stdtime.h \ - syslog.h time.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_includedir}/isc - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} $(top_srcdir)/lib/isc/unix/include/isc/$$i \ - ${DESTDIR}${export_includedir}/isc ; \ - done diff --git a/lib/export/isccfg/Makefile.in b/lib/export/isccfg/Makefile.in deleted file mode 100644 index 2a791a4de6..0000000000 --- a/lib/export/isccfg/Makefile.in +++ /dev/null @@ -1,83 +0,0 @@ -# Copyright (C) 2009, 2011-2013 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -top_srcdir = @top_srcdir@ -srcdir = @top_srcdir@/lib/isccfg -export_srcdir = @top_srcdir@/lib/export - -@BIND9_VERSION@ - -@LIBISCCFG_API@ - -@BIND9_MAKE_INCLUDES@ - -CINCLUDES = -I. ${DNS_INCLUDES} -I${export_srcdir}/isc/include \ - ${ISC_INCLUDES} ${ISCCFG_INCLUDES} - -CDEFINES = -CWARNINGS = - -ISCLIBS = ../isc/libisc.@A@ -DNSLIBS = ../dns/libdns.@A@ @DNS_CRYPTO_LIBS@ - -ISCDEPLIBS = ../../lib/isc/libisc.@A@ -ISCCFGDEPLIBS = libisccfg.@A@ - -LIBS = @LIBS@ - -SUBDIRS = include - -# Alphabetically -OBJS = dnsconf.@O@ log.@O@ parser.@O@ version.@O@ - -# Alphabetically -SRCS = dnsconf.c log.c parser.c version.c - -TARGETS = timestamp - -@BIND9_MAKE_RULES@ - -version.@O@: ${srcdir}/version.c - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} \ - -DVERSION=\"${VERSION}\" \ - -DLIBINTERFACE=${LIBINTERFACE} \ - -DLIBREVISION=${LIBREVISION} \ - -DLIBAGE=${LIBAGE} \ - -c ${srcdir}/version.c - -libisccfg.@SA@: ${OBJS} - ${AR} ${ARFLAGS} $@ ${OBJS} - ${RANLIB} $@ - -libisccfg.la: ${OBJS} - ${LIBTOOL_MODE_LINK} \ - ${CC} ${ALL_CFLAGS} ${LDFLAGS} -o libisccfg.la \ - -rpath ${export_libdir} \ - -version-info ${LIBINTERFACE}:${LIBREVISION}:${LIBAGE} \ - ${OBJS} ${LIBS} ${DNSLIBS} ${ISCLIBS} - -timestamp: libisccfg.@A@ - touch timestamp - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs ${DESTDIR}${export_libdir} - -install:: timestamp installdirs - ${LIBTOOL_MODE_INSTALL} ${INSTALL_DATA} libisccfg.@A@ \ - ${DESTDIR}${export_libdir}/ - -clean distclean:: - rm -f libisccfg.@A@ timestamp diff --git a/lib/export/isccfg/include/Makefile.in b/lib/export/isccfg/include/Makefile.in deleted file mode 100644 index 9733c11c7b..0000000000 --- a/lib/export/isccfg/include/Makefile.in +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 2009, 2011, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id$ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - - -SUBDIRS = isccfg -TARGETS = - -@BIND9_MAKE_RULES@ diff --git a/lib/export/isccfg/include/isccfg/Makefile.in b/lib/export/isccfg/include/isccfg/Makefile.in deleted file mode 100644 index 57a344cc24..0000000000 --- a/lib/export/isccfg/include/isccfg/Makefile.in +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") -# -# Permission to use, copy, modify, and/or distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH -# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, -# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE -# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -# PERFORMANCE OF THIS SOFTWARE. - -# $Id: Makefile.in,v 1.3 2009/09/02 23:48:02 tbox Exp $ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ - -@BIND9_VERSION@ - -# -# Only list headers that are to be installed and are not -# machine generated. The latter are handled specially in the -# install target below. -# -HEADERS = cfg.h grammar.h log.h dnsconf.h version.h - -SUBDIRS = -TARGETS = - -@BIND9_MAKE_RULES@ - -installdirs: - $(SHELL) ${top_srcdir}/mkinstalldirs \ - ${DESTDIR}${export_includedir}/isccfg - -install:: installdirs - for i in ${HEADERS}; do \ - ${INSTALL_DATA} ${top_srcdir}/lib/isccfg/include/isccfg/$$i \ - ${DESTDIR}${export_includedir}/isccfg ; \ - done diff --git a/lib/export/samples/.gitignore b/lib/export/samples/.gitignore deleted file mode 100644 index af3e922c68..0000000000 --- a/lib/export/samples/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -Makefile-postinstall -nsprobe -sample -sample-async -sample-gai -sample-request -sample-update diff --git a/lib/isc/Makefile.in b/lib/isc/Makefile.in index e68290cd29..b6b206f216 100644 --- a/lib/isc/Makefile.in +++ b/lib/isc/Makefile.in @@ -52,8 +52,8 @@ WIN32OBJS = win32/condition.@O@ win32/dir.@O@ win32/file.@O@ \ # Alphabetically OBJS = @ISC_EXTRA_OBJS@ \ assertions.@O@ backtrace.@O@ base32.@O@ base64.@O@ \ - bitstring.@O@ buffer.@O@ bufferlist.@O@ commandline.@O@ \ - error.@O@ event.@O@ \ + bind9.@O@ bitstring.@O@ buffer.@O@ bufferlist.@O@ \ + commandline.@O@ error.@O@ event.@O@ \ hash.@O@ heap.@O@ hex.@O@ hmacmd5.@O@ hmacsha.@O@ \ httpd.@O@ inet_aton.@O@ iterated_hash.@O@ \ lex.@O@ lfsr.@O@ lib.@O@ log.@O@ \ @@ -69,9 +69,9 @@ SYMTBLOBJS = backtrace-emptytbl.@O@ # Alphabetically SRCS = @ISC_EXTRA_SRCS@ \ - assertions.c backtrace.c base32.c base64.c bitstring.c \ - buffer.c bufferlist.c commandline.c error.c event.c \ - heap.c hex.c hmacmd5.c hmacsha.c \ + assertions.c backtrace.c base32.c base64.c bind9.c \ + bitstring.c buffer.c bufferlist.c commandline.c \ + error.c event.c heap.c hex.c hmacmd5.c hmacsha.c \ httpd.c inet_aton.c iterated_hash.c \ lex.c lfsr.c lib.c log.c \ md5.c mem.c mutexblock.c \ diff --git a/lib/isc/app_api.c b/lib/isc/app_api.c index ce767d1750..3ab0a6145a 100644 --- a/lib/isc/app_api.c +++ b/lib/isc/app_api.c @@ -57,6 +57,9 @@ isc_result_t isc_appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) { isc_result_t result; + if (isc_bind9) + return (isc__appctx_create(mctx, ctxp)); + LOCK(&createlock); REQUIRE(appctx_createfunc != NULL); @@ -71,7 +74,10 @@ void isc_appctx_destroy(isc_appctx_t **ctxp) { REQUIRE(ctxp != NULL && ISCAPI_APPCTX_VALID(*ctxp)); - (*ctxp)->methods->ctxdestroy(ctxp); + if (isc_bind9) + isc__appctx_destroy(ctxp); + else + (*ctxp)->methods->ctxdestroy(ctxp); ENSURE(*ctxp == NULL); } @@ -80,6 +86,9 @@ isc_result_t isc_app_ctxstart(isc_appctx_t *ctx) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); + if (isc_bind9) + return (isc__app_ctxstart(ctx)); + return (ctx->methods->ctxstart(ctx)); } @@ -87,6 +96,9 @@ isc_result_t isc_app_ctxrun(isc_appctx_t *ctx) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); + if (isc_bind9) + return (isc__app_ctxrun(ctx)); + return (ctx->methods->ctxrun(ctx)); } @@ -94,6 +106,9 @@ isc_result_t isc_app_ctxsuspend(isc_appctx_t *ctx) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); + if (isc_bind9) + return (isc__app_ctxsuspend(ctx)); + return (ctx->methods->ctxsuspend(ctx)); } @@ -101,6 +116,9 @@ isc_result_t isc_app_ctxshutdown(isc_appctx_t *ctx) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); + if (isc_bind9) + return (isc__app_ctxshutdown(ctx)); + return (ctx->methods->ctxshutdown(ctx)); } @@ -108,6 +126,9 @@ void isc_app_ctxfinish(isc_appctx_t *ctx) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); + if (isc_bind9) + isc__app_ctxfinish(ctx); + ctx->methods->ctxfinish(ctx); } @@ -116,6 +137,9 @@ isc_appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); REQUIRE(taskmgr != NULL); + if (isc_bind9) + isc__appctx_settaskmgr(ctx, taskmgr); + ctx->methods->settaskmgr(ctx, taskmgr); } @@ -124,6 +148,9 @@ isc_appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); REQUIRE(socketmgr != NULL); + if (isc_bind9) + isc__appctx_setsocketmgr(ctx, socketmgr); + ctx->methods->setsocketmgr(ctx, socketmgr); } @@ -132,5 +159,74 @@ isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr) { REQUIRE(ISCAPI_APPCTX_VALID(ctx)); REQUIRE(timermgr != NULL); + if (isc_bind9) + isc__appctx_settimermgr(ctx, timermgr); + ctx->methods->settimermgr(ctx, timermgr); } + +isc_result_t +isc_app_start() { + if (isc_bind9) + return (isc__app_start()); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +isc_app_onrun(isc_mem_t *mctx, isc_task_t *task, + isc_taskaction_t action, void *arg) +{ + if (isc_bind9) + return (isc__app_onrun(mctx, task, action, arg)); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +isc_app_run() { + if (isc_bind9) + return (isc__app_run()); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +isc_app_shutdown() { + if (isc_bind9) + return (isc__app_shutdown()); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +isc_app_reload() { + if (isc_bind9) + return (isc__app_reload()); + + return (ISC_R_NOTIMPLEMENTED); +} + +void +isc_app_finish() { + if (!isc_bind9) + return; + + isc__app_finish(); +} + +void +isc_app_block() { + if (!isc_bind9) + return; + + isc__app_block(); +} + +void +isc_app_unblock() { + if (!isc_bind9) + return; + + isc__app_unblock(); +} diff --git a/lib/export/isc/include/isc/bind9.h b/lib/isc/bind9.c similarity index 60% rename from lib/export/isc/include/isc/bind9.h rename to lib/isc/bind9.c index e96789b6d8..9ca66d0f02 100644 --- a/lib/export/isc/include/isc/bind9.h +++ b/lib/isc/bind9.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC") * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -14,17 +14,15 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: bind9.h,v 1.2 2009/12/05 23:31:41 each Exp $ */ +/*! \file */ -#ifndef ISC_BIND9_H -#define ISC_BIND9_H 1 +#include /* - * This determines whether we are building BIND9 or using the exported - * libisc/libdns libraries. The version of this file included in the - * standard BIND9 build defines BIND9; the version included with the - * exportable libraries does not. + * This determines whether we are using the libisc/libdns libraries + * in BIND9 or in some other application. It is initialized to ISC_TRUE + * and remains unchanged for BIND9 and related tools; export library + * clients will run isc_lib_register(), which sets it to ISC_FALSE, + * overriding certain BIND9 behaviors. */ -#undef BIND9 - -#endif /* ISC_BIND9_H */ +LIBISC_EXTERNAL_DATA isc_boolean_t isc_bind9 = ISC_TRUE; diff --git a/lib/isc/hash.c b/lib/isc/hash.c index f1d68c7700..5b9a2d9425 100644 --- a/lib/isc/hash.c +++ b/lib/isc/hash.c @@ -194,12 +194,8 @@ isc_hash_ctxcreate(isc_mem_t *mctx, isc_entropy_t *entropy, hctx->vectorlen = vlen; hctx->rndvector = rv; -#ifdef BIND9 if (entropy != NULL) isc_entropy_attach(entropy, &hctx->entropy); -#else - UNUSED(entropy); -#endif *hctxp = hctx; return (ISC_R_SUCCESS); @@ -245,17 +241,13 @@ isc_hash_ctxinit(isc_hash_t *hctx) { if (hctx->initialized == ISC_TRUE) goto out; - if (hctx->entropy) { -#ifdef BIND9 + if (hctx->entropy != NULL) { isc_result_t result; result = isc_entropy_getdata(hctx->entropy, hctx->rndvector, hctx->vectorlen, NULL, 0); INSIST(result == ISC_R_SUCCESS); -#else - INSIST(0); -#endif } else { isc_uint32_t pr; unsigned int i, copylen; @@ -312,10 +304,8 @@ destroy(isc_hash_t **hctxp) { isc_refcount_destroy(&hctx->refcnt); mctx = hctx->mctx; -#ifdef BIND9 if (hctx->entropy != NULL) isc_entropy_detach(&hctx->entropy); -#endif if (hctx->rndvector != NULL) isc_mem_put(mctx, hctx->rndvector, hctx->vectorlen); diff --git a/lib/isc/include/isc/app.h b/lib/isc/include/isc/app.h index e0be790637..d0c166da5e 100644 --- a/lib/isc/include/isc/app.h +++ b/lib/isc/include/isc/app.h @@ -345,7 +345,6 @@ isc_appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr); *\li 'timermgr' is a valid timer manager. */ -#ifdef USE_APPIMPREGISTER /*%< * See isc_appctx_create() above. */ @@ -368,7 +367,6 @@ isc__app_register(void); * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ -#endif /* USE_APPIMPREGISTER */ ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/bind9.h b/lib/isc/include/isc/bind9.h index 00bcb24c4a..5bb5b35ab7 100644 --- a/lib/isc/include/isc/bind9.h +++ b/lib/isc/include/isc/bind9.h @@ -19,12 +19,15 @@ #ifndef ISC_BIND9_H #define ISC_BIND9_H 1 +#include +#include + /* - * This determines whether we are building BIND9 or using the exported - * libisc/libdns libraries. The version of this file included in the - * standard BIND9 build defines BIND9; the version included with the - * exportable libraries does not. + * This determines whether we are using the libisc/libdns libraries + * in BIND9 or in some other application. For BIND9 (named and related + * tools) it must be set to ISC_TRUE at runtime. Export library clients + * will call isc_lib_register(), which will set it to ISC_FALSE. */ -#define BIND9 1 +LIBISC_EXTERNAL_DATA extern isc_boolean_t isc_bind9; #endif /* ISC_BIND9_H */ diff --git a/lib/isc/include/isc/mem.h b/lib/isc/include/isc/mem.h index 0f99da145c..cd0c43b13e 100644 --- a/lib/isc/include/isc/mem.h +++ b/lib/isc/include/isc/mem.h @@ -727,8 +727,6 @@ ISCMEMPOOLFUNC(get)(isc_mempool_t * _ISC_MEM_FLARG); void ISCMEMPOOLFUNC(put)(isc_mempool_t *, void * _ISC_MEM_FLARG); -#ifdef USE_MEMIMPREGISTER - /*%< * See isc_mem_create2() above. */ @@ -752,7 +750,6 @@ isc__mem_register(void); * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ -#endif /* USE_MEMIMPREGISTER */ ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/namespace.h b/lib/isc/include/isc/namespace.h deleted file mode 100644 index 743ddd94dd..0000000000 --- a/lib/isc/include/isc/namespace.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2009-2013 Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id$ */ - -#ifndef ISCAPI_NAMESPACE_H -#define ISCAPI_NAMESPACE_H 1 - -/*% - * name space conversions - */ - -#ifdef BIND9 - -#define isc_app_start isc__app_start -#define isc_app_ctxstart isc__app_ctxstart -#define isc_app_onrun isc__app_onrun -#define isc_app_run isc__app_run -#define isc_app_ctxrun isc__app_ctxrun -#define isc_app_shutdown isc__app_shutdown -#define isc_app_ctxfinish isc__app_ctxfinish -#define isc_app_ctxshutdown isc__app_ctxshutdown -#define isc_app_ctxsuspend isc__app_ctxsuspend -#define isc_app_reload isc__app_reload -#define isc_app_finish isc__app_finish -#define isc_app_block isc__app_block -#define isc_app_unblock isc__app_unblock -#define isc_appctx_create isc__appctx_create -#define isc_appctx_destroy isc__appctx_destroy -#define isc_appctx_settaskmgr isc__appctx_settaskmgr -#define isc_appctx_setsocketmgr isc__appctx_setsocketmgr -#define isc_appctx_settimermgr isc__appctx_settimermgr - -#define isc_mem_checkdestroyed isc__mem_checkdestroyed -#define isc_mem_createx isc__mem_createx -#define isc_mem_createx2 isc__mem_createx2 -#define isc_mem_create isc__mem_create -#define isc_mem_create2 isc__mem_create2 -#define isc_mem_attach isc__mem_attach -#define isc_mem_detach isc__mem_detach -#define isc__mem_putanddetach isc___mem_putanddetach -#define isc_mem_destroy isc__mem_destroy -#define isc_mem_ondestroy isc__mem_ondestroy -#define isc__mem_get isc___mem_get -#define isc__mem_put isc___mem_put -#define isc_mem_stats isc__mem_stats -#define isc__mem_allocate isc___mem_allocate -#define isc__mem_free isc___mem_free -#define isc__mem_strdup isc___mem_strdup -#define isc__mem_reallocate isc___mem_reallocate -#define isc_mem_references isc__mem_references -#define isc_mem_setdestroycheck isc__mem_setdestroycheck -#define isc_mem_setquota isc__mem_setquota -#define isc_mem_getname isc__mem_getname -#define isc_mem_getquota isc__mem_getquota -#define isc_mem_gettag isc__mem_gettag -#define isc_mem_inuse isc__mem_inuse -#define isc_mem_maxinuse isc__mem_maxinuse -#define isc_mem_total isc__mem_total -#define isc_mem_isovermem isc__mem_isovermem -#define isc_mem_setname isc__mem_setname -#define isc_mem_setwater isc__mem_setwater -#define isc_mem_printactive isc__mem_printactive -#define isc_mem_printallactive isc__mem_printallactive -#define isc_mem_waterack isc__mem_waterack -#define isc_mempool_create isc__mempool_create -#define isc_mempool_setname isc__mempool_setname -#define isc_mempool_destroy isc__mempool_destroy -#define isc_mempool_associatelock isc__mempool_associatelock -#define isc__mempool_get isc___mempool_get -#define isc__mempool_put isc___mempool_put -#define isc_mempool_setfreemax isc__mempool_setfreemax -#define isc_mempool_getfreemax isc__mempool_getfreemax -#define isc_mempool_getfreecount isc__mempool_getfreecount -#define isc_mempool_setmaxalloc isc__mempool_setmaxalloc -#define isc_mempool_getmaxalloc isc__mempool_getmaxalloc -#define isc_mempool_getallocated isc__mempool_getallocated -#define isc_mempool_setfillcount isc__mempool_setfillcount -#define isc_mempool_getfillcount isc__mempool_getfillcount - -#define isc_socket_create isc__socket_create -#define isc_socket_dup isc__socket_dup -#define isc_socket_attach isc__socket_attach -#define isc_socket_detach isc__socket_detach -#define isc_socketmgr_create isc__socketmgr_create -#define isc_socketmgr_create2 isc__socketmgr_create2 -#define isc_socketmgr_destroy isc__socketmgr_destroy -#define isc_socket_open isc__socket_open -#define isc_socket_close isc__socket_close -#define isc_socket_recvv isc__socket_recvv -#define isc_socket_recv isc__socket_recv -#define isc_socket_recv2 isc__socket_recv2 -#define isc_socket_send isc__socket_send -#define isc_socket_sendto isc__socket_sendto -#define isc_socket_sendv isc__socket_sendv -#define isc_socket_sendtov isc__socket_sendtov -#define isc_socket_sendto2 isc__socket_sendto2 -#define isc_socket_cleanunix isc__socket_cleanunix -#define isc_socket_permunix isc__socket_permunix -#define isc_socket_bind isc__socket_bind -#define isc_socket_filter isc__socket_filter -#define isc_socket_listen isc__socket_listen -#define isc_socket_accept isc__socket_accept -#define isc_socket_connect isc__socket_connect -#define isc_socket_getfd isc__socket_getfd -#define isc_socket_getname isc__socket_getname -#define isc_socket_gettag isc__socket_gettag -#define isc_socket_getpeername isc__socket_getpeername -#define isc_socket_getsockname isc__socket_getsockname -#define isc_socket_cancel isc__socket_cancel -#define isc_socket_gettype isc__socket_gettype -#define isc_socket_isbound isc__socket_isbound -#define isc_socket_ipv6only isc__socket_ipv6only -#define isc_socket_dscp isc__socket_dscp -#define isc_socket_setname isc__socket_setname -#define isc_socketmgr_getmaxsockets isc__socketmgr_getmaxsockets -#define isc_socketmgr_setstats isc__socketmgr_setstats -#define isc_socketmgr_setreserved isc__socketmgr_setreserved -#define isc__socketmgr_maxudp isc___socketmgr_maxudp -#define isc_socket_fdwatchcreate isc__socket_fdwatchcreate -#define isc_socket_fdwatchpoke isc__socket_fdwatchpoke - -#define isc_task_create isc__task_create -#define isc_task_attach isc__task_attach -#define isc_task_detach isc__task_detach -/* #define isc_task_exiting isc__task_exiting XXXMPA */ -#define isc_task_send isc__task_send -#define isc_task_sendanddetach isc__task_sendanddetach -#define isc_task_purgerange isc__task_purgerange -#define isc_task_purge isc__task_purge -#define isc_task_purgeevent isc__task_purgeevent -#define isc_task_unsendrange isc__task_unsendrange -#define isc_task_unsend isc__task_unsend -#define isc_task_onshutdown isc__task_onshutdown -#define isc_task_shutdown isc__task_shutdown -#define isc_task_destroy isc__task_destroy -#define isc_task_setname isc__task_setname -#define isc_task_getname isc__task_getname -#define isc_task_gettag isc__task_gettag -#define isc_task_getcurrenttime isc__task_getcurrenttime -#define isc_taskmgr_create isc__taskmgr_create -#define isc_taskmgr_setmode isc__taskmgr_setmode -#define isc_taskmgr_mode isc__taskmgr_mode -#define isc_taskmgr_destroy isc__taskmgr_destroy -#define isc_taskmgr_setexcltask isc__taskmgr_setexcltask -#define isc_taskmgr_excltask isc__taskmgr_excltask -#define isc_task_beginexclusive isc__task_beginexclusive -#define isc_task_endexclusive isc__task_endexclusive -#define isc_task_setprivilege isc__task_setprivilege -#define isc_task_privilege isc__task_privilege - -#define isc_timer_create isc__timer_create -#define isc_timer_reset isc__timer_reset -#define isc_timer_gettype isc__timer_gettype -#define isc_timer_touch isc__timer_touch -#define isc_timer_attach isc__timer_attach -#define isc_timer_detach isc__timer_detach -#define isc_timermgr_create isc__timermgr_create -#define isc_timermgr_poke isc__timermgr_poke -#define isc_timermgr_destroy isc__timermgr_destroy - -#endif /* BIND9 */ - -#endif /* ISCAPI_NAMESPACE_H */ diff --git a/lib/isc/include/isc/socket.h b/lib/isc/include/isc/socket.h index 80e0351bcc..d2406f8752 100644 --- a/lib/isc/include/isc/socket.h +++ b/lib/isc/include/isc/socket.h @@ -1064,7 +1064,10 @@ isc_socket_gettype(isc_socket_t *sock); /*@{*/ isc_boolean_t -isc_socket_isbound(isc_socket_t *sock); +isc__socket_isbound(isc_socket_t *sock); +/*% + * Intended for internal use in BIND9 only + */ void isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes); @@ -1181,7 +1184,6 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr, json_object *stats); */ #endif /* HAVE_JSON */ -#ifdef USE_SOCKETIMPREGISTER /*%< * See isc_socketmgr_create() above. */ @@ -1204,7 +1206,6 @@ isc__socket_register(void); * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ -#endif /* USE_SOCKETIMPREGISTER */ ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/timer.h b/lib/isc/include/isc/timer.h index 0598f79b58..f226d40197 100644 --- a/lib/isc/include/isc/timer.h +++ b/lib/isc/include/isc/timer.h @@ -86,6 +86,7 @@ ISC_LANG_BEGINDECLS /*% Timer Type */ typedef enum { + isc_timertype_undefined = -1, /*%< Undefined */ isc_timertype_ticker = 0, /*%< Ticker */ isc_timertype_once = 1, /*%< Once */ isc_timertype_limited = 2, /*%< Limited */ @@ -402,7 +403,6 @@ isc_timermgr_destroy(isc_timermgr_t **managerp); void isc_timermgr_poke(isc_timermgr_t *m); -#ifdef USE_TIMERIMPREGISTER /*%< * See isc_timermgr_create() above. */ @@ -425,7 +425,6 @@ isc_timer_register(isc_timermgrcreatefunc_t createfunc); * usually do not have to care about this function: it would call * isc_lib_register(), which internally calls this function. */ -#endif /* USE_TIMERIMPREGISTER */ ISC_LANG_ENDDECLS diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index bbd664434d..19b9a33335 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -21,7 +21,6 @@ #define ISC_TYPES_H 1 #include -#include /*! \file isc/types.h * \brief diff --git a/lib/isc/lib.c b/lib/isc/lib.c index a50542551d..81fc02a97b 100644 --- a/lib/isc/lib.c +++ b/lib/isc/lib.c @@ -83,11 +83,12 @@ isc_lib_initmsgcat(void) { } } -#ifndef BIND9 static isc_once_t register_once = ISC_ONCE_INIT; static void do_register(void) { + isc_bind9 = ISC_FALSE; + RUNTIME_CHECK(isc__mem_register() == ISC_R_SUCCESS); RUNTIME_CHECK(isc__app_register() == ISC_R_SUCCESS); RUNTIME_CHECK(isc__task_register() == ISC_R_SUCCESS); @@ -100,4 +101,3 @@ isc_lib_register() { RUNTIME_CHECK(isc_once_do(®ister_once, do_register) == ISC_R_SUCCESS); } -#endif diff --git a/lib/isc/mem.c b/lib/isc/mem.c index fa698e66c8..dfe9e53094 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -27,6 +27,7 @@ #include +#include #include #include #include @@ -115,8 +116,10 @@ typedef ISC_LIST(debuglink_t) debuglist_t; /* List of all active memory contexts. */ static ISC_LIST(isc__mem_t) contexts; + static isc_once_t once = ISC_ONCE_INIT; static isc_mutex_t lock; +static isc_mutex_t createlock; /*% * Total size of lost memory due to a bug of external library. @@ -218,115 +221,97 @@ static void print_active(isc__mem_t *ctx, FILE *out); /*% - * The following can be either static or public, depending on build environment. + * The following are intended for internal use (indicated by "isc__" + * prefix) but are not declared as static, allowing direct access + * from unit tests, etc. */ -#ifdef BIND9 -#define ISC_MEMFUNC_SCOPE -#else -#define ISC_MEMFUNC_SCOPE static -#endif - -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_createx(size_t init_max_size, size_t target_size, - isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, - isc_mem_t **ctxp); -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_createx2(size_t init_max_size, size_t target_size, - isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, - isc_mem_t **ctxp, unsigned int flags); -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_create(size_t init_max_size, size_t target_size, isc_mem_t **ctxp); -ISC_MEMFUNC_SCOPE isc_result_t +isc_result_t isc__mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **ctxp, unsigned int flags); -ISC_MEMFUNC_SCOPE void +void isc__mem_attach(isc_mem_t *source, isc_mem_t **targetp); -ISC_MEMFUNC_SCOPE void +void isc__mem_detach(isc_mem_t **ctxp); -ISC_MEMFUNC_SCOPE void +void isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG); -ISC_MEMFUNC_SCOPE void +void isc__mem_destroy(isc_mem_t **ctxp); -ISC_MEMFUNC_SCOPE isc_result_t +isc_result_t isc__mem_ondestroy(isc_mem_t *ctx, isc_task_t *task, isc_event_t **event); -ISC_MEMFUNC_SCOPE void * +void * isc___mem_get(isc_mem_t *ctx, size_t size FLARG); -ISC_MEMFUNC_SCOPE void +void isc___mem_put(isc_mem_t *ctx, void *ptr, size_t size FLARG); -ISC_MEMFUNC_SCOPE void +void isc__mem_stats(isc_mem_t *ctx, FILE *out); -ISC_MEMFUNC_SCOPE void * +void * isc___mem_allocate(isc_mem_t *ctx, size_t size FLARG); -ISC_MEMFUNC_SCOPE void * +void * isc___mem_reallocate(isc_mem_t *ctx, void *ptr, size_t size FLARG); -ISC_MEMFUNC_SCOPE void +void isc___mem_free(isc_mem_t *ctx, void *ptr FLARG); -ISC_MEMFUNC_SCOPE char * +char * isc___mem_strdup(isc_mem_t *mctx, const char *s FLARG); -ISC_MEMFUNC_SCOPE void +void isc__mem_setdestroycheck(isc_mem_t *ctx, isc_boolean_t flag); -ISC_MEMFUNC_SCOPE void +void isc__mem_setquota(isc_mem_t *ctx, size_t quota); -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_getquota(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_inuse(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_maxinuse(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_total(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__mem_isovermem(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE void +void isc__mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, size_t hiwater, size_t lowater); -ISC_MEMFUNC_SCOPE void +void isc__mem_waterack(isc_mem_t *ctx0, int flag); -ISC_MEMFUNC_SCOPE void +void isc__mem_setname(isc_mem_t *ctx, const char *name, void *tag); -ISC_MEMFUNC_SCOPE const char * +const char * isc__mem_getname(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE void * +void * isc__mem_gettag(isc_mem_t *ctx); -ISC_MEMFUNC_SCOPE isc_result_t +isc_result_t isc__mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp); -ISC_MEMFUNC_SCOPE void +void isc__mempool_setname(isc_mempool_t *mpctx, const char *name); -ISC_MEMFUNC_SCOPE void +void isc__mempool_destroy(isc_mempool_t **mpctxp); -ISC_MEMFUNC_SCOPE void +void isc__mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock); -ISC_MEMFUNC_SCOPE void * +void * isc___mempool_get(isc_mempool_t *mpctx FLARG); -ISC_MEMFUNC_SCOPE void +void isc___mempool_put(isc_mempool_t *mpctx, void *mem FLARG); -ISC_MEMFUNC_SCOPE void +void isc__mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getfreemax(isc_mempool_t *mpctx); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getfreecount(isc_mempool_t *mpctx); -ISC_MEMFUNC_SCOPE void +void isc__mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getmaxalloc(isc_mempool_t *mpctx); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getallocated(isc_mempool_t *mpctx); -ISC_MEMFUNC_SCOPE void +void isc__mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getfillcount(isc_mempool_t *mpctx); -#ifdef BIND9 -ISC_MEMFUNC_SCOPE void +void isc__mem_printactive(isc_mem_t *ctx0, FILE *file); -ISC_MEMFUNC_SCOPE void +void isc__mem_printallactive(FILE *file); -ISC_MEMFUNC_SCOPE void -isc__mem_checkdestroyed(FILE *file); -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mem_references(isc_mem_t *ctx0); -#endif #endif /* ISC_MEM_TRACKLINES */ static struct isc__memmethods { @@ -335,10 +320,8 @@ static struct isc__memmethods { /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *createx, *create, *create2, *ondestroy, *stats, - *setquota, *getquota, *setname, *getname, *gettag; -#endif + *setquota, *getquota, *setname, *getname, *gettag; } memmethods = { { isc__mem_attach, @@ -359,15 +342,17 @@ static struct isc__memmethods { isc__mem_total, isc__mem_isovermem, isc__mempool_create - } -#ifndef BIND9 - , - (void *)isc__mem_createx, (void *)isc__mem_create, - (void *)isc__mem_create2, (void *)isc__mem_ondestroy, - (void *)isc__mem_stats, (void *)isc__mem_setquota, - (void *)isc__mem_getquota, (void *)isc__mem_setname, - (void *)isc__mem_getname, (void *)isc__mem_gettag -#endif + }, + (void *)isc_mem_createx, + (void *)isc_mem_create, + (void *)isc_mem_create2, + (void *)isc_mem_ondestroy, + (void *)isc_mem_stats, + (void *)isc_mem_setquota, + (void *)isc_mem_getquota, + (void *)isc_mem_setname, + (void *)isc_mem_getname, + (void *)isc_mem_gettag }; static struct isc__mempoolmethods { @@ -376,9 +361,7 @@ static struct isc__mempoolmethods { /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *getfreemax, *getfreecount, *getmaxalloc, *getfillcount; -#endif } mempoolmethods = { { isc__mempool_destroy, @@ -390,12 +373,11 @@ static struct isc__mempoolmethods { isc__mempool_setname, isc__mempool_associatelock, isc__mempool_setfillcount - } -#ifndef BIND9 - , - (void *)isc__mempool_getfreemax, (void *)isc__mempool_getfreecount, - (void *)isc__mempool_getmaxalloc, (void *)isc__mempool_getfillcount -#endif + }, + (void *)isc_mempool_getfreemax, + (void *)isc_mempool_getfreecount, + (void *)isc_mempool_getmaxalloc, + (void *)isc_mempool_getfillcount }; #if ISC_MEM_TRACKLINES @@ -403,9 +385,7 @@ static struct isc__mempoolmethods { * mctx must be locked. */ static inline void -add_trace_entry(isc__mem_t *mctx, const void *ptr, unsigned int size - FLARG) -{ +add_trace_entry(isc__mem_t *mctx, const void *ptr, unsigned int size FLARG) { debuglink_t *dl; unsigned int i; unsigned int mysize = size; @@ -893,6 +873,7 @@ default_memfree(void *arg, void *ptr) { static void initialize_action(void) { + RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); ISC_LIST_INIT(contexts); totallost = 0; @@ -902,18 +883,18 @@ initialize_action(void) { * Public. */ -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_createx(size_t init_max_size, size_t target_size, +isc_result_t +isc_mem_createx(size_t init_max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **ctxp) { - return (isc__mem_createx2(init_max_size, target_size, memalloc, memfree, - arg, ctxp, ISC_MEMFLAG_DEFAULT)); + return (isc_mem_createx2(init_max_size, target_size, memalloc, memfree, + arg, ctxp, ISC_MEMFLAG_DEFAULT)); } -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_createx2(size_t init_max_size, size_t target_size, +isc_result_t +isc_mem_createx2(size_t init_max_size, size_t target_size, isc_memalloc_t memalloc, isc_memfree_t memfree, void *arg, isc_mem_t **ctxp, unsigned int flags) { @@ -1046,22 +1027,6 @@ isc__mem_createx2(size_t init_max_size, size_t target_size, return (result); } -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_create(size_t init_max_size, size_t target_size, isc_mem_t **ctxp) { - return (isc__mem_createx2(init_max_size, target_size, - default_memalloc, default_memfree, NULL, - ctxp, ISC_MEMFLAG_DEFAULT)); -} - -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_create2(size_t init_max_size, size_t target_size, - isc_mem_t **ctxp, unsigned int flags) -{ - return (isc__mem_createx2(init_max_size, target_size, - default_memalloc, default_memfree, NULL, - ctxp, flags)); -} - static void destroy(isc__mem_t *ctx) { unsigned int i; @@ -1131,7 +1096,7 @@ destroy(isc__mem_t *ctx) { isc_ondestroy_notify(&ondest, ctx); } -ISC_MEMFUNC_SCOPE void +void isc__mem_attach(isc_mem_t *source0, isc_mem_t **targetp) { isc__mem_t *source = (isc__mem_t *)source0; @@ -1145,7 +1110,7 @@ isc__mem_attach(isc_mem_t *source0, isc_mem_t **targetp) { *targetp = (isc_mem_t *)source; } -ISC_MEMFUNC_SCOPE void +void isc__mem_detach(isc_mem_t **ctxp) { isc__mem_t *ctx; isc_boolean_t want_destroy = ISC_FALSE; @@ -1177,7 +1142,7 @@ isc__mem_detach(isc_mem_t **ctxp) { * isc_mem_detach(&mctx); */ -ISC_MEMFUNC_SCOPE void +void isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) { isc__mem_t *ctx; isc_boolean_t want_destroy = ISC_FALSE; @@ -1238,7 +1203,7 @@ isc___mem_putanddetach(isc_mem_t **ctxp, void *ptr, size_t size FLARG) { destroy(ctx); } -ISC_MEMFUNC_SCOPE void +void isc__mem_destroy(isc_mem_t **ctxp) { isc__mem_t *ctx; @@ -1265,8 +1230,8 @@ isc__mem_destroy(isc_mem_t **ctxp) { *ctxp = NULL; } -ISC_MEMFUNC_SCOPE isc_result_t -isc__mem_ondestroy(isc_mem_t *ctx0, isc_task_t *task, isc_event_t **event) { +isc_result_t +isc_mem_ondestroy(isc_mem_t *ctx0, isc_task_t *task, isc_event_t **event) { isc__mem_t *ctx = (isc__mem_t *)ctx0; isc_result_t res; @@ -1277,7 +1242,7 @@ isc__mem_ondestroy(isc_mem_t *ctx0, isc_task_t *task, isc_event_t **event) { return (res); } -ISC_MEMFUNC_SCOPE void * +void * isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; void *ptr; @@ -1322,7 +1287,7 @@ isc___mem_get(isc_mem_t *ctx0, size_t size FLARG) { return (ptr); } -ISC_MEMFUNC_SCOPE void +void isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; isc_boolean_t call_water = ISC_FALSE; @@ -1375,7 +1340,7 @@ isc___mem_put(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { (ctx->water)(ctx->water_arg, ISC_MEM_LOWATER); } -ISC_MEMFUNC_SCOPE void +void isc__mem_waterack(isc_mem_t *ctx0, int flag) { isc__mem_t *ctx = (isc__mem_t *)ctx0; @@ -1433,8 +1398,8 @@ print_active(isc__mem_t *mctx, FILE *out) { /* * Print the stats[] on the stream "out" with suitable formatting. */ -ISC_MEMFUNC_SCOPE void -isc__mem_stats(isc_mem_t *ctx0, FILE *out) { +void +isc_mem_stats(isc_mem_t *ctx0, FILE *out) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_t i; const struct stats *s; @@ -1516,7 +1481,7 @@ isc__mem_stats(isc_mem_t *ctx0, FILE *out) { */ static void * -isc__mem_allocateunlocked(isc_mem_t *ctx0, size_t size) { +mem_allocateunlocked(isc_mem_t *ctx0, size_t size) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_info *si; @@ -1539,7 +1504,7 @@ isc__mem_allocateunlocked(isc_mem_t *ctx0, size_t size) { return (&si[1]); } -ISC_MEMFUNC_SCOPE void * +void * isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_info *si; @@ -1549,9 +1514,9 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) { if ((ctx->flags & ISC_MEMFLAG_INTERNAL) != 0) { MCTXLOCK(ctx, &ctx->lock); - si = isc__mem_allocateunlocked((isc_mem_t *)ctx, size); + si = mem_allocateunlocked((isc_mem_t *)ctx, size); } else { - si = isc__mem_allocateunlocked((isc_mem_t *)ctx, size); + si = mem_allocateunlocked((isc_mem_t *)ctx, size); MCTXLOCK(ctx, &ctx->lock); if (si != NULL) mem_getstats(ctx, si[-1].u.size); @@ -1585,7 +1550,7 @@ isc___mem_allocate(isc_mem_t *ctx0, size_t size FLARG) { return (si); } -ISC_MEMFUNC_SCOPE void * +void * isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; void *new_ptr = NULL; @@ -1624,7 +1589,7 @@ isc___mem_reallocate(isc_mem_t *ctx0, void *ptr, size_t size FLARG) { return (new_ptr); } -ISC_MEMFUNC_SCOPE void +void isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_info *si; @@ -1682,7 +1647,7 @@ isc___mem_free(isc_mem_t *ctx0, void *ptr FLARG) { * Other useful things. */ -ISC_MEMFUNC_SCOPE char * +char * isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) { isc__mem_t *mctx = (isc__mem_t *)mctx0; size_t len; @@ -1693,7 +1658,7 @@ isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) { len = strlen(s); - ns = isc___mem_allocate((isc_mem_t *)mctx, len + 1 FLARG_PASS); + ns = isc__mem_allocate((isc_mem_t *)mctx, len + 1 FLARG_PASS); if (ns != NULL) strncpy(ns, s, len + 1); @@ -1701,7 +1666,7 @@ isc___mem_strdup(isc_mem_t *mctx0, const char *s FLARG) { return (ns); } -ISC_MEMFUNC_SCOPE void +void isc__mem_setdestroycheck(isc_mem_t *ctx0, isc_boolean_t flag) { isc__mem_t *ctx = (isc__mem_t *)ctx0; @@ -1717,8 +1682,8 @@ isc__mem_setdestroycheck(isc_mem_t *ctx0, isc_boolean_t flag) { * Quotas */ -ISC_MEMFUNC_SCOPE void -isc__mem_setquota(isc_mem_t *ctx0, size_t quota) { +void +isc_mem_setquota(isc_mem_t *ctx0, size_t quota) { isc__mem_t *ctx = (isc__mem_t *)ctx0; REQUIRE(VALID_CONTEXT(ctx)); @@ -1729,8 +1694,8 @@ isc__mem_setquota(isc_mem_t *ctx0, size_t quota) { MCTXUNLOCK(ctx, &ctx->lock); } -ISC_MEMFUNC_SCOPE size_t -isc__mem_getquota(isc_mem_t *ctx0) { +size_t +isc_mem_getquota(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_t quota; @@ -1744,7 +1709,7 @@ isc__mem_getquota(isc_mem_t *ctx0) { return (quota); } -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_inuse(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_t inuse; @@ -1759,7 +1724,7 @@ isc__mem_inuse(isc_mem_t *ctx0) { return (inuse); } -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_maxinuse(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_t maxinuse; @@ -1774,7 +1739,7 @@ isc__mem_maxinuse(isc_mem_t *ctx0) { return (maxinuse); } -ISC_MEMFUNC_SCOPE size_t +size_t isc__mem_total(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; size_t total; @@ -1789,9 +1754,9 @@ isc__mem_total(isc_mem_t *ctx0) { return (total); } -ISC_MEMFUNC_SCOPE void +void isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, - size_t hiwater, size_t lowater) + size_t hiwater, size_t lowater) { isc__mem_t *ctx = (isc__mem_t *)ctx0; isc_boolean_t callwater = ISC_FALSE; @@ -1828,7 +1793,7 @@ isc__mem_setwater(isc_mem_t *ctx0, isc_mem_water_t water, void *water_arg, (oldwater)(oldwater_arg, ISC_MEM_LOWATER); } -ISC_MEMFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__mem_isovermem(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; @@ -1842,8 +1807,8 @@ isc__mem_isovermem(isc_mem_t *ctx0) { return (ctx->is_overmem); } -ISC_MEMFUNC_SCOPE void -isc__mem_setname(isc_mem_t *ctx0, const char *name, void *tag) { +void +isc_mem_setname(isc_mem_t *ctx0, const char *name, void *tag) { isc__mem_t *ctx = (isc__mem_t *)ctx0; REQUIRE(VALID_CONTEXT(ctx)); @@ -1855,19 +1820,22 @@ isc__mem_setname(isc_mem_t *ctx0, const char *name, void *tag) { UNLOCK(&ctx->lock); } -ISC_MEMFUNC_SCOPE const char * -isc__mem_getname(isc_mem_t *ctx0) { +const char * +isc_mem_getname(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; REQUIRE(VALID_CONTEXT(ctx)); + if (ctx->name == NULL) + return (""); + return (ctx->name); } -ISC_MEMFUNC_SCOPE void * -isc__mem_gettag(isc_mem_t *ctx0) { +void * +isc_mem_gettag(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; - + REQUIRE(VALID_CONTEXT(ctx)); return (ctx->tag); @@ -1877,7 +1845,7 @@ isc__mem_gettag(isc_mem_t *ctx0) { * Memory pool stuff */ -ISC_MEMFUNC_SCOPE isc_result_t +isc_result_t isc__mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) { isc__mem_t *mctx = (isc__mem_t *)mctx0; isc__mempool_t *mpctx; @@ -1921,7 +1889,7 @@ isc__mempool_create(isc_mem_t *mctx0, size_t size, isc_mempool_t **mpctxp) { return (ISC_R_SUCCESS); } -ISC_MEMFUNC_SCOPE void +void isc__mempool_setname(isc_mempool_t *mpctx0, const char *name) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; @@ -1943,7 +1911,7 @@ isc__mempool_setname(isc_mempool_t *mpctx0, const char *name) { #endif } -ISC_MEMFUNC_SCOPE void +void isc__mempool_destroy(isc_mempool_t **mpctxp) { isc__mempool_t *mpctx; isc__mem_t *mctx; @@ -2007,7 +1975,7 @@ isc__mempool_destroy(isc_mempool_t **mpctxp) { *mpctxp = NULL; } -ISC_MEMFUNC_SCOPE void +void isc__mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; @@ -2018,7 +1986,7 @@ isc__mempool_associatelock(isc_mempool_t *mpctx0, isc_mutex_t *lock) { mpctx->lock = lock; } -ISC_MEMFUNC_SCOPE void * +void * isc___mempool_get(isc_mempool_t *mpctx0 FLARG) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; element *item; @@ -2102,7 +2070,7 @@ isc___mempool_get(isc_mempool_t *mpctx0 FLARG) { } /* coverity[+free : arg-1] */ -ISC_MEMFUNC_SCOPE void +void isc___mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; isc__mem_t *mctx; @@ -2158,7 +2126,7 @@ isc___mempool_put(isc_mempool_t *mpctx0, void *mem FLARG) { * Quotas */ -ISC_MEMFUNC_SCOPE void +void isc__mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; @@ -2173,8 +2141,8 @@ isc__mempool_setfreemax(isc_mempool_t *mpctx0, unsigned int limit) { UNLOCK(mpctx->lock); } -ISC_MEMFUNC_SCOPE unsigned int -isc__mempool_getfreemax(isc_mempool_t *mpctx0) { +unsigned int +isc_mempool_getfreemax(isc_mempool_t *mpctx0) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; unsigned int freemax; @@ -2191,8 +2159,8 @@ isc__mempool_getfreemax(isc_mempool_t *mpctx0) { return (freemax); } -ISC_MEMFUNC_SCOPE unsigned int -isc__mempool_getfreecount(isc_mempool_t *mpctx0) { +unsigned int +isc_mempool_getfreecount(isc_mempool_t *mpctx0) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; unsigned int freecount; @@ -2209,7 +2177,7 @@ isc__mempool_getfreecount(isc_mempool_t *mpctx0) { return (freecount); } -ISC_MEMFUNC_SCOPE void +void isc__mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; @@ -2226,8 +2194,8 @@ isc__mempool_setmaxalloc(isc_mempool_t *mpctx0, unsigned int limit) { UNLOCK(mpctx->lock); } -ISC_MEMFUNC_SCOPE unsigned int -isc__mempool_getmaxalloc(isc_mempool_t *mpctx0) { +unsigned int +isc_mempool_getmaxalloc(isc_mempool_t *mpctx0) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; unsigned int maxalloc; @@ -2244,7 +2212,7 @@ isc__mempool_getmaxalloc(isc_mempool_t *mpctx0) { return (maxalloc); } -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc__mempool_getallocated(isc_mempool_t *mpctx0) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; unsigned int allocated; @@ -2262,7 +2230,7 @@ isc__mempool_getallocated(isc_mempool_t *mpctx0) { return (allocated); } -ISC_MEMFUNC_SCOPE void +void isc__mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; @@ -2278,8 +2246,8 @@ isc__mempool_setfillcount(isc_mempool_t *mpctx0, unsigned int limit) { UNLOCK(mpctx->lock); } -ISC_MEMFUNC_SCOPE unsigned int -isc__mempool_getfillcount(isc_mempool_t *mpctx0) { +unsigned int +isc_mempool_getfillcount(isc_mempool_t *mpctx0) { isc__mempool_t *mpctx = (isc__mempool_t *)mpctx0; unsigned int fillcount; @@ -2297,15 +2265,12 @@ isc__mempool_getfillcount(isc_mempool_t *mpctx0) { return (fillcount); } -#ifdef USE_MEMIMPREGISTER isc_result_t isc__mem_register() { - return (isc_mem_register(isc__mem_create2)); + return (isc_mem_register(isc_mem_create2)); } -#endif -#ifdef BIND9 -ISC_MEMFUNC_SCOPE void +void isc__mem_printactive(isc_mem_t *ctx0, FILE *file) { #if ISC_MEM_TRACKLINES isc__mem_t *ctx = (isc__mem_t *)ctx0; @@ -2320,8 +2285,8 @@ isc__mem_printactive(isc_mem_t *ctx0, FILE *file) { #endif } -ISC_MEMFUNC_SCOPE void -isc__mem_printallactive(FILE *file) { +void +isc_mem_printallactive(FILE *file) { #if !ISC_MEM_TRACKLINES UNUSED(file); #else @@ -2340,8 +2305,8 @@ isc__mem_printallactive(FILE *file) { #endif } -ISC_MEMFUNC_SCOPE void -isc__mem_checkdestroyed(FILE *file) { +void +isc_mem_checkdestroyed(FILE *file) { #if !ISC_MEM_TRACKLINES UNUSED(file); #endif @@ -2366,7 +2331,7 @@ isc__mem_checkdestroyed(FILE *file) { UNLOCK(&lock); } -ISC_MEMFUNC_SCOPE unsigned int +unsigned int isc_mem_references(isc_mem_t *ctx0) { isc__mem_t *ctx = (isc__mem_t *)ctx0; unsigned int references; @@ -2709,4 +2674,353 @@ isc_mem_renderjson(json_object *memobj) { return (result); } #endif /* HAVE_JSON */ -#endif /* BIND9 */ + +static isc_memcreatefunc_t mem_createfunc = NULL; + +isc_result_t +isc_mem_register(isc_memcreatefunc_t createfunc) { + isc_result_t result = ISC_R_SUCCESS; + + RUNTIME_CHECK(isc_once_do(&once, initialize_action) == ISC_R_SUCCESS); + + LOCK(&createlock); + if (mem_createfunc == NULL) + mem_createfunc = createfunc; + else + result = ISC_R_EXISTS; + UNLOCK(&createlock); + + return (result); +} + + +isc_result_t +isc__mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **mctxp, + unsigned int flags) +{ + isc_result_t result; + + LOCK(&createlock); + + REQUIRE(mem_createfunc != NULL); + result = (*mem_createfunc)(init_max_size, target_size, mctxp, flags); + + UNLOCK(&createlock); + + return (result); +} + +isc_result_t +isc_mem_create(size_t init_max_size, size_t target_size, isc_mem_t **mctxp) { + isc_result_t result; + + if (isc_bind9) + return (isc_mem_createx2(init_max_size, target_size, + default_memalloc, default_memfree, + NULL, mctxp, ISC_MEMFLAG_DEFAULT)); + LOCK(&createlock); + + REQUIRE(mem_createfunc != NULL); + result = (*mem_createfunc)(init_max_size, target_size, mctxp, + ISC_MEMFLAG_DEFAULT); + + UNLOCK(&createlock); + + return (result); +} + +isc_result_t +isc_mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **mctxp, + unsigned int flags) +{ + if (isc_bind9) + return (isc_mem_createx2(init_max_size, target_size, + default_memalloc, default_memfree, + NULL, mctxp, flags)); + + return (isc_mem_createx2(init_max_size, target_size, + default_memalloc, default_memfree, + NULL, mctxp, flags)); +} + +void +isc_mem_attach(isc_mem_t *source, isc_mem_t **targetp) { + REQUIRE(ISCAPI_MCTX_VALID(source)); + REQUIRE(targetp != NULL && *targetp == NULL); + + if (isc_bind9) + isc__mem_attach(source, targetp); + else + source->methods->attach(source, targetp); + + ENSURE(*targetp == source); +} + +void +isc_mem_detach(isc_mem_t **mctxp) { + REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); + + if (isc_bind9) + isc__mem_detach(mctxp); + else + (*mctxp)->methods->detach(mctxp); + + ENSURE(*mctxp == NULL); +} + +void +isc_mem_destroy(isc_mem_t **mctxp) { + REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); + + if (isc_bind9) + isc__mem_destroy(mctxp); + else + (*mctxp)->methods->destroy(mctxp); + + ENSURE(*mctxp == NULL); +} + +void +isc_mem_setdestroycheck(isc_mem_t *mctx, isc_boolean_t flag) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + mctx->methods->setdestroycheck(mctx, flag); +} + +void +isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, + size_t hiwater, size_t lowater) +{ + REQUIRE(ISCAPI_MCTX_VALID(ctx)); + + if (isc_bind9) + isc__mem_setwater(ctx, water, water_arg, hiwater, lowater); + else + ctx->methods->setwater(ctx, water, water_arg, hiwater, lowater); +} + +void +isc_mem_waterack(isc_mem_t *ctx, int flag) { + REQUIRE(ISCAPI_MCTX_VALID(ctx)); + + if (isc_bind9) + isc__mem_waterack(ctx, flag); + else + ctx->methods->waterack(ctx, flag); +} + +size_t +isc_mem_inuse(isc_mem_t *mctx) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc__mem_inuse(mctx)); + + return (mctx->methods->inuse(mctx)); +} + +size_t +isc_mem_maxinuse(isc_mem_t *mctx) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc__mem_maxinuse(mctx)); + + return (mctx->methods->maxinuse(mctx)); +} + +size_t +isc_mem_total(isc_mem_t *mctx) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc__mem_total(mctx)); + + return (mctx->methods->total(mctx)); +} + +isc_boolean_t +isc_mem_isovermem(isc_mem_t *mctx) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc__mem_isovermem(mctx)); + + return (mctx->methods->isovermem(mctx)); +} + + +isc_result_t +isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + return (mctx->methods->mpcreate(mctx, size, mpctxp)); +} + +void +isc_mempool_destroy(isc_mempool_t **mpctxp) { + REQUIRE(mpctxp != NULL && ISCAPI_MPOOL_VALID(*mpctxp)); + + if (isc_bind9) + isc__mempool_destroy(mpctxp); + else + (*mpctxp)->methods->destroy(mpctxp); + + ENSURE(*mpctxp == NULL); +} + +unsigned int +isc_mempool_getallocated(isc_mempool_t *mpctx) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + return (isc__mempool_getallocated(mpctx)); + + return (mpctx->methods->getallocated(mpctx)); +} + +void +isc_mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc__mempool_setmaxalloc(mpctx, limit); + else + mpctx->methods->setmaxalloc(mpctx, limit); +} + +void +isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc__mempool_setfreemax(mpctx, limit); + else + mpctx->methods->setfreemax(mpctx, limit); +} + +void +isc_mempool_setname(isc_mempool_t *mpctx, const char *name) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc__mempool_setname(mpctx, name); + else + mpctx->methods->setname(mpctx, name); +} + +void +isc_mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc__mempool_associatelock(mpctx, lock); + else + mpctx->methods->associatelock(mpctx, lock); +} + +void +isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc__mempool_setfillcount(mpctx, limit); + else + mpctx->methods->setfillcount(mpctx, limit); +} + +void * +isc__mem_get(isc_mem_t *mctx, size_t size FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc___mem_get(mctx, size FLARG_PASS)); + + return (mctx->methods->memget(mctx, size FLARG_PASS)); + +} + +void +isc__mem_put(isc_mem_t *mctx, void *ptr, size_t size FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + isc___mem_put(mctx, ptr, size FLARG_PASS); + else + mctx->methods->memput(mctx, ptr, size FLARG_PASS); +} + +void +isc__mem_putanddetach(isc_mem_t **mctxp, void *ptr, size_t size FLARG) { + REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); + + if (isc_bind9) + isc___mem_putanddetach(mctxp, ptr, size FLARG_PASS); + else + (*mctxp)->methods->memputanddetach(mctxp, ptr, size FLARG_PASS); + + /* + * XXX: We cannot always ensure *mctxp == NULL here + * (see lib/isc/mem.c). + */ +} + +void * +isc__mem_allocate(isc_mem_t *mctx, size_t size FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc___mem_allocate(mctx, size FLARG_PASS)); + + return (mctx->methods->memallocate(mctx, size FLARG_PASS)); +} + +void * +isc__mem_reallocate(isc_mem_t *mctx, void *ptr, size_t size FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc___mem_reallocate(mctx, ptr, size FLARG_PASS)); + + return (mctx->methods->memreallocate(mctx, ptr, size FLARG_PASS)); +} + +char * +isc__mem_strdup(isc_mem_t *mctx, const char *s FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + return (isc___mem_strdup(mctx, s FLARG_PASS)); + + return (mctx->methods->memstrdup(mctx, s FLARG_PASS)); +} + +void +isc__mem_free(isc_mem_t *mctx, void *ptr FLARG) { + REQUIRE(ISCAPI_MCTX_VALID(mctx)); + + if (isc_bind9) + isc___mem_free(mctx, ptr FLARG_PASS); + else + mctx->methods->memfree(mctx, ptr FLARG_PASS); +} + +void * +isc__mempool_get(isc_mempool_t *mpctx FLARG) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + return (isc___mempool_get(mpctx FLARG_PASS)); + + return (mpctx->methods->get(mpctx FLARG_PASS)); +} + +void +isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) { + REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); + + if (isc_bind9) + isc___mempool_put(mpctx, mem FLARG_PASS); + else + mpctx->methods->put(mpctx, mem FLARG_PASS); +} diff --git a/lib/isc/mem_api.c b/lib/isc/mem_api.c deleted file mode 100644 index a5f1fdd066..0000000000 --- a/lib/isc/mem_api.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright (C) 2009, 2010, 2012 Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: mem_api.c,v 1.8 2010/08/12 21:30:26 jinmei Exp $ */ - -#include - -#include -#include -#include -#include - -#if ISC_MEM_TRACKLINES -#define FLARG_PASS , file, line -#define FLARG , const char *file, unsigned int line -#else -#define FLARG_PASS -#define FLARG -#endif - -static isc_mutex_t createlock; -static isc_once_t once = ISC_ONCE_INIT; -static isc_memcreatefunc_t mem_createfunc = NULL; - -static void -initialize(void) { - RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); -} - -isc_result_t -isc_mem_register(isc_memcreatefunc_t createfunc) { - isc_result_t result = ISC_R_SUCCESS; - - RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); - - LOCK(&createlock); - if (mem_createfunc == NULL) - mem_createfunc = createfunc; - else - result = ISC_R_EXISTS; - UNLOCK(&createlock); - - return (result); -} - -isc_result_t -isc_mem_create(size_t init_max_size, size_t target_size, isc_mem_t **mctxp) { - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(mem_createfunc != NULL); - result = (*mem_createfunc)(init_max_size, target_size, mctxp, - ISC_MEMFLAG_DEFAULT); - - UNLOCK(&createlock); - - return (result); -} - -isc_result_t -isc_mem_create2(size_t init_max_size, size_t target_size, isc_mem_t **mctxp, - unsigned int flags) -{ - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(mem_createfunc != NULL); - result = (*mem_createfunc)(init_max_size, target_size, mctxp, flags); - - UNLOCK(&createlock); - - return (result); -} - -void -isc_mem_attach(isc_mem_t *source, isc_mem_t **targetp) { - REQUIRE(ISCAPI_MCTX_VALID(source)); - REQUIRE(targetp != NULL && *targetp == NULL); - - source->methods->attach(source, targetp); - - ENSURE(*targetp == source); -} - -void -isc_mem_detach(isc_mem_t **mctxp) { - REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); - - (*mctxp)->methods->detach(mctxp); - - ENSURE(*mctxp == NULL); -} - -void -isc_mem_destroy(isc_mem_t **mctxp) { - REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); - - (*mctxp)->methods->destroy(mctxp); - - ENSURE(*mctxp == NULL); -} - -void * -isc__mem_get(isc_mem_t *mctx, size_t size FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->memget(mctx, size FLARG_PASS)); -} - -void -isc__mem_put(isc_mem_t *mctx, void *ptr, size_t size FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - mctx->methods->memput(mctx, ptr, size FLARG_PASS); -} - -void -isc__mem_putanddetach(isc_mem_t **mctxp, void *ptr, size_t size FLARG) { - REQUIRE(mctxp != NULL && ISCAPI_MCTX_VALID(*mctxp)); - - (*mctxp)->methods->memputanddetach(mctxp, ptr, size FLARG_PASS); - - /* - * XXX: We cannot always ensure *mctxp == NULL here - * (see lib/isc/mem.c). - */ -} - -void * -isc__mem_allocate(isc_mem_t *mctx, size_t size FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->memallocate(mctx, size FLARG_PASS)); -} - -void * -isc__mem_reallocate(isc_mem_t *mctx, void *ptr, size_t size FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->memreallocate(mctx, ptr, size FLARG_PASS)); -} - -char * -isc__mem_strdup(isc_mem_t *mctx, const char *s FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->memstrdup(mctx, s FLARG_PASS)); -} - -void -isc__mem_free(isc_mem_t *mctx, void *ptr FLARG) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - mctx->methods->memfree(mctx, ptr FLARG_PASS); -} - -void -isc_mem_setdestroycheck(isc_mem_t *mctx, isc_boolean_t flag) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - mctx->methods->setdestroycheck(mctx, flag); -} - -void -isc_mem_setwater(isc_mem_t *ctx, isc_mem_water_t water, void *water_arg, - size_t hiwater, size_t lowater) -{ - REQUIRE(ISCAPI_MCTX_VALID(ctx)); - - ctx->methods->setwater(ctx, water, water_arg, hiwater, lowater); -} - -void -isc_mem_waterack(isc_mem_t *ctx, int flag) { - REQUIRE(ISCAPI_MCTX_VALID(ctx)); - - ctx->methods->waterack(ctx, flag); -} - -size_t -isc_mem_inuse(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->inuse(mctx)); -} - -isc_boolean_t -isc_mem_isovermem(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->isovermem(mctx)); -} - -size_t -isc_mem_maxinuse(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->maxinuse(mctx)); -} - -size_t -isc_mem_total(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->total(mctx)); -} - -void -isc_mem_setname(isc_mem_t *mctx, const char *name, void *tag) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - UNUSED(name); - UNUSED(tag); - - return; -} - -const char * -isc_mem_getname(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (""); -} - -void * -isc_mem_gettag(isc_mem_t *mctx) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (NULL); -} - -isc_result_t -isc_mempool_create(isc_mem_t *mctx, size_t size, isc_mempool_t **mpctxp) { - REQUIRE(ISCAPI_MCTX_VALID(mctx)); - - return (mctx->methods->mpcreate(mctx, size, mpctxp)); -} - -void -isc_mempool_destroy(isc_mempool_t **mpctxp) { - REQUIRE(mpctxp != NULL && ISCAPI_MPOOL_VALID(*mpctxp)); - - (*mpctxp)->methods->destroy(mpctxp); - - ENSURE(*mpctxp == NULL); -} - -void * -isc__mempool_get(isc_mempool_t *mpctx FLARG) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - return (mpctx->methods->get(mpctx FLARG_PASS)); -} - -void -isc__mempool_put(isc_mempool_t *mpctx, void *mem FLARG) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->put(mpctx, mem FLARG_PASS); -} - -unsigned int -isc_mempool_getallocated(isc_mempool_t *mpctx) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - return (mpctx->methods->getallocated(mpctx)); -} - -void -isc_mempool_setmaxalloc(isc_mempool_t *mpctx, unsigned int limit) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->setmaxalloc(mpctx, limit); -} - -void -isc_mempool_setfreemax(isc_mempool_t *mpctx, unsigned int limit) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->setfreemax(mpctx, limit); -} - -void -isc_mempool_setname(isc_mempool_t *mpctx, const char *name) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->setname(mpctx, name); -} - -void -isc_mempool_associatelock(isc_mempool_t *mpctx, isc_mutex_t *lock) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->associatelock(mpctx, lock); -} - -void -isc_mempool_setfillcount(isc_mempool_t *mpctx, unsigned int limit) { - REQUIRE(ISCAPI_MPOOL_VALID(mpctx)); - - mpctx->methods->setfillcount(mpctx, limit); -} diff --git a/lib/isc/socket_api.c b/lib/isc/socket_api.c index 8c3f92322f..636a89d12f 100644 --- a/lib/isc/socket_api.c +++ b/lib/isc/socket_api.c @@ -73,6 +73,9 @@ isc_result_t isc_socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { isc_result_t result; + if (isc_bind9) + return (isc__socketmgr_create(mctx, managerp)); + LOCK(&createlock); REQUIRE(socketmgr_createfunc != NULL); @@ -87,7 +90,10 @@ void isc_socketmgr_destroy(isc_socketmgr_t **managerp) { REQUIRE(managerp != NULL && ISCAPI_SOCKETMGR_VALID(*managerp)); - (*managerp)->methods->destroy(managerp); + if (isc_bind9) + isc__socketmgr_destroy(managerp); + else + (*managerp)->methods->destroy(managerp); ENSURE(*managerp == NULL); } @@ -98,6 +104,9 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, { REQUIRE(ISCAPI_SOCKETMGR_VALID(manager)); + if (isc_bind9) + return (isc__socket_create(manager, pf, type, socketp)); + return (manager->methods->socketcreate(manager, pf, type, socketp)); } @@ -106,7 +115,10 @@ isc_socket_attach(isc_socket_t *sock, isc_socket_t **socketp) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); REQUIRE(socketp != NULL && *socketp == NULL); - sock->methods->attach(sock, socketp); + if (isc_bind9) + isc__socket_attach(sock, socketp); + else + sock->methods->attach(sock, socketp); ENSURE(*socketp == sock); } @@ -115,7 +127,10 @@ void isc_socket_detach(isc_socket_t **socketp) { REQUIRE(socketp != NULL && ISCAPI_SOCKET_VALID(*socketp)); - (*socketp)->methods->detach(socketp); + if (isc_bind9) + isc__socket_detach(socketp); + else + (*socketp)->methods->detach(socketp); ENSURE(*socketp == NULL); } @@ -126,6 +141,9 @@ isc_socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr, { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_bind(sock, sockaddr, options)); + return (sock->methods->bind(sock, sockaddr, options)); } @@ -136,28 +154,23 @@ isc_socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_sendto(sock, region, task, + action, arg, address, pktinfo)); + return (sock->methods->sendto(sock, region, task, action, arg, address, pktinfo)); } -isc_result_t -isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, - isc_task_t *task, isc_sockaddr_t *address, - struct in6_pktinfo *pktinfo, isc_socketevent_t *event, - unsigned int flags) -{ - REQUIRE(ISCAPI_SOCKET_VALID(sock)); - - return (sock->methods->sendto2(sock, region, task, address, - pktinfo, event, flags)); -} - isc_result_t isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, const void *arg) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_connect(sock, addr, task, action, arg)); + return (sock->methods->connect(sock, addr, task, action, arg)); } @@ -167,31 +180,30 @@ isc_socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_recv(sock, region, minimum, + task, action, arg)); + return (sock->methods->recv(sock, region, minimum, task, action, arg)); } -isc_result_t -isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, - unsigned int minimum, isc_task_t *task, - isc_socketevent_t *event, unsigned int flags) -{ - REQUIRE(ISCAPI_SOCKET_VALID(sock)); - - return (sock->methods->recv2(sock, region, minimum, task, - event, flags)); -} - void isc_socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); - sock->methods->cancel(sock, task, how); + if (isc_bind9) + isc__socket_cancel(sock, task, how); + else + sock->methods->cancel(sock, task, how); } isc_result_t isc_socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_getsockname(sock, addressp)); + return (sock->methods->getsockname(sock, addressp)); } @@ -199,7 +211,10 @@ void isc_socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); - sock->methods->ipv6only(sock, yes); + if (isc_bind9) + isc__socket_ipv6only(sock, yes); + else + sock->methods->ipv6only(sock, yes); } void @@ -213,6 +228,9 @@ isc_sockettype_t isc_socket_gettype(isc_socket_t *sock) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); + if (isc_bind9) + return (isc__socket_gettype(sock)); + return (sock->methods->gettype(sock)); } @@ -232,6 +250,11 @@ isc_socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags, { REQUIRE(ISCAPI_SOCKETMGR_VALID(manager)); + if (isc_bind9) + return (isc__socket_fdwatchcreate(manager, fd, flags, + callback, cbarg, + task, socketp)); + return (manager->methods->fdwatchcreate(manager, fd, flags, callback, cbarg, task, socketp)); @@ -242,7 +265,10 @@ isc_socket_fdwatchpoke(isc_socket_t *sock, int flags) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); - return(sock->methods->fdwatchpoke(sock, flags)); + if (isc_bind9) + return (isc__socket_fdwatchpoke(sock, flags)); + + return (sock->methods->fdwatchpoke(sock, flags)); } isc_result_t @@ -250,12 +276,119 @@ isc_socket_dup(isc_socket_t *sock, isc_socket_t **socketp) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); REQUIRE(socketp != NULL && *socketp == NULL); - return(sock->methods->dup(sock, socketp)); + if (isc_bind9) + return (isc__socket_dup(sock, socketp)); + + return (sock->methods->dup(sock, socketp)); } int isc_socket_getfd(isc_socket_t *sock) { REQUIRE(ISCAPI_SOCKET_VALID(sock)); - return(sock->methods->getfd(sock)); + if (isc_bind9) + return (isc__socket_getfd(sock)); + + return (sock->methods->getfd(sock)); } + +isc_result_t +isc_socket_open(isc_socket_t *sock) { + return (isc__socket_open(sock)); +} + +isc_result_t +isc_socket_close(isc_socket_t *sock) { + return (isc__socket_close(sock)); +} + +isc_result_t +isc_socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, + unsigned int maxsocks) +{ + return (isc__socketmgr_create2(mctx, managerp, maxsocks)); +} + +isc_result_t +isc_socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, + unsigned int minimum, isc_task_t *task, + isc_taskaction_t action, const void *arg) +{ + return (isc__socket_recvv(sock, buflist, minimum, task, action, arg)); +} + +isc_result_t +isc_socket_recv2(isc_socket_t *sock, isc_region_t *region, + unsigned int minimum, isc_task_t *task, + isc_socketevent_t *event, unsigned int flags) +{ + return (isc__socket_recv2(sock, region, minimum, task, event, flags)); +} + +isc_result_t +isc_socket_send(isc_socket_t *sock, isc_region_t *region, + isc_task_t *task, isc_taskaction_t action, const void *arg) +{ + return (isc__socket_send(sock, region, task, action, arg)); +} + +isc_result_t +isc_socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, + isc_task_t *task, isc_taskaction_t action, const void *arg) +{ + return (isc__socket_sendv(sock, buflist, task, action, arg)); +} + +isc_result_t +isc_socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, + isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) +{ + return (isc__socket_sendtov(sock, buflist, task, action, arg, + address, pktinfo)); +} + +isc_result_t +isc_socket_sendto2(isc_socket_t *sock, isc_region_t *region, + isc_task_t *task, + isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, + isc_socketevent_t *event, unsigned int flags) +{ + return (isc__socket_sendto2(sock, region, task, address, pktinfo, + event, flags)); +} + +void +isc_socket_cleanunix(isc_sockaddr_t *sockaddr, isc_boolean_t active) { + isc__socket_cleanunix(sockaddr, active); +} + +isc_result_t +isc_socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, + isc_uint32_t owner, isc_uint32_t group) +{ + return (isc__socket_permunix(sockaddr, perm, owner, group)); +} + +isc_result_t +isc_socket_filter(isc_socket_t *sock, const char *filter) { + return (isc__socket_filter(sock, filter)); +} + +isc_result_t +isc_socket_listen(isc_socket_t *sock, unsigned int backlog) { + return (isc__socket_listen(sock, backlog)); +} + +isc_result_t +isc_socket_accept(isc_socket_t *sock, isc_task_t *task, + isc_taskaction_t action, const void *arg) +{ + return (isc__socket_accept(sock, task, action, arg)); +} + +isc_result_t +isc_socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp) { + return (isc__socket_getpeername(sock, addressp)); +} + diff --git a/lib/isc/task.c b/lib/isc/task.c index 626f91525c..2d28bb5fa0 100644 --- a/lib/isc/task.c +++ b/lib/isc/task.c @@ -28,12 +28,14 @@ #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -57,13 +59,11 @@ * is expected to have a separate manager; no "worker threads" are shared by * the application threads. */ -#ifdef BIND9 #ifdef ISC_PLATFORM_USETHREADS #define USE_WORKER_THREADS #else #define USE_SHARED_MANAGER #endif /* ISC_PLATFORM_USETHREADS */ -#endif /* BIND9 */ #include "task_p.h" @@ -89,7 +89,7 @@ typedef enum { task_state_done } task_state_t; -#if defined(HAVE_LIBXML2) && defined(BIND9) +#if defined(HAVE_LIBXML2) static const char *statenames[] = { "idle", "ready", "running", "done", }; @@ -174,76 +174,72 @@ static isc__taskmgr_t *taskmgr = NULL; #endif /* USE_SHARED_MANAGER */ /*% - * The following can be either static or public, depending on build environment. + * The following are intended for internal use (indicated by "isc__" + * prefix) but are not declared as static, allowing direct access from + * unit tests etc. */ -#ifdef BIND9 -#define ISC_TASKFUNC_SCOPE -#else -#define ISC_TASKFUNC_SCOPE static -#endif - -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, isc_task_t **taskp); -ISC_TASKFUNC_SCOPE void +void isc__task_attach(isc_task_t *source0, isc_task_t **targetp); -ISC_TASKFUNC_SCOPE void +void isc__task_detach(isc_task_t **taskp); -ISC_TASKFUNC_SCOPE void +void isc__task_send(isc_task_t *task0, isc_event_t **eventp); -ISC_TASKFUNC_SCOPE void +void isc__task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp); -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag); -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag); -ISC_TASKFUNC_SCOPE isc_boolean_t -isc__task_purgeevent(isc_task_t *task0, isc_event_t *event); -ISC_TASKFUNC_SCOPE unsigned int +isc_boolean_t +isc_task_purgeevent(isc_task_t *task0, isc_event_t *event); +unsigned int isc__task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag, isc_eventlist_t *events); -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events); -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, const void *arg); -ISC_TASKFUNC_SCOPE void +void isc__task_shutdown(isc_task_t *task0); -ISC_TASKFUNC_SCOPE void +void isc__task_destroy(isc_task_t **taskp); -ISC_TASKFUNC_SCOPE void +void isc__task_setname(isc_task_t *task0, const char *name, void *tag); -ISC_TASKFUNC_SCOPE const char * +const char * isc__task_getname(isc_task_t *task0); -ISC_TASKFUNC_SCOPE void * +void * isc__task_gettag(isc_task_t *task0); -ISC_TASKFUNC_SCOPE void +void isc__task_getcurrenttime(isc_task_t *task0, isc_stdtime_t *t); -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, unsigned int default_quantum, isc_taskmgr_t **managerp); -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_destroy(isc_taskmgr_t **managerp); -ISC_TASKFUNC_SCOPE void -isc__taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0); -ISC_TASKFUNC_SCOPE isc_result_t -isc__taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp); -ISC_TASKFUNC_SCOPE isc_result_t +void +isc_taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0); +isc_result_t +isc_taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp); +isc_result_t isc__task_beginexclusive(isc_task_t *task); -ISC_TASKFUNC_SCOPE void +void isc__task_endexclusive(isc_task_t *task0); -ISC_TASKFUNC_SCOPE void +void isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv); -ISC_TASKFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__task_privilege(isc_task_t *task0); -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode); -ISC_TASKFUNC_SCOPE isc_taskmgrmode_t +isc_taskmgrmode_t isc__taskmgr_mode(isc_taskmgr_t *manager0); static inline isc_boolean_t @@ -261,9 +257,7 @@ static struct isc__taskmethods { /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *purgeevent, *unsendrange, *getname, *gettag, *getcurrenttime; -#endif } taskmethods = { { isc__task_attach, @@ -281,13 +275,12 @@ static struct isc__taskmethods { isc__task_endexclusive, isc__task_setprivilege, isc__task_privilege - } -#ifndef BIND9 - , - (void *)isc__task_purgeevent, (void *)isc__task_unsendrange, - (void *)isc__task_getname, (void *)isc__task_gettag, + }, + (void *)isc_task_purgeevent, + (void *)isc__task_unsendrange, + (void *)isc__task_getname, + (void *)isc__task_gettag, (void *)isc__task_getcurrenttime -#endif }; static isc_taskmgrmethods_t taskmgrmethods = { @@ -295,8 +288,8 @@ static isc_taskmgrmethods_t taskmgrmethods = { isc__taskmgr_setmode, isc__taskmgr_mode, isc__task_create, - isc__taskmgr_setexcltask, - isc__taskmgr_excltask + isc_taskmgr_setexcltask, + isc_taskmgr_excltask }; /*** @@ -336,7 +329,7 @@ task_finished(isc__task_t *task) { isc_mem_put(manager->mctx, task, sizeof(*task)); } -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, isc_task_t **taskp) { @@ -396,7 +389,7 @@ isc__task_create(isc_taskmgr_t *manager0, unsigned int quantum, return (ISC_R_SUCCESS); } -ISC_TASKFUNC_SCOPE void +void isc__task_attach(isc_task_t *source0, isc_task_t **targetp) { isc__task_t *source = (isc__task_t *)source0; @@ -510,7 +503,7 @@ task_detach(isc__task_t *task) { return (ISC_FALSE); } -ISC_TASKFUNC_SCOPE void +void isc__task_detach(isc_task_t **taskp) { isc__task_t *task; isc_boolean_t was_idle; @@ -566,7 +559,7 @@ task_send(isc__task_t *task, isc_event_t **eventp) { return (was_idle); } -ISC_TASKFUNC_SCOPE void +void isc__task_send(isc_task_t *task0, isc_event_t **eventp) { isc__task_t *task = (isc__task_t *)task0; isc_boolean_t was_idle; @@ -608,7 +601,7 @@ isc__task_send(isc_task_t *task0, isc_event_t **eventp) { } } -ISC_TASKFUNC_SCOPE void +void isc__task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) { isc_boolean_t idle1, idle2; isc__task_t *task; @@ -685,7 +678,7 @@ dequeue_events(isc__task_t *task, void *sender, isc_eventtype_t first, return (count); } -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag) { @@ -717,7 +710,7 @@ isc__task_purgerange(isc_task_t *task0, void *sender, isc_eventtype_t first, return (count); } -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag) { @@ -730,8 +723,8 @@ isc__task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, return (isc__task_purgerange(task, sender, type, type, tag)); } -ISC_TASKFUNC_SCOPE isc_boolean_t -isc__task_purgeevent(isc_task_t *task0, isc_event_t *event) { +isc_boolean_t +isc_task_purgeevent(isc_task_t *task0, isc_event_t *event) { isc__task_t *task = (isc__task_t *)task0; isc_event_t *curr_event, *next_event; @@ -774,7 +767,7 @@ isc__task_purgeevent(isc_task_t *task0, isc_event_t *event) { return (ISC_TRUE); } -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, isc_eventtype_t last, void *tag, isc_eventlist_t *events) @@ -789,7 +782,7 @@ isc__task_unsendrange(isc_task_t *task, void *sender, isc_eventtype_t first, last, tag, events, ISC_FALSE)); } -ISC_TASKFUNC_SCOPE unsigned int +unsigned int isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag, isc_eventlist_t *events) { @@ -803,7 +796,7 @@ isc__task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, type, tag, events, ISC_FALSE)); } -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, const void *arg) { @@ -843,7 +836,7 @@ isc__task_onshutdown(isc_task_t *task0, isc_taskaction_t action, return (result); } -ISC_TASKFUNC_SCOPE void +void isc__task_shutdown(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; isc_boolean_t was_idle; @@ -862,7 +855,7 @@ isc__task_shutdown(isc_task_t *task0) { task_ready(task); } -ISC_TASKFUNC_SCOPE void +void isc__task_destroy(isc_task_t **taskp) { /* @@ -875,7 +868,7 @@ isc__task_destroy(isc_task_t **taskp) { isc_task_detach(taskp); } -ISC_TASKFUNC_SCOPE void +void isc__task_setname(isc_task_t *task0, const char *name, void *tag) { isc__task_t *task = (isc__task_t *)task0; @@ -892,7 +885,7 @@ isc__task_setname(isc_task_t *task0, const char *name, void *tag) { UNLOCK(&task->lock); } -ISC_TASKFUNC_SCOPE const char * +const char * isc__task_getname(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; @@ -901,7 +894,7 @@ isc__task_getname(isc_task_t *task0) { return (task->name); } -ISC_TASKFUNC_SCOPE void * +void * isc__task_gettag(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; @@ -910,7 +903,7 @@ isc__task_gettag(isc_task_t *task0) { return (task->tag); } -ISC_TASKFUNC_SCOPE void +void isc__task_getcurrenttime(isc_task_t *task0, isc_stdtime_t *t) { isc__task_t *task = (isc__task_t *)task0; @@ -1333,7 +1326,7 @@ manager_free(isc__taskmgr_t *manager) { #endif /* USE_SHARED_MANAGER */ } -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, unsigned int default_quantum, isc_taskmgr_t **managerp) { @@ -1468,7 +1461,7 @@ isc__taskmgr_create(isc_mem_t *mctx, unsigned int workers, return (result); } -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_destroy(isc_taskmgr_t **managerp) { isc__taskmgr_t *manager; isc__task_t *task; @@ -1564,10 +1557,8 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) { UNLOCK(&manager->lock); while (isc__taskmgr_ready((isc_taskmgr_t *)manager)) (void)isc__taskmgr_dispatch((isc_taskmgr_t *)manager); -#ifdef BIND9 if (!ISC_LIST_EMPTY(manager->tasks)) isc_mem_printallactive(stderr); -#endif INSIST(ISC_LIST_EMPTY(manager->tasks)); #ifdef USE_SHARED_MANAGER taskmgr = NULL; @@ -1579,7 +1570,7 @@ isc__taskmgr_destroy(isc_taskmgr_t **managerp) { *managerp = NULL; } -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; @@ -1588,7 +1579,7 @@ isc__taskmgr_setmode(isc_taskmgr_t *manager0, isc_taskmgrmode_t mode) { UNLOCK(&manager->lock); } -ISC_TASKFUNC_SCOPE isc_taskmgrmode_t +isc_taskmgrmode_t isc__taskmgr_mode(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; isc_taskmgrmode_t mode; @@ -1635,7 +1626,7 @@ isc__taskmgr_dispatch(isc_taskmgr_t *manager0) { } #else -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_pause(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; LOCK(&manager->lock); @@ -1646,7 +1637,7 @@ isc__taskmgr_pause(isc_taskmgr_t *manager0) { UNLOCK(&manager->lock); } -ISC_TASKFUNC_SCOPE void +void isc__taskmgr_resume(isc_taskmgr_t *manager0) { isc__taskmgr_t *manager = (isc__taskmgr_t *)manager0; @@ -1659,8 +1650,8 @@ isc__taskmgr_resume(isc_taskmgr_t *manager0) { } #endif /* USE_WORKER_THREADS */ -ISC_TASKFUNC_SCOPE void -isc__taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0) { +void +isc_taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0) { isc__taskmgr_t *mgr = (isc__taskmgr_t *) mgr0; isc__task_t *task = (isc__task_t *) task0; @@ -1671,8 +1662,8 @@ isc__taskmgr_setexcltask(isc_taskmgr_t *mgr0, isc_task_t *task0) { isc__task_attach(task0, (isc_task_t **) &mgr->excl); } -ISC_TASKFUNC_SCOPE isc_result_t -isc__taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp) { +isc_result_t +isc_taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp) { isc__taskmgr_t *mgr = (isc__taskmgr_t *) mgr0; REQUIRE(VALID_MANAGER(mgr)); @@ -1685,7 +1676,7 @@ isc__taskmgr_excltask(isc_taskmgr_t *mgr0, isc_task_t **taskp) { return (ISC_R_SUCCESS); } -ISC_TASKFUNC_SCOPE isc_result_t +isc_result_t isc__task_beginexclusive(isc_task_t *task0) { #ifdef USE_WORKER_THREADS isc__task_t *task = (isc__task_t *)task0; @@ -1710,7 +1701,7 @@ isc__task_beginexclusive(isc_task_t *task0) { return (ISC_R_SUCCESS); } -ISC_TASKFUNC_SCOPE void +void isc__task_endexclusive(isc_task_t *task0) { #ifdef USE_WORKER_THREADS isc__task_t *task = (isc__task_t *)task0; @@ -1727,7 +1718,7 @@ isc__task_endexclusive(isc_task_t *task0) { #endif } -ISC_TASKFUNC_SCOPE void +void isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv) { isc__task_t *task = (isc__task_t *)task0; isc__taskmgr_t *manager = task->manager; @@ -1754,7 +1745,7 @@ isc__task_setprivilege(isc_task_t *task0, isc_boolean_t priv) { UNLOCK(&manager->lock); } -ISC_TASKFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__task_privilege(isc_task_t *task0) { isc__task_t *task = (isc__task_t *)task0; isc_boolean_t priv; @@ -1765,12 +1756,10 @@ isc__task_privilege(isc_task_t *task0) { return (priv); } -#ifdef USE_SOCKETIMPREGISTER isc_result_t isc__task_register() { return (isc_task_register(isc__taskmgr_create)); } -#endif isc_boolean_t isc_task_exiting(isc_task_t *t) { @@ -1781,7 +1770,6 @@ isc_task_exiting(isc_task_t *t) { } -#ifdef BIND9 #ifdef HAVE_LIBXML2 #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) int @@ -1996,4 +1984,294 @@ isc_taskmgr_renderjson(isc_taskmgr_t *mgr0, json_object *tasks) { return (result); } #endif -#endif /* BIND9 */ + + +static isc_mutex_t createlock; +static isc_once_t once = ISC_ONCE_INIT; +static isc_taskmgrcreatefunc_t taskmgr_createfunc = NULL; + +static void +initialize(void) { + RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); +} + +isc_result_t +isc_task_register(isc_taskmgrcreatefunc_t createfunc) { + isc_result_t result = ISC_R_SUCCESS; + + RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); + + LOCK(&createlock); + if (taskmgr_createfunc == NULL) + taskmgr_createfunc = createfunc; + else + result = ISC_R_EXISTS; + UNLOCK(&createlock); + + return (result); +} + +isc_result_t +isc_taskmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, + unsigned int workers, unsigned int default_quantum, + isc_taskmgr_t **managerp) +{ + isc_result_t result; + + LOCK(&createlock); + + REQUIRE(taskmgr_createfunc != NULL); + result = (*taskmgr_createfunc)(mctx, workers, default_quantum, + managerp); + + UNLOCK(&createlock); + + if (result == ISC_R_SUCCESS) + isc_appctx_settaskmgr(actx, *managerp); + + return (result); +} + +isc_result_t +isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers, + unsigned int default_quantum, isc_taskmgr_t **managerp) +{ + isc_result_t result; + + if (isc_bind9) + return (isc__taskmgr_create(mctx, workers, + default_quantum, managerp)); + LOCK(&createlock); + + REQUIRE(taskmgr_createfunc != NULL); + result = (*taskmgr_createfunc)(mctx, workers, default_quantum, + managerp); + + UNLOCK(&createlock); + + return (result); +} + +void +isc_taskmgr_destroy(isc_taskmgr_t **managerp) { + REQUIRE(managerp != NULL && ISCAPI_TASKMGR_VALID(*managerp)); + + if (isc_bind9) + isc__taskmgr_destroy(managerp); + else + (*managerp)->methods->destroy(managerp); + + ENSURE(*managerp == NULL); +} + +void +isc_taskmgr_setmode(isc_taskmgr_t *manager, isc_taskmgrmode_t mode) { + REQUIRE(ISCAPI_TASKMGR_VALID(manager)); + + if (isc_bind9) + isc__taskmgr_setmode(manager, mode); + else + manager->methods->setmode(manager, mode); +} + +isc_taskmgrmode_t +isc_taskmgr_mode(isc_taskmgr_t *manager) { + REQUIRE(ISCAPI_TASKMGR_VALID(manager)); + + if (isc_bind9) + return (isc__taskmgr_mode(manager)); + + return (manager->methods->mode(manager)); +} + +isc_result_t +isc_task_create(isc_taskmgr_t *manager, unsigned int quantum, + isc_task_t **taskp) +{ + REQUIRE(ISCAPI_TASKMGR_VALID(manager)); + REQUIRE(taskp != NULL && *taskp == NULL); + + if (isc_bind9) + return (isc__task_create(manager, quantum, taskp)); + + return (manager->methods->taskcreate(manager, quantum, taskp)); +} + +void +isc_task_attach(isc_task_t *source, isc_task_t **targetp) { + REQUIRE(ISCAPI_TASK_VALID(source)); + REQUIRE(targetp != NULL && *targetp == NULL); + + if (isc_bind9) + isc__task_attach(source, targetp); + else + source->methods->attach(source, targetp); + + ENSURE(*targetp == source); +} + +void +isc_task_detach(isc_task_t **taskp) { + REQUIRE(taskp != NULL && ISCAPI_TASK_VALID(*taskp)); + + if (isc_bind9) + isc__task_detach(taskp); + else + (*taskp)->methods->detach(taskp); + + ENSURE(*taskp == NULL); +} + +void +isc_task_send(isc_task_t *task, isc_event_t **eventp) { + REQUIRE(ISCAPI_TASK_VALID(task)); + REQUIRE(eventp != NULL && *eventp != NULL); + + if (isc_bind9) + isc__task_send(task, eventp); + else { + task->methods->send(task, eventp); + ENSURE(*eventp == NULL); + } +} + +void +isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) { + REQUIRE(taskp != NULL && ISCAPI_TASK_VALID(*taskp)); + REQUIRE(eventp != NULL && *eventp != NULL); + + if (isc_bind9) + isc__task_sendanddetach(taskp, eventp); + else { + (*taskp)->methods->sendanddetach(taskp, eventp); + ENSURE(*eventp == NULL); + } + + ENSURE(*taskp == NULL); +} + +unsigned int +isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, + void *tag, isc_eventlist_t *events) +{ + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_unsend(task, sender, type, tag, events)); + + return (task->methods->unsend(task, sender, type, tag, events)); +} + +isc_result_t +isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, const void *arg) +{ + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_onshutdown(task, action, arg)); + + return (task->methods->onshutdown(task, action, arg)); +} + +void +isc_task_shutdown(isc_task_t *task) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + isc__task_shutdown(task); + else + task->methods->shutdown(task); +} + +void +isc_task_destroy(isc_task_t **taskp) { + if (!isc_bind9) + return; + + isc__task_destroy(taskp); +} + +void +isc_task_setname(isc_task_t *task, const char *name, void *tag) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + isc__task_setname(task, name, tag); + else + task->methods->setname(task, name, tag); +} + +unsigned int +isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag) +{ + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_purge(task, sender, type, tag)); + + return (task->methods->purgeevents(task, sender, type, tag)); +} + +isc_result_t +isc_task_beginexclusive(isc_task_t *task) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_beginexclusive(task)); + + return (task->methods->beginexclusive(task)); +} + +void +isc_task_endexclusive(isc_task_t *task) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + isc__task_endexclusive(task); + else + task->methods->endexclusive(task); +} + +void +isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + isc__task_setprivilege(task, priv); + else + task->methods->setprivilege(task, priv); +} + +isc_boolean_t +isc_task_privilege(isc_task_t *task) { + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_privilege(task)); + + return (task->methods->privilege(task)); +} + +void +isc_task_getcurrenttime(isc_task_t *task, isc_stdtime_t *t) { + if (!isc_bind9) + return; + + isc__task_getcurrenttime(task, t); +} + +/*% + * This is necessary for libisc's internal timer implementation. Other + * implementation might skip implementing this. + */ +unsigned int +isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first, + isc_eventtype_t last, void *tag) +{ + REQUIRE(ISCAPI_TASK_VALID(task)); + + if (isc_bind9) + return (isc__task_purgerange(task, sender, first, last, tag)); + + return (task->methods->purgerange(task, sender, first, last, tag)); +} diff --git a/lib/isc/task_api.c b/lib/isc/task_api.c deleted file mode 100644 index f49ab321b2..0000000000 --- a/lib/isc/task_api.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Copyright (C) 2009-2012 Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id$ */ - -#include - -#include - -#include -#include -#include -#include -#include -#include - -static isc_mutex_t createlock; -static isc_once_t once = ISC_ONCE_INIT; -static isc_taskmgrcreatefunc_t taskmgr_createfunc = NULL; - -static void -initialize(void) { - RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); -} - -isc_result_t -isc_task_register(isc_taskmgrcreatefunc_t createfunc) { - isc_result_t result = ISC_R_SUCCESS; - - RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); - - LOCK(&createlock); - if (taskmgr_createfunc == NULL) - taskmgr_createfunc = createfunc; - else - result = ISC_R_EXISTS; - UNLOCK(&createlock); - - return (result); -} - -isc_result_t -isc_taskmgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, - unsigned int workers, unsigned int default_quantum, - isc_taskmgr_t **managerp) -{ - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(taskmgr_createfunc != NULL); - result = (*taskmgr_createfunc)(mctx, workers, default_quantum, - managerp); - - UNLOCK(&createlock); - - if (result == ISC_R_SUCCESS) - isc_appctx_settaskmgr(actx, *managerp); - - return (result); -} - -isc_result_t -isc_taskmgr_create(isc_mem_t *mctx, unsigned int workers, - unsigned int default_quantum, isc_taskmgr_t **managerp) -{ - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(taskmgr_createfunc != NULL); - result = (*taskmgr_createfunc)(mctx, workers, default_quantum, - managerp); - - UNLOCK(&createlock); - - return (result); -} - -void -isc_taskmgr_destroy(isc_taskmgr_t **managerp) { - REQUIRE(managerp != NULL && ISCAPI_TASKMGR_VALID(*managerp)); - - (*managerp)->methods->destroy(managerp); - - ENSURE(*managerp == NULL); -} - -void -isc_taskmgr_setmode(isc_taskmgr_t *manager, isc_taskmgrmode_t mode) { - REQUIRE(ISCAPI_TASKMGR_VALID(manager)); - - manager->methods->setmode(manager, mode); -} - -isc_taskmgrmode_t -isc_taskmgr_mode(isc_taskmgr_t *manager) { - REQUIRE(ISCAPI_TASKMGR_VALID(manager)); - - return (manager->methods->mode(manager)); -} - -isc_result_t -isc_task_create(isc_taskmgr_t *manager, unsigned int quantum, - isc_task_t **taskp) -{ - REQUIRE(ISCAPI_TASKMGR_VALID(manager)); - REQUIRE(taskp != NULL && *taskp == NULL); - - return (manager->methods->taskcreate(manager, quantum, taskp)); -} - -void -isc_task_attach(isc_task_t *source, isc_task_t **targetp) { - REQUIRE(ISCAPI_TASK_VALID(source)); - REQUIRE(targetp != NULL && *targetp == NULL); - - source->methods->attach(source, targetp); - - ENSURE(*targetp == source); -} - -void -isc_task_detach(isc_task_t **taskp) { - REQUIRE(taskp != NULL && ISCAPI_TASK_VALID(*taskp)); - - (*taskp)->methods->detach(taskp); - - ENSURE(*taskp == NULL); -} - -void -isc_task_send(isc_task_t *task, isc_event_t **eventp) { - REQUIRE(ISCAPI_TASK_VALID(task)); - REQUIRE(eventp != NULL && *eventp != NULL); - - task->methods->send(task, eventp); - - ENSURE(*eventp == NULL); -} - -void -isc_task_sendanddetach(isc_task_t **taskp, isc_event_t **eventp) { - REQUIRE(taskp != NULL && ISCAPI_TASK_VALID(*taskp)); - REQUIRE(eventp != NULL && *eventp != NULL); - - (*taskp)->methods->sendanddetach(taskp, eventp); - - ENSURE(*taskp == NULL && *eventp == NULL); -} - -unsigned int -isc_task_unsend(isc_task_t *task, void *sender, isc_eventtype_t type, - void *tag, isc_eventlist_t *events) -{ - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->unsend(task, sender, type, tag, events)); -} - -isc_result_t -isc_task_onshutdown(isc_task_t *task, isc_taskaction_t action, const void *arg) -{ - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->onshutdown(task, action, arg)); -} - -void -isc_task_shutdown(isc_task_t *task) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - task->methods->shutdown(task); -} - -void -isc_task_setname(isc_task_t *task, const char *name, void *tag) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - task->methods->setname(task, name, tag); -} - -unsigned int -isc_task_purge(isc_task_t *task, void *sender, isc_eventtype_t type, void *tag) -{ - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->purgeevents(task, sender, type, tag)); -} - -void -isc_taskmgr_setexcltask(isc_taskmgr_t *mgr, isc_task_t *task) { - REQUIRE(ISCAPI_TASK_VALID(task)); - return (mgr->methods->setexcltask(mgr, task)); -} - -isc_result_t -isc_taskmgr_excltask(isc_taskmgr_t *mgr, isc_task_t **taskp) { - return (mgr->methods->excltask(mgr, taskp)); -} - -isc_result_t -isc_task_beginexclusive(isc_task_t *task) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->beginexclusive(task)); -} - -void -isc_task_endexclusive(isc_task_t *task) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - task->methods->endexclusive(task); -} - -void -isc_task_setprivilege(isc_task_t *task, isc_boolean_t priv) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - task->methods->setprivilege(task, priv); -} - -isc_boolean_t -isc_task_privilege(isc_task_t *task) { - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->privilege(task)); -} - - -/*% - * This is necessary for libisc's internal timer implementation. Other - * implementation might skip implementing this. - */ -unsigned int -isc_task_purgerange(isc_task_t *task, void *sender, isc_eventtype_t first, - isc_eventtype_t last, void *tag) -{ - REQUIRE(ISCAPI_TASK_VALID(task)); - - return (task->methods->purgerange(task, sender, first, last, tag)); -} diff --git a/lib/isc/task_p.h b/lib/isc/task_p.h index 8c1e4c52fa..834aa1702c 100644 --- a/lib/isc/task_p.h +++ b/lib/isc/task_p.h @@ -22,7 +22,7 @@ /*! \file */ -#if defined(BIND9) && defined(ISC_PLATFORM_USETHREADS) +#if defined(ISC_PLATFORM_USETHREADS) void isc__taskmgr_pause(isc_taskmgr_t *taskmgr); @@ -34,6 +34,6 @@ isc__taskmgr_ready(isc_taskmgr_t *taskmgr); isc_result_t isc__taskmgr_dispatch(isc_taskmgr_t *taskmgr); -#endif /* !BIND9 || !ISC_PLATFORM_USETHREADS */ +#endif /* !ISC_PLATFORM_USETHREADS */ #endif /* ISC_TASK_P_H */ diff --git a/lib/isc/timer.c b/lib/isc/timer.c index 23fcbbef64..bc65b6d4be 100644 --- a/lib/isc/timer.c +++ b/lib/isc/timer.c @@ -21,12 +21,14 @@ #include +#include #include #include #include #include #include #include +#include #include #include #include @@ -39,13 +41,11 @@ #endif /* See task.c about the following definition: */ -#ifdef BIND9 #ifdef ISC_PLATFORM_USETHREADS #define USE_TIMER_THREAD #else #define USE_SHARED_MANAGER #endif /* ISC_PLATFORM_USETHREADS */ -#endif /* BIND9 */ #ifndef USE_TIMER_THREAD #include "timer_p.h" @@ -118,38 +118,33 @@ struct isc__timermgr { }; /*% - * The followings can be either static or public, depending on build - * environment. + * The following are intended for internal use (indicated by "isc__" + * prefix) but are not declared as static, allowing direct access from + * unit tests etc. */ -#ifdef BIND9 -#define ISC_TIMERFUNC_SCOPE -#else -#define ISC_TIMERFUNC_SCOPE static -#endif - -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timer_create(isc_timermgr_t *manager, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, const void *arg, isc_timer_t **timerp); -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timer_reset(isc_timer_t *timer, isc_timertype_t type, - const isc_time_t *expires, const isc_interval_t *interval, + const isc_time_t *expires, const isc_interval_t *interval, isc_boolean_t purge); -ISC_TIMERFUNC_SCOPE isc_timertype_t -isc__timer_gettype(isc_timer_t *timer); -ISC_TIMERFUNC_SCOPE isc_result_t +isc_timertype_t +isc_timer_gettype(isc_timer_t *timer); +isc_result_t isc__timer_touch(isc_timer_t *timer); -ISC_TIMERFUNC_SCOPE void +void isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp); -ISC_TIMERFUNC_SCOPE void +void isc__timer_detach(isc_timer_t **timerp); -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp); -ISC_TIMERFUNC_SCOPE void -isc__timermgr_poke(isc_timermgr_t *manager0); -ISC_TIMERFUNC_SCOPE void +void +isc_timermgr_poke(isc_timermgr_t *manager0); +void isc__timermgr_destroy(isc_timermgr_t **managerp); static struct isc__timermethods { @@ -158,36 +153,26 @@ static struct isc__timermethods { /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *gettype; -#endif } timermethods = { { isc__timer_attach, isc__timer_detach, isc__timer_reset, isc__timer_touch - } -#ifndef BIND9 - , - (void *)isc__timer_gettype -#endif + }, + (void *)isc_timer_gettype }; static struct isc__timermgrmethods { isc_timermgrmethods_t methods; -#ifndef BIND9 void *poke; /* see above */ -#endif } timermgrmethods = { { isc__timermgr_destroy, isc__timer_create - } -#ifndef BIND9 - , - (void *)isc__timermgr_poke -#endif + }, + (void *)isc_timermgr_poke }; #ifdef USE_SHARED_MANAGER @@ -390,7 +375,7 @@ destroy(isc__timer_t *timer) { isc_mem_put(manager->mctx, timer, sizeof(*timer)); } -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_task_t *task, isc_taskaction_t action, const void *arg, @@ -512,7 +497,7 @@ isc__timer_create(isc_timermgr_t *manager0, isc_timertype_t type, return (ISC_R_SUCCESS); } -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, const isc_time_t *expires, const isc_interval_t *interval, isc_boolean_t purge) @@ -588,8 +573,8 @@ isc__timer_reset(isc_timer_t *timer0, isc_timertype_t type, return (result); } -ISC_TIMERFUNC_SCOPE isc_timertype_t -isc__timer_gettype(isc_timer_t *timer0) { +isc_timertype_t +isc_timer_gettype(isc_timer_t *timer0) { isc__timer_t *timer = (isc__timer_t *)timer0; isc_timertype_t t; @@ -602,7 +587,7 @@ isc__timer_gettype(isc_timer_t *timer0) { return (t); } -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timer_touch(isc_timer_t *timer0) { isc__timer_t *timer = (isc__timer_t *)timer0; isc_result_t result; @@ -633,7 +618,7 @@ isc__timer_touch(isc_timer_t *timer0) { return (result); } -ISC_TIMERFUNC_SCOPE void +void isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) { isc__timer_t *timer = (isc__timer_t *)timer0; @@ -651,7 +636,7 @@ isc__timer_attach(isc_timer_t *timer0, isc_timer_t **timerp) { *timerp = (isc_timer_t *)timer; } -ISC_TIMERFUNC_SCOPE void +void isc__timer_detach(isc_timer_t **timerp) { isc__timer_t *timer; isc_boolean_t free_timer = ISC_FALSE; @@ -867,7 +852,7 @@ set_index(void *what, unsigned int index) { timer->index = index; } -ISC_TIMERFUNC_SCOPE isc_result_t +isc_result_t isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { isc__timermgr_t *manager; isc_result_t result; @@ -948,8 +933,8 @@ isc__timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { return (ISC_R_SUCCESS); } -ISC_TIMERFUNC_SCOPE void -isc__timermgr_poke(isc_timermgr_t *manager0) { +void +isc_timermgr_poke(isc_timermgr_t *manager0) { #ifdef USE_TIMER_THREAD isc__timermgr_t *manager = (isc__timermgr_t *)manager0; @@ -961,7 +946,7 @@ isc__timermgr_poke(isc_timermgr_t *manager0) { #endif } -ISC_TIMERFUNC_SCOPE void +void isc__timermgr_destroy(isc_timermgr_t **managerp) { isc__timermgr_t *manager; isc_mem_t *mctx; @@ -1064,9 +1049,146 @@ isc__timermgr_dispatch(isc_timermgr_t *manager0) { } #endif /* USE_TIMER_THREAD */ -#ifdef USE_TIMERIMPREGISTER isc_result_t isc__timer_register() { return (isc_timer_register(isc__timermgr_create)); } -#endif + +static isc_mutex_t createlock; +static isc_once_t once = ISC_ONCE_INIT; +static isc_timermgrcreatefunc_t timermgr_createfunc = NULL; + +static void +initialize(void) { + RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); +} + +isc_result_t +isc_timer_register(isc_timermgrcreatefunc_t createfunc) { + isc_result_t result = ISC_R_SUCCESS; + + RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); + + LOCK(&createlock); + if (timermgr_createfunc == NULL) + timermgr_createfunc = createfunc; + else + result = ISC_R_EXISTS; + UNLOCK(&createlock); + + return (result); +} + +isc_result_t +isc_timermgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, + isc_timermgr_t **managerp) +{ + isc_result_t result; + + LOCK(&createlock); + + REQUIRE(timermgr_createfunc != NULL); + result = (*timermgr_createfunc)(mctx, managerp); + + UNLOCK(&createlock); + + if (result == ISC_R_SUCCESS) + isc_appctx_settimermgr(actx, *managerp); + + return (result); +} + +isc_result_t +isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { + isc_result_t result; + + if (isc_bind9) + return (isc__timermgr_create(mctx, managerp)); + + LOCK(&createlock); + + REQUIRE(timermgr_createfunc != NULL); + result = (*timermgr_createfunc)(mctx, managerp); + + UNLOCK(&createlock); + + return (result); +} + +void +isc_timermgr_destroy(isc_timermgr_t **managerp) { + REQUIRE(*managerp != NULL && ISCAPI_TIMERMGR_VALID(*managerp)); + + if (isc_bind9) + isc__timermgr_destroy(managerp); + else + (*managerp)->methods->destroy(managerp); + + ENSURE(*managerp == NULL); +} + +isc_result_t +isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type, + const isc_time_t *expires, const isc_interval_t *interval, + isc_task_t *task, isc_taskaction_t action, const void *arg, + isc_timer_t **timerp) +{ + REQUIRE(ISCAPI_TIMERMGR_VALID(manager)); + + if (isc_bind9) + return (isc__timer_create(manager, type, expires, interval, + task, action, arg, timerp)); + + return (manager->methods->timercreate(manager, type, expires, + interval, task, action, arg, + timerp)); +} + +void +isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp) { + REQUIRE(ISCAPI_TIMER_VALID(timer)); + REQUIRE(timerp != NULL && *timerp == NULL); + + if (isc_bind9) + isc__timer_attach(timer, timerp); + else + timer->methods->attach(timer, timerp); + + ENSURE(*timerp == timer); +} + +void +isc_timer_detach(isc_timer_t **timerp) { + REQUIRE(timerp != NULL && ISCAPI_TIMER_VALID(*timerp)); + + if (isc_bind9) + isc__timer_detach(timerp); + else + (*timerp)->methods->detach(timerp); + + ENSURE(*timerp == NULL); +} + +isc_result_t +isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, + const isc_time_t *expires, const isc_interval_t *interval, + isc_boolean_t purge) +{ + REQUIRE(ISCAPI_TIMER_VALID(timer)); + + if (isc_bind9) + return (isc__timer_reset(timer, type, expires, + interval, purge)); + + return (timer->methods->reset(timer, type, expires, interval, purge)); +} + +isc_result_t +isc_timer_touch(isc_timer_t *timer) { + REQUIRE(ISCAPI_TIMER_VALID(timer)); + + if (isc_bind9) + return (isc__timer_touch(timer)); + + return (timer->methods->touch(timer)); +} diff --git a/lib/isc/timer_api.c b/lib/isc/timer_api.c deleted file mode 100644 index 39b33e3c74..0000000000 --- a/lib/isc/timer_api.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (C) 2009, 2012 Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: timer_api.c,v 1.4 2009/09/02 23:48:02 tbox Exp $ */ - -#include - -#include - -#include -#include -#include -#include -#include -#include - -static isc_mutex_t createlock; -static isc_once_t once = ISC_ONCE_INIT; -static isc_timermgrcreatefunc_t timermgr_createfunc = NULL; - -static void -initialize(void) { - RUNTIME_CHECK(isc_mutex_init(&createlock) == ISC_R_SUCCESS); -} - -isc_result_t -isc_timer_register(isc_timermgrcreatefunc_t createfunc) { - isc_result_t result = ISC_R_SUCCESS; - - RUNTIME_CHECK(isc_once_do(&once, initialize) == ISC_R_SUCCESS); - - LOCK(&createlock); - if (timermgr_createfunc == NULL) - timermgr_createfunc = createfunc; - else - result = ISC_R_EXISTS; - UNLOCK(&createlock); - - return (result); -} - -isc_result_t -isc_timermgr_createinctx(isc_mem_t *mctx, isc_appctx_t *actx, - isc_timermgr_t **managerp) -{ - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(timermgr_createfunc != NULL); - result = (*timermgr_createfunc)(mctx, managerp); - - UNLOCK(&createlock); - - if (result == ISC_R_SUCCESS) - isc_appctx_settimermgr(actx, *managerp); - - return (result); -} - -isc_result_t -isc_timermgr_create(isc_mem_t *mctx, isc_timermgr_t **managerp) { - isc_result_t result; - - LOCK(&createlock); - - REQUIRE(timermgr_createfunc != NULL); - result = (*timermgr_createfunc)(mctx, managerp); - - UNLOCK(&createlock); - - return (result); -} - -void -isc_timermgr_destroy(isc_timermgr_t **managerp) { - REQUIRE(*managerp != NULL && ISCAPI_TIMERMGR_VALID(*managerp)); - - (*managerp)->methods->destroy(managerp); - - ENSURE(*managerp == NULL); -} - -isc_result_t -isc_timer_create(isc_timermgr_t *manager, isc_timertype_t type, - const isc_time_t *expires, const isc_interval_t *interval, - isc_task_t *task, isc_taskaction_t action, const void *arg, - isc_timer_t **timerp) -{ - REQUIRE(ISCAPI_TIMERMGR_VALID(manager)); - - return (manager->methods->timercreate(manager, type, expires, - interval, task, action, arg, - timerp)); -} - -void -isc_timer_attach(isc_timer_t *timer, isc_timer_t **timerp) { - REQUIRE(ISCAPI_TIMER_VALID(timer)); - REQUIRE(timerp != NULL && *timerp == NULL); - - timer->methods->attach(timer, timerp); - - ENSURE(*timerp == timer); -} - -void -isc_timer_detach(isc_timer_t **timerp) { - REQUIRE(timerp != NULL && ISCAPI_TIMER_VALID(*timerp)); - - (*timerp)->methods->detach(timerp); - - ENSURE(*timerp == NULL); -} - -isc_result_t -isc_timer_reset(isc_timer_t *timer, isc_timertype_t type, - const isc_time_t *expires, const isc_interval_t *interval, - isc_boolean_t purge) -{ - REQUIRE(ISCAPI_TIMER_VALID(timer)); - - return (timer->methods->reset(timer, type, expires, interval, purge)); -} - -isc_result_t -isc_timer_touch(isc_timer_t *timer) { - REQUIRE(ISCAPI_TIMER_VALID(timer)); - - return (timer->methods->touch(timer)); -} diff --git a/lib/isc/unix/app.c b/lib/isc/unix/app.c index 5393be9425..0d45288ec2 100644 --- a/lib/isc/unix/app.c +++ b/lib/isc/unix/app.c @@ -48,65 +48,50 @@ #include #include +#ifdef ISC_PLATFORM_USETHREADS +#include +#endif + /*% * For BIND9 internal applications built with threads, we use a single app * context and let multiple worker, I/O, timer threads do actual jobs. * For other cases (including BIND9 built without threads) an app context acts * as an event loop dispatching various events. */ -#if defined(ISC_PLATFORM_USETHREADS) && defined(BIND9) -#define USE_THREADS_SINGLECTX -#endif - -#ifdef ISC_PLATFORM_USETHREADS -#include -#endif - -#ifndef USE_THREADS_SINGLECTX +#ifndef ISC_PLATFORM_USETHREADS #include "../timer_p.h" #include "../task_p.h" #include "socket_p.h" -#endif /* USE_THREADS_SINGLECTX */ +#endif /* ISC_PLATFORM_USETHREADS */ #ifdef ISC_PLATFORM_USETHREADS static pthread_t blockedthread; #endif /* ISC_PLATFORM_USETHREADS */ /*% - * The following can be either static or public, depending on build environment. + * The following are intended for internal use (indicated by "isc__" + * prefix) but are not declared as static, allowing direct access from + * unit tests etc. */ - -#ifdef BIND9 -#define ISC_APPFUNC_SCOPE -#else -#define ISC_APPFUNC_SCOPE static -#endif - -ISC_APPFUNC_SCOPE isc_result_t isc__app_start(void); -ISC_APPFUNC_SCOPE isc_result_t isc__app_ctxstart(isc_appctx_t *ctx); -ISC_APPFUNC_SCOPE isc_result_t isc__app_onrun(isc_mem_t *mctx, - isc_task_t *task, - isc_taskaction_t action, - void *arg); -ISC_APPFUNC_SCOPE isc_result_t isc__app_ctxrun(isc_appctx_t *ctx); -ISC_APPFUNC_SCOPE isc_result_t isc__app_run(void); -ISC_APPFUNC_SCOPE isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx); -ISC_APPFUNC_SCOPE isc_result_t isc__app_shutdown(void); -ISC_APPFUNC_SCOPE isc_result_t isc__app_reload(void); -ISC_APPFUNC_SCOPE isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx); -ISC_APPFUNC_SCOPE void isc__app_ctxfinish(isc_appctx_t *ctx); -ISC_APPFUNC_SCOPE void isc__app_finish(void); -ISC_APPFUNC_SCOPE void isc__app_block(void); -ISC_APPFUNC_SCOPE void isc__app_unblock(void); -ISC_APPFUNC_SCOPE isc_result_t isc__appctx_create(isc_mem_t *mctx, - isc_appctx_t **ctxp); -ISC_APPFUNC_SCOPE void isc__appctx_destroy(isc_appctx_t **ctxp); -ISC_APPFUNC_SCOPE void isc__appctx_settaskmgr(isc_appctx_t *ctx, - isc_taskmgr_t *taskmgr); -ISC_APPFUNC_SCOPE void isc__appctx_setsocketmgr(isc_appctx_t *ctx, - isc_socketmgr_t *socketmgr); -ISC_APPFUNC_SCOPE void isc__appctx_settimermgr(isc_appctx_t *ctx, - isc_timermgr_t *timermgr); +isc_result_t isc__app_start(void); +isc_result_t isc__app_ctxstart(isc_appctx_t *ctx); +isc_result_t isc__app_onrun(isc_mem_t *mctx, isc_task_t *task, + isc_taskaction_t action, void *arg); +isc_result_t isc__app_ctxrun(isc_appctx_t *ctx); +isc_result_t isc__app_run(void); +isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx); +isc_result_t isc__app_shutdown(void); +isc_result_t isc__app_reload(void); +isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx); +void isc__app_ctxfinish(isc_appctx_t *ctx); +void isc__app_finish(void); +void isc__app_block(void); +void isc__app_unblock(void); +isc_result_t isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp); +void isc__appctx_destroy(isc_appctx_t **ctxp); +void isc__appctx_settaskmgr(isc_appctx_t *ctx, isc_taskmgr_t *taskmgr); +void isc__appctx_setsocketmgr(isc_appctx_t *ctx, isc_socketmgr_t *socketmgr); +void isc__appctx_settimermgr(isc_appctx_t *ctx, isc_timermgr_t *timermgr); /* * The application context of this module. This implementation actually @@ -137,6 +122,10 @@ typedef struct isc__appctx { isc_taskmgr_t *taskmgr; isc_socketmgr_t *socketmgr; isc_timermgr_t *timermgr; +#ifdef ISC_PLATFORM_USETHREADS + isc_mutex_t readylock; + isc_condition_t ready; +#endif /* ISC_PLATFORM_USETHREADS */ } isc__appctx_t; static isc__appctx_t isc_g_appctx; @@ -147,10 +136,8 @@ static struct { /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *run, *shutdown, *start, *onrun, *reload, *finish, - *block, *unblock; -#endif + *block, *unblock; } appmethods = { { isc__appctx_destroy, @@ -162,14 +149,15 @@ static struct { isc__appctx_settaskmgr, isc__appctx_setsocketmgr, isc__appctx_settimermgr - } -#ifndef BIND9 - , - (void *)isc__app_run, (void *)isc__app_shutdown, - (void *)isc__app_start, (void *)isc__app_onrun, (void *)isc__app_reload, - (void *)isc__app_finish, (void *)isc__app_block, + }, + (void *)isc__app_run, + (void *)isc__app_shutdown, + (void *)isc__app_start, + (void *)isc__app_onrun, + (void *)isc__app_reload, + (void *)isc__app_finish, + (void *)isc__app_block, (void *)isc__app_unblock -#endif }; #ifdef HAVE_LINUXTHREADS @@ -193,12 +181,14 @@ exit_action(int arg) { isc_g_appctx.want_shutdown = ISC_TRUE; } +#ifdef ISC_PLATFORM_USETHREADS static void reload_action(int arg) { UNUSED(arg); isc_g_appctx.want_reload = ISC_TRUE; } #endif +#endif static isc_result_t handle_signal(int sig, void (*handler)(int)) { @@ -222,10 +212,14 @@ handle_signal(int sig, void (*handler)(int)) { return (ISC_R_SUCCESS); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_ctxstart(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; isc_result_t result; + int presult; + sigset_t sset; + char strbuf[ISC_STRERRORSIZE]; + REQUIRE(VALID_APPCTX(ctx)); @@ -246,13 +240,27 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { } #endif +#ifdef ISC_PLATFORM_USETHREADS #ifdef HAVE_LINUXTHREADS main_thread = pthread_self(); -#endif +#endif /* HAVE_LINUXTHREADS */ + + result = isc_mutex_init(&ctx->readylock); + if (result != ISC_R_SUCCESS) + return (result); + + result = isc_condition_init(&ctx->ready); + if (result != ISC_R_SUCCESS) + goto cleanup_rlock; result = isc_mutex_init(&ctx->lock); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup_rcond; +#else + result = isc_mutex_init(&ctx->lock); + if (result != ISC_R_SUCCESS) + goto cleanup; +#endif ISC_LIST_INIT(ctx->on_run); @@ -262,26 +270,6 @@ isc__app_ctxstart(isc_appctx_t *ctx0) { ctx->want_reload = ISC_FALSE; ctx->blocked = ISC_FALSE; - return (ISC_R_SUCCESS); -} - -ISC_APPFUNC_SCOPE isc_result_t -isc__app_start(void) { - isc_result_t result; - int presult; - sigset_t sset; - char strbuf[ISC_STRERRORSIZE]; - - isc_g_appctx.common.impmagic = APPCTX_MAGIC; - isc_g_appctx.common.magic = ISCAPI_APPCTX_MAGIC; - isc_g_appctx.common.methods = &appmethods.methods; - isc_g_appctx.mctx = NULL; - /* The remaining members will be initialized in ctxstart() */ - - result = isc__app_ctxstart((isc_appctx_t *)&isc_g_appctx); - if (result != ISC_R_SUCCESS) - return (result); - #ifndef HAVE_SIGWAIT /* * Install do-nothing handlers for SIGINT and SIGTERM. @@ -292,10 +280,10 @@ isc__app_start(void) { */ result = handle_signal(SIGINT, exit_action); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; result = handle_signal(SIGTERM, exit_action); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; #endif /* @@ -303,7 +291,7 @@ isc__app_start(void) { */ result = handle_signal(SIGPIPE, SIG_IGN); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; /* * On Solaris 2, delivery of a signal whose action is SIG_IGN @@ -316,15 +304,15 @@ isc__app_start(void) { */ result = handle_signal(SIGHUP, SIG_DFL); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; #ifdef HAVE_SIGWAIT result = handle_signal(SIGTERM, SIG_DFL); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; result = handle_signal(SIGINT, SIG_DFL); if (result != ISC_R_SUCCESS) - return (result); + goto cleanup; #endif #ifdef ISC_PLATFORM_USETHREADS @@ -344,7 +332,8 @@ isc__app_start(void) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() sigsetops: %s", strbuf); - return (ISC_R_UNEXPECTED); + result = ISC_R_UNEXPECTED; + goto cleanup; } presult = pthread_sigmask(SIG_BLOCK, &sset, NULL); if (presult != 0) { @@ -352,7 +341,8 @@ isc__app_start(void) { UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() pthread_sigmask: %s", strbuf); - return (ISC_R_UNEXPECTED); + result = ISC_R_UNEXPECTED; + goto cleanup; } #else /* ISC_PLATFORM_USETHREADS */ /* @@ -369,21 +359,44 @@ isc__app_start(void) { isc__strerror(errno, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() sigsetops: %s", strbuf); - return (ISC_R_UNEXPECTED); + result = ISC_R_UNEXPECTED; + goto cleanup; } presult = sigprocmask(SIG_UNBLOCK, &sset, NULL); if (presult != 0) { isc__strerror(presult, strbuf, sizeof(strbuf)); UNEXPECTED_ERROR(__FILE__, __LINE__, "isc_app_start() sigprocmask: %s", strbuf); - return (ISC_R_UNEXPECTED); + result = ISC_R_UNEXPECTED; + goto cleanup; } #endif /* ISC_PLATFORM_USETHREADS */ return (ISC_R_SUCCESS); + + cleanup: +#ifdef ISC_PLATFORM_USETHREADS + cleanup_rcond: + isc_condition_destroy(&ctx->ready); + + cleanup_rlock: + isc_mutex_destroy(&ctx->readylock); +#endif /* ISC_PLATFORM_USETHREADS */ + return (result); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t +isc__app_start(void) { + isc_g_appctx.common.impmagic = APPCTX_MAGIC; + isc_g_appctx.common.magic = ISCAPI_APPCTX_MAGIC; + isc_g_appctx.common.methods = &appmethods.methods; + isc_g_appctx.mctx = NULL; + /* The remaining members will be initialized in ctxstart() */ + + return (isc__app_ctxstart((isc_appctx_t *)&isc_g_appctx)); +} + +isc_result_t isc__app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, void *arg) { @@ -420,7 +433,7 @@ isc__app_onrun(isc_mem_t *mctx, isc_task_t *task, isc_taskaction_t action, return (result); } -#ifndef USE_THREADS_SINGLECTX +#ifndef ISC_PLATFORM_USETHREADS /*! * Event loop for nonthreaded programs. */ @@ -498,9 +511,7 @@ evloop(isc__appctx_t *ctx) { } return (ISC_R_SUCCESS); } -#endif /* USE_THREADS_SINGLECTX */ -#ifndef ISC_PLATFORM_USETHREADS /* * This is a gross hack to support waiting for condition * variables in nonthreaded programs in a limited way; @@ -560,22 +571,21 @@ isc__nothread_signal_hack(isc_condition_t *cp) { signalled = ISC_TRUE; return (ISC_R_SUCCESS); } - #endif /* ISC_PLATFORM_USETHREADS */ -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_ctxrun(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; int result; isc_event_t *event, *next_event; isc_task_t *task; -#ifdef USE_THREADS_SINGLECTX +#ifdef ISC_PLATFORM_USETHREADS sigset_t sset; char strbuf[ISC_STRERRORSIZE]; #ifdef HAVE_SIGWAIT int sig; -#endif -#endif /* USE_THREADS_SINGLECTX */ +#endif /* HAVE_SIGWAIT */ +#endif /* ISC_PLATFORM_USETHREADS */ REQUIRE(VALID_APPCTX(ctx)); @@ -605,79 +615,97 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { UNLOCK(&ctx->lock); -#ifndef HAVE_SIGWAIT +#ifndef ISC_PLATFORM_USETHREADS + (void) isc__taskmgr_dispatch(ctx->taskmgr); + result = evloop(ctx); + return (result); +#else /* ISC_PLATFORM_USETHREADS */ /* - * Catch SIGHUP. - * - * We do this here to ensure that the signal handler is installed - * (i.e. that it wasn't a "one-shot" handler). + * BIND9 internal tools using multiple contexts do not + * rely on signal. */ - if (ctx == &isc_g_appctx) { - result = handle_signal(SIGHUP, reload_action); - if (result != ISC_R_SUCCESS) - return (ISC_R_SUCCESS); - } -#endif - -#ifdef USE_THREADS_SINGLECTX - /* - * When we are using multiple contexts, we don't rely on signals. - */ - if (ctx != &isc_g_appctx) + if (isc_bind9 && ctx != &isc_g_appctx) return (ISC_R_SUCCESS); /* - * There is no danger if isc_app_shutdown() is called before we wait - * for signals. Signals are blocked, so any such signal will simply - * be made pending and we will get it when we call sigwait(). + * There is no danger if isc_app_shutdown() is called before we + * wait for signals. Signals are blocked, so any such signal will + * simply be made pending and we will get it when we call + * sigwait(). */ - while (!ctx->want_shutdown) { #ifdef HAVE_SIGWAIT - /* - * Wait for SIGHUP, SIGINT, or SIGTERM. - */ - if (sigemptyset(&sset) != 0 || - sigaddset(&sset, SIGHUP) != 0 || - sigaddset(&sset, SIGINT) != 0 || - sigaddset(&sset, SIGTERM) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_run() sigsetops: %s", strbuf); - return (ISC_R_UNEXPECTED); - } + if (isc_bind9) { + /* + * BIND9 internal; single context: + * Wait for SIGHUP, SIGINT, or SIGTERM. + */ + if (sigemptyset(&sset) != 0 || + sigaddset(&sset, SIGHUP) != 0 || + sigaddset(&sset, SIGINT) != 0 || + sigaddset(&sset, SIGTERM) != 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_run() sigsetops: %s", + strbuf); + return (ISC_R_UNEXPECTED); + } #ifndef HAVE_UNIXWARE_SIGWAIT - result = sigwait(&sset, &sig); - if (result == 0) { - if (sig == SIGINT || sig == SIGTERM) - ctx->want_shutdown = ISC_TRUE; - else if (sig == SIGHUP) - ctx->want_reload = ISC_TRUE; - } + result = sigwait(&sset, &sig); + if (result == 0) { + if (sig == SIGINT || sig == SIGTERM) + ctx->want_shutdown = ISC_TRUE; + else if (sig == SIGHUP) + ctx->want_reload = ISC_TRUE; + } #else /* Using UnixWare sigwait semantics. */ - sig = sigwait(&sset); - if (sig >= 0) { - if (sig == SIGINT || sig == SIGTERM) - ctx->want_shutdown = ISC_TRUE; - else if (sig == SIGHUP) - ctx->want_reload = ISC_TRUE; - } - + sig = sigwait(&sset); + if (sig >= 0) { + if (sig == SIGINT || sig == SIGTERM) + ctx->want_shutdown = ISC_TRUE; + else if (sig == SIGHUP) + ctx->want_reload = ISC_TRUE; + } #endif /* HAVE_UNIXWARE_SIGWAIT */ -#else /* Don't have sigwait(). */ - /* - * Listen for all signals. - */ - if (sigemptyset(&sset) != 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_run() sigsetops: %s", - strbuf); - return (ISC_R_UNEXPECTED); + } else { + /* + * External, or BIND9 using multiple contexts: + * wait until woken up. + */ + LOCK(&ctx->readylock); + WAIT(&ctx->ready, &ctx->readylock); + UNLOCK(&ctx->readylock); + } +#else /* Don't have sigwait(). */ + if (isc_bind9) { + /* + * BIND9 internal; single context: + * Install a signal handler for SIGHUP, then wait for + * all signals. + */ + result = handle_signal(SIGHUP, reload_action); + if (result != ISC_R_SUCCESS) + return (ISC_R_SUCCESS); + + if (sigemptyset(&sset) != 0) { + isc__strerror(errno, strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_run() sigsetops: %s", + strbuf); + return (ISC_R_UNEXPECTED); + } + result = sigsuspend(&sset); + } else { + /* + * External, or BIND9 using multiple contexts: + * wait until woken up. + */ + LOCK(&ctx->readylock); + WAIT(&ctx->ready, &ctx->readylock); + UNLOCK(&ctx->readylock); } - result = sigsuspend(&sset); #endif /* HAVE_SIGWAIT */ if (ctx->want_reload) { @@ -689,29 +717,22 @@ isc__app_ctxrun(isc_appctx_t *ctx0) { exit(1); } -#else /* USE_THREADS_SINGLECTX */ - - (void)isc__taskmgr_dispatch(ctx->taskmgr); - - result = evloop(ctx); - if (result != ISC_R_SUCCESS) - return (result); - -#endif /* USE_THREADS_SINGLECTX */ - return (ISC_R_SUCCESS); +#endif /* ISC_PLATFORM_USETHREADS */ } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_run() { return (isc__app_ctxrun((isc_appctx_t *)&isc_g_appctx)); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_ctxshutdown(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; isc_boolean_t want_kill = ISC_TRUE; +#ifdef ISC_PLATFORM_USETHREADS char strbuf[ISC_STRERRORSIZE]; +#endif /* ISC_PLATFORM_USETHREADS */ REQUIRE(VALID_APPCTX(ctx)); @@ -727,46 +748,66 @@ isc__app_ctxshutdown(isc_appctx_t *ctx0) { UNLOCK(&ctx->lock); if (want_kill) { - if (ctx != &isc_g_appctx) + if (isc_bind9 && ctx != &isc_g_appctx) + /* BIND9 internal, but using multiple contexts */ ctx->want_shutdown = ISC_TRUE; else { +#ifndef ISC_PLATFORM_USETHREADS + ctx->want_shutdown = ISC_TRUE; +#else /* ISC_PLATFORM_USETHREADS */ #ifdef HAVE_LINUXTHREADS - int result; + if (isc_bind9) { + /* BIND9 internal, single context */ + int result; - result = pthread_kill(main_thread, SIGTERM); - if (result != 0) { - isc__strerror(result, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_shutdown() " - "pthread_kill: %s", - strbuf); - return (ISC_R_UNEXPECTED); + result = pthread_kill(main_thread, SIGTERM); + if (result != 0) { + isc__strerror(result, + strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_shutdown() " + "pthread_kill: %s", + strbuf); + return (ISC_R_UNEXPECTED); + } } #else - if (kill(getpid(), SIGTERM) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_shutdown() " - "kill: %s", strbuf); - return (ISC_R_UNEXPECTED); + if (isc_bind9) { + /* BIND9 internal, single context */ + if (kill(getpid(), SIGTERM) < 0) { + isc__strerror(errno, + strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_shutdown() " + "kill: %s", strbuf); + return (ISC_R_UNEXPECTED); + } } -#endif /* HAVE_LINUXTHREADS */ +#endif /* HAVE_LINUXTHREADS */ + else { + /* External, multiple contexts */ + ctx->want_shutdown = ISC_TRUE; + SIGNAL(&ctx->ready); + } +#endif /* ISC_PLATFORM_USETHREADS */ } } return (ISC_R_SUCCESS); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_shutdown() { return (isc__app_ctxshutdown((isc_appctx_t *)&isc_g_appctx)); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_ctxsuspend(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; isc_boolean_t want_kill = ISC_TRUE; +#ifdef ISC_PLATFORM_USETHREADS char strbuf[ISC_STRERRORSIZE]; +#endif REQUIRE(VALID_APPCTX(ctx)); @@ -783,42 +824,60 @@ isc__app_ctxsuspend(isc_appctx_t *ctx0) { UNLOCK(&ctx->lock); if (want_kill) { - if (ctx != &isc_g_appctx) + if (isc_bind9 && ctx != &isc_g_appctx) + /* BIND9 internal, but using multiple contexts */ ctx->want_reload = ISC_TRUE; else { +#ifndef ISC_PLATFORM_USETHREADS + ctx->want_reload = ISC_TRUE; +#else /* ISC_PLATFORM_USETHREADS */ #ifdef HAVE_LINUXTHREADS - int result; + if (isc_bind9) { + /* BIND9 internal, single context */ + int result; - result = pthread_kill(main_thread, SIGHUP); - if (result != 0) { - isc__strerror(result, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_reload() " - "pthread_kill: %s", - strbuf); - return (ISC_R_UNEXPECTED); + result = pthread_kill(main_thread, SIGHUP); + if (result != 0) { + isc__strerror(result, + strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_reload() " + "pthread_kill: %s", + strbuf); + return (ISC_R_UNEXPECTED); + } } #else - if (kill(getpid(), SIGHUP) < 0) { - isc__strerror(errno, strbuf, sizeof(strbuf)); - UNEXPECTED_ERROR(__FILE__, __LINE__, - "isc_app_reload() " - "kill: %s", strbuf); - return (ISC_R_UNEXPECTED); + if (isc_bind9) { + /* BIND9 internal, single context */ + if (kill(getpid(), SIGHUP) < 0) { + isc__strerror(errno, + strbuf, sizeof(strbuf)); + UNEXPECTED_ERROR(__FILE__, __LINE__, + "isc_app_reload() " + "kill: %s", strbuf); + return (ISC_R_UNEXPECTED); + } } -#endif +#endif /* HAVE_LINUXTHREADS */ + else { + /* External, multiple contexts */ + ctx->want_reload = ISC_TRUE; + SIGNAL(&ctx->ready); + } +#endif /* ISC_PLATFORM_USETHREADS */ } } return (ISC_R_SUCCESS); } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__app_reload(void) { return (isc__app_ctxsuspend((isc_appctx_t *)&isc_g_appctx)); } -ISC_APPFUNC_SCOPE void +void isc__app_ctxfinish(isc_appctx_t *ctx0) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; @@ -827,12 +886,12 @@ isc__app_ctxfinish(isc_appctx_t *ctx0) { DESTROYLOCK(&ctx->lock); } -ISC_APPFUNC_SCOPE void +void isc__app_finish(void) { isc__app_ctxfinish((isc_appctx_t *)&isc_g_appctx); } -ISC_APPFUNC_SCOPE void +void isc__app_block(void) { #ifdef ISC_PLATFORM_USETHREADS sigset_t sset; @@ -850,7 +909,7 @@ isc__app_block(void) { #endif /* ISC_PLATFORM_USETHREADS */ } -ISC_APPFUNC_SCOPE void +void isc__app_unblock(void) { #ifdef ISC_PLATFORM_USETHREADS sigset_t sset; @@ -871,7 +930,7 @@ isc__app_unblock(void) { #endif /* ISC_PLATFORM_USETHREADS */ } -ISC_APPFUNC_SCOPE isc_result_t +isc_result_t isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) { isc__appctx_t *ctx; @@ -898,7 +957,7 @@ isc__appctx_create(isc_mem_t *mctx, isc_appctx_t **ctxp) { return (ISC_R_SUCCESS); } -ISC_APPFUNC_SCOPE void +void isc__appctx_destroy(isc_appctx_t **ctxp) { isc__appctx_t *ctx; @@ -911,7 +970,7 @@ isc__appctx_destroy(isc_appctx_t **ctxp) { *ctxp = NULL; } -ISC_APPFUNC_SCOPE void +void isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; @@ -920,7 +979,7 @@ isc__appctx_settaskmgr(isc_appctx_t *ctx0, isc_taskmgr_t *taskmgr) { ctx->taskmgr = taskmgr; } -ISC_APPFUNC_SCOPE void +void isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; @@ -929,7 +988,7 @@ isc__appctx_setsocketmgr(isc_appctx_t *ctx0, isc_socketmgr_t *socketmgr) { ctx->socketmgr = socketmgr; } -ISC_APPFUNC_SCOPE void +void isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) { isc__appctx_t *ctx = (isc__appctx_t *)ctx0; @@ -938,9 +997,9 @@ isc__appctx_settimermgr(isc_appctx_t *ctx0, isc_timermgr_t *timermgr) { ctx->timermgr = timermgr; } -#ifdef USE_APPIMPREGISTER isc_result_t isc__app_register() { return (isc_app_register(isc__appctx_create)); } -#endif + +#include "../app_api.c" diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index de4ee52c81..5676b997a6 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -599,7 +599,7 @@ try_dscp_v4(void) { hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; - hints.ai_flags = AI_PASSIVE; + hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; n = getaddrinfo("127.0.0.1", NULL, &hints, &res0); if (n != 0 || res0 == NULL) { @@ -610,6 +610,7 @@ try_dscp_v4(void) { } s = socket(res0->ai_family, res0->ai_socktype, res0->ai_protocol); + if (s == -1) { isc__strerror(errno, strbuf, sizeof(strbuf)); isc_log_write(isc_lctx, ISC_LOGCATEGORY_GENERAL, @@ -660,7 +661,7 @@ try_dscp_v6(void) { hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; - hints.ai_flags = AI_PASSIVE; + hints.ai_flags = AI_PASSIVE | AI_NUMERICHOST; n = getaddrinfo("::1", NULL, &hints, &res0); if (n != 0 || res0 == NULL) { diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index 9ad64c6d59..2f2774d9a8 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -78,13 +78,11 @@ #include "errno2result.h" /* See task.c about the following definition: */ -#ifdef BIND9 #ifdef ISC_PLATFORM_USETHREADS #define USE_WATCHER_THREAD #else #define USE_SHARED_MANAGER #endif /* ISC_PLATFORM_USETHREADS */ -#endif /* BIND9 */ #ifndef USE_WATCHER_THREAD #include "socket_p.h" @@ -466,56 +464,49 @@ static isc_boolean_t process_ctlfd(isc__socketmgr_t *manager); static void setdscp(isc__socket_t *sock, isc_dscp_t dscp); /*% - * The following can be either static or public, depending on build environment. + * The following are intended for internal use (indicated by "isc__" + * prefix) but are not declared as static, allowing direct access from + * unit tests etc. */ -#ifdef BIND9 -#define ISC_SOCKETFUNC_SCOPE -#else -#define ISC_SOCKETFUNC_SCOPE static -#endif - -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t +isc__socket_open(isc_socket_t *sock0); +isc_result_t +isc__socket_close(isc_socket_t *sock0); +isc_result_t isc__socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type, isc_socket_t **socketp); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_attach(isc_socket_t *sock, isc_socket_t **socketp); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_detach(isc_socket_t **socketp); -ISC_SOCKETFUNC_SCOPE isc_result_t -isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp); -ISC_SOCKETFUNC_SCOPE isc_result_t -isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, - unsigned int maxsocks); -ISC_SOCKETFUNC_SCOPE void -isc__socketmgr_destroy(isc_socketmgr_t **managerp); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recvv(isc_socket_t *sock, isc_bufferlist_t *buflist, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recv(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recv2(isc_socket_t *sock, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_send(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendto(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, const void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendtov(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, const void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendto2(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, @@ -525,71 +516,85 @@ isc_socket_socketevent(isc_mem_t *mctx, void *sender, isc_eventtype_t eventtype, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_cleanunix(isc_sockaddr_t *sockaddr, isc_boolean_t active); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, isc_uint32_t owner, isc_uint32_t group); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_bind(isc_socket_t *sock, isc_sockaddr_t *sockaddr, unsigned int options); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_filter(isc_socket_t *sock, const char *filter); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_listen(isc_socket_t *sock, unsigned int backlog); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_accept(isc_socket_t *sock, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, const void *arg); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_getpeername(isc_socket_t *sock, isc_sockaddr_t *addressp); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_getsockname(isc_socket_t *sock, isc_sockaddr_t *addressp); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_cancel(isc_socket_t *sock, isc_task_t *task, unsigned int how); -ISC_SOCKETFUNC_SCOPE isc_sockettype_t +isc_sockettype_t isc__socket_gettype(isc_socket_t *sock); -ISC_SOCKETFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__socket_isbound(isc_socket_t *sock); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_ipv6only(isc_socket_t *sock, isc_boolean_t yes); -ISC_SOCKETFUNC_SCOPE void +void isc__socket_dscp(isc_socket_t *sock, isc_dscp_t dscp); -#ifdef BIND9 -#ifdef HAVE_LIBXML2 -ISC_SOCKETFUNC_SCOPE void -isc__socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer); -#endif -#ifdef HAVE_JSON -ISC_SOCKETFUNC_SCOPE isc_result_t -isc__socketmgr_renderjson(isc_socketmgr_t *mgr0, json_object *stats); -#endif -#endif /* BIND9 */ - -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_fdwatchcreate(isc_socketmgr_t *manager, int fd, int flags, isc_sockfdwatch_t callback, void *cbarg, isc_task_t *task, isc_socket_t **socketp); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_fdwatchpoke(isc_socket_t *sock, int flags); -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_dup(isc_socket_t *sock, isc_socket_t **socketp); -ISC_SOCKETFUNC_SCOPE int +int isc__socket_getfd(isc_socket_t *sock); +isc_result_t +isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp); +isc_result_t +isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, + unsigned int maxsocks); +isc_result_t +isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager0, unsigned int *nsockp); +void +isc_socketmgr_setstats(isc_socketmgr_t *manager0, isc_stats_t *stats); +void +isc__socketmgr_destroy(isc_socketmgr_t **managerp); +void +isc__socket_setname(isc_socket_t *socket0, const char *name, void *tag); +const char * +isc__socket_getname(isc_socket_t *socket0); +void * +isc__socket_gettag(isc_socket_t *socket0); + +#ifdef HAVE_LIBXML2 +void +isc__socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer); +#endif +#ifdef HAVE_JSON +isc_result_t +isc__socketmgr_renderjson(isc_socketmgr_t *mgr0, json_object *stats); +#endif + static struct { isc_socketmethods_t methods; /*% * The following are defined just for avoiding unused static functions. */ -#ifndef BIND9 void *recvv, *send, *sendv, *sendto2, *cleanunix, *permunix, *filter, - *listen, *accept, *getpeername, *isbound; -#endif + *listen, *accept, *getpeername, *isbound; } socketmethods = { { isc__socket_attach, @@ -608,16 +613,13 @@ static struct { isc__socket_dup, isc__socket_getfd, isc__socket_dscp - } -#ifndef BIND9 - , + }, (void *)isc__socket_recvv, (void *)isc__socket_send, (void *)isc__socket_sendv, (void *)isc__socket_sendto2, (void *)isc__socket_cleanunix, (void *)isc__socket_permunix, (void *)isc__socket_filter, (void *)isc__socket_listen, (void *)isc__socket_accept, (void *)isc__socket_getpeername, (void *)isc__socket_isbound -#endif }; static isc_socketmgrmethods_t socketmgrmethods = { @@ -1482,7 +1484,6 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev, memcpy(CMSG_DATA(cmsgp), &use_min_mtu, sizeof(use_min_mtu)); #endif } -#ifdef BIND9 if (isc_dscp_check_value != -1) { if (sock->type == isc_sockettype_udp) INSIST((int)dev->dscp == isc_dscp_check_value); @@ -1556,7 +1557,6 @@ build_msghdr_send(isc__socket_t *sock, isc_socketevent_t *dev, strbuf); } } -#endif } #endif #endif /* USE_CMSG && ISC_PLATFORM_HAVEIPV6 */ @@ -2834,7 +2834,7 @@ socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, * called with 'arg' as the arg value. The new socket is returned * in 'socketp'. */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, isc_socket_t **socketp) { @@ -2845,7 +2845,7 @@ isc__socket_create(isc_socketmgr_t *manager0, int pf, isc_sockettype_t type, * Duplicate an existing socket. The new socket is returned * in 'socketp'. */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_dup(isc_socket_t *sock0, isc_socket_t **socketp) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -2857,8 +2857,7 @@ isc__socket_dup(isc_socket_t *sock0, isc_socket_t **socketp) { sock0)); } -#ifdef BIND9 -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_open(isc_socket_t *sock0) { isc_result_t result; isc__socket_t *sock = (isc__socket_t *)sock0; @@ -2901,7 +2900,6 @@ isc__socket_open(isc_socket_t *sock0) { return (result); } -#endif /* BIND9 */ /* * Create a new 'type' socket managed by 'manager'. Events @@ -2909,7 +2907,7 @@ isc__socket_open(isc_socket_t *sock0) { * called with 'arg' as the arg value. The new socket is returned * in 'socketp'. */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags, isc_sockfdwatch_t callback, void *cbarg, isc_task_t *task, isc_socket_t **socketp) @@ -2974,7 +2972,7 @@ isc__socket_fdwatchcreate(isc_socketmgr_t *manager0, int fd, int flags, * it is for writing but could be used for reading if desired */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_fdwatchpoke(isc_socket_t *sock0, int flags) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -3008,7 +3006,7 @@ isc__socket_fdwatchpoke(isc_socket_t *sock0, int flags) /* * Attach to a socket. Caller must explicitly detach when it is done. */ -ISC_SOCKETFUNC_SCOPE void +void isc__socket_attach(isc_socket_t *sock0, isc_socket_t **socketp) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -3026,7 +3024,7 @@ isc__socket_attach(isc_socket_t *sock0, isc_socket_t **socketp) { * Dereference a socket. If this is the last reference to it, clean things * up by destroying the socket. */ -ISC_SOCKETFUNC_SCOPE void +void isc__socket_detach(isc_socket_t **socketp) { isc__socket_t *sock; isc_boolean_t kill_socket = ISC_FALSE; @@ -3048,8 +3046,7 @@ isc__socket_detach(isc_socket_t **socketp) { *socketp = NULL; } -#ifdef BIND9 -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_close(isc_socket_t *sock0) { isc__socket_t *sock = (isc__socket_t *)sock0; int fd; @@ -3091,7 +3088,6 @@ isc__socket_close(isc_socket_t *sock0) { return (ISC_R_SUCCESS); } -#endif /* BIND9 */ /* * I/O is possible on a given socket. Schedule an event to this task that @@ -4124,8 +4120,7 @@ watcher(void *uap) { } #endif /* USE_WATCHER_THREAD */ -#ifdef BIND9 -ISC_SOCKETFUNC_SCOPE void +void isc__socketmgr_setreserved(isc_socketmgr_t *manager0, isc_uint32_t reserved) { isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0; @@ -4134,15 +4129,14 @@ isc__socketmgr_setreserved(isc_socketmgr_t *manager0, isc_uint32_t reserved) { manager->reserved = reserved; } -ISC_SOCKETFUNC_SCOPE void -isc___socketmgr_maxudp(isc_socketmgr_t *manager0, int maxudp) { +void +isc__socketmgr_maxudp(isc_socketmgr_t *manager0, int maxudp) { isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0; REQUIRE(VALID_MANAGER(manager)); manager->maxudp = maxudp; } -#endif /* BIND9 */ /* * Create a new socket manager. @@ -4358,12 +4352,12 @@ cleanup_watcher(isc_mem_t *mctx, isc__socketmgr_t *manager) { #endif /* USE_KQUEUE */ } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socketmgr_create(isc_mem_t *mctx, isc_socketmgr_t **managerp) { return (isc__socketmgr_create2(mctx, managerp, 0)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, unsigned int maxsocks) { @@ -4542,9 +4536,8 @@ free_manager: return (result); } -#ifdef BIND9 isc_result_t -isc__socketmgr_getmaxsockets(isc_socketmgr_t *manager0, unsigned int *nsockp) { +isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager0, unsigned int *nsockp) { isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0; REQUIRE(VALID_MANAGER(manager)); REQUIRE(nsockp != NULL); @@ -4555,7 +4548,7 @@ isc__socketmgr_getmaxsockets(isc_socketmgr_t *manager0, unsigned int *nsockp) { } void -isc__socketmgr_setstats(isc_socketmgr_t *manager0, isc_stats_t *stats) { +isc_socketmgr_setstats(isc_socketmgr_t *manager0, isc_stats_t *stats) { isc__socketmgr_t *manager = (isc__socketmgr_t *)manager0; REQUIRE(VALID_MANAGER(manager)); @@ -4565,9 +4558,8 @@ isc__socketmgr_setstats(isc_socketmgr_t *manager0, isc_stats_t *stats) { isc_stats_attach(stats, &manager->stats); } -#endif -ISC_SOCKETFUNC_SCOPE void +void isc__socketmgr_destroy(isc_socketmgr_t **managerp) { isc__socketmgr_t *manager; int i; @@ -4745,7 +4737,7 @@ socket_recv(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, return (result); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recvv(isc_socket_t *sock0, isc_bufferlist_t *buflist, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, const void *arg) @@ -4800,7 +4792,7 @@ isc__socket_recvv(isc_socket_t *sock0, isc_bufferlist_t *buflist, return (socket_recv(sock, dev, task, 0)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recv(isc_socket_t *sock0, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_taskaction_t action, const void *arg) @@ -4825,7 +4817,7 @@ isc__socket_recv(isc_socket_t *sock0, isc_region_t *region, return (isc__socket_recv2(sock0, region, minimum, task, dev, 0)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_recv2(isc_socket_t *sock0, isc_region_t *region, unsigned int minimum, isc_task_t *task, isc_socketevent_t *event, unsigned int flags) @@ -4947,7 +4939,7 @@ socket_send(isc__socket_t *sock, isc_socketevent_t *dev, isc_task_t *task, return (result); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_send(isc_socket_t *sock, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, const void *arg) { @@ -4958,7 +4950,7 @@ isc__socket_send(isc_socket_t *sock, isc_region_t *region, NULL)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendto(isc_socket_t *sock0, isc_region_t *region, isc_task_t *task, isc_taskaction_t action, const void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) @@ -4987,7 +4979,7 @@ isc__socket_sendto(isc_socket_t *sock0, isc_region_t *region, return (socket_send(sock, dev, task, address, pktinfo, 0)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, const void *arg) { @@ -4995,7 +4987,7 @@ isc__socket_sendv(isc_socket_t *sock, isc_bufferlist_t *buflist, NULL)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendtov(isc_socket_t *sock0, isc_bufferlist_t *buflist, isc_task_t *task, isc_taskaction_t action, const void *arg, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo) @@ -5036,7 +5028,7 @@ isc__socket_sendtov(isc_socket_t *sock0, isc_bufferlist_t *buflist, return (socket_send(sock, dev, task, address, pktinfo, 0)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_sendto2(isc_socket_t *sock0, isc_region_t *region, isc_task_t *task, isc_sockaddr_t *address, struct in6_pktinfo *pktinfo, @@ -5059,7 +5051,7 @@ isc__socket_sendto2(isc_socket_t *sock0, isc_region_t *region, return (socket_send(sock, event, task, address, pktinfo, flags)); } -ISC_SOCKETFUNC_SCOPE void +void isc__socket_cleanunix(isc_sockaddr_t *sockaddr, isc_boolean_t active) { #ifdef ISC_PLATFORM_HAVESYSUNH int s; @@ -5189,7 +5181,7 @@ isc__socket_cleanunix(isc_sockaddr_t *sockaddr, isc_boolean_t active) { #endif } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, isc_uint32_t owner, isc_uint32_t group) { @@ -5243,7 +5235,7 @@ isc__socket_permunix(isc_sockaddr_t *sockaddr, isc_uint32_t perm, #endif } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_bind(isc_socket_t *sock0, isc_sockaddr_t *sockaddr, unsigned int options) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -5319,7 +5311,7 @@ isc__socket_bind(isc_socket_t *sock0, isc_sockaddr_t *sockaddr, */ #undef ENABLE_ACCEPTFILTER -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_filter(isc_socket_t *sock0, const char *filter) { isc__socket_t *sock = (isc__socket_t *)sock0; #if defined(SO_ACCEPTFILTER) && defined(ENABLE_ACCEPTFILTER) @@ -5359,7 +5351,7 @@ isc__socket_filter(isc_socket_t *sock0, const char *filter) { * is a new connection we'll have to allocate a new one anyway, so we might * as well keep things simple rather than having to track them. */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_listen(isc_socket_t *sock0, unsigned int backlog) { isc__socket_t *sock = (isc__socket_t *)sock0; char strbuf[ISC_STRERRORSIZE]; @@ -5394,7 +5386,7 @@ isc__socket_listen(isc_socket_t *sock0, unsigned int backlog) { /* * This should try to do aggressive accept() XXXMLG */ -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_accept(isc_socket_t *sock0, isc_task_t *task, isc_taskaction_t action, const void *arg) { @@ -5469,7 +5461,7 @@ isc__socket_accept(isc_socket_t *sock0, return (ISC_R_SUCCESS); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_connect(isc_socket_t *sock0, isc_sockaddr_t *addr, isc_task_t *task, isc_taskaction_t action, const void *arg) { @@ -5730,7 +5722,7 @@ internal_connect(isc_task_t *me, isc_event_t *ev) { isc_task_sendanddetach(&task, ISC_EVENT_PTR(&dev)); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_getpeername(isc_socket_t *sock0, isc_sockaddr_t *addressp) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_result_t result; @@ -5752,7 +5744,7 @@ isc__socket_getpeername(isc_socket_t *sock0, isc_sockaddr_t *addressp) { return (result); } -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc__socket_getsockname(isc_socket_t *sock0, isc_sockaddr_t *addressp) { isc__socket_t *sock = (isc__socket_t *)sock0; ISC_SOCKADDR_LEN_T len; @@ -5791,7 +5783,7 @@ isc__socket_getsockname(isc_socket_t *sock0, isc_sockaddr_t *addressp) { * Run through the list of events on this socket, and cancel the ones * queued for task "task" of type "how". "how" is a bitmask. */ -ISC_SOCKETFUNC_SCOPE void +void isc__socket_cancel(isc_socket_t *sock0, isc_task_t *task, unsigned int how) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -5912,7 +5904,7 @@ isc__socket_cancel(isc_socket_t *sock0, isc_task_t *task, unsigned int how) { UNLOCK(&sock->lock); } -ISC_SOCKETFUNC_SCOPE isc_sockettype_t +isc_sockettype_t isc__socket_gettype(isc_socket_t *sock0) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -5921,7 +5913,7 @@ isc__socket_gettype(isc_socket_t *sock0) { return (sock->type); } -ISC_SOCKETFUNC_SCOPE isc_boolean_t +isc_boolean_t isc__socket_isbound(isc_socket_t *sock0) { isc__socket_t *sock = (isc__socket_t *)sock0; isc_boolean_t val; @@ -5935,7 +5927,7 @@ isc__socket_isbound(isc_socket_t *sock0) { return (val); } -ISC_SOCKETFUNC_SCOPE void +void isc__socket_ipv6only(isc_socket_t *sock0, isc_boolean_t yes) { isc__socket_t *sock = (isc__socket_t *)sock0; #if defined(IPV6_V6ONLY) @@ -6012,7 +6004,7 @@ setdscp(isc__socket_t *sock, isc_dscp_t dscp) { #endif } -ISC_SOCKETFUNC_SCOPE void +void isc__socket_dscp(isc_socket_t *sock0, isc_dscp_t dscp) { isc__socket_t *sock = (isc__socket_t *)sock0; @@ -6150,7 +6142,6 @@ isc__socketmgr_dispatch(isc_socketmgr_t *manager0, isc_socketwait_t *swait) { } #endif /* USE_WATCHER_THREAD */ -#ifdef BIND9 void isc__socket_setname(isc_socket_t *socket0, const char *name, void *tag) { isc__socket_t *socket = (isc__socket_t *)socket0; @@ -6168,7 +6159,7 @@ isc__socket_setname(isc_socket_t *socket0, const char *name, void *tag) { UNLOCK(&socket->lock); } -ISC_SOCKETFUNC_SCOPE const char * +const char * isc__socket_getname(isc_socket_t *socket0) { isc__socket_t *socket = (isc__socket_t *)socket0; @@ -6181,24 +6172,19 @@ isc__socket_gettag(isc_socket_t *socket0) { return (socket->tag); } -#endif /* BIND9 */ -#ifdef USE_SOCKETIMPREGISTER isc_result_t isc__socket_register() { return (isc_socket_register(isc__socketmgr_create)); } -#endif -ISC_SOCKETFUNC_SCOPE int +int isc__socket_getfd(isc_socket_t *socket0) { isc__socket_t *socket = (isc__socket_t *)socket0; return ((short) socket->fd); } -#ifdef BIND9 - #if defined(HAVE_LIBXML2) || defined(HAVE_JSON) static const char * _socktype(isc_sockettype_t type) @@ -6218,7 +6204,7 @@ _socktype(isc_sockettype_t type) #ifdef HAVE_LIBXML2 #define TRY0(a) do { xmlrc = (a); if (xmlrc < 0) goto error; } while(0) -ISC_SOCKETFUNC_SCOPE int +int isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer) { isc__socketmgr_t *mgr = (isc__socketmgr_t *)mgr0; isc__socket_t *sock = NULL; @@ -6335,7 +6321,7 @@ isc_socketmgr_renderxml(isc_socketmgr_t *mgr0, xmlTextWriterPtr writer) { } \ } while(0) -ISC_SOCKETFUNC_SCOPE isc_result_t +isc_result_t isc_socketmgr_renderjson(isc_socketmgr_t *mgr0, json_object *stats) { isc_result_t result = ISC_R_SUCCESS; isc__socketmgr_t *mgr = (isc__socketmgr_t *)mgr0; @@ -6466,4 +6452,5 @@ isc_socketmgr_renderjson(isc_socketmgr_t *mgr0, json_object *stats) { return (result); } #endif /* HAVE_JSON */ -#endif /* BIND9 */ + +#include "../socket_api.c" diff --git a/lib/isc/win32/app.c b/lib/isc/win32/app.c index 04b1638783..ac5cba482a 100644 --- a/lib/isc/win32/app.c +++ b/lib/isc/win32/app.c @@ -258,3 +258,5 @@ isc__app_unblock(void) { blocked = ISC_FALSE; REQUIRE(blockedthread == GetCurrentThread()); } + +#include "../app_api.c" diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index 07716712b5..91219d482f 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -2669,7 +2669,7 @@ isc__socketmgr_create2(isc_mem_t *mctx, isc_socketmgr_t **managerp, } isc_result_t -isc__socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) { +isc_socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) { REQUIRE(VALID_MANAGER(manager)); REQUIRE(nsockp != NULL); @@ -2677,7 +2677,7 @@ isc__socketmgr_getmaxsockets(isc_socketmgr_t *manager, unsigned int *nsockp) { } void -isc__socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) { +isc_socketmgr_setstats(isc_socketmgr_t *manager, isc_stats_t *stats) { REQUIRE(VALID_MANAGER(manager)); REQUIRE(ISC_LIST_EMPTY(manager->socklist)); REQUIRE(manager->stats == NULL); @@ -4036,3 +4036,5 @@ error: return (xmlrc); } #endif /* HAVE_LIBXML2 */ + +#include "../socket_api.c" diff --git a/lib/isccfg/Makefile.in b/lib/isccfg/Makefile.in index 19ec61edd9..3f6781b566 100644 --- a/lib/isccfg/Makefile.in +++ b/lib/isccfg/Makefile.in @@ -43,10 +43,12 @@ LIBS = @LIBS@ SUBDIRS = include # Alphabetically -OBJS = aclconf.@O@ log.@O@ namedconf.@O@ parser.@O@ version.@O@ +OBJS = aclconf.@O@ dnsconf.@O@ log.@O@ namedconf.@O@ \ + parser.@O@ version.@O@ # Alphabetically -SRCS = aclconf.c log.c namedconf.c parser.c version.c +SRCS = aclconf.c dnsconf.c log.c namedconf.c \ + parser.c version.c TARGETS = timestamp diff --git a/lib/export/samples/Makefile-postinstall.in b/lib/samples/Makefile-postinstall.in similarity index 100% rename from lib/export/samples/Makefile-postinstall.in rename to lib/samples/Makefile-postinstall.in diff --git a/lib/export/samples/Makefile.in b/lib/samples/Makefile.in similarity index 86% rename from lib/export/samples/Makefile.in rename to lib/samples/Makefile.in index 194aaeb24a..db3548572f 100644 --- a/lib/export/samples/Makefile.in +++ b/lib/samples/Makefile.in @@ -16,14 +16,12 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ -export_srcdir = @top_srcdir@/lib/export @BIND9_VERSION@ @BIND9_MAKE_INCLUDES@ CINCLUDES = -I${srcdir}/include -I../dns/include \ - -I${export_srcdir}/isc/include \ ${DNS_INCLUDES} ${ISC_INCLUDES} \ -I${top_srcdir}/lib/irs/include \ -I../../irs/include @@ -41,21 +39,21 @@ ISCDEPLIBS = ../isc/libisc.@A@ ISCCFGDEPLIBS = ../isccfg/libisccfg.@A@ IRSDEPLIBS = ../irs/libirs.@A@ -DEPLIBS = ${DNSDEPLIBS} ${ISCCFGDEPLIBS} ${ISCDEPLIBS} +DEPLIBS = ${DNSDEPLIBS} ${ISCDEPLIBS} ${ISCCFGDEPLIBS} LIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@ SUBDIRS = -TARGETS = sample@EXEEXT@ sample-async@EXEEXT@ sample-gai@EXEEXT@ \ +TARGETS = resolve@EXEEXT@ sample-async@EXEEXT@ sample-gai@EXEEXT@ \ sample-update@EXEEXT@ sample-request@EXEEXT@ nsprobe@EXEEXT@ -OBJS = sample.@O@ sample-async.@O@ sample-gai.@O@ sample-update.@O@ \ +OBJS = resolve.@O@ sample-async.@O@ sample-gai.@O@ sample-update.@O@ \ sample-request.@O@ nsprobe.@O@ UOBJS = -SRCS = sample.c sample-async.c sample-gai.c sample-update.c \ +SRCS = resolve.c sample-async.c sample-gai.c sample-update.c \ sample-request.c nsprobe.c MANPAGES = @@ -66,9 +64,9 @@ MANOBJS = ${MANPAGES} ${HTMLPAGES} @BIND9_MAKE_RULES@ -sample@EXEEXT@: sample.@O@ ${DEPLIBS} +resolve@EXEEXT@: resolve.@O@ ${IRSDEPLIBS} ${DEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample.@O@ ${LIBS} + resolve.@O@ ${IRSLIBS} ${LIBS} sample-async@EXEEXT@: sample-async.@O@ ${DEPLIBS} ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ @@ -97,3 +95,4 @@ docclean manclean maintainer-clean:: clean distclean maintainer-clean:: rm -f ${TARGETS} + rm -f sample.key diff --git a/lib/export/samples/nsprobe.c b/lib/samples/nsprobe.c similarity index 100% rename from lib/export/samples/nsprobe.c rename to lib/samples/nsprobe.c diff --git a/lib/export/samples/sample.c b/lib/samples/resolve.c similarity index 89% rename from lib/export/samples/sample.c rename to lib/samples/resolve.c index 1b3f33ff3d..f03c6910ad 100644 --- a/lib/export/samples/sample.c +++ b/lib/samples/resolve.c @@ -14,8 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: sample.c,v 1.5 2009/09/29 15:06:07 fdupont Exp $ */ - #include #include @@ -38,6 +36,8 @@ #include #include +#include + #include #include #include @@ -83,10 +83,10 @@ usage(void) ISC_PLATFORM_NORETURN_POST; static void usage(void) { - fprintf(stderr, "sample [-t RRtype] " + fprintf(stderr, "resolve [-t RRtype] " "[[-a algorithm] [-e] -k keyname -K keystring] " - "[-s domain:serveraddr_for_domain ] " - "server_address hostname\n"); + "[-S domain:serveraddr_for_domain ] [-s server_address]" + "hostname\n"); exit(1); } @@ -230,6 +230,7 @@ int main(int argc, char *argv[]) { int ch; isc_textregion_t tr; + char *server = NULL; char *altserver = NULL; char *altserveraddr = NULL; char *altservername = NULL; @@ -248,8 +249,9 @@ main(int argc, char *argv[]) { unsigned int clientopt, resopt; isc_boolean_t is_sep = ISC_FALSE; const char *port = "53"; + isc_mem_t *mctx = NULL; - while ((ch = getopt(argc, argv, "a:es:t:k:K:p:")) != -1) { + while ((ch = getopt(argc, argv, "a:es:t:k:K:p:S:")) != -1) { switch (ch) { case 't': tr.base = optarg; @@ -267,7 +269,7 @@ main(int argc, char *argv[]) { case 'e': is_sep = ISC_TRUE; break; - case 's': + case 'S': if (altserver != NULL) { fprintf(stderr, "alternate server " "already defined: %s\n", @@ -276,6 +278,15 @@ main(int argc, char *argv[]) { } altserver = optarg; break; + case 's': + if (server != NULL) { + fprintf(stderr, "server " + "already defined: %s\n", + server); + exit(1); + } + server = optarg; + break; case 'k': keynamestr = optarg; break; @@ -292,7 +303,7 @@ main(int argc, char *argv[]) { argc -= optind; argv += optind; - if (argc < 2) + if (argc < 1) usage(); if (altserver != NULL) { @@ -316,6 +327,12 @@ main(int argc, char *argv[]) { exit(1); } + result = isc_mem_create(0, 0, &mctx); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "failed to crate mctx\n"); + exit(1); + } + clientopt = 0; result = dns_client_create(&client, clientopt); if (result != ISC_R_SUCCESS) { @@ -324,7 +341,22 @@ main(int argc, char *argv[]) { } /* Set the nameserver */ - addserver(client, argv[0], port, NULL); + if (server == NULL) { + irs_resconf_t *resconf = NULL; + isc_sockaddrlist_t *nameservers; + + result = irs_resconf_load(mctx, "/etc/resolv.conf", &resconf); + nameservers = irs_resconf_getnameservers(resconf); + result = dns_client_setservers(client, dns_rdataclass_in, + NULL, nameservers); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "dns_client_setservers failed: %d\n", + result); + exit(1); + } + } else { + addserver(client, server, port, NULL); + } /* Set the alternate nameserver (when specified) */ if (altserver != NULL) @@ -342,8 +374,8 @@ main(int argc, char *argv[]) { } /* Construct qname */ - namelen = strlen(argv[1]); - isc_buffer_init(&b, argv[1], namelen); + namelen = strlen(argv[0]); + isc_buffer_init(&b, argv[0], namelen); isc_buffer_add(&b, namelen); dns_fixedname_init(&qname0); qname = dns_fixedname_name(&qname0); diff --git a/lib/samples/rootkey.sh b/lib/samples/rootkey.sh new file mode 100644 index 0000000000..e26f153863 --- /dev/null +++ b/lib/samples/rootkey.sh @@ -0,0 +1,16 @@ +#!/bin/sh +# Fetch a copy of a current root signing key; used for testing +# DNSSEC validation in 'sample'. +# +# After running this script, "sample `cat sample.key` " will +# perform a lookup as specified in and validate the result +# using the root key. +# +# (This is NOT a secure method of obtaining the root key; it is +# included here for testing purposes only.) +dig +noall +answer dnskey . | perl -n -e ' +local ($dn, $ttl, $class, $type, $flags, $proto, $alg, @rest) = split; +next if ($flags != 257); +local $key = join("", @rest); +print "-a $alg -e -k $dn -K $key\n" +' > sample.key diff --git a/lib/export/samples/sample-async.c b/lib/samples/sample-async.c similarity index 100% rename from lib/export/samples/sample-async.c rename to lib/samples/sample-async.c diff --git a/lib/export/samples/sample-gai.c b/lib/samples/sample-gai.c similarity index 100% rename from lib/export/samples/sample-gai.c rename to lib/samples/sample-gai.c diff --git a/lib/export/samples/sample-request.c b/lib/samples/sample-request.c similarity index 100% rename from lib/export/samples/sample-request.c rename to lib/samples/sample-request.c diff --git a/lib/export/samples/sample-update.c b/lib/samples/sample-update.c similarity index 100% rename from lib/export/samples/sample-update.c rename to lib/samples/sample-update.c diff --git a/make/rules.in b/make/rules.in index 37bc50d82f..5db4e6f18f 100644 --- a/make/rules.in +++ b/make/rules.in @@ -35,8 +35,6 @@ sysconfdir = @sysconfdir@ localstatedir = @localstatedir@ mandir = @mandir@ datarootdir = @datarootdir@ -export_libdir = @export_libdir@ -export_includedir = @export_includedir@ DESTDIR =