sockopt_rfc3493_linux.go 441 B

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