func setIPv4MulticastInterface(fd int, ifi *net.Interface) error { ip, err := netInterfaceToIP4(ifi) if err != nil { return os.NewSyscallError("setsockopt", err) } var v [4]byte copy(v[:], ip.To4()) return os.NewSyscallError("setsockopt", syscall.SetsockoptInet4Addr(fd, ianaProtocolIP, syscall.IP_MULTICAST_IF, v)) }
func setIPv4MulticastInterface(fd int, ifi *net.Interface) error { ip, err := netInterfaceToIP4(ifi) if err != nil { return os.NewSyscallError("setsockopt", err) } var a [4]byte copy(a[:], ip.To4()) err = syscall.SetsockoptInet4Addr(fd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, a) if err != nil { return os.NewSyscallError("setsockopt", err) } return nil }
func setIPv4MulticastInterface(fd *netFD, ifi *Interface) error { ip, err := interfaceToIPv4Addr(ifi) if err != nil { return os.NewSyscallError("setsockopt", err) } var a [4]byte copy(a[:], ip.To4()) if err := fd.incref(); err != nil { return err } defer fd.decref() return os.NewSyscallError("setsockopt", syscall.SetsockoptInet4Addr(fd.sysfd, syscall.IPPROTO_IP, syscall.IP_MULTICAST_IF, a)) }