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 // +build darwin freebsd netbsd openbsd
14 func setIPv4MulticastInterface(fd
*netFD
, ifi
*Interface
) error
{
15 ip
, err
:= interfaceToIPv4Addr(ifi
)
17 return os
.NewSyscallError("setsockopt", err
)
21 if err
:= fd
.incref(false); err
!= nil {
25 err
= syscall
.SetsockoptInet4Addr(fd
.sysfd
, syscall
.IPPROTO_IP
, syscall
.IP_MULTICAST_IF
, a
)
27 return os
.NewSyscallError("setsockopt", err
)
32 func setIPv4MulticastLoopback(fd
*netFD
, v
bool) error
{
33 if err
:= fd
.incref(false); err
!= nil {
37 err
:= syscall
.SetsockoptByte(fd
.sysfd
, syscall
.IPPROTO_IP
, syscall
.IP_MULTICAST_LOOP
, byte(boolint(v
)))
39 return os
.NewSyscallError("setsockopt", err
)