libgo: update to Go 1.11
[official-gcc.git] / libgo / go / net / sockoptip_linux.go
blobbd7d8344258e2418fb8ac8c36463deb19fcec96e
1 // Copyright 2011 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package net
7 import (
8 "runtime"
9 "syscall"
12 func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error {
13 var v int32
14 if ifi != nil {
15 v = int32(ifi.Index)
17 mreq := &syscall.IPMreqn{Ifindex: v}
18 err := fd.pfd.SetsockoptIPMreqn(syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, mreq)
19 runtime.KeepAlive(fd)
20 return wrapSyscallError("setsockopt", err)
23 func setIPv4MulticastLoopback(fd *netFD, v bool) error {
24 err := fd.pfd.SetsockoptInt(syscall.IPPROTO_IP, syscall.IP_MULTICAST_LOOP, boolint(v))
25 runtime.KeepAlive(fd)
26 return wrapSyscallError("setsockopt", err)