Fix vendor out of sync issue

Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
This commit is contained in:
Madhu Rajanna 2019-07-18 17:43:24 +05:30 committed by mergify[bot]
parent 21a02fb559
commit e128caddc5
84 changed files with 2686 additions and 704 deletions

54
Gopkg.lock generated
View File

@ -138,12 +138,12 @@
version = "v0.19.2" version = "v0.19.2"
[[projects]] [[projects]]
digest = "1:10332cabbb0525ad9384874b4c0e23501540b7f469ab4177f47f227d46ad2dca" digest = "1:b2ea9a25f2ca9ebea4e58ec61832a80caee98d85038563e43f774b37ef990ebb"
name = "github.com/go-openapi/swag" name = "github.com/go-openapi/swag"
packages = ["."] packages = ["."]
pruneopts = "NUT" pruneopts = "NUT"
revision = "7e8dd5ceab83c86d17bc967d09e195414fe2b47e" revision = "de649ffb9e02183a414820c5b1b4582f7b009792"
version = "v0.19.2" version = "v0.19.4"
[[projects]] [[projects]]
digest = "1:37234906013da82d4c05666262eda5bdec8f736bafa7d4ec1fb3314e965b476f" digest = "1:37234906013da82d4c05666262eda5bdec8f736bafa7d4ec1fb3314e965b476f"
@ -164,10 +164,10 @@
name = "github.com/golang/groupcache" name = "github.com/golang/groupcache"
packages = ["lru"] packages = ["lru"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "5b532d6fd5efaf7fa130d4e859a2fde0fc3a9e1b" revision = "869f871628b6baa9cfbc11732cdf6546b17c1298"
[[projects]] [[projects]]
digest = "1:f0ba580759848d2bb230cb37bc288690f92812d0850112e07ecbd1b727f3d973" digest = "1:aacda36e495e3d479ef5c3b8da317e44e026923456fa0d6b734395125f971a34"
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
"descriptor", "descriptor",
@ -180,8 +180,8 @@
"ptypes/wrappers", "ptypes/wrappers",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" revision = "6c65a5562fc06764971b7c5d05c76c75e84bdbf7"
version = "v1.3.1" version = "v1.3.2"
[[projects]] [[projects]]
digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107" digest = "1:05f95ffdfcf651bdb0f05b40b69e7f5663047f8da75c72d58728acb59b5cc107"
@ -323,7 +323,7 @@
"jwriter", "jwriter",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "da37f6c1e4819c2ed4be6542856f9c0f0560348d" revision = "b2ccc519800e761ac8000b95e5d57c80a897ff9e"
[[projects]] [[projects]]
digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6" digest = "1:5985ef4caf91ece5d54817c11ea25f182697534f8ae6521eadcd628c142ac4b6"
@ -477,15 +477,15 @@
version = "v0.6.0" version = "v0.6.0"
[[projects]] [[projects]]
digest = "1:afe5de112e0ca26a37730f01bc4bac9aabe9843cbfd66034f0c16e5a1fbd045b" digest = "1:19305fc369377c111c865a7a01e11c675c57c52a932353bbd4ea360bd5b72d99"
name = "github.com/prometheus/procfs" name = "github.com/prometheus/procfs"
packages = [ packages = [
".", ".",
"internal/fs", "internal/fs",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "833678b5bb319f2d20a475cb165c6cc59c2cc77c" revision = "3f98efb27840a48a7a2898ec80be07674d19f9c8"
version = "v0.0.2" version = "v0.0.3"
[[projects]] [[projects]]
digest = "1:6792bb72ea0e7112157d02e4e175cd421b43d004a853f56316a19beca6e0c074" digest = "1:6792bb72ea0e7112157d02e4e175cd421b43d004a853f56316a19beca6e0c074"
@ -541,7 +541,7 @@
"ssh/terminal", "ssh/terminal",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "cc06ce4a13d484c0101a9e92913248488a75786d" revision = "4def268fd1a49955bfb3dda92fe3db4f924f2285"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -562,7 +562,7 @@
"websocket", "websocket",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "3b0461eec859c4b73bb64fdc8285971fd33e3938" revision = "da137c7871d730100384dbcf36e6f8fa493aef5b"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -577,7 +577,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:a366d75c958364d5fc14e7ac3fa2f4891bb1e3f0f9377c81b86f1da0429ef72e" digest = "1:bf898cc8813a5e2a93ead21ccce151d5715df2803882f99e3e0d3619f8330db9"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = [ packages = [
"cpu", "cpu",
@ -585,7 +585,7 @@
"windows", "windows",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "d432491b91382bba9c2a91776aa47c9430183a6f" revision = "fae7ac547cb717d141c433a2a173315e216b64c4"
[[projects]] [[projects]]
digest = "1:0b5dc8c3581fc3ea2b80cc2e360dfb9c2d61dd0cba0d2fe247e8edd3e83f7551" digest = "1:0b5dc8c3581fc3ea2b80cc2e360dfb9c2d61dd0cba0d2fe247e8edd3e83f7551"
@ -655,10 +655,10 @@
name = "google.golang.org/genproto" name = "google.golang.org/genproto"
packages = ["googleapis/rpc/status"] packages = ["googleapis/rpc/status"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "6af8c5fc6601ab6b41cd32742a65ce2f5bd9db57" revision = "c506a9f9061087022822e8da603a52fc387115a8"
[[projects]] [[projects]]
digest = "1:1ec4bc6f7cbf98268fafafea40cdeb5ff5d4914cc9b9ef615fbbfc1ac43c0622" digest = "1:2faab8e13984b728cde9ced456912a0fc5cd43da5b9a4b45b749dc3ae63f27b2"
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
packages = [ packages = [
".", ".",
@ -690,13 +690,14 @@
"resolver", "resolver",
"resolver/dns", "resolver/dns",
"resolver/passthrough", "resolver/passthrough",
"serviceconfig",
"stats", "stats",
"status", "status",
"tap", "tap",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "501c41df7f472c740d0674ff27122f3f48c80ce7" revision = "1d89a3c832915b2314551c1d2a506874d62e53f7"
version = "v1.21.1" version = "v1.22.0"
[[projects]] [[projects]]
digest = "1:1b91ae0dc69a41d4c2ed23ea5cffb721ea63f5037ca4b81e6d6771fbb8f45129" digest = "1:1b91ae0dc69a41d4c2ed23ea5cffb721ea63f5037ca4b81e6d6771fbb8f45129"
@ -1094,7 +1095,7 @@
"volume/helpers", "volume/helpers",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "195130590fb21ae434e0406c61d813afff1eb745" revision = "585d8110a88f18f8cb30cf64236f373f84708c63"
[[projects]] [[projects]]
branch = "master" branch = "master"
@ -1105,15 +1106,15 @@
"featuregate", "featuregate",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "e5083e713460627ce571f3f9e6c79b5b8deb0e60" revision = "b4f50308a6168b3e1e8687b3fb46e9bf1a112ee5"
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:6ab908b738c8935c785ff7562d574ce3ed8559301610906ff3c4c5ca88db863d" digest = "1:3b2df8ed191ba34801a4299447c0219f35f7c23a9fd351a2d2724ec97916e584"
name = "k8s.io/cri-api" name = "k8s.io/cri-api"
packages = ["pkg/apis/runtime/v1alpha2"] packages = ["pkg/apis/runtime/v1alpha2"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "8a10675a4b1e6b246958bd5bdea51c63039526c4" revision = "0b0c4484b3d3cc29ce8890ba0de35d571db071a2"
[[projects]] [[projects]]
digest = "1:43099cc4ed575c40f80277c7ba7168df37d0c663bdc4f541325430bd175cce8a" digest = "1:43099cc4ed575c40f80277c7ba7168df37d0c663bdc4f541325430bd175cce8a"
@ -1132,7 +1133,7 @@
"pkg/util/proto", "pkg/util/proto",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "db7b694dc208eead64d38030265f702db593fcf2" revision = "3cf2ea39288623b60ec6ed8423a75b8e996fe289"
[[projects]] [[projects]]
digest = "1:d036b4cd708fbfeeb3a8c2b0f458dca68178b19d00145ea66fd49fd47cdec496" digest = "1:d036b4cd708fbfeeb3a8c2b0f458dca68178b19d00145ea66fd49fd47cdec496"
@ -1264,7 +1265,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:18770473e85f6148fb6f162e1d9aea6c4ec956f1daafda13b151a2a34836fae9" digest = "1:1541afde648991d68b2579076b29afb2d51a54aec822b434644f60f435eeee6e"
name = "k8s.io/utils" name = "k8s.io/utils"
packages = [ packages = [
"buffer", "buffer",
@ -1280,7 +1281,7 @@
"trace", "trace",
] ]
pruneopts = "NUT" pruneopts = "NUT"
revision = "c55fbcfc754a5b2ec2fbae8fb9dcac36bdba6a12" revision = "3dccf664f023863740c508fb4284e49742bedfa4"
[[projects]] [[projects]]
digest = "1:cb422c75bab66a8339a38b64e837f3b28f3d5a8c06abd7b9048f420363baa18a" digest = "1:cb422c75bab66a8339a38b64e837f3b28f3d5a8c06abd7b9048f420363baa18a"
@ -1359,7 +1360,6 @@
"k8s.io/kubernetes/test/e2e/framework/log", "k8s.io/kubernetes/test/e2e/framework/log",
"k8s.io/kubernetes/test/utils", "k8s.io/kubernetes/test/utils",
"k8s.io/utils/exec", "k8s.io/utils/exec",
"k8s.io/utils/keymutex",
"k8s.io/utils/nsenter", "k8s.io/utils/nsenter",
] ]
solver-name = "gps-cdcl" solver-name = "gps-cdcl"

View File

@ -39,11 +39,12 @@ func IsFloat64AJSONInteger(f float64) bool {
diff := math.Abs(f - g) diff := math.Abs(f - g)
// more info: https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases // more info: https://floating-point-gui.de/errors/comparison/#look-out-for-edge-cases
if f == g { // best case switch {
case f == g: // best case
return true return true
} else if f == float64(int64(f)) || f == float64(uint64(f)) { // optimistic case case f == float64(int64(f)) || f == float64(uint64(f)): // optimistic case
return true return true
} else if f == 0 || g == 0 || diff < math.SmallestNonzeroFloat64 { // very close to 0 values case f == 0 || g == 0 || diff < math.SmallestNonzeroFloat64: // very close to 0 values
return diff < (epsilon * math.SmallestNonzeroFloat64) return diff < (epsilon * math.SmallestNonzeroFloat64)
} }
// check the relative error // check the relative error

View File

@ -99,7 +99,7 @@ func ConcatJSON(blobs ...[]byte) []byte {
last := len(blobs) - 1 last := len(blobs) - 1
for blobs[last] == nil || bytes.Equal(blobs[last], nullJSON) { for blobs[last] == nil || bytes.Equal(blobs[last], nullJSON) {
// strips trailing null objects // strips trailing null objects
last = last - 1 last--
if last < 0 { if last < 0 {
// there was nothing but "null"s or nil... // there was nothing but "null"s or nil...
return nil return nil

View File

@ -28,6 +28,14 @@ var initialisms []string
var isInitialism func(string) bool var isInitialism func(string) bool
// GoNamePrefixFunc sets an optional rule to prefix go names
// which do not start with a letter.
//
// e.g. to help converting "123" into "{prefix}123"
//
// The default is to prefix with "X"
var GoNamePrefixFunc func(string) string
func init() { func init() {
// Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769 // Taken from https://github.com/golang/lint/blob/3390df4df2787994aea98de825b964ac7944b817/lint.go#L732-L769
var configuredInitialisms = map[string]bool{ var configuredInitialisms = map[string]bool{
@ -288,8 +296,17 @@ func ToGoName(name string) string {
} }
if len(result) > 0 { if len(result) > 0 {
if !unicode.IsUpper([]rune(result)[0]) { // Only prefix with X when the first character isn't an ascii letter
result = "X" + result first := []rune(result)[0]
if !unicode.IsLetter(first) || (first > unicode.MaxASCII && !unicode.IsUpper(first)) {
if GoNamePrefixFunc == nil {
return "X" + result
}
result = GoNamePrefixFunc(name) + result
}
first = []rune(result)[0]
if unicode.IsLetter(first) && !unicode.IsUpper(first) {
result = string(append([]rune{unicode.ToUpper(first)}, []rune(result)[1:]...))
} }
} }

View File

@ -38,7 +38,6 @@ package proto
import ( import (
"fmt" "fmt"
"log" "log"
"os"
"reflect" "reflect"
"sort" "sort"
"strconv" "strconv"
@ -194,7 +193,7 @@ func (p *Properties) Parse(s string) {
// "bytes,49,opt,name=foo,def=hello!" // "bytes,49,opt,name=foo,def=hello!"
fields := strings.Split(s, ",") // breaks def=, but handled below. fields := strings.Split(s, ",") // breaks def=, but handled below.
if len(fields) < 2 { if len(fields) < 2 {
fmt.Fprintf(os.Stderr, "proto: tag has too few fields: %q\n", s) log.Printf("proto: tag has too few fields: %q", s)
return return
} }
@ -214,7 +213,7 @@ func (p *Properties) Parse(s string) {
p.WireType = WireBytes p.WireType = WireBytes
// no numeric converter for non-numeric types // no numeric converter for non-numeric types
default: default:
fmt.Fprintf(os.Stderr, "proto: tag has unknown wire type: %q\n", s) log.Printf("proto: tag has unknown wire type: %q", s)
return return
} }

View File

@ -25,6 +25,9 @@ const (
// DefaultSysMountPoint is the common mount point of the sys filesystem. // DefaultSysMountPoint is the common mount point of the sys filesystem.
DefaultSysMountPoint = "/sys" DefaultSysMountPoint = "/sys"
// DefaultConfigfsMountPoint is the commont mount point of the configfs
DefaultConfigfsMountPoint = "/sys/kernel/config"
) )
// FS represents a pseudo-filesystem, normally /proc or /sys, which provides an // FS represents a pseudo-filesystem, normally /proc or /sys, which provides an

View File

@ -22,8 +22,8 @@ import (
) )
var ( var (
statuslineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`) statusLineRE = regexp.MustCompile(`(\d+) blocks .*\[(\d+)/(\d+)\] \[[U_]+\]`)
buildlineRE = regexp.MustCompile(`\((\d+)/\d+\)`) recoveryLineRE = regexp.MustCompile(`\((\d+)/\d+\)`)
) )
// MDStat holds info parsed from /proc/mdstat. // MDStat holds info parsed from /proc/mdstat.
@ -34,8 +34,12 @@ type MDStat struct {
ActivityState string ActivityState string
// Number of active disks. // Number of active disks.
DisksActive int64 DisksActive int64
// Total number of disks the device consists of. // Total number of disks the device requires.
DisksTotal int64 DisksTotal int64
// Number of failed disks.
DisksFailed int64
// Spare disks in the device.
DisksSpare int64
// Number of blocks the device holds. // Number of blocks the device holds.
BlocksTotal int64 BlocksTotal int64
// Number of blocks on the device that are in sync. // Number of blocks on the device that are in sync.
@ -59,29 +63,38 @@ func (fs FS) MDStat() ([]MDStat, error) {
// parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of // parseMDStat parses data from mdstat file (/proc/mdstat) and returns a slice of
// structs containing the relevant info. // structs containing the relevant info.
func parseMDStat(mdstatData []byte) ([]MDStat, error) { func parseMDStat(mdStatData []byte) ([]MDStat, error) {
mdStats := []MDStat{} mdStats := []MDStat{}
lines := strings.Split(string(mdstatData), "\n") lines := strings.Split(string(mdStatData), "\n")
for i, l := range lines {
if strings.TrimSpace(l) == "" || l[0] == ' ' || for i, line := range lines {
strings.HasPrefix(l, "Personalities") || strings.HasPrefix(l, "unused") { if strings.TrimSpace(line) == "" || line[0] == ' ' ||
strings.HasPrefix(line, "Personalities") ||
strings.HasPrefix(line, "unused") {
continue continue
} }
deviceFields := strings.Fields(l) deviceFields := strings.Fields(line)
if len(deviceFields) < 3 { if len(deviceFields) < 3 {
return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", l) return nil, fmt.Errorf("not enough fields in mdline (expected at least 3): %s", line)
} }
mdName := deviceFields[0] mdName := deviceFields[0] // mdx
activityState := deviceFields[2] state := deviceFields[2] // active or inactive
if len(lines) <= i+3 { if len(lines) <= i+3 {
return mdStats, fmt.Errorf("missing lines for md device %s", mdName) return nil, fmt.Errorf(
"error parsing %s: too few lines for md device",
mdName,
)
} }
active, total, size, err := evalStatusLine(lines[i+1]) // Failed disks have the suffix (F) & Spare disks have the suffix (S).
fail := int64(strings.Count(line, "(F)"))
spare := int64(strings.Count(line, "(S)"))
active, total, size, err := evalStatusLine(lines[i], lines[i+1])
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("error parsing md device lines: %s", err)
} }
syncLineIdx := i + 2 syncLineIdx := i + 2
@ -89,20 +102,38 @@ func parseMDStat(mdstatData []byte) ([]MDStat, error) {
syncLineIdx++ syncLineIdx++
} }
// If device is recovering/syncing at the moment, get the number of currently // If device is syncing at the moment, get the number of currently
// synced bytes, otherwise that number equals the size of the device. // synced bytes, otherwise that number equals the size of the device.
syncedBlocks := size syncedBlocks := size
if strings.Contains(lines[syncLineIdx], "recovery") || strings.Contains(lines[syncLineIdx], "resync") { recovering := strings.Contains(lines[syncLineIdx], "recovery")
syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx]) resyncing := strings.Contains(lines[syncLineIdx], "resync")
if err != nil {
return nil, err // Append recovery and resyncing state info.
if recovering || resyncing {
if recovering {
state = "recovering"
} else {
state = "resyncing"
}
// Handle case when resync=PENDING or resync=DELAYED.
if strings.Contains(lines[syncLineIdx], "PENDING") ||
strings.Contains(lines[syncLineIdx], "DELAYED") {
syncedBlocks = 0
} else {
syncedBlocks, err = evalRecoveryLine(lines[syncLineIdx])
if err != nil {
return nil, fmt.Errorf("error parsing sync line in md device %s: %s", mdName, err)
}
} }
} }
mdStats = append(mdStats, MDStat{ mdStats = append(mdStats, MDStat{
Name: mdName, Name: mdName,
ActivityState: activityState, ActivityState: state,
DisksActive: active, DisksActive: active,
DisksFailed: fail,
DisksSpare: spare,
DisksTotal: total, DisksTotal: total,
BlocksTotal: size, BlocksTotal: size,
BlocksSynced: syncedBlocks, BlocksSynced: syncedBlocks,
@ -112,39 +143,51 @@ func parseMDStat(mdstatData []byte) ([]MDStat, error) {
return mdStats, nil return mdStats, nil
} }
func evalStatusLine(statusline string) (active, total, size int64, err error) { func evalStatusLine(deviceLine, statusLine string) (active, total, size int64, err error) {
matches := statuslineRE.FindStringSubmatch(statusline)
if len(matches) != 4 { sizeStr := strings.Fields(statusLine)[0]
return 0, 0, 0, fmt.Errorf("unexpected statusline: %s", statusline) size, err = strconv.ParseInt(sizeStr, 10, 64)
if err != nil {
return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
} }
size, err = strconv.ParseInt(matches[1], 10, 64) if strings.Contains(deviceLine, "raid0") || strings.Contains(deviceLine, "linear") {
if err != nil { // In the device deviceLine, only disks have a number associated with them in [].
return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) total = int64(strings.Count(deviceLine, "["))
return total, total, size, nil
}
if strings.Contains(deviceLine, "inactive") {
return 0, 0, size, nil
}
matches := statusLineRE.FindStringSubmatch(statusLine)
if len(matches) != 4 {
return 0, 0, 0, fmt.Errorf("couldn't find all the substring matches: %s", statusLine)
} }
total, err = strconv.ParseInt(matches[2], 10, 64) total, err = strconv.ParseInt(matches[2], 10, 64)
if err != nil { if err != nil {
return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
} }
active, err = strconv.ParseInt(matches[3], 10, 64) active, err = strconv.ParseInt(matches[3], 10, 64)
if err != nil { if err != nil {
return 0, 0, 0, fmt.Errorf("unexpected statusline %s: %s", statusline, err) return 0, 0, 0, fmt.Errorf("unexpected statusLine %s: %s", statusLine, err)
} }
return active, total, size, nil return active, total, size, nil
} }
func evalRecoveryLine(buildline string) (syncedBlocks int64, err error) { func evalRecoveryLine(recoveryLine string) (syncedBlocks int64, err error) {
matches := buildlineRE.FindStringSubmatch(buildline) matches := recoveryLineRE.FindStringSubmatch(recoveryLine)
if len(matches) != 2 { if len(matches) != 2 {
return 0, fmt.Errorf("unexpected buildline: %s", buildline) return 0, fmt.Errorf("unexpected recoveryLine: %s", recoveryLine)
} }
syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64) syncedBlocks, err = strconv.ParseInt(matches[1], 10, 64)
if err != nil { if err != nil {
return 0, fmt.Errorf("%s in buildline: %s", err, buildline) return 0, fmt.Errorf("%s in recoveryLine: %s", err, recoveryLine)
} }
return syncedBlocks, nil return syncedBlocks, nil

178
vendor/github.com/prometheus/procfs/mountinfo.go generated vendored Normal file
View File

@ -0,0 +1,178 @@
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package procfs
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
var validOptionalFields = map[string]bool{
"shared": true,
"master": true,
"propagate_from": true,
"unbindable": true,
}
// A MountInfo is a type that describes the details, options
// for each mount, parsed from /proc/self/mountinfo.
// The fields described in each entry of /proc/self/mountinfo
// is described in the following man page.
// http://man7.org/linux/man-pages/man5/proc.5.html
type MountInfo struct {
// Unique Id for the mount
MountId int
// The Id of the parent mount
ParentId int
// The value of `st_dev` for the files on this FS
MajorMinorVer string
// The pathname of the directory in the FS that forms
// the root for this mount
Root string
// The pathname of the mount point relative to the root
MountPoint string
// Mount options
Options map[string]string
// Zero or more optional fields
OptionalFields map[string]string
// The Filesystem type
FSType string
// FS specific information or "none"
Source string
// Superblock options
SuperOptions map[string]string
}
// Returns part of the mountinfo line, if it exists, else an empty string.
func getStringSliceElement(parts []string, idx int, defaultValue string) string {
if idx >= len(parts) {
return defaultValue
}
return parts[idx]
}
// Reads each line of the mountinfo file, and returns a list of formatted MountInfo structs.
func parseMountInfo(r io.Reader) ([]*MountInfo, error) {
mounts := []*MountInfo{}
scanner := bufio.NewScanner(r)
for scanner.Scan() {
mountString := scanner.Text()
parsedMounts, err := parseMountInfoString(mountString)
if err != nil {
return nil, err
}
mounts = append(mounts, parsedMounts)
}
err := scanner.Err()
return mounts, err
}
// Parses a mountinfo file line, and converts it to a MountInfo struct.
// An important check here is to see if the hyphen separator, as if it does not exist,
// it means that the line is malformed.
func parseMountInfoString(mountString string) (*MountInfo, error) {
var err error
// OptionalFields can be zero, hence these checks to ensure we do not populate the wrong values in the wrong spots
separatorIndex := strings.Index(mountString, "-")
if separatorIndex == -1 {
return nil, fmt.Errorf("no separator found in mountinfo string: %s", mountString)
}
beforeFields := strings.Fields(mountString[:separatorIndex])
afterFields := strings.Fields(mountString[separatorIndex+1:])
if (len(beforeFields) + len(afterFields)) < 7 {
return nil, fmt.Errorf("too few fields")
}
mount := &MountInfo{
MajorMinorVer: getStringSliceElement(beforeFields, 2, ""),
Root: getStringSliceElement(beforeFields, 3, ""),
MountPoint: getStringSliceElement(beforeFields, 4, ""),
Options: mountOptionsParser(getStringSliceElement(beforeFields, 5, "")),
OptionalFields: nil,
FSType: getStringSliceElement(afterFields, 0, ""),
Source: getStringSliceElement(afterFields, 1, ""),
SuperOptions: mountOptionsParser(getStringSliceElement(afterFields, 2, "")),
}
mount.MountId, err = strconv.Atoi(getStringSliceElement(beforeFields, 0, ""))
if err != nil {
return nil, fmt.Errorf("failed to parse mount ID")
}
mount.ParentId, err = strconv.Atoi(getStringSliceElement(beforeFields, 1, ""))
if err != nil {
return nil, fmt.Errorf("failed to parse parent ID")
}
// Has optional fields, which is a space separated list of values.
// Example: shared:2 master:7
if len(beforeFields) > 6 {
mount.OptionalFields = make(map[string]string)
optionalFields := beforeFields[6:]
for _, field := range optionalFields {
optionSplit := strings.Split(field, ":")
target, value := optionSplit[0], ""
if len(optionSplit) == 2 {
value = optionSplit[1]
}
// Checks if the 'keys' in the optional fields in the mountinfo line are acceptable.
// Allowed 'keys' are shared, master, propagate_from, unbindable.
if _, ok := validOptionalFields[target]; ok {
mount.OptionalFields[target] = value
}
}
}
return mount, nil
}
// Parses the mount options, superblock options.
func mountOptionsParser(mountOptions string) map[string]string {
opts := make(map[string]string)
options := strings.Split(mountOptions, ",")
for _, opt := range options {
splitOption := strings.Split(opt, "=")
if len(splitOption) < 2 {
key := splitOption[0]
opts[key] = ""
} else {
key, value := splitOption[0], splitOption[1]
opts[key] = value
}
}
return opts
}
// Retrieves mountinfo information from `/proc/self/mountinfo`.
func GetMounts() ([]*MountInfo, error) {
f, err := os.Open("/proc/self/mountinfo")
if err != nil {
return nil, err
}
defer f.Close()
return parseMountInfo(f)
}
// Retrieves mountinfo information from a processes' `/proc/<pid>/mountinfo`.
func GetProcMounts(pid int) ([]*MountInfo, error) {
f, err := os.Open(fmt.Sprintf("/proc/%d/mountinfo", pid))
if err != nil {
return nil, err
}
defer f.Close()
return parseMountInfo(f)
}

View File

@ -247,6 +247,20 @@ func (p Proc) MountStats() ([]*Mount, error) {
return parseMountStats(f) return parseMountStats(f)
} }
// MountInfo retrieves mount information for mount points in a
// process's namespace.
// It supplies information missing in `/proc/self/mounts` and
// fixes various other problems with that file too.
func (p Proc) MountInfo() ([]*MountInfo, error) {
f, err := os.Open(p.path("mountinfo"))
if err != nil {
return nil, err
}
defer f.Close()
return parseMountInfo(f)
}
func (p Proc) fileDescriptors() ([]string, error) { func (p Proc) fileDescriptors() ([]string, error) {
d, err := os.Open(p.path("fd")) d, err := os.Open(p.path("fd"))
if err != nil { if err != nil {

43
vendor/github.com/prometheus/procfs/proc_environ.go generated vendored Normal file
View File

@ -0,0 +1,43 @@
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package procfs
import (
"io/ioutil"
"os"
"strings"
)
// Environ reads process environments from /proc/<pid>/environ
func (p Proc) Environ() ([]string, error) {
environments := make([]string, 0)
f, err := os.Open(p.path("environ"))
if err != nil {
return environments, err
}
defer f.Close()
data, err := ioutil.ReadAll(f)
if err != nil {
return environments, err
}
environments = strings.Split(string(data), "\000")
if len(environments) > 0 {
environments = environments[:len(environments)-1]
}
return environments, nil
}

View File

@ -106,7 +106,7 @@ type ProcStat struct {
// NewStat returns the current status information of the process. // NewStat returns the current status information of the process.
// //
// Deprecated: use NewStat() instead // Deprecated: use p.Stat() instead
func (p Proc) NewStat() (ProcStat, error) { func (p Proc) NewStat() (ProcStat, error) {
return p.Stat() return p.Stat()
} }

View File

@ -6,12 +6,97 @@
package unix package unix
import "syscall" import "unsafe"
// readInt returns the size-bytes unsigned integer in native byte order at offset off.
func readInt(b []byte, off, size uintptr) (u uint64, ok bool) {
if len(b) < int(off+size) {
return 0, false
}
if isBigEndian {
return readIntBE(b[off:], size), true
}
return readIntLE(b[off:], size), true
}
func readIntBE(b []byte, size uintptr) uint64 {
switch size {
case 1:
return uint64(b[0])
case 2:
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[1]) | uint64(b[0])<<8
case 4:
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[3]) | uint64(b[2])<<8 | uint64(b[1])<<16 | uint64(b[0])<<24
case 8:
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
default:
panic("syscall: readInt with unsupported size")
}
}
func readIntLE(b []byte, size uintptr) uint64 {
switch size {
case 1:
return uint64(b[0])
case 2:
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[0]) | uint64(b[1])<<8
case 4:
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24
case 8:
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
default:
panic("syscall: readInt with unsupported size")
}
}
// ParseDirent parses up to max directory entries in buf, // ParseDirent parses up to max directory entries in buf,
// appending the names to names. It returns the number of // appending the names to names. It returns the number of
// bytes consumed from buf, the number of entries added // bytes consumed from buf, the number of entries added
// to names, and the new names slice. // to names, and the new names slice.
func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) { func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, newnames []string) {
return syscall.ParseDirent(buf, max, names) origlen := len(buf)
count = 0
for max != 0 && len(buf) > 0 {
reclen, ok := direntReclen(buf)
if !ok || reclen > uint64(len(buf)) {
return origlen, count, names
}
rec := buf[:reclen]
buf = buf[reclen:]
ino, ok := direntIno(rec)
if !ok {
break
}
if ino == 0 { // File absent in directory.
continue
}
const namoff = uint64(unsafe.Offsetof(Dirent{}.Name))
namlen, ok := direntNamlen(rec)
if !ok || namoff+namlen > uint64(len(rec)) {
break
}
name := rec[namoff : namoff+namlen]
for i, c := range name {
if c == 0 {
name = name[:i]
break
}
}
// Check for useless names before allocating a string.
if string(name) == "." || string(name) == ".." {
continue
}
max--
count++
names = append(names, string(name))
}
return origlen - len(buf), count, names
} }

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build aix freebsd linux netbsd openbsd // +build aix dragonfly freebsd linux netbsd openbsd
package unix package unix

View File

@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin dragonfly // +build darwin
package unix package unix

View File

@ -280,6 +280,22 @@ func sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
return -1, ENOSYS return -1, ENOSYS
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
reclen, ok := direntReclen(buf)
if !ok {
return 0, false
}
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
}
//sys getdirent(fd int, buf []byte) (n int, err error) //sys getdirent(fd int, buf []byte) (n int, err error)
func Getdents(fd int, buf []byte) (n int, err error) { func Getdents(fd int, buf []byte) (n int, err error) {
return getdirent(fd, buf) return getdirent(fd, buf)

View File

@ -77,6 +77,18 @@ func nametomib(name string) (mib []_C_int, err error) {
return buf[0 : n/siz], nil return buf[0 : n/siz], nil
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
//sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error) //sys ptrace(request int, pid int, addr uintptr, data uintptr) (err error)
func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) } func PtraceAttach(pid int) (err error) { return ptrace(PT_ATTACH, pid, 0, 0) }
func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) } func PtraceDetach(pid int) (err error) { return ptrace(PT_DETACH, pid, 0, 0) }

View File

@ -57,6 +57,22 @@ func nametomib(name string) (mib []_C_int, err error) {
return buf[0 : n/siz], nil return buf[0 : n/siz], nil
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
}
func direntReclen(buf []byte) (uint64, bool) {
namlen, ok := direntNamlen(buf)
if !ok {
return 0, false
}
return (16 + namlen + 1 + 7) &^ 7, true
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
//sysnb pipe() (r int, w int, err error) //sysnb pipe() (r int, w int, err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
@ -269,6 +285,7 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err e
//sys Fstatfs(fd int, stat *Statfs_t) (err error) //sys Fstatfs(fd int, stat *Statfs_t) (err error)
//sys Fsync(fd int) (err error) //sys Fsync(fd int) (err error)
//sys Ftruncate(fd int, length int64) (err error) //sys Ftruncate(fd int, length int64) (err error)
//sys Getdents(fd int, buf []byte) (n int, err error)
//sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) //sys Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error)
//sys Getdtablesize() (size int) //sys Getdtablesize() (size int)
//sysnb Getegid() (egid int) //sysnb Getegid() (egid int)

View File

@ -82,6 +82,18 @@ func nametomib(name string) (mib []_C_int, err error) {
return buf[0 : n/siz], nil return buf[0 : n/siz], nil
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {
return Pipe2(p, 0) return Pipe2(p, 0)
} }

View File

@ -1413,6 +1413,22 @@ func Reboot(cmd int) (err error) {
return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "") return reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, cmd, "")
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
reclen, ok := direntReclen(buf)
if !ok {
return 0, false
}
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
}
//sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error) //sys mount(source string, target string, fstype string, flags uintptr, data *byte) (err error)
func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) { func Mount(source string, target string, fstype string, flags uintptr, data string) (err error) {

View File

@ -94,6 +94,18 @@ func nametomib(name string) (mib []_C_int, err error) {
return mib, nil return mib, nil
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
func SysctlClockinfo(name string) (*Clockinfo, error) { func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name) mib, err := sysctlmib(name)
if err != nil { if err != nil {

View File

@ -43,6 +43,18 @@ func nametomib(name string) (mib []_C_int, err error) {
return nil, EINVAL return nil, EINVAL
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Fileno), unsafe.Sizeof(Dirent{}.Fileno))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Namlen), unsafe.Sizeof(Dirent{}.Namlen))
}
func SysctlClockinfo(name string) (*Clockinfo, error) { func SysctlClockinfo(name string) (*Clockinfo, error) {
mib, err := sysctlmib(name) mib, err := sysctlmib(name)
if err != nil { if err != nil {

View File

@ -35,6 +35,22 @@ type SockaddrDatalink struct {
raw RawSockaddrDatalink raw RawSockaddrDatalink
} }
func direntIno(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino))
}
func direntReclen(buf []byte) (uint64, bool) {
return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen))
}
func direntNamlen(buf []byte) (uint64, bool) {
reclen, ok := direntReclen(buf)
if !ok {
return 0, false
}
return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true
}
//sysnb pipe(p *[2]_C_int) (n int, err error) //sysnb pipe(p *[2]_C_int) (n int, err error)
func Pipe(p []int) (err error) { func Pipe(p []int) (err error) {

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1135,6 +1149,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1997,6 +2025,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2204,6 +2236,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2423,6 +2456,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x400854d5 TUNATTACHFILTER = 0x400854d5
TUNDETACHFILTER = 0x400854d6 TUNDETACHFILTER = 0x400854d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x800854db TUNGETFILTER = 0x800854db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1135,6 +1149,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1998,6 +2026,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2205,6 +2237,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2424,6 +2457,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x401054d5 TUNATTACHFILTER = 0x401054d5
TUNDETACHFILTER = 0x401054d6 TUNDETACHFILTER = 0x401054d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x801054db TUNGETFILTER = 0x801054db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -2004,6 +2032,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2211,6 +2243,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2430,6 +2463,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x400854d5 TUNATTACHFILTER = 0x400854d5
TUNDETACHFILTER = 0x400854d6 TUNDETACHFILTER = 0x400854d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x800854db TUNGETFILTER = 0x800854db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -528,6 +541,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1137,6 +1151,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1988,6 +2016,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2196,6 +2228,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2415,6 +2448,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x401054d5 TUNATTACHFILTER = 0x401054d5
TUNDETACHFILTER = 0x401054d6 TUNDETACHFILTER = 0x401054d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x801054db TUNGETFILTER = 0x801054db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1997,6 +2025,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x467f SIOCINQ = 0x467f
SIOCOUTQ = 0x7472 SIOCOUTQ = 0x7472
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2205,6 +2237,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2425,6 +2458,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x800854d5 TUNATTACHFILTER = 0x800854d5
TUNDETACHFILTER = 0x800854d6 TUNDETACHFILTER = 0x800854d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x400854db TUNGETFILTER = 0x400854db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1997,6 +2025,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x467f SIOCINQ = 0x467f
SIOCOUTQ = 0x7472 SIOCOUTQ = 0x7472
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2205,6 +2237,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2425,6 +2458,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5 TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6 TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1997,6 +2025,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x467f SIOCINQ = 0x467f
SIOCOUTQ = 0x7472 SIOCOUTQ = 0x7472
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2205,6 +2237,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2425,6 +2458,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5 TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6 TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1997,6 +2025,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x467f SIOCINQ = 0x467f
SIOCOUTQ = 0x7472 SIOCOUTQ = 0x7472
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2205,6 +2237,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2425,6 +2458,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x800854d5 TUNATTACHFILTER = 0x800854d5
TUNDETACHFILTER = 0x800854d6 TUNDETACHFILTER = 0x800854d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x400854db TUNGETFILTER = 0x400854db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -2055,6 +2083,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x4004667f SIOCINQ = 0x4004667f
SIOCOUTQ = 0x40047473 SIOCOUTQ = 0x40047473
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2262,6 +2294,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2485,6 +2518,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5 TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6 TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -2055,6 +2083,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x4004667f SIOCINQ = 0x4004667f
SIOCOUTQ = 0x40047473 SIOCOUTQ = 0x40047473
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2262,6 +2294,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2485,6 +2518,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5 TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6 TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -1985,6 +2013,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2192,6 +2224,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2411,6 +2444,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x401054d5 TUNATTACHFILTER = 0x401054d5
TUNDETACHFILTER = 0x401054d6 TUNDETACHFILTER = 0x401054d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x801054db TUNGETFILTER = 0x801054db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -196,6 +196,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -217,6 +219,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -238,16 +245,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -290,8 +300,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -411,6 +423,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -527,6 +540,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1134,6 +1148,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -2058,6 +2086,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x80108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x80108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x541b SIOCINQ = 0x541b
SIOCOUTQ = 0x5411 SIOCOUTQ = 0x5411
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2265,6 +2297,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2484,6 +2517,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x401054d5 TUNATTACHFILTER = 0x401054d5
TUNDETACHFILTER = 0x401054d6 TUNDETACHFILTER = 0x401054d6
TUNGETDEVNETNS = 0x54e3
TUNGETFEATURES = 0x800454cf TUNGETFEATURES = 0x800454cf
TUNGETFILTER = 0x801054db TUNGETFILTER = 0x801054db
TUNGETIFF = 0x800454d2 TUNGETIFF = 0x800454d2

View File

@ -199,6 +199,8 @@ const (
BPF_A = 0x10 BPF_A = 0x10
BPF_ABS = 0x20 BPF_ABS = 0x20
BPF_ADD = 0x0 BPF_ADD = 0x0
BPF_ADJ_ROOM_ENCAP_L2_MASK = 0xff
BPF_ADJ_ROOM_ENCAP_L2_SHIFT = 0x38
BPF_ALU = 0x4 BPF_ALU = 0x4
BPF_ALU64 = 0x7 BPF_ALU64 = 0x7
BPF_AND = 0x50 BPF_AND = 0x50
@ -220,6 +222,11 @@ const (
BPF_FROM_BE = 0x8 BPF_FROM_BE = 0x8
BPF_FROM_LE = 0x0 BPF_FROM_LE = 0x0
BPF_FS_MAGIC = 0xcafe4a11 BPF_FS_MAGIC = 0xcafe4a11
BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 = 0x2
BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 = 0x4
BPF_F_ADJ_ROOM_ENCAP_L4_GRE = 0x8
BPF_F_ADJ_ROOM_ENCAP_L4_UDP = 0x10
BPF_F_ADJ_ROOM_FIXED_GSO = 0x1
BPF_F_ALLOW_MULTI = 0x2 BPF_F_ALLOW_MULTI = 0x2
BPF_F_ALLOW_OVERRIDE = 0x1 BPF_F_ALLOW_OVERRIDE = 0x1
BPF_F_ANY_ALIGNMENT = 0x2 BPF_F_ANY_ALIGNMENT = 0x2
@ -241,16 +248,19 @@ const (
BPF_F_PSEUDO_HDR = 0x10 BPF_F_PSEUDO_HDR = 0x10
BPF_F_QUERY_EFFECTIVE = 0x1 BPF_F_QUERY_EFFECTIVE = 0x1
BPF_F_RDONLY = 0x8 BPF_F_RDONLY = 0x8
BPF_F_RDONLY_PROG = 0x80
BPF_F_RECOMPUTE_CSUM = 0x1 BPF_F_RECOMPUTE_CSUM = 0x1
BPF_F_REUSE_STACKID = 0x400 BPF_F_REUSE_STACKID = 0x400
BPF_F_SEQ_NUMBER = 0x8 BPF_F_SEQ_NUMBER = 0x8
BPF_F_SKIP_FIELD_MASK = 0xff BPF_F_SKIP_FIELD_MASK = 0xff
BPF_F_STACK_BUILD_ID = 0x20 BPF_F_STACK_BUILD_ID = 0x20
BPF_F_STRICT_ALIGNMENT = 0x1 BPF_F_STRICT_ALIGNMENT = 0x1
BPF_F_SYSCTL_BASE_NAME = 0x1
BPF_F_TUNINFO_IPV6 = 0x1 BPF_F_TUNINFO_IPV6 = 0x1
BPF_F_USER_BUILD_ID = 0x800 BPF_F_USER_BUILD_ID = 0x800
BPF_F_USER_STACK = 0x100 BPF_F_USER_STACK = 0x100
BPF_F_WRONLY = 0x10 BPF_F_WRONLY = 0x10
BPF_F_WRONLY_PROG = 0x100
BPF_F_ZERO_CSUM_TX = 0x2 BPF_F_ZERO_CSUM_TX = 0x2
BPF_F_ZERO_SEED = 0x40 BPF_F_ZERO_SEED = 0x40
BPF_H = 0x8 BPF_H = 0x8
@ -293,8 +303,10 @@ const (
BPF_OR = 0x40 BPF_OR = 0x40
BPF_PSEUDO_CALL = 0x1 BPF_PSEUDO_CALL = 0x1
BPF_PSEUDO_MAP_FD = 0x1 BPF_PSEUDO_MAP_FD = 0x1
BPF_PSEUDO_MAP_VALUE = 0x2
BPF_RET = 0x6 BPF_RET = 0x6
BPF_RSH = 0x70 BPF_RSH = 0x70
BPF_SK_STORAGE_GET_F_CREATE = 0x1
BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7 BPF_SOCK_OPS_ALL_CB_FLAGS = 0x7
BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2 BPF_SOCK_OPS_RETRANS_CB_FLAG = 0x2
BPF_SOCK_OPS_RTO_CB_FLAG = 0x1 BPF_SOCK_OPS_RTO_CB_FLAG = 0x1
@ -414,6 +426,7 @@ const (
CLONE_NEWUTS = 0x4000000 CLONE_NEWUTS = 0x4000000
CLONE_PARENT = 0x8000 CLONE_PARENT = 0x8000
CLONE_PARENT_SETTID = 0x100000 CLONE_PARENT_SETTID = 0x100000
CLONE_PIDFD = 0x1000
CLONE_PTRACE = 0x2000 CLONE_PTRACE = 0x2000
CLONE_SETTLS = 0x80000 CLONE_SETTLS = 0x80000
CLONE_SIGHAND = 0x800 CLONE_SIGHAND = 0x800
@ -531,6 +544,7 @@ const (
ETH_P_DNA_RC = 0x6002 ETH_P_DNA_RC = 0x6002
ETH_P_DNA_RT = 0x6003 ETH_P_DNA_RT = 0x6003
ETH_P_DSA = 0x1b ETH_P_DSA = 0x1b
ETH_P_DSA_8021Q = 0xdadb
ETH_P_ECONET = 0x18 ETH_P_ECONET = 0x18
ETH_P_EDSA = 0xdada ETH_P_EDSA = 0xdada
ETH_P_ERSPAN = 0x88be ETH_P_ERSPAN = 0x88be
@ -1138,6 +1152,20 @@ const (
LOCK_NB = 0x4 LOCK_NB = 0x4
LOCK_SH = 0x1 LOCK_SH = 0x1
LOCK_UN = 0x8 LOCK_UN = 0x8
LOOP_CLR_FD = 0x4c01
LOOP_CTL_ADD = 0x4c80
LOOP_CTL_GET_FREE = 0x4c82
LOOP_CTL_REMOVE = 0x4c81
LOOP_GET_STATUS = 0x4c03
LOOP_GET_STATUS64 = 0x4c05
LOOP_SET_BLOCK_SIZE = 0x4c09
LOOP_SET_CAPACITY = 0x4c07
LOOP_SET_DIRECT_IO = 0x4c08
LOOP_SET_FD = 0x4c00
LOOP_SET_STATUS = 0x4c02
LOOP_SET_STATUS64 = 0x4c04
LO_KEY_SIZE = 0x20
LO_NAME_SIZE = 0x40
MADV_DODUMP = 0x11 MADV_DODUMP = 0x11
MADV_DOFORK = 0xb MADV_DOFORK = 0xb
MADV_DONTDUMP = 0x10 MADV_DONTDUMP = 0x10
@ -2050,6 +2078,10 @@ const (
SIOCGSKNS = 0x894c SIOCGSKNS = 0x894c
SIOCGSTAMP = 0x8906 SIOCGSTAMP = 0x8906
SIOCGSTAMPNS = 0x8907 SIOCGSTAMPNS = 0x8907
SIOCGSTAMPNS_NEW = 0x40108907
SIOCGSTAMPNS_OLD = 0x8907
SIOCGSTAMP_NEW = 0x40108906
SIOCGSTAMP_OLD = 0x8906
SIOCINQ = 0x4004667f SIOCINQ = 0x4004667f
SIOCOUTQ = 0x40047473 SIOCOUTQ = 0x40047473
SIOCOUTQNSD = 0x894b SIOCOUTQNSD = 0x894b
@ -2257,6 +2289,7 @@ const (
SYNC_FILE_RANGE_WAIT_AFTER = 0x4 SYNC_FILE_RANGE_WAIT_AFTER = 0x4
SYNC_FILE_RANGE_WAIT_BEFORE = 0x1 SYNC_FILE_RANGE_WAIT_BEFORE = 0x1
SYNC_FILE_RANGE_WRITE = 0x2 SYNC_FILE_RANGE_WRITE = 0x2
SYNC_FILE_RANGE_WRITE_AND_WAIT = 0x7
SYSFS_MAGIC = 0x62656572 SYSFS_MAGIC = 0x62656572
S_BLKSIZE = 0x200 S_BLKSIZE = 0x200
S_IEXEC = 0x40 S_IEXEC = 0x40
@ -2473,6 +2506,7 @@ const (
TS_COMM_LEN = 0x20 TS_COMM_LEN = 0x20
TUNATTACHFILTER = 0x801054d5 TUNATTACHFILTER = 0x801054d5
TUNDETACHFILTER = 0x801054d6 TUNDETACHFILTER = 0x801054d6
TUNGETDEVNETNS = 0x200054e3
TUNGETFEATURES = 0x400454cf TUNGETFEATURES = 0x400454cf
TUNGETFILTER = 0x401054db TUNGETFILTER = 0x401054db
TUNGETIFF = 0x400454d2 TUNGETIFF = 0x400454d2

View File

@ -749,6 +749,23 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getdents(fd int, buf []byte) (n int, err error) {
var _p0 unsafe.Pointer
if len(buf) > 0 {
_p0 = unsafe.Pointer(&buf[0])
} else {
_p0 = unsafe.Pointer(&_zero)
}
r0, _, e1 := Syscall(SYS_GETDENTS, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
n = int(r0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) { func Getdirentries(fd int, buf []byte, basep *uintptr) (n int, err error) {
var _p0 unsafe.Pointer var _p0 unsafe.Pointer
if len(buf) > 0 { if len(buf) > 0 {

View File

@ -423,4 +423,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -345,4 +345,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -387,4 +387,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -290,4 +290,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -408,4 +408,10 @@ const (
SYS_IO_URING_SETUP = 4425 SYS_IO_URING_SETUP = 4425
SYS_IO_URING_ENTER = 4426 SYS_IO_URING_ENTER = 4426
SYS_IO_URING_REGISTER = 4427 SYS_IO_URING_REGISTER = 4427
SYS_OPEN_TREE = 4428
SYS_MOVE_MOUNT = 4429
SYS_FSOPEN = 4430
SYS_FSCONFIG = 4431
SYS_FSMOUNT = 4432
SYS_FSPICK = 4433
) )

View File

@ -338,4 +338,10 @@ const (
SYS_IO_URING_SETUP = 5425 SYS_IO_URING_SETUP = 5425
SYS_IO_URING_ENTER = 5426 SYS_IO_URING_ENTER = 5426
SYS_IO_URING_REGISTER = 5427 SYS_IO_URING_REGISTER = 5427
SYS_OPEN_TREE = 5428
SYS_MOVE_MOUNT = 5429
SYS_FSOPEN = 5430
SYS_FSCONFIG = 5431
SYS_FSMOUNT = 5432
SYS_FSPICK = 5433
) )

View File

@ -338,4 +338,10 @@ const (
SYS_IO_URING_SETUP = 5425 SYS_IO_URING_SETUP = 5425
SYS_IO_URING_ENTER = 5426 SYS_IO_URING_ENTER = 5426
SYS_IO_URING_REGISTER = 5427 SYS_IO_URING_REGISTER = 5427
SYS_OPEN_TREE = 5428
SYS_MOVE_MOUNT = 5429
SYS_FSOPEN = 5430
SYS_FSCONFIG = 5431
SYS_FSMOUNT = 5432
SYS_FSPICK = 5433
) )

View File

@ -408,4 +408,10 @@ const (
SYS_IO_URING_SETUP = 4425 SYS_IO_URING_SETUP = 4425
SYS_IO_URING_ENTER = 4426 SYS_IO_URING_ENTER = 4426
SYS_IO_URING_REGISTER = 4427 SYS_IO_URING_REGISTER = 4427
SYS_OPEN_TREE = 4428
SYS_MOVE_MOUNT = 4429
SYS_FSOPEN = 4430
SYS_FSCONFIG = 4431
SYS_FSMOUNT = 4432
SYS_FSPICK = 4433
) )

View File

@ -387,4 +387,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -387,4 +387,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -289,4 +289,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -352,4 +352,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -367,4 +367,10 @@ const (
SYS_IO_URING_SETUP = 425 SYS_IO_URING_SETUP = 425
SYS_IO_URING_ENTER = 426 SYS_IO_URING_ENTER = 426
SYS_IO_URING_REGISTER = 427 SYS_IO_URING_REGISTER = 427
SYS_OPEN_TREE = 428
SYS_MOVE_MOUNT = 429
SYS_FSOPEN = 430
SYS_FSCONFIG = 431
SYS_FSMOUNT = 432
SYS_FSPICK = 433
) )

View File

@ -2484,3 +2484,40 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint16
Inode uint32
Rdevice uint16
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint32
Reserved [4]int8
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2497,3 +2497,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint64
Inode uint64
Rdevice uint64
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2475,3 +2475,40 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint16
Inode uint32
Rdevice uint16
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]uint8
Encrypt_key [32]uint8
Init [2]uint32
Reserved [4]uint8
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2476,3 +2476,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2481,3 +2481,40 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint32
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint32
Reserved [4]int8
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2478,3 +2478,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2478,3 +2478,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2481,3 +2481,40 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint32
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint32
Reserved [4]int8
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2486,3 +2486,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint64
Inode uint64
Rdevice uint64
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]uint8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2486,3 +2486,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint64
Inode uint64
Rdevice uint64
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]uint8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2503,3 +2503,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]uint8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2500,3 +2500,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint16
Inode uint64
Rdevice uint16
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -2481,3 +2481,41 @@ const (
LINUX_CAPABILITY_VERSION_2 = 0x20071026 LINUX_CAPABILITY_VERSION_2 = 0x20071026
LINUX_CAPABILITY_VERSION_3 = 0x20080522 LINUX_CAPABILITY_VERSION_3 = 0x20080522
) )
const (
LO_FLAGS_READ_ONLY = 0x1
LO_FLAGS_AUTOCLEAR = 0x4
LO_FLAGS_PARTSCAN = 0x8
LO_FLAGS_DIRECT_IO = 0x10
)
type LoopInfo struct {
Number int32
Device uint32
Inode uint64
Rdevice uint32
Offset int32
Encrypt_type int32
Encrypt_key_size int32
Flags int32
Name [64]int8
Encrypt_key [32]uint8
Init [2]uint64
Reserved [4]int8
_ [4]byte
}
type LoopInfo64 struct {
Device uint64
Inode uint64
Rdevice uint64
Offset uint64
Sizelimit uint64
Number uint32
Encrypt_type uint32
Encrypt_key_size uint32
Flags uint32
File_name [64]uint8
Crypt_name [64]uint8
Encrypt_key [32]uint8
Init [2]uint64
}

View File

@ -22,6 +22,7 @@ package balancer
import ( import (
"context" "context"
"encoding/json"
"errors" "errors"
"net" "net"
"strings" "strings"
@ -31,6 +32,7 @@ import (
"google.golang.org/grpc/internal" "google.golang.org/grpc/internal"
"google.golang.org/grpc/metadata" "google.golang.org/grpc/metadata"
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
"google.golang.org/grpc/serviceconfig"
) )
var ( var (
@ -39,7 +41,10 @@ var (
) )
// Register registers the balancer builder to the balancer map. b.Name // Register registers the balancer builder to the balancer map. b.Name
// (lowercased) will be used as the name registered with this builder. // (lowercased) will be used as the name registered with this builder. If the
// Builder implements ConfigParser, ParseConfig will be called when new service
// configs are received by the resolver, and the result will be provided to the
// Balancer in UpdateClientConnState.
// //
// NOTE: this function must only be called during initialization time (i.e. in // NOTE: this function must only be called during initialization time (i.e. in
// an init() function), and is not thread-safe. If multiple Balancers are // an init() function), and is not thread-safe. If multiple Balancers are
@ -172,6 +177,14 @@ type Builder interface {
Name() string Name() string
} }
// ConfigParser parses load balancer configs.
type ConfigParser interface {
// ParseConfig parses the JSON load balancer config provided into an
// internal form or returns an error if the config is invalid. For future
// compatibility reasons, unknown fields in the config should be ignored.
ParseConfig(LoadBalancingConfigJSON json.RawMessage) (serviceconfig.LoadBalancingConfig, error)
}
// PickOptions contains addition information for the Pick operation. // PickOptions contains addition information for the Pick operation.
type PickOptions struct { type PickOptions struct {
// FullMethodName is the method name that NewClientStream() is called // FullMethodName is the method name that NewClientStream() is called
@ -270,7 +283,7 @@ type Balancer interface {
// non-nil error to gRPC. // non-nil error to gRPC.
// //
// Deprecated: if V2Balancer is implemented by the Balancer, // Deprecated: if V2Balancer is implemented by the Balancer,
// UpdateResolverState will be called instead. // UpdateClientConnState will be called instead.
HandleResolvedAddrs([]resolver.Address, error) HandleResolvedAddrs([]resolver.Address, error)
// Close closes the balancer. The balancer is not required to call // Close closes the balancer. The balancer is not required to call
// ClientConn.RemoveSubConn for its existing SubConns. // ClientConn.RemoveSubConn for its existing SubConns.
@ -283,14 +296,23 @@ type SubConnState struct {
// TODO: add last connection error // TODO: add last connection error
} }
// ClientConnState describes the state of a ClientConn relevant to the
// balancer.
type ClientConnState struct {
ResolverState resolver.State
// The parsed load balancing configuration returned by the builder's
// ParseConfig method, if implemented.
BalancerConfig serviceconfig.LoadBalancingConfig
}
// V2Balancer is defined for documentation purposes. If a Balancer also // V2Balancer is defined for documentation purposes. If a Balancer also
// implements V2Balancer, its UpdateResolverState method will be called instead // implements V2Balancer, its UpdateClientConnState method will be called
// of HandleResolvedAddrs and its UpdateSubConnState will be called instead of // instead of HandleResolvedAddrs and its UpdateSubConnState will be called
// HandleSubConnStateChange. // instead of HandleSubConnStateChange.
type V2Balancer interface { type V2Balancer interface {
// UpdateResolverState is called by gRPC when the state of the resolver // UpdateClientConnState is called by gRPC when the state of the ClientConn
// changes. // changes.
UpdateResolverState(resolver.State) UpdateClientConnState(ClientConnState)
// UpdateSubConnState is called by gRPC when the state of a SubConn // UpdateSubConnState is called by gRPC when the state of a SubConn
// changes. // changes.
UpdateSubConnState(SubConn, SubConnState) UpdateSubConnState(SubConn, SubConnState)

View File

@ -70,13 +70,13 @@ func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error)
panic("not implemented") panic("not implemented")
} }
func (b *baseBalancer) UpdateResolverState(s resolver.State) { func (b *baseBalancer) UpdateClientConnState(s balancer.ClientConnState) {
// TODO: handle s.Err (log if not nil) once implemented. // TODO: handle s.ResolverState.Err (log if not nil) once implemented.
// TODO: handle s.ServiceConfig? // TODO: handle s.ResolverState.ServiceConfig?
grpclog.Infoln("base.baseBalancer: got new resolver state: ", s) grpclog.Infoln("base.baseBalancer: got new ClientConn state: ", s)
// addrsSet is the set converted from addrs, it's used for quick lookup of an address. // addrsSet is the set converted from addrs, it's used for quick lookup of an address.
addrsSet := make(map[resolver.Address]struct{}) addrsSet := make(map[resolver.Address]struct{})
for _, a := range s.Addresses { for _, a := range s.ResolverState.Addresses {
addrsSet[a] = struct{}{} addrsSet[a] = struct{}{}
if _, ok := b.subConns[a]; !ok { if _, ok := b.subConns[a]; !ok {
// a is a new address (not existing in b.subConns). // a is a new address (not existing in b.subConns).

View File

@ -88,7 +88,7 @@ type ccBalancerWrapper struct {
cc *ClientConn cc *ClientConn
balancer balancer.Balancer balancer balancer.Balancer
stateChangeQueue *scStateUpdateBuffer stateChangeQueue *scStateUpdateBuffer
resolverUpdateCh chan *resolver.State ccUpdateCh chan *balancer.ClientConnState
done chan struct{} done chan struct{}
mu sync.Mutex mu sync.Mutex
@ -99,7 +99,7 @@ func newCCBalancerWrapper(cc *ClientConn, b balancer.Builder, bopts balancer.Bui
ccb := &ccBalancerWrapper{ ccb := &ccBalancerWrapper{
cc: cc, cc: cc,
stateChangeQueue: newSCStateUpdateBuffer(), stateChangeQueue: newSCStateUpdateBuffer(),
resolverUpdateCh: make(chan *resolver.State, 1), ccUpdateCh: make(chan *balancer.ClientConnState, 1),
done: make(chan struct{}), done: make(chan struct{}),
subConns: make(map[*acBalancerWrapper]struct{}), subConns: make(map[*acBalancerWrapper]struct{}),
} }
@ -126,7 +126,7 @@ func (ccb *ccBalancerWrapper) watcher() {
} else { } else {
ccb.balancer.HandleSubConnStateChange(t.sc, t.state) ccb.balancer.HandleSubConnStateChange(t.sc, t.state)
} }
case s := <-ccb.resolverUpdateCh: case s := <-ccb.ccUpdateCh:
select { select {
case <-ccb.done: case <-ccb.done:
ccb.balancer.Close() ccb.balancer.Close()
@ -134,9 +134,9 @@ func (ccb *ccBalancerWrapper) watcher() {
default: default:
} }
if ub, ok := ccb.balancer.(balancer.V2Balancer); ok { if ub, ok := ccb.balancer.(balancer.V2Balancer); ok {
ub.UpdateResolverState(*s) ub.UpdateClientConnState(*s)
} else { } else {
ccb.balancer.HandleResolvedAddrs(s.Addresses, nil) ccb.balancer.HandleResolvedAddrs(s.ResolverState.Addresses, nil)
} }
case <-ccb.done: case <-ccb.done:
} }
@ -151,9 +151,11 @@ func (ccb *ccBalancerWrapper) watcher() {
for acbw := range scs { for acbw := range scs {
ccb.cc.removeAddrConn(acbw.getAddrConn(), errConnDrain) ccb.cc.removeAddrConn(acbw.getAddrConn(), errConnDrain)
} }
ccb.UpdateBalancerState(connectivity.Connecting, nil)
return return
default: default:
} }
ccb.cc.firstResolveEvent.Fire()
} }
} }
@ -178,9 +180,10 @@ func (ccb *ccBalancerWrapper) handleSubConnStateChange(sc balancer.SubConn, s co
}) })
} }
func (ccb *ccBalancerWrapper) updateResolverState(s resolver.State) { func (ccb *ccBalancerWrapper) updateClientConnState(ccs *balancer.ClientConnState) {
if ccb.cc.curBalancerName != grpclbName { if ccb.cc.curBalancerName != grpclbName {
// Filter any grpclb addresses since we don't have the grpclb balancer. // Filter any grpclb addresses since we don't have the grpclb balancer.
s := ccs.ResolverState
for i := 0; i < len(s.Addresses); { for i := 0; i < len(s.Addresses); {
if s.Addresses[i].Type == resolver.GRPCLB { if s.Addresses[i].Type == resolver.GRPCLB {
copy(s.Addresses[i:], s.Addresses[i+1:]) copy(s.Addresses[i:], s.Addresses[i+1:])
@ -191,10 +194,10 @@ func (ccb *ccBalancerWrapper) updateResolverState(s resolver.State) {
} }
} }
select { select {
case <-ccb.resolverUpdateCh: case <-ccb.ccUpdateCh:
default: default:
} }
ccb.resolverUpdateCh <- &s ccb.ccUpdateCh <- ccs
} }
func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) { func (ccb *ccBalancerWrapper) NewSubConn(addrs []resolver.Address, opts balancer.NewSubConnOptions) (balancer.SubConn, error) {

View File

@ -45,6 +45,7 @@ import (
"google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver"
_ "google.golang.org/grpc/resolver/dns" // To register dns resolver. _ "google.golang.org/grpc/resolver/dns" // To register dns resolver.
_ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver. _ "google.golang.org/grpc/resolver/passthrough" // To register passthrough resolver.
"google.golang.org/grpc/serviceconfig"
"google.golang.org/grpc/status" "google.golang.org/grpc/status"
) )
@ -532,24 +533,6 @@ func (cc *ClientConn) waitForResolvedAddrs(ctx context.Context) error {
} }
} }
// gRPC should resort to default service config when:
// * resolver service config is disabled
// * or, resolver does not return a service config or returns an invalid one.
func (cc *ClientConn) fallbackToDefaultServiceConfig(sc string) bool {
if cc.dopts.disableServiceConfig {
return true
}
// The logic below is temporary, will be removed once we change the resolver.State ServiceConfig field type.
// Right now, we assume that empty service config string means resolver does not return a config.
if sc == "" {
return true
}
// TODO: the logic below is temporary. Once we finish the logic to validate service config
// in resolver, we will replace the logic below.
_, err := parseServiceConfig(sc)
return err != nil
}
func (cc *ClientConn) updateResolverState(s resolver.State) error { func (cc *ClientConn) updateResolverState(s resolver.State) error {
cc.mu.Lock() cc.mu.Lock()
defer cc.mu.Unlock() defer cc.mu.Unlock()
@ -560,44 +543,37 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error {
return nil return nil
} }
if cc.fallbackToDefaultServiceConfig(s.ServiceConfig) { if cc.dopts.disableServiceConfig || s.ServiceConfig == nil {
if cc.dopts.defaultServiceConfig != nil && cc.sc == nil { if cc.dopts.defaultServiceConfig != nil && cc.sc == nil {
cc.applyServiceConfig(cc.dopts.defaultServiceConfig) cc.applyServiceConfig(cc.dopts.defaultServiceConfig)
} }
} else { } else if sc, ok := s.ServiceConfig.(*ServiceConfig); ok {
// TODO: the parsing logic below will be moved inside resolver. cc.applyServiceConfig(sc)
sc, err := parseServiceConfig(s.ServiceConfig)
if err != nil {
return err
}
if cc.sc == nil || cc.sc.rawJSONString != s.ServiceConfig {
cc.applyServiceConfig(sc)
}
}
// update the service config that will be sent to balancer.
if cc.sc != nil {
s.ServiceConfig = cc.sc.rawJSONString
} }
var balCfg serviceconfig.LoadBalancingConfig
if cc.dopts.balancerBuilder == nil { if cc.dopts.balancerBuilder == nil {
// Only look at balancer types and switch balancer if balancer dial // Only look at balancer types and switch balancer if balancer dial
// option is not set. // option is not set.
var isGRPCLB bool
for _, a := range s.Addresses {
if a.Type == resolver.GRPCLB {
isGRPCLB = true
break
}
}
var newBalancerName string var newBalancerName string
// TODO: use new loadBalancerConfig field with appropriate priority. if cc.sc != nil && cc.sc.lbConfig != nil {
if isGRPCLB { newBalancerName = cc.sc.lbConfig.name
newBalancerName = grpclbName balCfg = cc.sc.lbConfig.cfg
} else if cc.sc != nil && cc.sc.LB != nil {
newBalancerName = *cc.sc.LB
} else { } else {
newBalancerName = PickFirstBalancerName var isGRPCLB bool
for _, a := range s.Addresses {
if a.Type == resolver.GRPCLB {
isGRPCLB = true
break
}
}
if isGRPCLB {
newBalancerName = grpclbName
} else if cc.sc != nil && cc.sc.LB != nil {
newBalancerName = *cc.sc.LB
} else {
newBalancerName = PickFirstBalancerName
}
} }
cc.switchBalancer(newBalancerName) cc.switchBalancer(newBalancerName)
} else if cc.balancerWrapper == nil { } else if cc.balancerWrapper == nil {
@ -607,8 +583,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error {
cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts) cc.balancerWrapper = newCCBalancerWrapper(cc, cc.dopts.balancerBuilder, cc.balancerBuildOpts)
} }
cc.balancerWrapper.updateResolverState(s) cc.balancerWrapper.updateClientConnState(&balancer.ClientConnState{ResolverState: s, BalancerConfig: balCfg})
cc.firstResolveEvent.Fire()
return nil return nil
} }
@ -621,7 +596,7 @@ func (cc *ClientConn) updateResolverState(s resolver.State) error {
// //
// Caller must hold cc.mu. // Caller must hold cc.mu.
func (cc *ClientConn) switchBalancer(name string) { func (cc *ClientConn) switchBalancer(name string) {
if strings.ToLower(cc.curBalancerName) == strings.ToLower(name) { if strings.EqualFold(cc.curBalancerName, name) {
return return
} }
@ -760,6 +735,8 @@ func (ac *addrConn) connect() error {
ac.mu.Unlock() ac.mu.Unlock()
return nil return nil
} }
// Update connectivity state within the lock to prevent subsequent or
// concurrent calls from resetting the transport more than once.
ac.updateConnectivityState(connectivity.Connecting) ac.updateConnectivityState(connectivity.Connecting)
ac.mu.Unlock() ac.mu.Unlock()
@ -770,7 +747,16 @@ func (ac *addrConn) connect() error {
// tryUpdateAddrs tries to update ac.addrs with the new addresses list. // tryUpdateAddrs tries to update ac.addrs with the new addresses list.
// //
// It checks whether current connected address of ac is in the new addrs list. // If ac is Connecting, it returns false. The caller should tear down the ac and
// create a new one. Note that the backoff will be reset when this happens.
//
// If ac is TransientFailure, it updates ac.addrs and returns true. The updated
// addresses will be picked up by retry in the next iteration after backoff.
//
// If ac is Shutdown or Idle, it updates ac.addrs and returns true.
//
// If ac is Ready, it checks whether current connected address of ac is in the
// new addrs list.
// - If true, it updates ac.addrs and returns true. The ac will keep using // - If true, it updates ac.addrs and returns true. The ac will keep using
// the existing connection. // the existing connection.
// - If false, it does nothing and returns false. // - If false, it does nothing and returns false.
@ -778,17 +764,18 @@ func (ac *addrConn) tryUpdateAddrs(addrs []resolver.Address) bool {
ac.mu.Lock() ac.mu.Lock()
defer ac.mu.Unlock() defer ac.mu.Unlock()
grpclog.Infof("addrConn: tryUpdateAddrs curAddr: %v, addrs: %v", ac.curAddr, addrs) grpclog.Infof("addrConn: tryUpdateAddrs curAddr: %v, addrs: %v", ac.curAddr, addrs)
if ac.state == connectivity.Shutdown { if ac.state == connectivity.Shutdown ||
ac.state == connectivity.TransientFailure ||
ac.state == connectivity.Idle {
ac.addrs = addrs ac.addrs = addrs
return true return true
} }
// Unless we're busy reconnecting already, let's reconnect from the top of if ac.state == connectivity.Connecting {
// the list.
if ac.state != connectivity.Ready {
return false return false
} }
// ac.state is Ready, try to find the connected address.
var curAddrFound bool var curAddrFound bool
for _, a := range addrs { for _, a := range addrs {
if reflect.DeepEqual(ac.curAddr, a) { if reflect.DeepEqual(ac.curAddr, a) {
@ -1037,6 +1024,9 @@ func (ac *addrConn) resetTransport() {
// The spec doesn't mention what should be done for multiple addresses. // The spec doesn't mention what should be done for multiple addresses.
// https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md#proposed-backoff-algorithm // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md#proposed-backoff-algorithm
connectDeadline := time.Now().Add(dialDuration) connectDeadline := time.Now().Add(dialDuration)
ac.updateConnectivityState(connectivity.Connecting)
ac.transport = nil
ac.mu.Unlock() ac.mu.Unlock()
newTr, addr, reconnect, err := ac.tryAllAddrs(addrs, connectDeadline) newTr, addr, reconnect, err := ac.tryAllAddrs(addrs, connectDeadline)
@ -1079,27 +1069,8 @@ func (ac *addrConn) resetTransport() {
ac.transport = newTr ac.transport = newTr
ac.backoffIdx = 0 ac.backoffIdx = 0
healthCheckConfig := ac.cc.healthCheckConfig()
// LB channel health checking is only enabled when all the four requirements below are met:
// 1. it is not disabled by the user with the WithDisableHealthCheck DialOption,
// 2. the internal.HealthCheckFunc is set by importing the grpc/healthcheck package,
// 3. a service config with non-empty healthCheckConfig field is provided,
// 4. the current load balancer allows it.
hctx, hcancel := context.WithCancel(ac.ctx) hctx, hcancel := context.WithCancel(ac.ctx)
healthcheckManagingState := false ac.startHealthCheck(hctx)
if !ac.cc.dopts.disableHealthCheck && healthCheckConfig != nil && ac.scopts.HealthCheckEnabled {
if ac.cc.dopts.healthCheckFunc == nil {
// TODO: add a link to the health check doc in the error message.
grpclog.Error("the client side LB channel health check function has not been set.")
} else {
// TODO(deklerk) refactor to just return transport
go ac.startHealthCheck(hctx, newTr, addr, healthCheckConfig.ServiceName)
healthcheckManagingState = true
}
}
if !healthcheckManagingState {
ac.updateConnectivityState(connectivity.Ready)
}
ac.mu.Unlock() ac.mu.Unlock()
// Block until the created transport is down. And when this happens, // Block until the created transport is down. And when this happens,
@ -1133,8 +1104,6 @@ func (ac *addrConn) tryAllAddrs(addrs []resolver.Address, connectDeadline time.T
ac.mu.Unlock() ac.mu.Unlock()
return nil, resolver.Address{}, nil, errConnClosing return nil, resolver.Address{}, nil, errConnClosing
} }
ac.updateConnectivityState(connectivity.Connecting)
ac.transport = nil
ac.cc.mu.RLock() ac.cc.mu.RLock()
ac.dopts.copts.KeepaliveParams = ac.cc.mkp ac.dopts.copts.KeepaliveParams = ac.cc.mkp
@ -1225,42 +1194,83 @@ func (ac *addrConn) createTransport(addr resolver.Address, copts transport.Conne
return newTr, reconnect, nil return newTr, reconnect, nil
} }
func (ac *addrConn) startHealthCheck(ctx context.Context, newTr transport.ClientTransport, addr resolver.Address, serviceName string) { // startHealthCheck starts the health checking stream (RPC) to watch the health
// Set up the health check helper functions // stats of this connection if health checking is requested and configured.
newStream := func() (interface{}, error) { //
return ac.newClientStream(ctx, &StreamDesc{ServerStreams: true}, "/grpc.health.v1.Health/Watch", newTr) // LB channel health checking is enabled when all requirements below are met:
// 1. it is not disabled by the user with the WithDisableHealthCheck DialOption
// 2. internal.HealthCheckFunc is set by importing the grpc/healthcheck package
// 3. a service config with non-empty healthCheckConfig field is provided
// 4. the load balancer requests it
//
// It sets addrConn to READY if the health checking stream is not started.
//
// Caller must hold ac.mu.
func (ac *addrConn) startHealthCheck(ctx context.Context) {
var healthcheckManagingState bool
defer func() {
if !healthcheckManagingState {
ac.updateConnectivityState(connectivity.Ready)
}
}()
if ac.cc.dopts.disableHealthCheck {
return
} }
firstReady := true healthCheckConfig := ac.cc.healthCheckConfig()
reportHealth := func(ok bool) { if healthCheckConfig == nil {
return
}
if !ac.scopts.HealthCheckEnabled {
return
}
healthCheckFunc := ac.cc.dopts.healthCheckFunc
if healthCheckFunc == nil {
// The health package is not imported to set health check function.
//
// TODO: add a link to the health check doc in the error message.
grpclog.Error("Health check is requested but health check function is not set.")
return
}
healthcheckManagingState = true
// Set up the health check helper functions.
currentTr := ac.transport
newStream := func(method string) (interface{}, error) {
ac.mu.Lock()
if ac.transport != currentTr {
ac.mu.Unlock()
return nil, status.Error(codes.Canceled, "the provided transport is no longer valid to use")
}
ac.mu.Unlock()
return newNonRetryClientStream(ctx, &StreamDesc{ServerStreams: true}, method, currentTr, ac)
}
setConnectivityState := func(s connectivity.State) {
ac.mu.Lock() ac.mu.Lock()
defer ac.mu.Unlock() defer ac.mu.Unlock()
if ac.transport != newTr { if ac.transport != currentTr {
return return
} }
if ok { ac.updateConnectivityState(s)
if firstReady {
firstReady = false
ac.curAddr = addr
}
ac.updateConnectivityState(connectivity.Ready)
} else {
ac.updateConnectivityState(connectivity.TransientFailure)
}
} }
err := ac.cc.dopts.healthCheckFunc(ctx, newStream, reportHealth, serviceName) // Start the health checking stream.
if err != nil { go func() {
if status.Code(err) == codes.Unimplemented { err := ac.cc.dopts.healthCheckFunc(ctx, newStream, setConnectivityState, healthCheckConfig.ServiceName)
if channelz.IsOn() { if err != nil {
channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{ if status.Code(err) == codes.Unimplemented {
Desc: "Subchannel health check is unimplemented at server side, thus health check is disabled", if channelz.IsOn() {
Severity: channelz.CtError, channelz.AddTraceEvent(ac.channelzID, &channelz.TraceEventDesc{
}) Desc: "Subchannel health check is unimplemented at server side, thus health check is disabled",
Severity: channelz.CtError,
})
}
grpclog.Error("Subchannel health check is unimplemented at server side, thus health check is disabled")
} else {
grpclog.Errorf("HealthCheckFunc exits with unexpected error %v", err)
} }
grpclog.Error("Subchannel health check is unimplemented at server side, thus health check is disabled")
} else {
grpclog.Errorf("HealthCheckFunc exits with unexpected error %v", err)
} }
} }()
} }
func (ac *addrConn) resetConnectBackoff() { func (ac *addrConn) resetConnectBackoff() {

View File

@ -278,24 +278,22 @@ type ChannelzSecurityValue interface {
// TLSChannelzSecurityValue defines the struct that TLS protocol should return // TLSChannelzSecurityValue defines the struct that TLS protocol should return
// from GetSecurityValue(), containing security info like cipher and certificate used. // from GetSecurityValue(), containing security info like cipher and certificate used.
type TLSChannelzSecurityValue struct { type TLSChannelzSecurityValue struct {
ChannelzSecurityValue
StandardName string StandardName string
LocalCertificate []byte LocalCertificate []byte
RemoteCertificate []byte RemoteCertificate []byte
} }
func (*TLSChannelzSecurityValue) isChannelzSecurityValue() {}
// OtherChannelzSecurityValue defines the struct that non-TLS protocol should return // OtherChannelzSecurityValue defines the struct that non-TLS protocol should return
// from GetSecurityValue(), which contains protocol specific security info. Note // from GetSecurityValue(), which contains protocol specific security info. Note
// the Value field will be sent to users of channelz requesting channel info, and // the Value field will be sent to users of channelz requesting channel info, and
// thus sensitive info should better be avoided. // thus sensitive info should better be avoided.
type OtherChannelzSecurityValue struct { type OtherChannelzSecurityValue struct {
ChannelzSecurityValue
Name string Name string
Value proto.Message Value proto.Message
} }
func (*OtherChannelzSecurityValue) isChannelzSecurityValue() {}
var cipherSuiteLookup = map[uint16]string{ var cipherSuiteLookup = map[uint16]string{
tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA", tls.TLS_RSA_WITH_RC4_128_SHA: "TLS_RSA_WITH_RC4_128_SHA",
tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA", tls.TLS_RSA_WITH_3DES_EDE_CBC_SHA: "TLS_RSA_WITH_3DES_EDE_CBC_SHA",

View File

@ -23,6 +23,8 @@ package internal
import ( import (
"context" "context"
"time" "time"
"google.golang.org/grpc/connectivity"
) )
var ( var (
@ -37,10 +39,25 @@ var (
// KeepaliveMinPingTime is the minimum ping interval. This must be 10s by // KeepaliveMinPingTime is the minimum ping interval. This must be 10s by
// default, but tests may wish to set it lower for convenience. // default, but tests may wish to set it lower for convenience.
KeepaliveMinPingTime = 10 * time.Second KeepaliveMinPingTime = 10 * time.Second
// ParseServiceConfig is a function to parse JSON service configs into
// opaque data structures.
ParseServiceConfig func(sc string) (interface{}, error)
// StatusRawProto is exported by status/status.go. This func returns a
// pointer to the wrapped Status proto for a given status.Status without a
// call to proto.Clone(). The returned Status proto should not be mutated by
// the caller.
StatusRawProto interface{} // func (*status.Status) *spb.Status
) )
// HealthChecker defines the signature of the client-side LB channel health checking function. // HealthChecker defines the signature of the client-side LB channel health checking function.
type HealthChecker func(ctx context.Context, newStream func() (interface{}, error), reportHealth func(bool), serviceName string) error //
// The implementation is expected to create a health checking RPC stream by
// calling newStream(), watch for the health status of serviceName, and report
// it's health back by calling setConnectivityState().
//
// The health checking protocol is defined at:
// https://github.com/grpc/grpc/blob/master/doc/health-checking.md
type HealthChecker func(ctx context.Context, newStream func(string) (interface{}, error), setConnectivityState func(connectivity.State), serviceName string) error
const ( const (
// CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode. // CredsBundleModeFallback switches GoogleDefaultCreds to fallback mode.

View File

@ -24,6 +24,7 @@
package transport package transport
import ( import (
"bytes"
"context" "context"
"errors" "errors"
"fmt" "fmt"
@ -347,7 +348,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace
ht.stats.HandleRPC(s.ctx, inHeader) ht.stats.HandleRPC(s.ctx, inHeader)
} }
s.trReader = &transportReader{ s.trReader = &transportReader{
reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf}, reader: &recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: s.buf, freeBuffer: func(*bytes.Buffer) {}},
windowHandler: func(int) {}, windowHandler: func(int) {},
} }
@ -361,7 +362,7 @@ func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), trace
for buf := make([]byte, readSize); ; { for buf := make([]byte, readSize); ; {
n, err := req.Body.Read(buf) n, err := req.Body.Read(buf)
if n > 0 { if n > 0 {
s.buf.put(recvMsg{data: buf[:n:n]}) s.buf.put(recvMsg{buffer: bytes.NewBuffer(buf[:n:n])})
buf = buf[n:] buf = buf[n:]
} }
if err != nil { if err != nil {

View File

@ -117,6 +117,8 @@ type http2Client struct {
onGoAway func(GoAwayReason) onGoAway func(GoAwayReason)
onClose func() onClose func()
bufferPool *bufferPool
} }
func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) {
@ -249,6 +251,7 @@ func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts Conne
onGoAway: onGoAway, onGoAway: onGoAway,
onClose: onClose, onClose: onClose,
keepaliveEnabled: keepaliveEnabled, keepaliveEnabled: keepaliveEnabled,
bufferPool: newBufferPool(),
} }
t.controlBuf = newControlBuffer(t.ctxDone) t.controlBuf = newControlBuffer(t.ctxDone)
if opts.InitialWindowSize >= defaultWindowSize { if opts.InitialWindowSize >= defaultWindowSize {
@ -367,6 +370,7 @@ func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream {
closeStream: func(err error) { closeStream: func(err error) {
t.CloseStream(s, err) t.CloseStream(s, err)
}, },
freeBuffer: t.bufferPool.put,
}, },
windowHandler: func(n int) { windowHandler: func(n int) {
t.updateWindow(s, uint32(n)) t.updateWindow(s, uint32(n))
@ -437,6 +441,15 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr)
if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok { if md, added, ok := metadata.FromOutgoingContextRaw(ctx); ok {
var k string var k string
for k, vv := range md {
// HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set.
if isReservedHeader(k) {
continue
}
for _, v := range vv {
headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)})
}
}
for _, vv := range added { for _, vv := range added {
for i, v := range vv { for i, v := range vv {
if i%2 == 0 { if i%2 == 0 {
@ -450,15 +463,6 @@ func (t *http2Client) createHeaderFields(ctx context.Context, callHdr *CallHdr)
headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)}) headerFields = append(headerFields, hpack.HeaderField{Name: strings.ToLower(k), Value: encodeMetadataHeader(k, v)})
} }
} }
for k, vv := range md {
// HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set.
if isReservedHeader(k) {
continue
}
for _, v := range vv {
headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)})
}
}
} }
if md, ok := t.md.(*metadata.MD); ok { if md, ok := t.md.(*metadata.MD); ok {
for k, vv := range *md { for k, vv := range *md {
@ -946,9 +950,10 @@ func (t *http2Client) handleData(f *http2.DataFrame) {
// guarantee f.Data() is consumed before the arrival of next frame. // guarantee f.Data() is consumed before the arrival of next frame.
// Can this copy be eliminated? // Can this copy be eliminated?
if len(f.Data()) > 0 { if len(f.Data()) > 0 {
data := make([]byte, len(f.Data())) buffer := t.bufferPool.get()
copy(data, f.Data()) buffer.Reset()
s.write(recvMsg{data: data}) buffer.Write(f.Data())
s.write(recvMsg{buffer: buffer})
} }
} }
// The server has closed the stream without sending trailers. Record that // The server has closed the stream without sending trailers. Record that

View File

@ -35,9 +35,11 @@ import (
"golang.org/x/net/http2" "golang.org/x/net/http2"
"golang.org/x/net/http2/hpack" "golang.org/x/net/http2/hpack"
spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/internal/channelz"
"google.golang.org/grpc/internal/grpcrand" "google.golang.org/grpc/internal/grpcrand"
"google.golang.org/grpc/keepalive" "google.golang.org/grpc/keepalive"
@ -55,6 +57,9 @@ var (
// ErrHeaderListSizeLimitViolation indicates that the header list size is larger // ErrHeaderListSizeLimitViolation indicates that the header list size is larger
// than the limit set by peer. // than the limit set by peer.
ErrHeaderListSizeLimitViolation = errors.New("transport: trying to send header list size larger than the limit set by peer") ErrHeaderListSizeLimitViolation = errors.New("transport: trying to send header list size larger than the limit set by peer")
// statusRawProto is a function to get to the raw status proto wrapped in a
// status.Status without a proto.Clone().
statusRawProto = internal.StatusRawProto.(func(*status.Status) *spb.Status)
) )
// http2Server implements the ServerTransport interface with HTTP2. // http2Server implements the ServerTransport interface with HTTP2.
@ -119,6 +124,7 @@ type http2Server struct {
// Fields below are for channelz metric collection. // Fields below are for channelz metric collection.
channelzID int64 // channelz unique identification number channelzID int64 // channelz unique identification number
czData *channelzData czData *channelzData
bufferPool *bufferPool
} }
// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is // newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is
@ -220,6 +226,7 @@ func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err
kep: kep, kep: kep,
initialWindowSize: iwz, initialWindowSize: iwz,
czData: new(channelzData), czData: new(channelzData),
bufferPool: newBufferPool(),
} }
t.controlBuf = newControlBuffer(t.ctxDone) t.controlBuf = newControlBuffer(t.ctxDone)
if dynamicWindow { if dynamicWindow {
@ -405,9 +412,10 @@ func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(
s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone) s.wq = newWriteQuota(defaultWriteQuota, s.ctxDone)
s.trReader = &transportReader{ s.trReader = &transportReader{
reader: &recvBufferReader{ reader: &recvBufferReader{
ctx: s.ctx, ctx: s.ctx,
ctxDone: s.ctxDone, ctxDone: s.ctxDone,
recv: s.buf, recv: s.buf,
freeBuffer: t.bufferPool.put,
}, },
windowHandler: func(n int) { windowHandler: func(n int) {
t.updateWindow(s, uint32(n)) t.updateWindow(s, uint32(n))
@ -591,9 +599,10 @@ func (t *http2Server) handleData(f *http2.DataFrame) {
// guarantee f.Data() is consumed before the arrival of next frame. // guarantee f.Data() is consumed before the arrival of next frame.
// Can this copy be eliminated? // Can this copy be eliminated?
if len(f.Data()) > 0 { if len(f.Data()) > 0 {
data := make([]byte, len(f.Data())) buffer := t.bufferPool.get()
copy(data, f.Data()) buffer.Reset()
s.write(recvMsg{data: data}) buffer.Write(f.Data())
s.write(recvMsg{buffer: buffer})
} }
} }
if f.Header().Flags.Has(http2.FlagDataEndStream) { if f.Header().Flags.Has(http2.FlagDataEndStream) {
@ -817,7 +826,7 @@ func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error {
headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))})
headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())})
if p := st.Proto(); p != nil && len(p.Details) > 0 { if p := statusRawProto(st); p != nil && len(p.Details) > 0 {
stBytes, err := proto.Marshal(p) stBytes, err := proto.Marshal(p)
if err != nil { if err != nil {
// TODO: return error instead, when callers are able to handle it. // TODO: return error instead, when callers are able to handle it.
@ -1019,13 +1028,7 @@ func (t *http2Server) Close() error {
} }
// deleteStream deletes the stream s from transport's active streams. // deleteStream deletes the stream s from transport's active streams.
func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState streamState) { func (t *http2Server) deleteStream(s *Stream, eosReceived bool) {
oldState = s.swapState(streamDone)
if oldState == streamDone {
// If the stream was already done, return.
return oldState
}
// In case stream sending and receiving are invoked in separate // In case stream sending and receiving are invoked in separate
// goroutines (e.g., bi-directional streaming), cancel needs to be // goroutines (e.g., bi-directional streaming), cancel needs to be
// called to interrupt the potential blocking on other goroutines. // called to interrupt the potential blocking on other goroutines.
@ -1047,15 +1050,13 @@ func (t *http2Server) deleteStream(s *Stream, eosReceived bool) (oldState stream
atomic.AddInt64(&t.czData.streamsFailed, 1) atomic.AddInt64(&t.czData.streamsFailed, 1)
} }
} }
return oldState
} }
// finishStream closes the stream and puts the trailing headerFrame into controlbuf. // finishStream closes the stream and puts the trailing headerFrame into controlbuf.
func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) { func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, hdr *headerFrame, eosReceived bool) {
oldState := t.deleteStream(s, eosReceived) oldState := s.swapState(streamDone)
// If the stream is already closed, then don't put trailing header to controlbuf.
if oldState == streamDone { if oldState == streamDone {
// If the stream was already done, return.
return return
} }
@ -1063,14 +1064,18 @@ func (t *http2Server) finishStream(s *Stream, rst bool, rstCode http2.ErrCode, h
streamID: s.id, streamID: s.id,
rst: rst, rst: rst,
rstCode: rstCode, rstCode: rstCode,
onWrite: func() {}, onWrite: func() {
t.deleteStream(s, eosReceived)
},
} }
t.controlBuf.put(hdr) t.controlBuf.put(hdr)
} }
// closeStream clears the footprint of a stream when the stream is not needed any more. // closeStream clears the footprint of a stream when the stream is not needed any more.
func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) { func (t *http2Server) closeStream(s *Stream, rst bool, rstCode http2.ErrCode, eosReceived bool) {
s.swapState(streamDone)
t.deleteStream(s, eosReceived) t.deleteStream(s, eosReceived)
t.controlBuf.put(&cleanupStream{ t.controlBuf.put(&cleanupStream{
streamID: s.id, streamID: s.id,
rst: rst, rst: rst,

View File

@ -22,6 +22,7 @@
package transport package transport
import ( import (
"bytes"
"context" "context"
"errors" "errors"
"fmt" "fmt"
@ -39,10 +40,32 @@ import (
"google.golang.org/grpc/tap" "google.golang.org/grpc/tap"
) )
type bufferPool struct {
pool sync.Pool
}
func newBufferPool() *bufferPool {
return &bufferPool{
pool: sync.Pool{
New: func() interface{} {
return new(bytes.Buffer)
},
},
}
}
func (p *bufferPool) get() *bytes.Buffer {
return p.pool.Get().(*bytes.Buffer)
}
func (p *bufferPool) put(b *bytes.Buffer) {
p.pool.Put(b)
}
// recvMsg represents the received msg from the transport. All transport // recvMsg represents the received msg from the transport. All transport
// protocol specific info has been removed. // protocol specific info has been removed.
type recvMsg struct { type recvMsg struct {
data []byte buffer *bytes.Buffer
// nil: received some data // nil: received some data
// io.EOF: stream is completed. data is nil. // io.EOF: stream is completed. data is nil.
// other non-nil error: transport failure. data is nil. // other non-nil error: transport failure. data is nil.
@ -117,8 +140,9 @@ type recvBufferReader struct {
ctx context.Context ctx context.Context
ctxDone <-chan struct{} // cache of ctx.Done() (for performance). ctxDone <-chan struct{} // cache of ctx.Done() (for performance).
recv *recvBuffer recv *recvBuffer
last []byte // Stores the remaining data in the previous calls. last *bytes.Buffer // Stores the remaining data in the previous calls.
err error err error
freeBuffer func(*bytes.Buffer)
} }
// Read reads the next len(p) bytes from last. If last is drained, it tries to // Read reads the next len(p) bytes from last. If last is drained, it tries to
@ -128,10 +152,13 @@ func (r *recvBufferReader) Read(p []byte) (n int, err error) {
if r.err != nil { if r.err != nil {
return 0, r.err return 0, r.err
} }
if r.last != nil && len(r.last) > 0 { if r.last != nil {
// Read remaining data left in last call. // Read remaining data left in last call.
copied := copy(p, r.last) copied, _ := r.last.Read(p)
r.last = r.last[copied:] if r.last.Len() == 0 {
r.freeBuffer(r.last)
r.last = nil
}
return copied, nil return copied, nil
} }
if r.closeStream != nil { if r.closeStream != nil {
@ -170,8 +197,13 @@ func (r *recvBufferReader) readAdditional(m recvMsg, p []byte) (n int, err error
if m.err != nil { if m.err != nil {
return 0, m.err return 0, m.err
} }
copied := copy(p, m.data) copied, _ := m.buffer.Read(p)
r.last = m.data[copied:] if m.buffer.Len() == 0 {
r.freeBuffer(m.buffer)
r.last = nil
} else {
r.last = m.buffer
}
return copied, nil return copied, nil
} }

View File

@ -17,9 +17,8 @@
*/ */
// Package naming defines the naming API and related data structures for gRPC. // Package naming defines the naming API and related data structures for gRPC.
// The interface is EXPERIMENTAL and may be subject to change.
// //
// Deprecated: please use package resolver. // This package is deprecated: please use package resolver instead.
package naming package naming
// Operation defines the corresponding operations for a name resolution change. // Operation defines the corresponding operations for a name resolution change.

View File

@ -20,6 +20,10 @@
// All APIs in this package are experimental. // All APIs in this package are experimental.
package resolver package resolver
import (
"google.golang.org/grpc/serviceconfig"
)
var ( var (
// m is a map from scheme to resolver builder. // m is a map from scheme to resolver builder.
m = make(map[string]Builder) m = make(map[string]Builder)
@ -100,11 +104,12 @@ type BuildOption struct {
// State contains the current Resolver state relevant to the ClientConn. // State contains the current Resolver state relevant to the ClientConn.
type State struct { type State struct {
Addresses []Address // Resolved addresses for the target Addresses []Address // Resolved addresses for the target
ServiceConfig string // JSON representation of the service config // ServiceConfig is the parsed service config; obtained from
// serviceconfig.Parse.
ServiceConfig serviceconfig.Config
// TODO: add Err error // TODO: add Err error
// TODO: add ParsedServiceConfig interface{}
} }
// ClientConn contains the callbacks for resolver to notify any updates // ClientConn contains the callbacks for resolver to notify any updates

View File

@ -138,19 +138,22 @@ func (ccr *ccResolverWrapper) NewServiceConfig(sc string) {
return return
} }
grpclog.Infof("ccResolverWrapper: got new service config: %v", sc) grpclog.Infof("ccResolverWrapper: got new service config: %v", sc)
if channelz.IsOn() { c, err := parseServiceConfig(sc)
ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: sc}) if err != nil {
return
} }
ccr.curState.ServiceConfig = sc if channelz.IsOn() {
ccr.addChannelzTraceEvent(resolver.State{Addresses: ccr.curState.Addresses, ServiceConfig: c})
}
ccr.curState.ServiceConfig = c
ccr.cc.updateResolverState(ccr.curState) ccr.cc.updateResolverState(ccr.curState)
} }
func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) { func (ccr *ccResolverWrapper) addChannelzTraceEvent(s resolver.State) {
if s.ServiceConfig == ccr.curState.ServiceConfig && (len(ccr.curState.Addresses) == 0) == (len(s.Addresses) == 0) {
return
}
var updates []string var updates []string
if s.ServiceConfig != ccr.curState.ServiceConfig { oldSC, oldOK := ccr.curState.ServiceConfig.(*ServiceConfig)
newSC, newOK := s.ServiceConfig.(*ServiceConfig)
if oldOK != newOK || (oldOK && newOK && oldSC.rawJSONString != newSC.rawJSONString) {
updates = append(updates, "service config updated") updates = append(updates, "service config updated")
} }
if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 { if len(ccr.curState.Addresses) > 0 && len(s.Addresses) == 0 {

View File

@ -90,7 +90,7 @@ type Server struct {
mu sync.Mutex // guards following mu sync.Mutex // guards following
lis map[net.Listener]bool lis map[net.Listener]bool
conns map[io.Closer]bool conns map[transport.ServerTransport]bool
serve bool serve bool
drain bool drain bool
cv *sync.Cond // signaled when connections close for GracefulStop cv *sync.Cond // signaled when connections close for GracefulStop
@ -386,7 +386,7 @@ func NewServer(opt ...ServerOption) *Server {
s := &Server{ s := &Server{
lis: make(map[net.Listener]bool), lis: make(map[net.Listener]bool),
opts: opts, opts: opts,
conns: make(map[io.Closer]bool), conns: make(map[transport.ServerTransport]bool),
m: make(map[string]*service), m: make(map[string]*service),
quit: make(chan struct{}), quit: make(chan struct{}),
done: make(chan struct{}), done: make(chan struct{}),
@ -786,27 +786,27 @@ func (s *Server) traceInfo(st transport.ServerTransport, stream *transport.Strea
return trInfo return trInfo
} }
func (s *Server) addConn(c io.Closer) bool { func (s *Server) addConn(st transport.ServerTransport) bool {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if s.conns == nil { if s.conns == nil {
c.Close() st.Close()
return false return false
} }
if s.drain { if s.drain {
// Transport added after we drained our existing conns: drain it // Transport added after we drained our existing conns: drain it
// immediately. // immediately.
c.(transport.ServerTransport).Drain() st.Drain()
} }
s.conns[c] = true s.conns[st] = true
return true return true
} }
func (s *Server) removeConn(c io.Closer) { func (s *Server) removeConn(st transport.ServerTransport) {
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
if s.conns != nil { if s.conns != nil {
delete(s.conns, c) delete(s.conns, st)
s.cv.Broadcast() s.cv.Broadcast()
} }
} }
@ -1423,8 +1423,8 @@ func (s *Server) GracefulStop() {
} }
s.lis = nil s.lis = nil
if !s.drain { if !s.drain {
for c := range s.conns { for st := range s.conns {
c.(transport.ServerTransport).Drain() st.Drain()
} }
s.drain = true s.drain = true
} }

View File

@ -25,8 +25,11 @@ import (
"strings" "strings"
"time" "time"
"google.golang.org/grpc/balancer"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/serviceconfig"
) )
const maxInt = int(^uint(0) >> 1) const maxInt = int(^uint(0) >> 1)
@ -61,6 +64,11 @@ type MethodConfig struct {
retryPolicy *retryPolicy retryPolicy *retryPolicy
} }
type lbConfig struct {
name string
cfg serviceconfig.LoadBalancingConfig
}
// ServiceConfig is provided by the service provider and contains parameters for how // ServiceConfig is provided by the service provider and contains parameters for how
// clients that connect to the service should behave. // clients that connect to the service should behave.
// //
@ -68,10 +76,18 @@ type MethodConfig struct {
// through name resolver, as specified here // through name resolver, as specified here
// https://github.com/grpc/grpc/blob/master/doc/service_config.md // https://github.com/grpc/grpc/blob/master/doc/service_config.md
type ServiceConfig struct { type ServiceConfig struct {
// LB is the load balancer the service providers recommends. The balancer specified serviceconfig.Config
// via grpc.WithBalancer will override this.
// LB is the load balancer the service providers recommends. The balancer
// specified via grpc.WithBalancer will override this. This is deprecated;
// lbConfigs is preferred. If lbConfig and LB are both present, lbConfig
// will be used.
LB *string LB *string
// lbConfig is the service config's load balancing configuration. If
// lbConfig and LB are both present, lbConfig will be used.
lbConfig *lbConfig
// Methods contains a map for the methods in this service. If there is an // Methods contains a map for the methods in this service. If there is an
// exact match for a method (i.e. /service/method) in the map, use the // exact match for a method (i.e. /service/method) in the map, use the
// corresponding MethodConfig. If there's no exact match, look for the // corresponding MethodConfig. If there's no exact match, look for the
@ -233,15 +249,27 @@ type jsonMC struct {
RetryPolicy *jsonRetryPolicy RetryPolicy *jsonRetryPolicy
} }
type loadBalancingConfig map[string]json.RawMessage
// TODO(lyuxuan): delete this struct after cleaning up old service config implementation. // TODO(lyuxuan): delete this struct after cleaning up old service config implementation.
type jsonSC struct { type jsonSC struct {
LoadBalancingPolicy *string LoadBalancingPolicy *string
LoadBalancingConfig *[]loadBalancingConfig
MethodConfig *[]jsonMC MethodConfig *[]jsonMC
RetryThrottling *retryThrottlingPolicy RetryThrottling *retryThrottlingPolicy
HealthCheckConfig *healthCheckConfig HealthCheckConfig *healthCheckConfig
} }
func init() {
internal.ParseServiceConfig = func(sc string) (interface{}, error) {
return parseServiceConfig(sc)
}
}
func parseServiceConfig(js string) (*ServiceConfig, error) { func parseServiceConfig(js string) (*ServiceConfig, error) {
if len(js) == 0 {
return nil, fmt.Errorf("no JSON service config provided")
}
var rsc jsonSC var rsc jsonSC
err := json.Unmarshal([]byte(js), &rsc) err := json.Unmarshal([]byte(js), &rsc)
if err != nil { if err != nil {
@ -255,10 +283,38 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
healthCheckConfig: rsc.HealthCheckConfig, healthCheckConfig: rsc.HealthCheckConfig,
rawJSONString: js, rawJSONString: js,
} }
if rsc.LoadBalancingConfig != nil {
for i, lbcfg := range *rsc.LoadBalancingConfig {
if len(lbcfg) != 1 {
err := fmt.Errorf("invalid loadBalancingConfig: entry %v does not contain exactly 1 policy/config pair: %q", i, lbcfg)
grpclog.Warningf(err.Error())
return nil, err
}
var name string
var jsonCfg json.RawMessage
for name, jsonCfg = range lbcfg {
}
builder := balancer.Get(name)
if builder == nil {
continue
}
sc.lbConfig = &lbConfig{name: name}
if parser, ok := builder.(balancer.ConfigParser); ok {
var err error
sc.lbConfig.cfg, err = parser.ParseConfig(jsonCfg)
if err != nil {
return nil, fmt.Errorf("error parsing loadBalancingConfig for policy %q: %v", name, err)
}
} else if string(jsonCfg) != "{}" {
grpclog.Warningf("non-empty balancer configuration %q, but balancer does not implement ParseConfig", string(jsonCfg))
}
break
}
}
if rsc.MethodConfig == nil { if rsc.MethodConfig == nil {
return &sc, nil return &sc, nil
} }
for _, m := range *rsc.MethodConfig { for _, m := range *rsc.MethodConfig {
if m.Name == nil { if m.Name == nil {
continue continue
@ -299,11 +355,11 @@ func parseServiceConfig(js string) (*ServiceConfig, error) {
} }
if sc.retryThrottling != nil { if sc.retryThrottling != nil {
if sc.retryThrottling.MaxTokens <= 0 || if mt := sc.retryThrottling.MaxTokens; mt <= 0 || mt > 1000 {
sc.retryThrottling.MaxTokens > 1000 || return nil, fmt.Errorf("invalid retry throttling config: maxTokens (%v) out of range (0, 1000]", mt)
sc.retryThrottling.TokenRatio <= 0 { }
// Illegal throttling config; disable throttling. if tr := sc.retryThrottling.TokenRatio; tr <= 0 {
sc.retryThrottling = nil return nil, fmt.Errorf("invalid retry throttling config: tokenRatio (%v) may not be negative", tr)
} }
} }
return &sc, nil return &sc, nil

View File

@ -0,0 +1,48 @@
/*
*
* Copyright 2019 gRPC authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
// Package serviceconfig defines types and methods for operating on gRPC
// service configs.
//
// This package is EXPERIMENTAL.
package serviceconfig
import (
"google.golang.org/grpc/internal"
)
// Config represents an opaque data structure holding a service config.
type Config interface {
isConfig()
}
// LoadBalancingConfig represents an opaque data structure holding a load
// balancer config.
type LoadBalancingConfig interface {
isLoadBalancingConfig()
}
// Parse parses the JSON service config provided into an internal form or
// returns an error if the config is invalid.
func Parse(ServiceConfigJSON string) (Config, error) {
c, err := internal.ParseServiceConfig(ServiceConfigJSON)
if err != nil {
return nil, err
}
return c.(Config), err
}

View File

@ -36,8 +36,15 @@ import (
"github.com/golang/protobuf/ptypes" "github.com/golang/protobuf/ptypes"
spb "google.golang.org/genproto/googleapis/rpc/status" spb "google.golang.org/genproto/googleapis/rpc/status"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/internal"
) )
func init() {
internal.StatusRawProto = statusRawProto
}
func statusRawProto(s *Status) *spb.Status { return s.s }
// statusError is an alias of a status proto. It implements error and Status, // statusError is an alias of a status proto. It implements error and Status,
// and a nil statusError should never be returned by this package. // and a nil statusError should never be returned by this package.
type statusError spb.Status type statusError spb.Status

View File

@ -30,7 +30,6 @@ import (
"golang.org/x/net/trace" "golang.org/x/net/trace"
"google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
"google.golang.org/grpc/connectivity"
"google.golang.org/grpc/encoding" "google.golang.org/grpc/encoding"
"google.golang.org/grpc/grpclog" "google.golang.org/grpc/grpclog"
"google.golang.org/grpc/internal/balancerload" "google.golang.org/grpc/internal/balancerload"
@ -965,19 +964,18 @@ func (a *csAttempt) finish(err error) {
a.mu.Unlock() a.mu.Unlock()
} }
func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, method string, t transport.ClientTransport, opts ...CallOption) (_ ClientStream, err error) { // newClientStream creates a ClientStream with the specified transport, on the
ac.mu.Lock() // given addrConn.
if ac.transport != t { //
ac.mu.Unlock() // It's expected that the given transport is either the same one in addrConn, or
return nil, status.Error(codes.Canceled, "the provided transport is no longer valid to use") // is already closed. To avoid race, transport is specified separately, instead
} // of using ac.transpot.
// transition to CONNECTING state when an attempt starts //
if ac.state != connectivity.Connecting { // Main difference between this and ClientConn.NewStream:
ac.updateConnectivityState(connectivity.Connecting) // - no retry
ac.cc.handleSubConnStateChange(ac.acbw, ac.state) // - no service config (or wait for service config)
} // - no tracing or stats
ac.mu.Unlock() func newNonRetryClientStream(ctx context.Context, desc *StreamDesc, method string, t transport.ClientTransport, ac *addrConn, opts ...CallOption) (_ ClientStream, err error) {
if t == nil { if t == nil {
// TODO: return RPC error here? // TODO: return RPC error here?
return nil, errors.New("transport provided is nil") return nil, errors.New("transport provided is nil")
@ -985,14 +983,6 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho
// defaultCallInfo contains unnecessary info(i.e. failfast, maxRetryRPCBufferSize), so we just initialize an empty struct. // defaultCallInfo contains unnecessary info(i.e. failfast, maxRetryRPCBufferSize), so we just initialize an empty struct.
c := &callInfo{} c := &callInfo{}
for _, o := range opts {
if err := o.before(c); err != nil {
return nil, toRPCErr(err)
}
}
c.maxReceiveMessageSize = getMaxSize(nil, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize)
c.maxSendMessageSize = getMaxSize(nil, c.maxSendMessageSize, defaultServerMaxSendMessageSize)
// Possible context leak: // Possible context leak:
// The cancel function for the child context we create will only be called // The cancel function for the child context we create will only be called
// when RecvMsg returns a non-nil error, if the ClientConn is closed, or if // when RecvMsg returns a non-nil error, if the ClientConn is closed, or if
@ -1005,6 +995,13 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho
} }
}() }()
for _, o := range opts {
if err := o.before(c); err != nil {
return nil, toRPCErr(err)
}
}
c.maxReceiveMessageSize = getMaxSize(nil, c.maxReceiveMessageSize, defaultClientMaxReceiveMessageSize)
c.maxSendMessageSize = getMaxSize(nil, c.maxSendMessageSize, defaultServerMaxSendMessageSize)
if err := setCallInfoCodec(c); err != nil { if err := setCallInfoCodec(c); err != nil {
return nil, err return nil, err
} }
@ -1037,6 +1034,7 @@ func (ac *addrConn) newClientStream(ctx context.Context, desc *StreamDesc, metho
callHdr.Creds = c.creds callHdr.Creds = c.creds
} }
// Use a special addrConnStream to avoid retry.
as := &addrConnStream{ as := &addrConnStream{
callHdr: callHdr, callHdr: callHdr,
ac: ac, ac: ac,

View File

@ -19,4 +19,4 @@
package grpc package grpc
// Version is the current grpc version. // Version is the current grpc version.
const Version = "1.21.1" const Version = "1.22.0"

File diff suppressed because it is too large Load Diff

27
vendor/k8s.io/utils/inotify/LICENSE generated vendored Normal file
View File

@ -0,0 +1,27 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

22
vendor/k8s.io/utils/inotify/PATENTS generated vendored Normal file
View File

@ -0,0 +1,22 @@
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the Go project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.