sockopt_rfc3493_bsd.go 479 B

1234567891011121314151617181920
  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 netbsd openbsd
  5. package ipv6
  6. import (
  7. "os"
  8. "unsafe"
  9. )
  10. func setIPv6Checksum(fd int, on bool, offset int) error {
  11. if !on {
  12. offset = -1
  13. }
  14. v := int32(offset)
  15. return os.NewSyscallError("setsockopt", setsockopt(fd, ianaProtocolIPv6, sysSockoptChecksum, unsafe.Pointer(&v), 4))
  16. }