~ubuntu-branches/ubuntu/trusty/juju-core/trusty-proposed

« back to all changes in this revision

Viewing changes to src/code.google.com/p/go.net/ipv6/icmp_bsd.go

  • Committer: Package Import Robot
  • Author(s): Robie Basak
  • Date: 2015-07-15 13:09:07 UTC
  • mfrom: (35.1.15 wily-proposed)
  • Revision ID: package-import@ubuntu.com-20150715130907-wqak1zpebzzdvy3q
Tags: 1.22.6-0ubuntu1~14.04.1
* No change backport to 14.04 (LP: #1469744). This results in the
  following packaging delta from the previous 1.20.11-0ubuntu0.14.04.1
  in trusty-updates:
  - distro-info added and libgo5 removed from Build-Depends.
  - Standards-Version bumped.
  - cloud-image-utils | cloud-utils added to juju-local Depends.
  - d/copyright updated.
  - dep8 tests updated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 darwin freebsd netbsd openbsd
6
 
 
7
 
package ipv6
8
 
 
9
 
type sysICMPFilter struct {
10
 
        Filt [8]uint32
11
 
}
12
 
 
13
 
func (f *sysICMPFilter) set(typ ICMPType, block bool) {
14
 
        if block {
15
 
                f.Filt[typ>>5] &^= 1 << (uint32(typ) & 31)
16
 
        } else {
17
 
                f.Filt[typ>>5] |= 1 << (uint32(typ) & 31)
18
 
        }
19
 
}
20
 
 
21
 
func (f *sysICMPFilter) setAll(block bool) {
22
 
        for i := range f.Filt {
23
 
                if block {
24
 
                        f.Filt[i] = 0
25
 
                } else {
26
 
                        f.Filt[i] = 1<<32 - 1
27
 
                }
28
 
        }
29
 
}
30
 
 
31
 
func (f *sysICMPFilter) willBlock(typ ICMPType) bool {
32
 
        return f.Filt[typ>>5]&(1<<(uint32(typ)&31)) == 0
33
 
}