blob: e1a791de46ed342ded423cde640e777635eca402 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// 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// +build darwin dragonfly freebsd netbsd openbsd
6
7package ipv6
8
9func (f *icmpv6Filter) accept(typ ICMPType) {
10 f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
11}
12
13func (f *icmpv6Filter) block(typ ICMPType) {
14 f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
15}
16
17func (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
27func (f *icmpv6Filter) willBlock(typ ICMPType) bool {
28 return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
29}