tests.sh revision 0f5144163c44a67d9be986383769852a0dae502a
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley# Permission to use, copy, modify, and/or distribute this software for any
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley# purpose with or without fee is hereby granted, provided that the above
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence# copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
15a44745412679c30a6d022733925af70a38b715David Lawrence# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15a44745412679c30a6d022733925af70a38b715David Lawrence# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15a44745412679c30a6d022733925af70a38b715David Lawrence# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15a44745412679c30a6d022733925af70a38b715David Lawrence# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15a44745412679c30a6d022733925af70a38b715David Lawrence# PERFORMANCE OF THIS SOFTWARE.
def8e47c688e2480a4539d69c3d1a0a28a7c0550Mark Andrewsecho "I:check +edns=100 sets version 100 ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +qr +norec +edns=100 soa $zone > dig.out$n
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrencegrep "EDNS: version: 100," dig.out$n > /dev/null || { ret=1; reason="version"; }
8dfa9caeec8e68db0c937e347a3d6629e7627d54Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:check +ednsopt=100 adds option 100 ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +qr +norec +ednsopt=100 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "; OPT=100" dig.out$n > /dev/null || { ret=1; reason="option"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:check +ednsflags=0x80 sets flags to 0080 ($n)"
078d49b63324f01d98301ee21671abee0c41fcdeBob Halley$DIG -p 5300 @10.53.0.1 +qr +norec +ednsflags=0x80 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "MBZ: 0080" dig.out$n > /dev/null || { ret=1; reason="flags"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
ca67883a666bdf314d3da958d5195e7215b1f797Bob Halleyecho "I:Unknown EDNS version ($n)"
b12f0228b32775ee688ed21ddbf3a116c1adfb43Michael Graff$DIG -p 5300 @10.53.0.1 +norec +edns=100 +noednsneg soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "status: BADVERS," dig.out$n > /dev/null || { ret=1; reason="status"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "IN.SOA." dig.out$n > /dev/null && { ret=1; reaons="soa"; }
e496615043400500492fa7b891c515c8e7cb7d08Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:Unknown EDNS option ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +norec +ednsopt=100 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "status: NOERROR," dig.out$n > /dev/null || { ret=1; reason="status"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "; OPT=100" dig.out$n > /dev/null && { ret=1; reason="option"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "IN.SOA." dig.out$n > /dev/null || { ret=1; reason="nosoa"; }
078d49b63324f01d98301ee21671abee0c41fcdeBob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:Unknown EDNS version + option ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +norec +edns=100 +noednsneg +ednsopt=100 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "status: BADVERS," dig.out$n > /dev/null || { ret=1; reason="status"; }
ca67883a666bdf314d3da958d5195e7215b1f797Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
732e0731dec1922747bb3b3147cf2c3d16b22eaaBob Halleygrep "; OPT=100" dig.out$n > /dev/null && { ret=1; reason="option"; }
b12f0228b32775ee688ed21ddbf3a116c1adfb43Michael Graffgrep "IN.SOA." dig.out$n > /dev/null && { ret=1; reason="soa"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyif [ $ret != 0 ]; then echo "I:failed: $reason"; fi
e496615043400500492fa7b891c515c8e7cb7d08Bob Halleyecho "I:Unknown EDNS flag ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +norec +ednsflags=0x80 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "status: NOERROR," dig.out$n > /dev/null || { ret=1; reason="status"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "EDNS:.*MBZ" dig.out$n > /dev/null > /dev/null && { ret=1; reason="mbz"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep ".IN.SOA." dig.out$n > /dev/null || { ret=1; reason="nosoa"; }
2cd0c38115b1efb043ed3104c0d08e51ceade0d7Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
0180ccf72c79b98eb8ee5abbb7331aec6951dd9fBob Halleyecho "I:Unknown EDNS version + flag ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +norec +edns=100 +noednsneg +ednsflags=0x80 soa $zone > dig.out$n
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "status: BADVERS," dig.out$n > /dev/null || { ret=1; reason="status"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halleygrep "EDNS:.*MBZ" dig.out$n > /dev/null > /dev/null && { ret=1; reason="mbz"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "IN.SOA." dig.out$n > /dev/null && { ret=1; reason="soa"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyecho "I:DiG's EDNS negotiation ($n)"
5619558151f1aa4249b3ead979e76876e29278b6Bob Halley$DIG -p 5300 @10.53.0.1 +norec +edns=100 soa $zone > dig.out$n
e496615043400500492fa7b891c515c8e7cb7d08Bob Halleygrep "status: NOERROR," dig.out$n > /dev/null || { ret=1; reason="status"; }
e496615043400500492fa7b891c515c8e7cb7d08Bob Halleygrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleygrep "IN.SOA." dig.out$n > /dev/null || { ret=1; reason="soa"; }
5619558151f1aa4249b3ead979e76876e29278b6Bob Halleyif [ $ret != 0 ]; then echo "I:failed $reason"; fi
28640d1da26d561f4137122fe64e9e8cc08bf11eBob Halleyecho "I:exit status: $status"