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