File tree 6 files changed +36
-24
lines changed
6 files changed +36
-24
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ func (typ ICMPType) String() string {
21
21
// packets.
22
22
type ICMPFilter struct {
23
23
mu sync.RWMutex
24
- sysICMPFilter
24
+ sysICMPv6Filter
25
25
}
26
26
27
27
// Set sets the ICMP type and filter action to the filter.
Original file line number Diff line number Diff line change 6
6
7
7
package ipv6
8
8
9
- type sysICMPFilter struct {
10
- Filt [8 ]uint32
11
- }
12
-
13
- func (f * sysICMPFilter ) set (typ ICMPType , block bool ) {
9
+ func (f * sysICMPv6Filter ) set (typ ICMPType , block bool ) {
14
10
if block {
15
11
f .Filt [typ >> 5 ] &^= 1 << (uint32 (typ ) & 31 )
16
12
} else {
17
13
f .Filt [typ >> 5 ] |= 1 << (uint32 (typ ) & 31 )
18
14
}
19
15
}
20
16
21
- func (f * sysICMPFilter ) setAll (block bool ) {
17
+ func (f * sysICMPv6Filter ) setAll (block bool ) {
22
18
for i := range f .Filt {
23
19
if block {
24
20
f .Filt [i ] = 0
@@ -28,6 +24,6 @@ func (f *sysICMPFilter) setAll(block bool) {
28
24
}
29
25
}
30
26
31
- func (f * sysICMPFilter ) willBlock (typ ICMPType ) bool {
27
+ func (f * sysICMPv6Filter ) willBlock (typ ICMPType ) bool {
32
28
return f .Filt [typ >> 5 ]& (1 << (uint32 (typ )& 31 )) == 0
33
29
}
Original file line number Diff line number Diff line change 4
4
5
5
package ipv6
6
6
7
- type sysICMPFilter struct {
8
- Data [8 ]uint32
9
- }
10
-
11
- func (f * sysICMPFilter ) set (typ ICMPType , block bool ) {
7
+ func (f * sysICMPv6Filter ) set (typ ICMPType , block bool ) {
12
8
if block {
13
9
f .Data [typ >> 5 ] |= 1 << (uint32 (typ ) & 31 )
14
10
} else {
15
11
f .Data [typ >> 5 ] &^= 1 << (uint32 (typ ) & 31 )
16
12
}
17
13
}
18
14
19
- func (f * sysICMPFilter ) setAll (block bool ) {
15
+ func (f * sysICMPv6Filter ) setAll (block bool ) {
20
16
for i := range f .Data {
21
17
if block {
22
18
f .Data [i ] = 1 << 32 - 1
@@ -26,6 +22,6 @@ func (f *sysICMPFilter) setAll(block bool) {
26
22
}
27
23
}
28
24
29
- func (f * sysICMPFilter ) willBlock (typ ICMPType ) bool {
25
+ func (f * sysICMPv6Filter ) willBlock (typ ICMPType ) bool {
30
26
return f .Data [typ >> 5 ]& (1 << (uint32 (typ )& 31 )) != 0
31
27
}
Original file line number Diff line number Diff line change
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
+ // +build solaris
6
+
7
+ package ipv6
8
+
9
+ func (f * sysICMPv6Filter ) set (typ ICMPType , block bool ) {
10
+ // TODO(mikio): Implement this
11
+ }
12
+
13
+ func (f * sysICMPv6Filter ) setAll (block bool ) {
14
+ // TODO(mikio): Implement this
15
+ }
16
+
17
+ func (f * sysICMPv6Filter ) willBlock (typ ICMPType ) bool {
18
+ // TODO(mikio): Implement this
19
+ return false
20
+ }
Original file line number Diff line number Diff line change 2
2
// Use of this source code is governed by a BSD-style
3
3
// license that can be found in the LICENSE file.
4
4
5
- // +build nacl plan9 solaris
5
+ // +build nacl plan9
6
6
7
7
package ipv6
8
8
9
- type sysICMPFilter struct {
9
+ type sysICMPv6Filter struct {
10
10
// TODO(mikio): Implement this
11
11
}
12
12
13
- func (f * sysICMPFilter ) set (typ ICMPType , block bool ) {
13
+ func (f * sysICMPv6Filter ) set (typ ICMPType , block bool ) {
14
14
// TODO(mikio): Implement this
15
15
}
16
16
17
- func (f * sysICMPFilter ) setAll (block bool ) {
17
+ func (f * sysICMPv6Filter ) setAll (block bool ) {
18
18
// TODO(mikio): Implement this
19
19
}
20
20
21
- func (f * sysICMPFilter ) willBlock (typ ICMPType ) bool {
21
+ func (f * sysICMPv6Filter ) willBlock (typ ICMPType ) bool {
22
22
// TODO(mikio): Implement this
23
23
return false
24
24
}
Original file line number Diff line number Diff line change 4
4
5
5
package ipv6
6
6
7
- type sysICMPFilter struct {
7
+ type sysICMPv6Filter struct {
8
8
// TODO(mikio): Implement this
9
9
}
10
10
11
- func (f * sysICMPFilter ) set (typ ICMPType , block bool ) {
11
+ func (f * sysICMPv6Filter ) set (typ ICMPType , block bool ) {
12
12
// TODO(mikio): Implement this
13
13
}
14
14
15
- func (f * sysICMPFilter ) setAll (block bool ) {
15
+ func (f * sysICMPv6Filter ) setAll (block bool ) {
16
16
// TODO(mikio): Implement this
17
17
}
18
18
19
- func (f * sysICMPFilter ) willBlock (typ ICMPType ) bool {
19
+ func (f * sysICMPv6Filter ) willBlock (typ ICMPType ) bool {
20
20
// TODO(mikio): Implement this
21
21
return false
22
22
}
You can’t perform that action at this time.
0 commit comments