mirror of
				https://github.com/golang/go.git
				synced 2025-11-03 18:20:59 +00:00 
			
		
		
		
	net: support IPv6 addresses in ListenMulticastUDP on Windows
Fixes #63529. Change-Id: Id9246af1a72beef3149af571f0891437bba2f4e0 Reviewed-on: https://go-review.googlesource.com/c/go/+/668216 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
This commit is contained in:
		
							parent
							
								
									8270b858ee
								
							
						
					
					
						commit
						c966f1c0c0
					
				
					 3 changed files with 7 additions and 3 deletions
				
			
		
							
								
								
									
										1
									
								
								doc/next/6-stdlib/99-minor/net/63529.md
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								doc/next/6-stdlib/99-minor/net/63529.md
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					On Windows, the [ListenMulticastUDP] now supports IPv6 addresses.
 | 
				
			||||||
| 
						 | 
					@ -610,7 +610,8 @@ func TestIPv6MulticastListener(t *testing.T) {
 | 
				
			||||||
	if !supportsIPv6() {
 | 
						if !supportsIPv6() {
 | 
				
			||||||
		t.Skip("IPv6 is not supported")
 | 
							t.Skip("IPv6 is not supported")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if os.Getuid() != 0 {
 | 
						// On Windows, the test can be run by non-admin users.
 | 
				
			||||||
 | 
						if runtime.GOOS != "windows" && os.Getuid() != 0 {
 | 
				
			||||||
		t.Skip("must be root")
 | 
							t.Skip("must be root")
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -669,7 +670,7 @@ func checkMulticastListener(c *UDPConn, ip IP) error {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func multicastRIBContains(ip IP) (bool, error) {
 | 
					func multicastRIBContains(ip IP) (bool, error) {
 | 
				
			||||||
	switch runtime.GOOS {
 | 
						switch runtime.GOOS {
 | 
				
			||||||
	case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos", "windows":
 | 
						case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos":
 | 
				
			||||||
		return true, nil // not implemented yet
 | 
							return true, nil // not implemented yet
 | 
				
			||||||
	case "linux":
 | 
						case "linux":
 | 
				
			||||||
		if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
 | 
							if runtime.GOARCH == "arm" || runtime.GOARCH == "alpha" {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1192,7 +1192,9 @@ func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) {
 | 
				
			||||||
func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) {
 | 
					func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) {
 | 
				
			||||||
	return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
 | 
						return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { return EWINDOWS }
 | 
					func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) {
 | 
				
			||||||
 | 
						return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq)))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func Getpid() (pid int) { return int(getCurrentProcessId()) }
 | 
					func Getpid() (pid int) { return int(getCurrentProcessId()) }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue