sockopt_asmreq_unix.go 574 B

12345678910111213141516171819202122
  1. // Copyright 2013 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.
  4. // +build darwin dragonfly freebsd linux netbsd openbsd
  5. package ipv6
  6. import (
  7. "net"
  8. "os"
  9. "unsafe"
  10. )
  11. func setsockoptIPMreq(fd int, opt *sockOpt, ifi *net.Interface, grp net.IP) error {
  12. var mreq sysIPv6Mreq
  13. copy(mreq.Multiaddr[:], grp)
  14. if ifi != nil {
  15. mreq.setIfindex(ifi.Index)
  16. }
  17. return os.NewSyscallError("setsockopt", setsockopt(fd, opt.level, opt.name, unsafe.Pointer(&mreq), sysSizeofIPv6Mreq))
  18. }