]> Cypherpunks repositories - gostls13.git/commitdiff
net: fix LookupSRV ordering on plan 9
authorNicolas Owens <mischief@offblast.org>
Fri, 9 Aug 2013 21:16:43 +0000 (14:16 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 9 Aug 2013 21:16:43 +0000 (14:16 -0700)
lookup_plan9.go's lookupSRV is using the wrong order for srv results. order should be weight, priority, port, following the response from /net/dns:

  chi Aug  9 20:31:13 Rread tag 20 count 61 '_xmpp-client._tcp.offblast.org srv 5 0 5222 iota.offblast.org' 72

R=golang-dev, bradfitz
CC=ality, golang-dev, r, rsc
https://golang.org/cl/12708043

src/pkg/net/lookup_plan9.go

index 3a7b9acb943103540b8701d69d57047ba0426f3b..f1204a99f7bbecdef9dad074226e90abb0983d77 100644 (file)
@@ -186,9 +186,9 @@ func lookupSRV(service, proto, name string) (cname string, addrs []*SRV, err err
                if len(f) < 6 {
                        continue
                }
-               port, _, portOk := dtoi(f[2], 0)
+               port, _, portOk := dtoi(f[4], 0)
                priority, _, priorityOk := dtoi(f[3], 0)
-               weight, _, weightOk := dtoi(f[4], 0)
+               weight, _, weightOk := dtoi(f[2], 0)
                if !(portOk && priorityOk && weightOk) {
                        continue
                }