0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsecho "I:check +edns=100 sets version 100 ($n)"
ba751492fcc4f161a18b983d4f018a1a52938cb9Evan Hunt$DIG -p 5300 @10.53.0.1 +qr +norec +edns=100 soa $zone > dig.out$n
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "EDNS: version: 100," dig.out$n > /dev/null || { ret=1; reason="version"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsif [ $ret != 0 ]; then echo "I:failed $reason"; fi
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsecho "I:check +ednsopt=100 adds option 100 ($n)"
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews$DIG -p 5300 @10.53.0.1 +qr +norec +ednsopt=100 soa $zone > dig.out$n
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "; OPT=100" dig.out$n > /dev/null || { ret=1; reason="option"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsif [ $ret != 0 ]; then echo "I:failed $reason"; fi
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsecho "I:check +ednsflags=0x80 sets flags to 0x0080 ($n)"
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews$DIG -p 5300 @10.53.0.1 +qr +norec +ednsflags=0x80 soa $zone > dig.out$n
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "MBZ: 0x0080," dig.out$n > /dev/null || { ret=1; reason="flags"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsif [ $ret != 0 ]; then echo "I:failed $reason"; fi
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsecho "I:Unknown EDNS version ($n)"
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrews$DIG -p 5300 @10.53.0.1 +norec +edns=100 +noednsnegotiation soa $zone > dig.out$n
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "status: BADVERS," dig.out$n > /dev/null || { ret=1; reason="status"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "EDNS: version: 0," dig.out$n > /dev/null || { ret=1; reason="version"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsgrep "IN.SOA." dig.out$n > /dev/null && { ret=1; reaons="soa"; }
7865ea9545f28f12f046b32d24c989e8441b9812Mark Andrewsif [ $ret != 0 ]; then echo "I:failed $reason"; fi
n=`expr $n + 1`
n=`expr $n + 1`
n=`expr $n + 1`
n=`expr $n + 1`
n=`expr $n + 1`
n=`expr $n + 1`
echo "I:exit status: $status"