Merge pull request #1358 from weaveworks/1357-dns-reverse-tombstone
Make reverse dns lookups honor tombstones.
This commit is contained in:
commit
42b64f826b
3 files changed
+27
-4
No files matched your search
@@ -121,7 +121,7 @@ func (n *Nameserver) ReverseLookup(ip address.Address) (string, error) {
|
||||
defer n.RUnlock()
|
||||
|
||||
match, err := n.entries.first(func(e *Entry) bool {
|
||||
return e.Addr == ip
|
||||
return e.Tombstone == 0 && e.Addr == ip
|
||||
})
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
#! /bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
IP=10.2.0.67
|
||||
|
||||
start_suite "Reverse DNS test"
|
||||
|
||||
weave_on $HOST1 launch
|
||||
start_container_with_dns $HOST1 --name=c1
|
||||
|
||||
# We try names in alphabetical order; this is because the
|
||||
# nameserver keeps entries sorted by hostname then address,
|
||||
# so by starting with acontainer then trying bcontainer,
|
||||
# we're guaranteed to have to ignore a tombstone to get the
|
||||
# right result.
|
||||
for name in acontainer bcontainer ccontainer; do
|
||||
start_container $HOST1 $IP/24 --name=$name
|
||||
assert_dns_record $HOST1 c1 $name.weave.local $IP
|
||||
rm_containers $HOST1 $name
|
||||
done
|
||||
|
||||
end_suite
|
||||
+3
-3
@@ -167,9 +167,9 @@ container_ip() {
|
||||
|
||||
# assert_dns_record <host> <container> <name> [<ip> ...]
|
||||
assert_dns_record() {
|
||||
host=$1
|
||||
container=$2
|
||||
name=$3
|
||||
local host=$1
|
||||
local container=$2
|
||||
local name=$3
|
||||
shift 3
|
||||
exp_ips_regex=$(echo "$@" | sed -e 's/ /\\\|/g')
|
||||
|
||||
|
||||
Reference in new issue
Block a user