golang.org/x/net@v0.25.1-0.20240516223405-c87a5b62e243/ipv6/icmp_bsd.go (about) 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 5 //go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd 6 7 package ipv6 8 9 func (f *icmpv6Filter) accept(typ ICMPType) { 10 f.Filt[typ>>5] |= 1 << (uint32(typ) & 31) 11 } 12 13 func (f *icmpv6Filter) block(typ ICMPType) { 14 f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31) 15 } 16 17 func (f *icmpv6Filter) setAll(block bool) { 18 for i := range f.Filt { 19 if block { 20 f.Filt[i] = 0 21 } else { 22 f.Filt[i] = 1<<32 - 1 23 } 24 } 25 } 26 27 func (f *icmpv6Filter) willBlock(typ ICMPType) bool { 28 return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0 29 }