...
1
2
3
4
5 package ipv6
6
7 func (f *icmpv6Filter) accept(typ ICMPType) {
8 f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
9
10 }
11
12 func (f *icmpv6Filter) block(typ ICMPType) {
13 f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
14
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 }
30
View as plain text