diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf0ab7fdb..5a60716d2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,11 +45,16 @@ jobs: run: | echo "PKG_CONFIG_PATH=$GITHUB_WORKSPACE/mk" >> $GITHUB_ENV + # Some files such as sockops_bpfel.go require some preprocessing + - name: golangci-lint prepare + run: | + ./hack/golangci-lint-prepare.sh + # Since requiring code generated by the Proto compilation, execute go lint after building. - name: golangci-lint - uses: golangci/golangci-lint-action@v3.7.0 + uses: golangci/golangci-lint-action@v6.0.0 with: - args: "--config=common/config/.golangci.yaml --out-format colored-line-number" + args: "--config=common/config/.golangci.yaml --out-format colored-line-number --verbose" skip-pkg-cache: true - name: Go Test diff --git a/.gitignore b/.gitignore index 14f8c464e..a6b9ba09f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,31 +40,10 @@ coverage.out # build artifacts *.so *.o -bpf/kmesh/bpf2go/kmeshcgroupsock_bpfeb.go -bpf/kmesh/bpf2go/kmeshcgroupsock_bpfel.go -bpf/kmesh/bpf2go/kmeshcgroupsockworkload_bpfeb.go -bpf/kmesh/bpf2go/kmeshcgroupsockworkload_bpfel.go -bpf/kmesh/bpf2go/kmeshsockopsworkload_bpfeb.go -bpf/kmesh/bpf2go/kmeshsockopsworkload_bpfel.go -bpf/kmesh/bpf2go/kmeshxdpauth_bpfeb.go -bpf/kmesh/bpf2go/kmeshxdpauth_bpfel.go -bpf/kmesh/bpf2go/kmeshsendmsg_bpfeb.go -bpf/kmesh/bpf2go/kmeshsendmsg_bpfel.go -bpf/kmesh/bpf2go/kmeshsockops_bpfeb.go -bpf/kmesh/bpf2go/kmeshsockops_bpfel.go -bpf/kmesh/bpf2go/kmeshtracepoint_bpfeb.go -bpf/kmesh/bpf2go/kmeshtracepoint_bpfel.go -bpf/kmesh/bpf2go/kmeshcgroupsockcompat_bpfeb.go -bpf/kmesh/bpf2go/kmeshcgroupsockcompat_bpfel.go -bpf/kmesh/bpf2go/kmeshcgroupsockworkloadcompat_bpfeb.go -bpf/kmesh/bpf2go/kmeshcgroupsockworkloadcompat_bpfel.go -bpf/kmesh/bpf2go/kmeshsendmsgcompat_bpfeb.go -bpf/kmesh/bpf2go/kmeshsendmsgcompat_bpfel.go -bpf/kmesh/bpf2go/kmeshsockopsworkloadcompat_bpfeb.go -bpf/kmesh/bpf2go/kmeshsockopsworkloadcompat_bpfel.go -bpf/kmesh/bpf2go/kmeshxdpauthcompat_bpfeb.go -bpf/kmesh/bpf2go/kmeshxdpauthcompat_bpfel.go +bpf/kmesh/bpf2go/** +config/** +mk/* kernel/**/*.ko kernel/**/*.cmd diff --git a/.golangci.yaml b/.golangci.yaml new file mode 100644 index 000000000..01aa10494 --- /dev/null +++ b/.golangci.yaml @@ -0,0 +1,132 @@ +# This files contains all configuration options for analysis running. +# More details please refer to: https://golangci-lint.run/usage/configuration/ + +run: + # timeout for analysis, e.g. 30s, 5m, default is 1m + timeout: 30m + + # which dirs to skip: issues from them won't be reported; + # can use regexp here: generated.*, regexp is applied on full path; + # default value is empty list, but default dirs are skipped independently + # from this option's value (see skip-dirs-use-default). + # "/" will be replaced by current OS file path separator to properly work + # on Windows. + skip-dirs: [] + + # default is true. Enables skipping of directories: + # vendor$, third_party$, testdata$, examples$, Godeps$, builtin$ + skip-dirs-use-default: true + + # One of 'readonly' and 'vendor'. + # - readonly: the go command is disallowed from the implicit automatic updating of go.mod described above. + # Instead, it fails when any changes to go.mod are needed. This setting is most useful to check + # that go.mod does not need updates, such as in a continuous integration and testing system. + # - vendor: the go command assumes that the vendor directory holds the correct copies of dependencies and ignores + # the dependency descriptions in go.mod. + modules-download-mode: readonly +linters: + disable-all: true + enable: + # linters maintained by golang.org + - gofmt + - goimports + - govet + - depguard + # linters default enabled by golangci-lint . + - errcheck + - gosimple + - ineffassign + - staticcheck + - typecheck + - unused + - misspell + - whitespace + #- gosec + #- revive + +linters-settings: + goimports: + local-prefixes: kmesh.net + gocyclo: + # minimal cyclomatic complexity to report + min-complexity: 15 + depguard: + rules: + main: + deny: + - pkg: "github.com/golang/protobuf" + desc: "Please use google.golang.org/protobuf instead." + - pkg: 'gopkg.in/yaml.v3' + desc: "Please use sigs.k8s.io/yaml instead." + - pkg: "gopkg.in/yaml.v2" + desc: "Please use sigs.k8s.io/yaml instead." + - pkg: "github.com/ghodss/yaml" + desc: "Please use sigs.k8s.io/yaml instead." + + +issues: + # List of regexps of issue texts to exclude, empty list by default. + # But independently from this option we use default exclude patterns, + # it can be disabled by `exclude-use-default: false`. To list all + # excluded by default patterns execute `golangci-lint run --help` + exclude: + - composite literal uses unkeyed fields + # Which files to exclude: they will be analyzed, but issues from them won't be reported. + # There is no need to include all autogenerated files, + # we confidently recognize autogenerated files. + # If it's not, please let us know. + # "/" will be replaced by current OS file path separator to properly work on Windows. + # Default: [] + exclude-files: + - ".*\\.pb\\.go" + - ".*\\.gen\\.go" + - ".*_bpfeb\\.go" + - ".*_bpfel\\.go$" + - ".*bpfeb\\.go" + - ".*bpfel\\.go$" + - ".*/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfel.go" + exclude-dirs: + - bpf/kmesh/bpf2go/dualengine + - bpf/kmesh/bpf2go/kernelnative + exclude-rules: + # Exclude some linters from running on test files. + - path: _test\.go$|^tests/|^samples/ + linters: + - errcheck + - maligned + - path: _test\.go$ + text: "dot-imports: should not use dot imports" + # We need to use the deprecated module since the jsonpb replacement is not backwards compatible. + - linters: + - staticcheck + text: "SA1019: package github.com/golang/protobuf/jsonpb" + - linters: + - staticcheck + text: 'SA1019: "github.com/golang/protobuf/jsonpb"' + # This is not helpful. The new function is not very usable and the current function will not be removed + - linters: + - staticcheck + text: 'SA1019: grpc.Dial is deprecated: use NewClient instead' + - linters: + - staticcheck + text: 'SA1019: grpc.DialContext is deprecated: use NewClient instead' + - linters: + - staticcheck + text: "SA1019: grpc.WithBlock is deprecated" + - linters: + - staticcheck + text: "SA1019: grpc.FailOnNonTempDialError" + - linters: + - staticcheck + text: "SA1019: grpc.WithReturnConnectionError" + # Independently from option `exclude` we use default exclude patterns, + # it can be disabled by this option. To list all + # excluded by default patterns execute `golangci-lint run --help`. + # Default value for this option is true. + exclude-use-default: true + # Maximum issues count per one linter. + # Set to 0 to disable. + # Default: 50 + max-issues-per-linter: 0 + # Maximum count of issues with the same text. Set to 0 to disable. Default is 3. + max-same-issues: 0 diff --git a/Makefile b/Makefile index 4f5b3374e..d1cc0326d 100644 --- a/Makefile +++ b/Makefile @@ -79,22 +79,27 @@ TMP_FILES := bpf/kmesh/bpf2go/bpf2go.go \ bpf/kmesh/ads/include/config.h \ bpf/include/bpf_helper_defs_ext.h \ -.PHONY: all -all: +.PHONY: all kmesh-bpf kmesh-ko all-binary +all: kmesh-bpf kmesh-ko all-binary + +kmesh-bpf: $(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g" $(QUIET) make -C api/v2-c $(QUIET) make -C bpf/deserialization_to_bpf_map $(QUIET) $(GO) generate bpf/kmesh/bpf2go/bpf2go.go - +kmesh-ko: + $(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g" + $(call printlog, BUILD, "kernel") + $(QUIET) make -C kernel/ko_src + +all-binary: + $(QUIET) find $(ROOT_DIR)/mk -name "*.pc" | xargs sed -i "s#^prefix=.*#prefix=${ROOT_DIR}#g" $(call printlog, BUILD, $(APPS1)) $(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \ $(GO) build -ldflags $(LDFLAGS) -tags $(ENHANCED_KERNEL) -o $(APPS1) $(GOFLAGS) ./daemon/main.go) - $(call printlog, BUILD, "kernel") - $(QUIET) make -C kernel/ko_src - $(call printlog, BUILD, $(APPS2)) $(QUIET) cd oncn-mda && cmake . -B build && make -C build @@ -117,6 +122,10 @@ kmeshctl: gen-proto: $(QUIET) make -C api gen-proto +.PHONY: gen-bpf2go +gen-bpf2go: + hack/gen_bpf2go.sh + .PHONY: tidy tidy: go mod tidy @@ -124,6 +133,7 @@ tidy: .PHONY: gen gen: tidy\ gen-proto \ + gen-bpf2go \ format .PHONY: gen-check diff --git a/bpf/kmesh/bpf2go/bpf2go.go b/bpf/kmesh/bpf2go/bpf2go.go index 7ca98eb2d..5163f6284 100644 --- a/bpf/kmesh/bpf2go/bpf2go.go +++ b/bpf/kmesh/bpf2go/bpf2go.go @@ -18,18 +18,18 @@ package bpf2go // go run github.com/cilium/ebpf/cmd/bpf2go --help -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSock ../ads/cgroup_sock.c -- -I../ads/include -I../../include -I../../../api/v2-c -DCGROUP_SOCK_MANAGE -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockWorkload ../workload/cgroup_sock.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockops ../ads/sockops.c -- -I../ads/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshTracePoint ../ads/tracepoint.c -- -I../ads/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsWorkload ../workload/sockops.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshXDPAuth ../workload/xdp.c -- -I../workload/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSendmsg ../workload/sendmsg.c -- -I../workload/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/normal --go-package normal -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSock ../ads/cgroup_sock.c -- -I../ads/include -I../../include -I../../../api/v2-c -DCGROUP_SOCK_MANAGE -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockWorkload ../workload/cgroup_sock.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/enhanced --go-package enhanced -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockops ../ads/sockops.c -- -I../ads/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/enhanced --go-package enhanced -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshTracePoint ../ads/tracepoint.c -- -I../ads/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsWorkload ../workload/sockops.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshXDPAuth ../workload/xdp.c -- -I../workload/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=1 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSendmsg ../workload/sendmsg.c -- -I../workload/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=1 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockCompat ../ads/cgroup_sock.c -- -I../ads/include -I../../include -I../../../api/v2-c -DCGROUP_SOCK_MANAGE -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockWorkloadCompat ../workload/cgroup_sock.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsCompat ../ads/sockops.c -- -I../ads/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshTracePointCompat ../ads/tracepoint.c -- -I../ads/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsWorkloadCompat ../workload/sockops.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshXDPAuthCompat ../workload/xdp.c -- -I../workload/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=0 -//go:generate go run github.com/cilium/ebpf/cmd/bpf2go -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSendmsgCompat ../workload/sendmsg.c -- -I../workload/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/normal --go-package normal -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockCompat ../ads/cgroup_sock.c -- -I../ads/include -I../../include -I../../../api/v2-c -DCGROUP_SOCK_MANAGE -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshCgroupSockWorkloadCompat ../workload/cgroup_sock.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/enhanced --go-package enhanced -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsCompat ../ads/sockops.c -- -I../ads/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir kernelnative/enhanced --go-package enhanced -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshTracePointCompat ../ads/tracepoint.c -- -I../ads/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSockopsWorkloadCompat ../workload/sockops.c -- -I../workload/include -I../../include -I../probes -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshXDPAuthCompat ../workload/xdp.c -- -I../workload/include -I../../include -I../../../api/v2-c -DKERNEL_VERSION_HIGHER_5_13_0=0 +//go:generate go run github.com/cilium/ebpf/cmd/bpf2go --output-dir dualengine --go-package dualengine -cc clang --cflags $EXTRA_CFLAGS --cflags $EXTRA_CDEFINE KmeshSendmsgCompat ../workload/sendmsg.c -- -I../workload/include -I../../include -DKERNEL_VERSION_HIGHER_5_13_0=0 diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfeb.go new file mode 100644 index 000000000..3c91b7003 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfeb.go @@ -0,0 +1,223 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockWorkloadBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshCgroupSockWorkloadBuf struct{ Data [40]int8 } + +type KmeshCgroupSockWorkloadLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockWorkloadManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockWorkloadOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockWorkload returns the embedded CollectionSpec for KmeshCgroupSockWorkload. +func LoadKmeshCgroupSockWorkload() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockWorkloadBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockWorkload: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockWorkloadObjects loads KmeshCgroupSockWorkload and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockWorkloadObjects +// *KmeshCgroupSockWorkloadPrograms +// *KmeshCgroupSockWorkloadMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockWorkloadObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockWorkload() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockWorkloadSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadSpecs struct { + KmeshCgroupSockWorkloadProgramSpecs + KmeshCgroupSockWorkloadMapSpecs +} + +// KmeshCgroupSockWorkloadSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect6_prog"` +} + +// KmeshCgroupSockWorkloadMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.MapSpec `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockWorkloadObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadObjects struct { + KmeshCgroupSockWorkloadPrograms + KmeshCgroupSockWorkloadMaps +} + +func (o *KmeshCgroupSockWorkloadObjects) Close() error { + return _KmeshCgroupSockWorkloadClose( + &o.KmeshCgroupSockWorkloadPrograms, + &o.KmeshCgroupSockWorkloadMaps, + ) +} + +// KmeshCgroupSockWorkloadMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.Map `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockWorkloadMaps) Close() error { + return _KmeshCgroupSockWorkloadClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfSockStorage, + m.MapOfTailCallProg, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockWorkloadPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.Program `ebpf:"cgroup_connect6_prog"` +} + +func (p *KmeshCgroupSockWorkloadPrograms) Close() error { + return _KmeshCgroupSockWorkloadClose( + p.CgroupConnect4Prog, + p.CgroupConnect6Prog, + ) +} + +func _KmeshCgroupSockWorkloadClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockworkload_bpfeb.o +var _KmeshCgroupSockWorkloadBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfel.go new file mode 100644 index 000000000..1a9310d46 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkload_bpfel.go @@ -0,0 +1,223 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockWorkloadBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshCgroupSockWorkloadBuf struct{ Data [40]int8 } + +type KmeshCgroupSockWorkloadLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockWorkloadManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockWorkloadOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockWorkload returns the embedded CollectionSpec for KmeshCgroupSockWorkload. +func LoadKmeshCgroupSockWorkload() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockWorkloadBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockWorkload: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockWorkloadObjects loads KmeshCgroupSockWorkload and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockWorkloadObjects +// *KmeshCgroupSockWorkloadPrograms +// *KmeshCgroupSockWorkloadMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockWorkloadObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockWorkload() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockWorkloadSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadSpecs struct { + KmeshCgroupSockWorkloadProgramSpecs + KmeshCgroupSockWorkloadMapSpecs +} + +// KmeshCgroupSockWorkloadSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect6_prog"` +} + +// KmeshCgroupSockWorkloadMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.MapSpec `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockWorkloadObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadObjects struct { + KmeshCgroupSockWorkloadPrograms + KmeshCgroupSockWorkloadMaps +} + +func (o *KmeshCgroupSockWorkloadObjects) Close() error { + return _KmeshCgroupSockWorkloadClose( + &o.KmeshCgroupSockWorkloadPrograms, + &o.KmeshCgroupSockWorkloadMaps, + ) +} + +// KmeshCgroupSockWorkloadMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.Map `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockWorkloadMaps) Close() error { + return _KmeshCgroupSockWorkloadClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfSockStorage, + m.MapOfTailCallProg, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockWorkloadPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.Program `ebpf:"cgroup_connect6_prog"` +} + +func (p *KmeshCgroupSockWorkloadPrograms) Close() error { + return _KmeshCgroupSockWorkloadClose( + p.CgroupConnect4Prog, + p.CgroupConnect6Prog, + ) +} + +func _KmeshCgroupSockWorkloadClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockworkload_bpfel.o +var _KmeshCgroupSockWorkloadBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfeb.go new file mode 100644 index 000000000..82373b92d --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfeb.go @@ -0,0 +1,223 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockWorkloadCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshCgroupSockWorkloadCompatBuf struct{ Data [40]int8 } + +type KmeshCgroupSockWorkloadCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockWorkloadCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockWorkloadCompatOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadCompatOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockWorkloadCompat returns the embedded CollectionSpec for KmeshCgroupSockWorkloadCompat. +func LoadKmeshCgroupSockWorkloadCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockWorkloadCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockWorkloadCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockWorkloadCompatObjects loads KmeshCgroupSockWorkloadCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockWorkloadCompatObjects +// *KmeshCgroupSockWorkloadCompatPrograms +// *KmeshCgroupSockWorkloadCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockWorkloadCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockWorkloadCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockWorkloadCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatSpecs struct { + KmeshCgroupSockWorkloadCompatProgramSpecs + KmeshCgroupSockWorkloadCompatMapSpecs +} + +// KmeshCgroupSockWorkloadCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect6_prog"` +} + +// KmeshCgroupSockWorkloadCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.MapSpec `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockWorkloadCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatObjects struct { + KmeshCgroupSockWorkloadCompatPrograms + KmeshCgroupSockWorkloadCompatMaps +} + +func (o *KmeshCgroupSockWorkloadCompatObjects) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + &o.KmeshCgroupSockWorkloadCompatPrograms, + &o.KmeshCgroupSockWorkloadCompatMaps, + ) +} + +// KmeshCgroupSockWorkloadCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.Map `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockWorkloadCompatMaps) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfSockStorage, + m.MapOfTailCallProg, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockWorkloadCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.Program `ebpf:"cgroup_connect6_prog"` +} + +func (p *KmeshCgroupSockWorkloadCompatPrograms) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + p.CgroupConnect4Prog, + p.CgroupConnect6Prog, + ) +} + +func _KmeshCgroupSockWorkloadCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockworkloadcompat_bpfeb.o +var _KmeshCgroupSockWorkloadCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfel.go new file mode 100644 index 000000000..c2f938178 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshcgroupsockworkloadcompat_bpfel.go @@ -0,0 +1,223 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockWorkloadCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshCgroupSockWorkloadCompatBuf struct{ Data [40]int8 } + +type KmeshCgroupSockWorkloadCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockWorkloadCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockWorkloadCompatOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadCompatOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshCgroupSockWorkloadCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockWorkloadCompat returns the embedded CollectionSpec for KmeshCgroupSockWorkloadCompat. +func LoadKmeshCgroupSockWorkloadCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockWorkloadCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockWorkloadCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockWorkloadCompatObjects loads KmeshCgroupSockWorkloadCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockWorkloadCompatObjects +// *KmeshCgroupSockWorkloadCompatPrograms +// *KmeshCgroupSockWorkloadCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockWorkloadCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockWorkloadCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockWorkloadCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatSpecs struct { + KmeshCgroupSockWorkloadCompatProgramSpecs + KmeshCgroupSockWorkloadCompatMapSpecs +} + +// KmeshCgroupSockWorkloadCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect6_prog"` +} + +// KmeshCgroupSockWorkloadCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockWorkloadCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.MapSpec `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockWorkloadCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatObjects struct { + KmeshCgroupSockWorkloadCompatPrograms + KmeshCgroupSockWorkloadCompatMaps +} + +func (o *KmeshCgroupSockWorkloadCompatObjects) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + &o.KmeshCgroupSockWorkloadCompatPrograms, + &o.KmeshCgroupSockWorkloadCompatMaps, + ) +} + +// KmeshCgroupSockWorkloadCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTailCallProg *ebpf.Map `ebpf:"map_of_tail_call_prog"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockWorkloadCompatMaps) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfSockStorage, + m.MapOfTailCallProg, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockWorkloadCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockWorkloadCompatPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + CgroupConnect6Prog *ebpf.Program `ebpf:"cgroup_connect6_prog"` +} + +func (p *KmeshCgroupSockWorkloadCompatPrograms) Close() error { + return _KmeshCgroupSockWorkloadCompatClose( + p.CgroupConnect4Prog, + p.CgroupConnect6Prog, + ) +} + +func _KmeshCgroupSockWorkloadCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockworkloadcompat_bpfel.o +var _KmeshCgroupSockWorkloadCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go new file mode 100644 index 000000000..121e72ce0 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfeb.go @@ -0,0 +1,149 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSendmsgBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSendmsgBuf struct{ Data [40]int8 } + +type KmeshSendmsgLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +// LoadKmeshSendmsg returns the embedded CollectionSpec for KmeshSendmsg. +func LoadKmeshSendmsg() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSendmsgBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSendmsg: %w", err) + } + + return spec, err +} + +// LoadKmeshSendmsgObjects loads KmeshSendmsg and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSendmsgObjects +// *KmeshSendmsgPrograms +// *KmeshSendmsgMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSendmsgObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSendmsg() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSendmsgSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgSpecs struct { + KmeshSendmsgProgramSpecs + KmeshSendmsgMapSpecs +} + +// KmeshSendmsgSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgProgramSpecs struct { + SendmsgProg *ebpf.ProgramSpec `ebpf:"sendmsg_prog"` +} + +// KmeshSendmsgMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgMapSpecs struct { + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSendmsgObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgObjects struct { + KmeshSendmsgPrograms + KmeshSendmsgMaps +} + +func (o *KmeshSendmsgObjects) Close() error { + return _KmeshSendmsgClose( + &o.KmeshSendmsgPrograms, + &o.KmeshSendmsgMaps, + ) +} + +// KmeshSendmsgMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgMaps struct { + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSendmsgMaps) Close() error { + return _KmeshSendmsgClose( + m.KmeshConfigMap, + m.KmeshEvents, + m.MapOfDstInfo, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSendmsgPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgPrograms struct { + SendmsgProg *ebpf.Program `ebpf:"sendmsg_prog"` +} + +func (p *KmeshSendmsgPrograms) Close() error { + return _KmeshSendmsgClose( + p.SendmsgProg, + ) +} + +func _KmeshSendmsgClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsendmsg_bpfeb.o +var _KmeshSendmsgBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go new file mode 100644 index 000000000..538d62496 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsg_bpfel.go @@ -0,0 +1,149 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSendmsgBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSendmsgBuf struct{ Data [40]int8 } + +type KmeshSendmsgLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +// LoadKmeshSendmsg returns the embedded CollectionSpec for KmeshSendmsg. +func LoadKmeshSendmsg() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSendmsgBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSendmsg: %w", err) + } + + return spec, err +} + +// LoadKmeshSendmsgObjects loads KmeshSendmsg and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSendmsgObjects +// *KmeshSendmsgPrograms +// *KmeshSendmsgMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSendmsgObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSendmsg() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSendmsgSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgSpecs struct { + KmeshSendmsgProgramSpecs + KmeshSendmsgMapSpecs +} + +// KmeshSendmsgSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgProgramSpecs struct { + SendmsgProg *ebpf.ProgramSpec `ebpf:"sendmsg_prog"` +} + +// KmeshSendmsgMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgMapSpecs struct { + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSendmsgObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgObjects struct { + KmeshSendmsgPrograms + KmeshSendmsgMaps +} + +func (o *KmeshSendmsgObjects) Close() error { + return _KmeshSendmsgClose( + &o.KmeshSendmsgPrograms, + &o.KmeshSendmsgMaps, + ) +} + +// KmeshSendmsgMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgMaps struct { + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSendmsgMaps) Close() error { + return _KmeshSendmsgClose( + m.KmeshConfigMap, + m.KmeshEvents, + m.MapOfDstInfo, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSendmsgPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgPrograms struct { + SendmsgProg *ebpf.Program `ebpf:"sendmsg_prog"` +} + +func (p *KmeshSendmsgPrograms) Close() error { + return _KmeshSendmsgClose( + p.SendmsgProg, + ) +} + +func _KmeshSendmsgClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsendmsg_bpfel.o +var _KmeshSendmsgBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go new file mode 100644 index 000000000..44898b255 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfeb.go @@ -0,0 +1,149 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSendmsgCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSendmsgCompatBuf struct{ Data [40]int8 } + +type KmeshSendmsgCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +// LoadKmeshSendmsgCompat returns the embedded CollectionSpec for KmeshSendmsgCompat. +func LoadKmeshSendmsgCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSendmsgCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSendmsgCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSendmsgCompatObjects loads KmeshSendmsgCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSendmsgCompatObjects +// *KmeshSendmsgCompatPrograms +// *KmeshSendmsgCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSendmsgCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSendmsgCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSendmsgCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatSpecs struct { + KmeshSendmsgCompatProgramSpecs + KmeshSendmsgCompatMapSpecs +} + +// KmeshSendmsgCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatProgramSpecs struct { + SendmsgProg *ebpf.ProgramSpec `ebpf:"sendmsg_prog"` +} + +// KmeshSendmsgCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatMapSpecs struct { + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSendmsgCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatObjects struct { + KmeshSendmsgCompatPrograms + KmeshSendmsgCompatMaps +} + +func (o *KmeshSendmsgCompatObjects) Close() error { + return _KmeshSendmsgCompatClose( + &o.KmeshSendmsgCompatPrograms, + &o.KmeshSendmsgCompatMaps, + ) +} + +// KmeshSendmsgCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatMaps struct { + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSendmsgCompatMaps) Close() error { + return _KmeshSendmsgCompatClose( + m.KmeshConfigMap, + m.KmeshEvents, + m.MapOfDstInfo, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSendmsgCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatPrograms struct { + SendmsgProg *ebpf.Program `ebpf:"sendmsg_prog"` +} + +func (p *KmeshSendmsgCompatPrograms) Close() error { + return _KmeshSendmsgCompatClose( + p.SendmsgProg, + ) +} + +func _KmeshSendmsgCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsendmsgcompat_bpfeb.o +var _KmeshSendmsgCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go new file mode 100644 index 000000000..7ecbfd257 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsendmsgcompat_bpfel.go @@ -0,0 +1,149 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSendmsgCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSendmsgCompatBuf struct{ Data [40]int8 } + +type KmeshSendmsgCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +// LoadKmeshSendmsgCompat returns the embedded CollectionSpec for KmeshSendmsgCompat. +func LoadKmeshSendmsgCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSendmsgCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSendmsgCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSendmsgCompatObjects loads KmeshSendmsgCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSendmsgCompatObjects +// *KmeshSendmsgCompatPrograms +// *KmeshSendmsgCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSendmsgCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSendmsgCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSendmsgCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatSpecs struct { + KmeshSendmsgCompatProgramSpecs + KmeshSendmsgCompatMapSpecs +} + +// KmeshSendmsgCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatProgramSpecs struct { + SendmsgProg *ebpf.ProgramSpec `ebpf:"sendmsg_prog"` +} + +// KmeshSendmsgCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSendmsgCompatMapSpecs struct { + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSendmsgCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatObjects struct { + KmeshSendmsgCompatPrograms + KmeshSendmsgCompatMaps +} + +func (o *KmeshSendmsgCompatObjects) Close() error { + return _KmeshSendmsgCompatClose( + &o.KmeshSendmsgCompatPrograms, + &o.KmeshSendmsgCompatMaps, + ) +} + +// KmeshSendmsgCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatMaps struct { + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSendmsgCompatMaps) Close() error { + return _KmeshSendmsgCompatClose( + m.KmeshConfigMap, + m.KmeshEvents, + m.MapOfDstInfo, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSendmsgCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSendmsgCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSendmsgCompatPrograms struct { + SendmsgProg *ebpf.Program `ebpf:"sendmsg_prog"` +} + +func (p *KmeshSendmsgCompatPrograms) Close() error { + return _KmeshSendmsgCompatClose( + p.SendmsgProg, + ) +} + +func _KmeshSendmsgCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsendmsgcompat_bpfel.o +var _KmeshSendmsgCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfeb.go new file mode 100644 index 000000000..247e747a5 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfeb.go @@ -0,0 +1,220 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsWorkloadBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSockopsWorkloadBuf struct{ Data [40]int8 } + +type KmeshSockopsWorkloadLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsWorkloadManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsWorkloadOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsWorkload returns the embedded CollectionSpec for KmeshSockopsWorkload. +func LoadKmeshSockopsWorkload() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsWorkloadBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsWorkload: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsWorkloadObjects loads KmeshSockopsWorkload and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsWorkloadObjects +// *KmeshSockopsWorkloadPrograms +// *KmeshSockopsWorkloadMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsWorkloadObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsWorkload() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsWorkloadSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadSpecs struct { + KmeshSockopsWorkloadProgramSpecs + KmeshSockopsWorkloadMapSpecs +} + +// KmeshSockopsWorkloadSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadProgramSpecs struct { + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsWorkloadMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.MapSpec `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsWorkloadObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadObjects struct { + KmeshSockopsWorkloadPrograms + KmeshSockopsWorkloadMaps +} + +func (o *KmeshSockopsWorkloadObjects) Close() error { + return _KmeshSockopsWorkloadClose( + &o.KmeshSockopsWorkloadPrograms, + &o.KmeshSockopsWorkloadMaps, + ) +} + +// KmeshSockopsWorkloadMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.Map `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsWorkloadMaps) Close() error { + return _KmeshSockopsWorkloadClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfKmeshSocket, + m.MapOfSockStorage, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsWorkloadPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadPrograms struct { + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsWorkloadPrograms) Close() error { + return _KmeshSockopsWorkloadClose( + p.SockopsProg, + ) +} + +func _KmeshSockopsWorkloadClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopsworkload_bpfeb.o +var _KmeshSockopsWorkloadBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfel.go new file mode 100644 index 000000000..2e36e830a --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkload_bpfel.go @@ -0,0 +1,220 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsWorkloadBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSockopsWorkloadBuf struct{ Data [40]int8 } + +type KmeshSockopsWorkloadLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsWorkloadManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsWorkloadOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsWorkload returns the embedded CollectionSpec for KmeshSockopsWorkload. +func LoadKmeshSockopsWorkload() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsWorkloadBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsWorkload: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsWorkloadObjects loads KmeshSockopsWorkload and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsWorkloadObjects +// *KmeshSockopsWorkloadPrograms +// *KmeshSockopsWorkloadMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsWorkloadObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsWorkload() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsWorkloadSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadSpecs struct { + KmeshSockopsWorkloadProgramSpecs + KmeshSockopsWorkloadMapSpecs +} + +// KmeshSockopsWorkloadSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadProgramSpecs struct { + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsWorkloadMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.MapSpec `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsWorkloadObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadObjects struct { + KmeshSockopsWorkloadPrograms + KmeshSockopsWorkloadMaps +} + +func (o *KmeshSockopsWorkloadObjects) Close() error { + return _KmeshSockopsWorkloadClose( + &o.KmeshSockopsWorkloadPrograms, + &o.KmeshSockopsWorkloadMaps, + ) +} + +// KmeshSockopsWorkloadMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.Map `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsWorkloadMaps) Close() error { + return _KmeshSockopsWorkloadClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfKmeshSocket, + m.MapOfSockStorage, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsWorkloadPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadPrograms struct { + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsWorkloadPrograms) Close() error { + return _KmeshSockopsWorkloadClose( + p.SockopsProg, + ) +} + +func _KmeshSockopsWorkloadClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopsworkload_bpfel.o +var _KmeshSockopsWorkloadBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfeb.go new file mode 100644 index 000000000..dfa6dc0ef --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfeb.go @@ -0,0 +1,220 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsWorkloadCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSockopsWorkloadCompatBuf struct{ Data [40]int8 } + +type KmeshSockopsWorkloadCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsWorkloadCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsWorkloadCompatOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadCompatOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsWorkloadCompat returns the embedded CollectionSpec for KmeshSockopsWorkloadCompat. +func LoadKmeshSockopsWorkloadCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsWorkloadCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsWorkloadCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsWorkloadCompatObjects loads KmeshSockopsWorkloadCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsWorkloadCompatObjects +// *KmeshSockopsWorkloadCompatPrograms +// *KmeshSockopsWorkloadCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsWorkloadCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsWorkloadCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsWorkloadCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatSpecs struct { + KmeshSockopsWorkloadCompatProgramSpecs + KmeshSockopsWorkloadCompatMapSpecs +} + +// KmeshSockopsWorkloadCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatProgramSpecs struct { + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsWorkloadCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.MapSpec `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsWorkloadCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatObjects struct { + KmeshSockopsWorkloadCompatPrograms + KmeshSockopsWorkloadCompatMaps +} + +func (o *KmeshSockopsWorkloadCompatObjects) Close() error { + return _KmeshSockopsWorkloadCompatClose( + &o.KmeshSockopsWorkloadCompatPrograms, + &o.KmeshSockopsWorkloadCompatMaps, + ) +} + +// KmeshSockopsWorkloadCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.Map `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsWorkloadCompatMaps) Close() error { + return _KmeshSockopsWorkloadCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfKmeshSocket, + m.MapOfSockStorage, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsWorkloadCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatPrograms struct { + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsWorkloadCompatPrograms) Close() error { + return _KmeshSockopsWorkloadCompatClose( + p.SockopsProg, + ) +} + +func _KmeshSockopsWorkloadCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopsworkloadcompat_bpfeb.o +var _KmeshSockopsWorkloadCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfel.go new file mode 100644 index 000000000..faab12fc0 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshsockopsworkloadcompat_bpfel.go @@ -0,0 +1,220 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsWorkloadCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshSockopsWorkloadCompatBuf struct{ Data [40]int8 } + +type KmeshSockopsWorkloadCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsWorkloadCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsWorkloadCompatOperationUsageData struct { + StartTime uint64 + EndTime uint64 + PidTgid uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadCompatOperationUsageKey struct { + SocketCookie uint64 + OperationType uint32 + _ [4]byte +} + +type KmeshSockopsWorkloadCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsWorkloadCompat returns the embedded CollectionSpec for KmeshSockopsWorkloadCompat. +func LoadKmeshSockopsWorkloadCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsWorkloadCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsWorkloadCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsWorkloadCompatObjects loads KmeshSockopsWorkloadCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsWorkloadCompatObjects +// *KmeshSockopsWorkloadCompatPrograms +// *KmeshSockopsWorkloadCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsWorkloadCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsWorkloadCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsWorkloadCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatSpecs struct { + KmeshSockopsWorkloadCompatProgramSpecs + KmeshSockopsWorkloadCompatMapSpecs +} + +// KmeshSockopsWorkloadCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatProgramSpecs struct { + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsWorkloadCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsWorkloadCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.MapSpec `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.MapSpec `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.MapSpec `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.MapSpec `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.MapSpec `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsWorkloadCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatObjects struct { + KmeshSockopsWorkloadCompatPrograms + KmeshSockopsWorkloadCompatMaps +} + +func (o *KmeshSockopsWorkloadCompatObjects) Close() error { + return _KmeshSockopsWorkloadCompatClose( + &o.KmeshSockopsWorkloadCompatPrograms, + &o.KmeshSockopsWorkloadCompatMaps, + ) +} + +// KmeshSockopsWorkloadCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshPerfInfo *ebpf.Map `ebpf:"kmesh_perf_info"` + KmeshPerfMap *ebpf.Map `ebpf:"kmesh_perf_map"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfDstInfo *ebpf.Map `ebpf:"map_of_dst_info"` + MapOfKmeshSocket *ebpf.Map `ebpf:"map_of_kmesh_socket"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTcpInfo *ebpf.Map `ebpf:"map_of_tcp_info"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsWorkloadCompatMaps) Close() error { + return _KmeshSockopsWorkloadCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshPerfInfo, + m.KmeshPerfMap, + m.KmeshService, + m.MapOfAuth, + m.MapOfDstInfo, + m.MapOfKmeshSocket, + m.MapOfSockStorage, + m.MapOfTcpInfo, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsWorkloadCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsWorkloadCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsWorkloadCompatPrograms struct { + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsWorkloadCompatPrograms) Close() error { + return _KmeshSockopsWorkloadCompatClose( + p.SockopsProg, + ) +} + +func _KmeshSockopsWorkloadCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopsworkloadcompat_bpfel.o +var _KmeshSockopsWorkloadCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfeb.go new file mode 100644 index 000000000..f49906e24 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfeb.go @@ -0,0 +1,194 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshXDPAuthBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshXDPAuthBuf struct{ Data [40]int8 } + +type KmeshXDPAuthLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshXDPAuthManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshXDPAuthSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshXDPAuth returns the embedded CollectionSpec for KmeshXDPAuth. +func LoadKmeshXDPAuth() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshXDPAuthBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshXDPAuth: %w", err) + } + + return spec, err +} + +// LoadKmeshXDPAuthObjects loads KmeshXDPAuth and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshXDPAuthObjects +// *KmeshXDPAuthPrograms +// *KmeshXDPAuthMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshXDPAuthObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshXDPAuth() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshXDPAuthSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthSpecs struct { + KmeshXDPAuthProgramSpecs + KmeshXDPAuthMapSpecs +} + +// KmeshXDPAuthSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthProgramSpecs struct { + XdpShutdown *ebpf.ProgramSpec `ebpf:"xdp_shutdown"` +} + +// KmeshXDPAuthMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.MapSpec `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshXDPAuthObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthObjects struct { + KmeshXDPAuthPrograms + KmeshXDPAuthMaps +} + +func (o *KmeshXDPAuthObjects) Close() error { + return _KmeshXDPAuthClose( + &o.KmeshXDPAuthPrograms, + &o.KmeshXDPAuthMaps, + ) +} + +// KmeshXDPAuthMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.Map `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshXDPAuthMaps) Close() error { + return _KmeshXDPAuthClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshService, + m.MapOfAuth, + m.MapOfAuthz, + m.MapOfSockStorage, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshXDPAuthPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthPrograms struct { + XdpShutdown *ebpf.Program `ebpf:"xdp_shutdown"` +} + +func (p *KmeshXDPAuthPrograms) Close() error { + return _KmeshXDPAuthClose( + p.XdpShutdown, + ) +} + +func _KmeshXDPAuthClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshxdpauth_bpfeb.o +var _KmeshXDPAuthBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfel.go new file mode 100644 index 000000000..23b836527 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauth_bpfel.go @@ -0,0 +1,194 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshXDPAuthBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshXDPAuthBuf struct{ Data [40]int8 } + +type KmeshXDPAuthLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshXDPAuthManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshXDPAuthSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshXDPAuth returns the embedded CollectionSpec for KmeshXDPAuth. +func LoadKmeshXDPAuth() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshXDPAuthBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshXDPAuth: %w", err) + } + + return spec, err +} + +// LoadKmeshXDPAuthObjects loads KmeshXDPAuth and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshXDPAuthObjects +// *KmeshXDPAuthPrograms +// *KmeshXDPAuthMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshXDPAuthObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshXDPAuth() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshXDPAuthSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthSpecs struct { + KmeshXDPAuthProgramSpecs + KmeshXDPAuthMapSpecs +} + +// KmeshXDPAuthSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthProgramSpecs struct { + XdpShutdown *ebpf.ProgramSpec `ebpf:"xdp_shutdown"` +} + +// KmeshXDPAuthMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.MapSpec `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshXDPAuthObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthObjects struct { + KmeshXDPAuthPrograms + KmeshXDPAuthMaps +} + +func (o *KmeshXDPAuthObjects) Close() error { + return _KmeshXDPAuthClose( + &o.KmeshXDPAuthPrograms, + &o.KmeshXDPAuthMaps, + ) +} + +// KmeshXDPAuthMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.Map `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshXDPAuthMaps) Close() error { + return _KmeshXDPAuthClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshService, + m.MapOfAuth, + m.MapOfAuthz, + m.MapOfSockStorage, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshXDPAuthPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthPrograms struct { + XdpShutdown *ebpf.Program `ebpf:"xdp_shutdown"` +} + +func (p *KmeshXDPAuthPrograms) Close() error { + return _KmeshXDPAuthClose( + p.XdpShutdown, + ) +} + +func _KmeshXDPAuthClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshxdpauth_bpfel.o +var _KmeshXDPAuthBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfeb.go b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfeb.go new file mode 100644 index 000000000..b0bd880b8 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfeb.go @@ -0,0 +1,194 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshXDPAuthCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshXDPAuthCompatBuf struct{ Data [40]int8 } + +type KmeshXDPAuthCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshXDPAuthCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshXDPAuthCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshXDPAuthCompat returns the embedded CollectionSpec for KmeshXDPAuthCompat. +func LoadKmeshXDPAuthCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshXDPAuthCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshXDPAuthCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshXDPAuthCompatObjects loads KmeshXDPAuthCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshXDPAuthCompatObjects +// *KmeshXDPAuthCompatPrograms +// *KmeshXDPAuthCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshXDPAuthCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshXDPAuthCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshXDPAuthCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatSpecs struct { + KmeshXDPAuthCompatProgramSpecs + KmeshXDPAuthCompatMapSpecs +} + +// KmeshXDPAuthCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatProgramSpecs struct { + XdpShutdown *ebpf.ProgramSpec `ebpf:"xdp_shutdown"` +} + +// KmeshXDPAuthCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.MapSpec `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshXDPAuthCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatObjects struct { + KmeshXDPAuthCompatPrograms + KmeshXDPAuthCompatMaps +} + +func (o *KmeshXDPAuthCompatObjects) Close() error { + return _KmeshXDPAuthCompatClose( + &o.KmeshXDPAuthCompatPrograms, + &o.KmeshXDPAuthCompatMaps, + ) +} + +// KmeshXDPAuthCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.Map `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshXDPAuthCompatMaps) Close() error { + return _KmeshXDPAuthCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshService, + m.MapOfAuth, + m.MapOfAuthz, + m.MapOfSockStorage, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshXDPAuthCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatPrograms struct { + XdpShutdown *ebpf.Program `ebpf:"xdp_shutdown"` +} + +func (p *KmeshXDPAuthCompatPrograms) Close() error { + return _KmeshXDPAuthCompatClose( + p.XdpShutdown, + ) +} + +func _KmeshXDPAuthCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshxdpauthcompat_bpfeb.o +var _KmeshXDPAuthCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfel.go b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfel.go new file mode 100644 index 000000000..61a0f2242 --- /dev/null +++ b/bpf/kmesh/bpf2go/dualengine/kmeshxdpauthcompat_bpfel.go @@ -0,0 +1,194 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package dualengine + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshXDPAuthCompatBpfSockTuple struct { + Ipv4 struct { + Saddr uint32 + Daddr uint32 + Sport uint16 + Dport uint16 + } + _ [24]byte +} + +type KmeshXDPAuthCompatBuf struct{ Data [40]int8 } + +type KmeshXDPAuthCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshXDPAuthCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshXDPAuthCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshXDPAuthCompat returns the embedded CollectionSpec for KmeshXDPAuthCompat. +func LoadKmeshXDPAuthCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshXDPAuthCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshXDPAuthCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshXDPAuthCompatObjects loads KmeshXDPAuthCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshXDPAuthCompatObjects +// *KmeshXDPAuthCompatPrograms +// *KmeshXDPAuthCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshXDPAuthCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshXDPAuthCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshXDPAuthCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatSpecs struct { + KmeshXDPAuthCompatProgramSpecs + KmeshXDPAuthCompatMapSpecs +} + +// KmeshXDPAuthCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatProgramSpecs struct { + XdpShutdown *ebpf.ProgramSpec `ebpf:"xdp_shutdown"` +} + +// KmeshXDPAuthCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshXDPAuthCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshBackend *ebpf.MapSpec `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.MapSpec `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.MapSpec `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshService *ebpf.MapSpec `ebpf:"kmesh_service"` + MapOfAuth *ebpf.MapSpec `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.MapSpec `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.MapSpec `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.MapSpec `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshXDPAuthCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatObjects struct { + KmeshXDPAuthCompatPrograms + KmeshXDPAuthCompatMaps +} + +func (o *KmeshXDPAuthCompatObjects) Close() error { + return _KmeshXDPAuthCompatClose( + &o.KmeshXDPAuthCompatPrograms, + &o.KmeshXDPAuthCompatMaps, + ) +} + +// KmeshXDPAuthCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshBackend *ebpf.Map `ebpf:"kmesh_backend"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEndpoint *ebpf.Map `ebpf:"kmesh_endpoint"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshFrontend *ebpf.Map `ebpf:"kmesh_frontend"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshService *ebpf.Map `ebpf:"kmesh_service"` + MapOfAuth *ebpf.Map `ebpf:"map_of_auth"` + MapOfAuthz *ebpf.Map `ebpf:"map_of_authz"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + MapOfTuple *ebpf.Map `ebpf:"map_of_tuple"` + MapOfWlPolicy *ebpf.Map `ebpf:"map_of_wl_policy"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshXDPAuthCompatMaps) Close() error { + return _KmeshXDPAuthCompatClose( + m.InnerMap, + m.KmeshBackend, + m.KmeshConfigMap, + m.KmeshEndpoint, + m.KmeshEvents, + m.KmeshFrontend, + m.KmeshManage, + m.KmeshService, + m.MapOfAuth, + m.MapOfAuthz, + m.MapOfSockStorage, + m.MapOfTuple, + m.MapOfWlPolicy, + m.OuterMap, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshXDPAuthCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshXDPAuthCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshXDPAuthCompatPrograms struct { + XdpShutdown *ebpf.Program `ebpf:"xdp_shutdown"` +} + +func (p *KmeshXDPAuthCompatPrograms) Close() error { + return _KmeshXDPAuthCompatClose( + p.XdpShutdown, + ) +} + +func _KmeshXDPAuthCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshxdpauthcompat_bpfel.o +var _KmeshXDPAuthCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfeb.go new file mode 100644 index 000000000..707e6b814 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfeb.go @@ -0,0 +1,224 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsBuf struct{ Data [40]int8 } + +type KmeshSockopsClusterSockData struct{ ClusterId uint32 } + +type KmeshSockopsLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshSockopsRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshSockopsSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockops returns the embedded CollectionSpec for KmeshSockops. +func LoadKmeshSockops() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockops: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsObjects loads KmeshSockops and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsObjects +// *KmeshSockopsPrograms +// *KmeshSockopsMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockops() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsSpecs struct { + KmeshSockopsProgramSpecs + KmeshSockopsMapSpecs +} + +// KmeshSockopsSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsProgramSpecs struct { + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` + RouteConfigManager *ebpf.ProgramSpec `ebpf:"route_config_manager"` + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.MapSpec `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsObjects struct { + KmeshSockopsPrograms + KmeshSockopsMaps +} + +func (o *KmeshSockopsObjects) Close() error { + return _KmeshSockopsClose( + &o.KmeshSockopsPrograms, + &o.KmeshSockopsMaps, + ) +} + +// KmeshSockopsMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.Map `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsMaps) Close() error { + return _KmeshSockopsClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfRouterConfig, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsPrograms struct { + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` + RouteConfigManager *ebpf.Program `ebpf:"route_config_manager"` + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsPrograms) Close() error { + return _KmeshSockopsClose( + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + p.RouteConfigManager, + p.SockopsProg, + ) +} + +func _KmeshSockopsClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockops_bpfeb.o +var _KmeshSockopsBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfel.go new file mode 100644 index 000000000..17ae9717a --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockops_bpfel.go @@ -0,0 +1,224 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsBuf struct{ Data [40]int8 } + +type KmeshSockopsClusterSockData struct{ ClusterId uint32 } + +type KmeshSockopsLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshSockopsRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshSockopsSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockops returns the embedded CollectionSpec for KmeshSockops. +func LoadKmeshSockops() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockops: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsObjects loads KmeshSockops and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsObjects +// *KmeshSockopsPrograms +// *KmeshSockopsMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockops() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsSpecs struct { + KmeshSockopsProgramSpecs + KmeshSockopsMapSpecs +} + +// KmeshSockopsSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsProgramSpecs struct { + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` + RouteConfigManager *ebpf.ProgramSpec `ebpf:"route_config_manager"` + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.MapSpec `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsObjects struct { + KmeshSockopsPrograms + KmeshSockopsMaps +} + +func (o *KmeshSockopsObjects) Close() error { + return _KmeshSockopsClose( + &o.KmeshSockopsPrograms, + &o.KmeshSockopsMaps, + ) +} + +// KmeshSockopsMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.Map `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsMaps) Close() error { + return _KmeshSockopsClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfRouterConfig, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsPrograms struct { + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` + RouteConfigManager *ebpf.Program `ebpf:"route_config_manager"` + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsPrograms) Close() error { + return _KmeshSockopsClose( + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + p.RouteConfigManager, + p.SockopsProg, + ) +} + +func _KmeshSockopsClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockops_bpfel.o +var _KmeshSockopsBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfeb.go new file mode 100644 index 000000000..aae8eb089 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfeb.go @@ -0,0 +1,224 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsCompatBuf struct{ Data [40]int8 } + +type KmeshSockopsCompatClusterSockData struct{ ClusterId uint32 } + +type KmeshSockopsCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsCompatRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshSockopsCompatRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshSockopsCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsCompat returns the embedded CollectionSpec for KmeshSockopsCompat. +func LoadKmeshSockopsCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsCompatObjects loads KmeshSockopsCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsCompatObjects +// *KmeshSockopsCompatPrograms +// *KmeshSockopsCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatSpecs struct { + KmeshSockopsCompatProgramSpecs + KmeshSockopsCompatMapSpecs +} + +// KmeshSockopsCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatProgramSpecs struct { + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` + RouteConfigManager *ebpf.ProgramSpec `ebpf:"route_config_manager"` + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.MapSpec `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatObjects struct { + KmeshSockopsCompatPrograms + KmeshSockopsCompatMaps +} + +func (o *KmeshSockopsCompatObjects) Close() error { + return _KmeshSockopsCompatClose( + &o.KmeshSockopsCompatPrograms, + &o.KmeshSockopsCompatMaps, + ) +} + +// KmeshSockopsCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.Map `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsCompatMaps) Close() error { + return _KmeshSockopsCompatClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfRouterConfig, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatPrograms struct { + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` + RouteConfigManager *ebpf.Program `ebpf:"route_config_manager"` + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsCompatPrograms) Close() error { + return _KmeshSockopsCompatClose( + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + p.RouteConfigManager, + p.SockopsProg, + ) +} + +func _KmeshSockopsCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopscompat_bpfeb.o +var _KmeshSockopsCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfel.go new file mode 100644 index 000000000..4be520386 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshsockopscompat_bpfel.go @@ -0,0 +1,224 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshSockopsCompatBuf struct{ Data [40]int8 } + +type KmeshSockopsCompatClusterSockData struct{ ClusterId uint32 } + +type KmeshSockopsCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshSockopsCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshSockopsCompatRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshSockopsCompatRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshSockopsCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshSockopsCompat returns the embedded CollectionSpec for KmeshSockopsCompat. +func LoadKmeshSockopsCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshSockopsCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshSockopsCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshSockopsCompatObjects loads KmeshSockopsCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshSockopsCompatObjects +// *KmeshSockopsCompatPrograms +// *KmeshSockopsCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshSockopsCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshSockopsCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshSockopsCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatSpecs struct { + KmeshSockopsCompatProgramSpecs + KmeshSockopsCompatMapSpecs +} + +// KmeshSockopsCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatProgramSpecs struct { + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` + RouteConfigManager *ebpf.ProgramSpec `ebpf:"route_config_manager"` + SockopsProg *ebpf.ProgramSpec `ebpf:"sockops_prog"` +} + +// KmeshSockopsCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshSockopsCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.MapSpec `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshSockopsCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatObjects struct { + KmeshSockopsCompatPrograms + KmeshSockopsCompatMaps +} + +func (o *KmeshSockopsCompatObjects) Close() error { + return _KmeshSockopsCompatClose( + &o.KmeshSockopsCompatPrograms, + &o.KmeshSockopsCompatMaps, + ) +} + +// KmeshSockopsCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfRouterConfig *ebpf.Map `ebpf:"map_of_router_config"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshSockopsCompatMaps) Close() error { + return _KmeshSockopsCompatClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfRouterConfig, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshSockopsCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshSockopsCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshSockopsCompatPrograms struct { + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` + RouteConfigManager *ebpf.Program `ebpf:"route_config_manager"` + SockopsProg *ebpf.Program `ebpf:"sockops_prog"` +} + +func (p *KmeshSockopsCompatPrograms) Close() error { + return _KmeshSockopsCompatClose( + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + p.RouteConfigManager, + p.SockopsProg, + ) +} + +func _KmeshSockopsCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshsockopscompat_bpfel.o +var _KmeshSockopsCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfeb.go new file mode 100644 index 000000000..9deec1c35 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfeb.go @@ -0,0 +1,115 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +// LoadKmeshTracePoint returns the embedded CollectionSpec for KmeshTracePoint. +func LoadKmeshTracePoint() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshTracePointBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshTracePoint: %w", err) + } + + return spec, err +} + +// LoadKmeshTracePointObjects loads KmeshTracePoint and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshTracePointObjects +// *KmeshTracePointPrograms +// *KmeshTracePointMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshTracePointObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshTracePoint() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshTracePointSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointSpecs struct { + KmeshTracePointProgramSpecs + KmeshTracePointMapSpecs +} + +// KmeshTracePointSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointProgramSpecs struct { + ConnectRet *ebpf.ProgramSpec `ebpf:"connect_ret"` +} + +// KmeshTracePointMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointMapSpecs struct { +} + +// KmeshTracePointObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointObjects struct { + KmeshTracePointPrograms + KmeshTracePointMaps +} + +func (o *KmeshTracePointObjects) Close() error { + return _KmeshTracePointClose( + &o.KmeshTracePointPrograms, + &o.KmeshTracePointMaps, + ) +} + +// KmeshTracePointMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointMaps struct { +} + +func (m *KmeshTracePointMaps) Close() error { + return _KmeshTracePointClose() +} + +// KmeshTracePointPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointPrograms struct { + ConnectRet *ebpf.Program `ebpf:"connect_ret"` +} + +func (p *KmeshTracePointPrograms) Close() error { + return _KmeshTracePointClose( + p.ConnectRet, + ) +} + +func _KmeshTracePointClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshtracepoint_bpfeb.o +var _KmeshTracePointBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfel.go new file mode 100644 index 000000000..20d20d7d9 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepoint_bpfel.go @@ -0,0 +1,115 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +// LoadKmeshTracePoint returns the embedded CollectionSpec for KmeshTracePoint. +func LoadKmeshTracePoint() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshTracePointBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshTracePoint: %w", err) + } + + return spec, err +} + +// LoadKmeshTracePointObjects loads KmeshTracePoint and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshTracePointObjects +// *KmeshTracePointPrograms +// *KmeshTracePointMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshTracePointObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshTracePoint() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshTracePointSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointSpecs struct { + KmeshTracePointProgramSpecs + KmeshTracePointMapSpecs +} + +// KmeshTracePointSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointProgramSpecs struct { + ConnectRet *ebpf.ProgramSpec `ebpf:"connect_ret"` +} + +// KmeshTracePointMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointMapSpecs struct { +} + +// KmeshTracePointObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointObjects struct { + KmeshTracePointPrograms + KmeshTracePointMaps +} + +func (o *KmeshTracePointObjects) Close() error { + return _KmeshTracePointClose( + &o.KmeshTracePointPrograms, + &o.KmeshTracePointMaps, + ) +} + +// KmeshTracePointMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointMaps struct { +} + +func (m *KmeshTracePointMaps) Close() error { + return _KmeshTracePointClose() +} + +// KmeshTracePointPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointPrograms struct { + ConnectRet *ebpf.Program `ebpf:"connect_ret"` +} + +func (p *KmeshTracePointPrograms) Close() error { + return _KmeshTracePointClose( + p.ConnectRet, + ) +} + +func _KmeshTracePointClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshtracepoint_bpfel.o +var _KmeshTracePointBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfeb.go new file mode 100644 index 000000000..76bdabd1b --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfeb.go @@ -0,0 +1,115 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +// LoadKmeshTracePointCompat returns the embedded CollectionSpec for KmeshTracePointCompat. +func LoadKmeshTracePointCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshTracePointCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshTracePointCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshTracePointCompatObjects loads KmeshTracePointCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshTracePointCompatObjects +// *KmeshTracePointCompatPrograms +// *KmeshTracePointCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshTracePointCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshTracePointCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshTracePointCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatSpecs struct { + KmeshTracePointCompatProgramSpecs + KmeshTracePointCompatMapSpecs +} + +// KmeshTracePointCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatProgramSpecs struct { + ConnectRet *ebpf.ProgramSpec `ebpf:"connect_ret"` +} + +// KmeshTracePointCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatMapSpecs struct { +} + +// KmeshTracePointCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatObjects struct { + KmeshTracePointCompatPrograms + KmeshTracePointCompatMaps +} + +func (o *KmeshTracePointCompatObjects) Close() error { + return _KmeshTracePointCompatClose( + &o.KmeshTracePointCompatPrograms, + &o.KmeshTracePointCompatMaps, + ) +} + +// KmeshTracePointCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatMaps struct { +} + +func (m *KmeshTracePointCompatMaps) Close() error { + return _KmeshTracePointCompatClose() +} + +// KmeshTracePointCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatPrograms struct { + ConnectRet *ebpf.Program `ebpf:"connect_ret"` +} + +func (p *KmeshTracePointCompatPrograms) Close() error { + return _KmeshTracePointCompatClose( + p.ConnectRet, + ) +} + +func _KmeshTracePointCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshtracepointcompat_bpfeb.o +var _KmeshTracePointCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfel.go new file mode 100644 index 000000000..b0fc02813 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/enhanced/kmeshtracepointcompat_bpfel.go @@ -0,0 +1,115 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package enhanced + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +// LoadKmeshTracePointCompat returns the embedded CollectionSpec for KmeshTracePointCompat. +func LoadKmeshTracePointCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshTracePointCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshTracePointCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshTracePointCompatObjects loads KmeshTracePointCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshTracePointCompatObjects +// *KmeshTracePointCompatPrograms +// *KmeshTracePointCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshTracePointCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshTracePointCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshTracePointCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatSpecs struct { + KmeshTracePointCompatProgramSpecs + KmeshTracePointCompatMapSpecs +} + +// KmeshTracePointCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatProgramSpecs struct { + ConnectRet *ebpf.ProgramSpec `ebpf:"connect_ret"` +} + +// KmeshTracePointCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshTracePointCompatMapSpecs struct { +} + +// KmeshTracePointCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatObjects struct { + KmeshTracePointCompatPrograms + KmeshTracePointCompatMaps +} + +func (o *KmeshTracePointCompatObjects) Close() error { + return _KmeshTracePointCompatClose( + &o.KmeshTracePointCompatPrograms, + &o.KmeshTracePointCompatMaps, + ) +} + +// KmeshTracePointCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatMaps struct { +} + +func (m *KmeshTracePointCompatMaps) Close() error { + return _KmeshTracePointCompatClose() +} + +// KmeshTracePointCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshTracePointCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshTracePointCompatPrograms struct { + ConnectRet *ebpf.Program `ebpf:"connect_ret"` +} + +func (p *KmeshTracePointCompatPrograms) Close() error { + return _KmeshTracePointCompatClose( + p.ConnectRet, + ) +} + +func _KmeshTracePointCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshtracepointcompat_bpfel.o +var _KmeshTracePointCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfeb.go new file mode 100644 index 000000000..ec6f1e440 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfeb.go @@ -0,0 +1,218 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package normal + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockBuf struct{ Data [40]int8 } + +type KmeshCgroupSockClusterSockData struct{ ClusterId uint32 } + +type KmeshCgroupSockLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshCgroupSockRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshCgroupSockSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSock returns the embedded CollectionSpec for KmeshCgroupSock. +func LoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSock: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockObjects loads KmeshCgroupSock and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockObjects +// *KmeshCgroupSockPrograms +// *KmeshCgroupSockMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSock() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockSpecs struct { + KmeshCgroupSockProgramSpecs + KmeshCgroupSockMapSpecs +} + +// KmeshCgroupSockSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` +} + +// KmeshCgroupSockMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockObjects struct { + KmeshCgroupSockPrograms + KmeshCgroupSockMaps +} + +func (o *KmeshCgroupSockObjects) Close() error { + return _KmeshCgroupSockClose( + &o.KmeshCgroupSockPrograms, + &o.KmeshCgroupSockMaps, + ) +} + +// KmeshCgroupSockMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockMaps) Close() error { + return _KmeshCgroupSockClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` +} + +func (p *KmeshCgroupSockPrograms) Close() error { + return _KmeshCgroupSockClose( + p.CgroupConnect4Prog, + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + ) +} + +func _KmeshCgroupSockClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsock_bpfeb.o +var _KmeshCgroupSockBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfel.go new file mode 100644 index 000000000..fea0fdd74 --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsock_bpfel.go @@ -0,0 +1,218 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package normal + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockBuf struct{ Data [40]int8 } + +type KmeshCgroupSockClusterSockData struct{ ClusterId uint32 } + +type KmeshCgroupSockLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshCgroupSockRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshCgroupSockSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSock returns the embedded CollectionSpec for KmeshCgroupSock. +func LoadKmeshCgroupSock() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSock: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockObjects loads KmeshCgroupSock and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockObjects +// *KmeshCgroupSockPrograms +// *KmeshCgroupSockMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSock() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockSpecs struct { + KmeshCgroupSockProgramSpecs + KmeshCgroupSockMapSpecs +} + +// KmeshCgroupSockSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` +} + +// KmeshCgroupSockMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockObjects struct { + KmeshCgroupSockPrograms + KmeshCgroupSockMaps +} + +func (o *KmeshCgroupSockObjects) Close() error { + return _KmeshCgroupSockClose( + &o.KmeshCgroupSockPrograms, + &o.KmeshCgroupSockMaps, + ) +} + +// KmeshCgroupSockMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockMaps) Close() error { + return _KmeshCgroupSockClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` +} + +func (p *KmeshCgroupSockPrograms) Close() error { + return _KmeshCgroupSockClose( + p.CgroupConnect4Prog, + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + ) +} + +func _KmeshCgroupSockClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsock_bpfel.o +var _KmeshCgroupSockBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfeb.go b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfeb.go new file mode 100644 index 000000000..830d651dc --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfeb.go @@ -0,0 +1,218 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build mips || mips64 || ppc64 || s390x + +package normal + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockCompatBuf struct{ Data [40]int8 } + +type KmeshCgroupSockCompatClusterSockData struct{ ClusterId uint32 } + +type KmeshCgroupSockCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockCompatRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshCgroupSockCompatRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshCgroupSockCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockCompat returns the embedded CollectionSpec for KmeshCgroupSockCompat. +func LoadKmeshCgroupSockCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockCompatObjects loads KmeshCgroupSockCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockCompatObjects +// *KmeshCgroupSockCompatPrograms +// *KmeshCgroupSockCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatSpecs struct { + KmeshCgroupSockCompatProgramSpecs + KmeshCgroupSockCompatMapSpecs +} + +// KmeshCgroupSockCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` +} + +// KmeshCgroupSockCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatObjects struct { + KmeshCgroupSockCompatPrograms + KmeshCgroupSockCompatMaps +} + +func (o *KmeshCgroupSockCompatObjects) Close() error { + return _KmeshCgroupSockCompatClose( + &o.KmeshCgroupSockCompatPrograms, + &o.KmeshCgroupSockCompatMaps, + ) +} + +// KmeshCgroupSockCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockCompatMaps) Close() error { + return _KmeshCgroupSockCompatClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` +} + +func (p *KmeshCgroupSockCompatPrograms) Close() error { + return _KmeshCgroupSockCompatClose( + p.CgroupConnect4Prog, + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + ) +} + +func _KmeshCgroupSockCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockcompat_bpfeb.o +var _KmeshCgroupSockCompatBytes []byte diff --git a/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfel.go b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfel.go new file mode 100644 index 000000000..6286ccbdb --- /dev/null +++ b/bpf/kmesh/bpf2go/kernelnative/normal/kmeshcgroupsockcompat_bpfel.go @@ -0,0 +1,218 @@ +// Code generated by bpf2go; DO NOT EDIT. +//go:build 386 || amd64 || arm || arm64 || loong64 || mips64le || mipsle || ppc64le || riscv64 + +package normal + +import ( + "bytes" + _ "embed" + "fmt" + "io" + + "github.com/cilium/ebpf" +) + +type KmeshCgroupSockCompatBuf struct{ Data [40]int8 } + +type KmeshCgroupSockCompatClusterSockData struct{ ClusterId uint32 } + +type KmeshCgroupSockCompatLogEvent struct { + Ret uint32 + Msg [255]int8 + _ [1]byte +} + +type KmeshCgroupSockCompatManagerKey struct { + NetnsCookie uint64 + _ [8]byte +} + +type KmeshCgroupSockCompatRatelimitKey struct { + Key struct { + SkSkb struct { + Netns uint64 + Ipv4 uint32 + Port uint32 + Family uint32 + _ [4]byte + } + } +} + +type KmeshCgroupSockCompatRatelimitValue struct { + LastTopup uint64 + Tokens uint64 +} + +type KmeshCgroupSockCompatSockStorageData struct { + ConnectNs uint64 + Direction uint8 + ConnectSuccess uint8 + _ [6]byte +} + +// LoadKmeshCgroupSockCompat returns the embedded CollectionSpec for KmeshCgroupSockCompat. +func LoadKmeshCgroupSockCompat() (*ebpf.CollectionSpec, error) { + reader := bytes.NewReader(_KmeshCgroupSockCompatBytes) + spec, err := ebpf.LoadCollectionSpecFromReader(reader) + if err != nil { + return nil, fmt.Errorf("can't load KmeshCgroupSockCompat: %w", err) + } + + return spec, err +} + +// LoadKmeshCgroupSockCompatObjects loads KmeshCgroupSockCompat and converts it into a struct. +// +// The following types are suitable as obj argument: +// +// *KmeshCgroupSockCompatObjects +// *KmeshCgroupSockCompatPrograms +// *KmeshCgroupSockCompatMaps +// +// See ebpf.CollectionSpec.LoadAndAssign documentation for details. +func LoadKmeshCgroupSockCompatObjects(obj interface{}, opts *ebpf.CollectionOptions) error { + spec, err := LoadKmeshCgroupSockCompat() + if err != nil { + return err + } + + return spec.LoadAndAssign(obj, opts) +} + +// KmeshCgroupSockCompatSpecs contains maps and programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatSpecs struct { + KmeshCgroupSockCompatProgramSpecs + KmeshCgroupSockCompatMapSpecs +} + +// KmeshCgroupSockCompatSpecs contains programs before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatProgramSpecs struct { + CgroupConnect4Prog *ebpf.ProgramSpec `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.ProgramSpec `ebpf:"cluster_manager"` + FilterChainManager *ebpf.ProgramSpec `ebpf:"filter_chain_manager"` + FilterManager *ebpf.ProgramSpec `ebpf:"filter_manager"` +} + +// KmeshCgroupSockCompatMapSpecs contains maps before they are loaded into the kernel. +// +// It can be passed ebpf.CollectionSpec.Assign. +type KmeshCgroupSockCompatMapSpecs struct { + InnerMap *ebpf.MapSpec `ebpf:"inner_map"` + KmeshCluster *ebpf.MapSpec `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.MapSpec `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.MapSpec `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.MapSpec `ebpf:"kmesh_events"` + KmeshListener *ebpf.MapSpec `ebpf:"kmesh_listener"` + KmeshManage *ebpf.MapSpec `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.MapSpec `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.MapSpec `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.MapSpec `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.MapSpec `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.MapSpec `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.MapSpec `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.MapSpec `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.MapSpec `ebpf:"outer_map"` + OuterOfMaglev *ebpf.MapSpec `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.MapSpec `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.MapSpec `ebpf:"tmp_log_buf"` +} + +// KmeshCgroupSockCompatObjects contains all objects after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatObjects struct { + KmeshCgroupSockCompatPrograms + KmeshCgroupSockCompatMaps +} + +func (o *KmeshCgroupSockCompatObjects) Close() error { + return _KmeshCgroupSockCompatClose( + &o.KmeshCgroupSockCompatPrograms, + &o.KmeshCgroupSockCompatMaps, + ) +} + +// KmeshCgroupSockCompatMaps contains all maps after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatMaps struct { + InnerMap *ebpf.Map `ebpf:"inner_map"` + KmeshCluster *ebpf.Map `ebpf:"kmesh_cluster"` + KmeshClusterStats *ebpf.Map `ebpf:"kmesh_cluster_stats"` + KmeshConfigMap *ebpf.Map `ebpf:"kmesh_config_map"` + KmeshEvents *ebpf.Map `ebpf:"kmesh_events"` + KmeshListener *ebpf.Map `ebpf:"kmesh_listener"` + KmeshManage *ebpf.Map `ebpf:"kmesh_manage"` + KmeshRatelimit *ebpf.Map `ebpf:"kmesh_ratelimit"` + KmeshTailCallCtx *ebpf.Map `ebpf:"kmesh_tail_call_ctx"` + KmeshTailCallProg *ebpf.Map `ebpf:"kmesh_tail_call_prog"` + MapOfClusterEps *ebpf.Map `ebpf:"map_of_cluster_eps"` + MapOfClusterEpsData *ebpf.Map `ebpf:"map_of_cluster_eps_data"` + MapOfClusterSock *ebpf.Map `ebpf:"map_of_cluster_sock"` + MapOfSockStorage *ebpf.Map `ebpf:"map_of_sock_storage"` + OuterMap *ebpf.Map `ebpf:"outer_map"` + OuterOfMaglev *ebpf.Map `ebpf:"outer_of_maglev"` + TmpBuf *ebpf.Map `ebpf:"tmp_buf"` + TmpLogBuf *ebpf.Map `ebpf:"tmp_log_buf"` +} + +func (m *KmeshCgroupSockCompatMaps) Close() error { + return _KmeshCgroupSockCompatClose( + m.InnerMap, + m.KmeshCluster, + m.KmeshClusterStats, + m.KmeshConfigMap, + m.KmeshEvents, + m.KmeshListener, + m.KmeshManage, + m.KmeshRatelimit, + m.KmeshTailCallCtx, + m.KmeshTailCallProg, + m.MapOfClusterEps, + m.MapOfClusterEpsData, + m.MapOfClusterSock, + m.MapOfSockStorage, + m.OuterMap, + m.OuterOfMaglev, + m.TmpBuf, + m.TmpLogBuf, + ) +} + +// KmeshCgroupSockCompatPrograms contains all programs after they have been loaded into the kernel. +// +// It can be passed to LoadKmeshCgroupSockCompatObjects or ebpf.CollectionSpec.LoadAndAssign. +type KmeshCgroupSockCompatPrograms struct { + CgroupConnect4Prog *ebpf.Program `ebpf:"cgroup_connect4_prog"` + ClusterManager *ebpf.Program `ebpf:"cluster_manager"` + FilterChainManager *ebpf.Program `ebpf:"filter_chain_manager"` + FilterManager *ebpf.Program `ebpf:"filter_manager"` +} + +func (p *KmeshCgroupSockCompatPrograms) Close() error { + return _KmeshCgroupSockCompatClose( + p.CgroupConnect4Prog, + p.ClusterManager, + p.FilterChainManager, + p.FilterManager, + ) +} + +func _KmeshCgroupSockCompatClose(closers ...io.Closer) error { + for _, closer := range closers { + if err := closer.Close(); err != nil { + return err + } + } + return nil +} + +// Do not access this directly. +// +//go:embed kmeshcgroupsockcompat_bpfel.o +var _KmeshCgroupSockCompatBytes []byte diff --git a/build.sh b/build.sh index 869a79b48..ed9c5dea4 100755 --- a/build.sh +++ b/build.sh @@ -1,55 +1,6 @@ #!/bin/bash ROOT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]})) - -# adjust the range of BPF code compilation based on the kernel is enhanced -function bpf_compile_range_adjust() { - if [ "$ENHANCED_KERNEL" == "enhanced" ]; then - sed -i '/ads\/tracepoint\.c/s/\(.*\)generate/\/\/go:generate/' bpf/kmesh/bpf2go/bpf2go.go - sed -i '/ads\/sockops\.c/s/\(.*\)generate/\/\/go:generate/' bpf/kmesh/bpf2go/bpf2go.go - else - sed -i '/ads\/tracepoint\.c/s/\(.*\)generate/\/\/not go:generate/' bpf/kmesh/bpf2go/bpf2go.go - sed -i '/ads\/sockops\.c/s/\(.*\)generate/\/\/not go:generate/' bpf/kmesh/bpf2go/bpf2go.go - fi -} - -function set_enhanced_kernel_env() { - # we use /usr/include/linux/bpf.h to determine the runtime environment’s - # support for kmesh. Considering the case of online image compilation, a - # variable KERNEL_HEADER_LINUX_BPF is used here to specify the path of the - # source of macro definition. - # When using an online compiled image, /usr/include/linux/bpf.h in host - # machine will be mounted to config/linux-bpf.h. - # Otherwise, /usr/include/linux/bpf.h from the current compilation - # environment will be obtained - export KERNEL_HEADER_LINUX_BPF=$ROOT_DIR/config/linux-bpf.h - if [ ! -f "$KERNEL_HEADER_LINUX_BPF" ]; then - export KERNEL_HEADER_LINUX_BPF=/usr/include/linux/bpf.h - fi - - if grep -q "FN(parse_header_msg)" $KERNEL_HEADER_LINUX_BPF; then - export ENHANCED_KERNEL="enhanced" - else - export ENHANCED_KERNEL="unenhanced" - fi -} - -function prepare() { - bash kmesh_compile_env_pre.sh - bash kmesh_macros_env.sh - bash kmesh_bpf_env.sh - if [ "$(arch)" == "x86_64" ]; then - export EXTRA_CDEFINE="-D__x86_64__" - export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu:$C_INCLUDE_PATH - fi - - if [ "$(arch)" == "aarch64" ]; then - export C_INCLUDE_PATH=/usr/include/aarch64-linux-gnu:$C_INCLUDE_PATH - fi - export EXTRA_GOFLAGS="-gcflags=\"-N -l\" -buildmode=pie" - export EXTRA_CFLAGS="-O0 -g" - - bpf_compile_range_adjust -} +source ./kmesh_compile_env_pre.sh function install() { mkdir -p /etc/kmesh diff --git a/common/config/.golangci.yaml b/common/config/.golangci.yaml index 28ba74414..ca92eb895 100644 --- a/common/config/.golangci.yaml +++ b/common/config/.golangci.yaml @@ -78,8 +78,9 @@ issues: # "/" will be replaced by current OS file path separator to properly work on Windows. # Default: [] exclude-files: - - ".*\\.pb\\.go" - - ".*\\.gen\\.go" + - ".*_bpfeb\\.go" + - ".*_bpfel\\.go$" + - ".*bpfeb\\.go" exclude-rules: # Exclude some linters from running on test files. - path: _test\.go$|^tests/|^samples/ diff --git a/hack/copyright/copyright_scan_dir.json b/hack/copyright/copyright_scan_dir.json index 3e23bd566..a60c6b846 100644 --- a/hack/copyright/copyright_scan_dir.json +++ b/hack/copyright/copyright_scan_dir.json @@ -9,7 +9,6 @@ "c_dirs": [ "/bpf", "/config", - "/depends", "/kernel", "/oncn-mda" ], diff --git a/hack/gen_bpf2go.sh b/hack/gen_bpf2go.sh new file mode 100755 index 000000000..7f20dea10 --- /dev/null +++ b/hack/gen_bpf2go.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +ROOT_DIR=$(git rev-parse --show-toplevel) +. $ROOT_DIR/hack/utils.sh +. $ROOT_DIR/kmesh_compile_env_pre.sh + +function build_kmesh_bpf2go() { + local container_id=$1 + docker exec $container_id git config --global --add safe.directory /kmesh + docker exec -e VERSION=$VERSION $container_id ./hack/gen_bpf2go_exec.sh +} + + +container_id=$(run_docker_container) +build_kmesh_bpf2go $container_id +clean_container $container_id +make clean + diff --git a/hack/gen_bpf2go_exec.sh b/hack/gen_bpf2go_exec.sh new file mode 100755 index 000000000..666aee347 --- /dev/null +++ b/hack/gen_bpf2go_exec.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +ROOT_DIR=$(git rev-parse --show-toplevel) +. $ROOT_DIR/hack/utils.sh +. $ROOT_DIR/kmesh_compile_env_pre.sh + + +kmesh_exec(){ + set_enhanced_kernel_env + prepare + go generate bpf/kmesh/bpf2go/bpf2go.go +} +kmesh_exec diff --git a/hack/golangci-lint-prepare.sh b/hack/golangci-lint-prepare.sh new file mode 100755 index 000000000..95383f9aa --- /dev/null +++ b/hack/golangci-lint-prepare.sh @@ -0,0 +1,24 @@ +#!/bin/bash +ROOT_DIR=$(git rev-parse --show-toplevel) + +TARGET_DIR="$ROOT_DIR/bpf/kmesh/bpf2go/kernelnative/enhanced" + +FILES=( + "kmeshsockops_bpfel.o" + "kmeshsockops_bpfeb.o" + "kmeshsockopscompat_bpfeb.o" + "kmeshsockopscompat_bpfel.o" + "kmeshtracepoint_bpfeb.o" + "kmeshtracepoint_bpfel.o" + "kmeshtracepointcompat_bpfeb.o" + "kmeshtracepointcompat_bpfel.o" +) + +mkdir -p "$TARGET_DIR" + +for FILE in "${FILES[@]}"; do + touch "$TARGET_DIR/$FILE" +done + +echo "All files have been created in $TARGET_DIR." + diff --git a/kmesh_compile_env_pre.sh b/kmesh_compile_env_pre.sh index a44da09b7..35b7162c6 100644 --- a/kmesh_compile_env_pre.sh +++ b/kmesh_compile_env_pre.sh @@ -96,9 +96,60 @@ function adapt_include_env { fi } -if [ "${SKIP_DEPENDENCY_INSTALL}" != "true" ]; then - dependency_pkg_install -fi -fix_libbpf_bug -adapt_low_version_kernel -adapt_include_env +function kmesh_set_env(){ + if [ "$(arch)" == "x86_64" ]; then + export EXTRA_CDEFINE="-D__x86_64__" + export C_INCLUDE_PATH=/usr/include/x86_64-linux-gnu:$C_INCLUDE_PATH + fi + + if [ "$(arch)" == "aarch64" ]; then + export C_INCLUDE_PATH=/usr/include/aarch64-linux-gnu:$C_INCLUDE_PATH + fi + export EXTRA_GOFLAGS="-gcflags=\"-N -l\" -buildmode=pie" + export EXTRA_CFLAGS="-O0 -g" +} + +# adjust the range of BPF code compilation based on the kernel is enhanced +function bpf_compile_range_adjust() { + if [ "$ENHANCED_KERNEL" == "enhanced" ]; then + sed -i '/ads\/tracepoint\.c/s/\(.*\)generate/\/\/go:generate/' bpf/kmesh/bpf2go/bpf2go.go + sed -i '/ads\/sockops\.c/s/\(.*\)generate/\/\/go:generate/' bpf/kmesh/bpf2go/bpf2go.go + else + sed -i '/ads\/tracepoint\.c/s/\(.*\)generate/\/\/not go:generate/' bpf/kmesh/bpf2go/bpf2go.go + sed -i '/ads\/sockops\.c/s/\(.*\)generate/\/\/not go:generate/' bpf/kmesh/bpf2go/bpf2go.go + fi +} + +function set_enhanced_kernel_env() { + # we use /usr/include/linux/bpf.h to determine the runtime environment’s + # support for kmesh. Considering the case of online image compilation, a + # variable KERNEL_HEADER_LINUX_BPF is used here to specify the path of the + # source of macro definition. + # When using an online compiled image, /usr/include/linux/bpf.h in host + # machine will be mounted to config/linux-bpf.h. + # Otherwise, /usr/include/linux/bpf.h from the current compilation + # environment will be obtained + export KERNEL_HEADER_LINUX_BPF=$ROOT_DIR/config/linux-bpf.h + if [ ! -f "$KERNEL_HEADER_LINUX_BPF" ]; then + export KERNEL_HEADER_LINUX_BPF=/usr/include/linux/bpf.h + fi + + if grep -q "FN(parse_header_msg)" $KERNEL_HEADER_LINUX_BPF; then + export ENHANCED_KERNEL="enhanced" + else + export ENHANCED_KERNEL="unenhanced" + fi +} + +function prepare() { + if [ "${SKIP_DEPENDENCY_INSTALL}" != "true" ]; then + dependency_pkg_install + fi + fix_libbpf_bug + adapt_low_version_kernel + adapt_include_env + kmesh_set_env + bash kmesh_macros_env.sh + bash kmesh_bpf_env.sh + bpf_compile_range_adjust +} diff --git a/pkg/bpf/ads/sock_connection.go b/pkg/bpf/ads/sock_connection.go index e2db0b1e5..607752463 100644 --- a/pkg/bpf/ads/sock_connection.go +++ b/pkg/bpf/ads/sock_connection.go @@ -28,7 +28,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/kernelnative/normal" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/utils" helper "kmesh.net/kmesh/pkg/utils" diff --git a/pkg/bpf/ads/sock_ops.go b/pkg/bpf/ads/sock_ops.go index 22ec2d3d4..9e6437252 100644 --- a/pkg/bpf/ads/sock_ops.go +++ b/pkg/bpf/ads/sock_ops.go @@ -27,7 +27,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/kernelnative/enhanced" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/utils" helper "kmesh.net/kmesh/pkg/utils" diff --git a/pkg/bpf/ads/trace_point.go b/pkg/bpf/ads/trace_point.go index 72e2849b9..0e2993272 100644 --- a/pkg/bpf/ads/trace_point.go +++ b/pkg/bpf/ads/trace_point.go @@ -23,7 +23,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/kernelnative/enhanced" "kmesh.net/kmesh/daemon/options" helper "kmesh.net/kmesh/pkg/utils" ) diff --git a/pkg/bpf/workload/sendmsg.go b/pkg/bpf/workload/sendmsg.go index 7805e724e..9dfc451c8 100644 --- a/pkg/bpf/workload/sendmsg.go +++ b/pkg/bpf/workload/sendmsg.go @@ -26,7 +26,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/restart" "kmesh.net/kmesh/pkg/bpf/utils" diff --git a/pkg/bpf/workload/sock_connection.go b/pkg/bpf/workload/sock_connection.go index b38c6f912..0d9f68c8e 100644 --- a/pkg/bpf/workload/sock_connection.go +++ b/pkg/bpf/workload/sock_connection.go @@ -25,7 +25,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/restart" "kmesh.net/kmesh/pkg/bpf/utils" diff --git a/pkg/bpf/workload/sock_ops.go b/pkg/bpf/workload/sock_ops.go index 6199594e9..ac3c6d71b 100644 --- a/pkg/bpf/workload/sock_ops.go +++ b/pkg/bpf/workload/sock_ops.go @@ -26,7 +26,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/restart" "kmesh.net/kmesh/pkg/bpf/utils" diff --git a/pkg/bpf/workload/xdp.go b/pkg/bpf/workload/xdp.go index 3b182dedc..f57984146 100644 --- a/pkg/bpf/workload/xdp.go +++ b/pkg/bpf/workload/xdp.go @@ -25,7 +25,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/link" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/daemon/options" "kmesh.net/kmesh/pkg/bpf/utils" "kmesh.net/kmesh/pkg/constants" diff --git a/pkg/controller/workload/bpfcache/factory.go b/pkg/controller/workload/bpfcache/factory.go index 7072d4b0e..1c2cc3396 100644 --- a/pkg/controller/workload/bpfcache/factory.go +++ b/pkg/controller/workload/bpfcache/factory.go @@ -19,7 +19,7 @@ package bpfcache import ( "istio.io/istio/pkg/util/sets" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/pkg/logger" ) diff --git a/pkg/controller/workload/bpfcache/fake_map.go b/pkg/controller/workload/bpfcache/fake_map.go index 27a7ba3dc..b70086bc3 100644 --- a/pkg/controller/workload/bpfcache/fake_map.go +++ b/pkg/controller/workload/bpfcache/fake_map.go @@ -23,7 +23,7 @@ import ( "github.com/cilium/ebpf" "github.com/cilium/ebpf/rlimit" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" ) func NewFakeWorkloadMap(t *testing.T) bpf2go.KmeshCgroupSockWorkloadMaps { diff --git a/pkg/controller/workload/workload_processor.go b/pkg/controller/workload/workload_processor.go index f3164983a..59b66ab9a 100644 --- a/pkg/controller/workload/workload_processor.go +++ b/pkg/controller/workload/workload_processor.go @@ -32,7 +32,7 @@ import ( "kmesh.net/kmesh/api/v2/workloadapi" "kmesh.net/kmesh/api/v2/workloadapi/security" security_v2 "kmesh.net/kmesh/api/v2/workloadapi/security" - "kmesh.net/kmesh/bpf/kmesh/bpf2go" + bpf2go "kmesh.net/kmesh/bpf/kmesh/bpf2go/dualengine" "kmesh.net/kmesh/pkg/auth" kmeshbpf "kmesh.net/kmesh/pkg/bpf/restart" maps_v2 "kmesh.net/kmesh/pkg/cache/v2/maps"