~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/net/ipsock_posix.go

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-11-18 15:12:26 UTC
  • mfrom: (14.2.12 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141118151226-zug7vn93mn3dtiz3
Tags: 2:1.3.2-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - Support co-installability with gccgo-go tool:
    - d/rules,golang-go.install: Rename bin/go -> bin/golang-go
    - d/golang-go.{postinst,prerm}: Install/remove /usr/bin/go using
      alternatives.
  - d/copyright: Amendments for full compiliance with copyright format.
  - d/control: Demote golang-go.tools to Suggests to support Ubuntu MIR.
  - dropped patches (now upstream):
    - d/p/issue27650045_40001_50001.diff
    - d/p/issue28050043_60001_70001.diff
    - d/p/issue54790044_100001_110001.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
4
 
5
 
// +build darwin dragonfly freebsd linux netbsd openbsd windows
 
5
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows
6
6
 
7
7
// Internet protocol family sockets for POSIX
8
8
 
40
40
func probeIPv6Stack() (supportsIPv6, supportsIPv4map bool) {
41
41
        var probes = []struct {
42
42
                laddr TCPAddr
 
43
                value int
43
44
                ok    bool
44
45
        }{
45
46
                // IPv6 communication capability
46
 
                {TCPAddr{IP: ParseIP("::1")}, false},
 
47
                {laddr: TCPAddr{IP: ParseIP("::1")}, value: 1},
47
48
                // IPv6 IPv4-mapped address communication capability
48
 
                {TCPAddr{IP: IPv4(127, 0, 0, 1)}, false},
 
49
                {laddr: TCPAddr{IP: IPv4(127, 0, 0, 1)}, value: 0},
49
50
        }
50
51
 
51
52
        for i := range probes {
54
55
                        continue
55
56
                }
56
57
                defer closesocket(s)
57
 
                syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, 0)
 
58
                syscall.SetsockoptInt(s, syscall.IPPROTO_IPV6, syscall.IPV6_V6ONLY, probes[i].value)
58
59
                sa, err := probes[i].laddr.sockaddr(syscall.AF_INET6)
59
60
                if err != nil {
60
61
                        continue