You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
589 B

  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 solaris windows
  5. package ipv6
  6. import (
  7. "net"
  8. "unsafe"
  9. "golang.org/x/net/internal/socket"
  10. )
  11. func (so *sockOpt) setIPMreq(c *socket.Conn, ifi *net.Interface, grp net.IP) error {
  12. var mreq ipv6Mreq
  13. copy(mreq.Multiaddr[:], grp)
  14. if ifi != nil {
  15. mreq.setIfindex(ifi.Index)
  16. }
  17. b := (*[sizeofIPv6Mreq]byte)(unsafe.Pointer(&mreq))[:sizeofIPv6Mreq]
  18. return so.Set(c, b)
  19. }