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.
 
 
 

30 lines
660 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 netbsd openbsd
  5. package ipv6
  6. func (f *icmpv6Filter) accept(typ ICMPType) {
  7. f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
  8. }
  9. func (f *icmpv6Filter) block(typ ICMPType) {
  10. f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
  11. }
  12. func (f *icmpv6Filter) setAll(block bool) {
  13. for i := range f.Filt {
  14. if block {
  15. f.Filt[i] = 0
  16. } else {
  17. f.Filt[i] = 1<<32 - 1
  18. }
  19. }
  20. }
  21. func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
  22. return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
  23. }