...
1
2
3
4
5
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 }
30
View as plain text