Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

datapath: Use iproute2+libbpf #16727

Merged
merged 3 commits into from
Aug 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-images-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:latest-race
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race
build-args: |
BASE_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
BASE_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4
LOCKDEBUG=1
RACE=1
OPERATOR_VARIANT=${{ matrix.name }}
Expand Down Expand Up @@ -152,7 +152,7 @@ jobs:
tags: |
quay.io/${{ github.repository_owner }}/${{ matrix.name }}-ci:${{ steps.tag.outputs.tag }}-race
build-args: |
BASE_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
BASE_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4
LOCKDEBUG=1
RACE=1
OPERATOR_VARIANT=${{ matrix.name }}
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
if: type != pull_request
env:
- RACE=1
- BASE_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
- BASE_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4
- LOCKDEBUG=1
- arch: arm64-graviton2
name: "arm64-graviton2-race"
if: type != pull_request
env:
- RACE=1
- BASE_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
- BASE_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4
- LOCKDEBUG=1
virt: vm
group: edge
Expand Down
2 changes: 1 addition & 1 deletion api/v1/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
include ../../Makefile.defs

# Update this via images/scripts/update-cilium-builder-image.sh
CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:c3cbbfef61132ae6c42e458e2ea0743c4904c6b1@sha256:0743586e88287e306bc744ceb3584a2a09d072061c3e95be9f39e61ada763a60
CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:2fad9bc7a22fcfd347341a653d1c9178ef687f5e@sha256:1b3b3a41398287b48bb551d927538da510e8e3fda7968779ddb449e3817772fd

.PHONY: proto
proto:
Expand Down
24 changes: 12 additions & 12 deletions bpf/bpf_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ __sock4_health_fwd(struct bpf_sock_addr *ctx __maybe_unused)
return ret;
}

__section("connect4")
__section("cgroup/connect4")
int sock4_connect(struct bpf_sock_addr *ctx)
{
if (sock_is_health_check(ctx))
Expand Down Expand Up @@ -491,7 +491,7 @@ static __always_inline int __sock4_post_bind(struct bpf_sock *ctx,
return 0;
}

__section("post_bind4")
__section("cgroup/post_bind4")
int sock4_post_bind(struct bpf_sock *ctx)
{
if (__sock4_post_bind(ctx, ctx) < 0)
Expand Down Expand Up @@ -530,7 +530,7 @@ static __always_inline int __sock4_pre_bind(struct bpf_sock_addr *ctx,
return ret;
}

__section("bind4")
__section("cgroup/bind4")
int sock4_pre_bind(struct bpf_sock_addr *ctx)
{
int ret = SYS_PROCEED;
Expand Down Expand Up @@ -582,21 +582,21 @@ static __always_inline int __sock4_xlate_rev(struct bpf_sock_addr *ctx,
return -ENXIO;
}

__section("sendmsg4")
__section("cgroup/sendmsg4")
int sock4_sendmsg(struct bpf_sock_addr *ctx)
{
__sock4_xlate_fwd(ctx, ctx, true);
return SYS_PROCEED;
}

__section("recvmsg4")
__section("cgroup/recvmsg4")
int sock4_recvmsg(struct bpf_sock_addr *ctx)
{
__sock4_xlate_rev(ctx, ctx);
return SYS_PROCEED;
}

__section("getpeername4")
__section("cgroup/getpeername4")
int sock4_getpeername(struct bpf_sock_addr *ctx)
{
__sock4_xlate_rev(ctx, ctx);
Expand Down Expand Up @@ -843,7 +843,7 @@ static __always_inline int __sock6_post_bind(struct bpf_sock *ctx)
return 0;
}

__section("post_bind6")
__section("cgroup/post_bind6")
int sock6_post_bind(struct bpf_sock *ctx)
{
if (__sock6_post_bind(ctx) < 0)
Expand Down Expand Up @@ -913,7 +913,7 @@ static __always_inline int __sock6_pre_bind(struct bpf_sock_addr *ctx)
return ret;
}

__section("bind6")
__section("cgroup/bind6")
int sock6_pre_bind(struct bpf_sock_addr *ctx)
{
int ret = SYS_PROCEED;
Expand Down Expand Up @@ -1033,7 +1033,7 @@ __sock6_health_fwd(struct bpf_sock_addr *ctx __maybe_unused)
return ret;
}

__section("connect6")
__section("cgroup/connect6")
int sock6_connect(struct bpf_sock_addr *ctx)
{
if (sock_is_health_check(ctx))
Expand Down Expand Up @@ -1111,21 +1111,21 @@ static __always_inline int __sock6_xlate_rev(struct bpf_sock_addr *ctx)
return sock6_xlate_rev_v4_in_v6(ctx);
}

__section("sendmsg6")
__section("cgroup/sendmsg6")
int sock6_sendmsg(struct bpf_sock_addr *ctx)
{
__sock6_xlate_fwd(ctx, true);
return SYS_PROCEED;
}

__section("recvmsg6")
__section("cgroup/recvmsg6")
int sock6_recvmsg(struct bpf_sock_addr *ctx)
{
__sock6_xlate_rev(ctx);
return SYS_PROCEED;
}

__section("getpeername6")
__section("cgroup/getpeername6")
int sock6_getpeername(struct bpf_sock_addr *ctx)
{
__sock6_xlate_rev(ctx);
Expand Down
2 changes: 1 addition & 1 deletion bpf/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ function bpf_load_cgroups()

cilium-map-migrate -s $OUT
set +e
tc exec bpf pin $TMP_FILE obj $OUT type $PROG_TYPE attach_type $WHERE sec $WHERE
tc exec bpf pin $TMP_FILE obj $OUT type $PROG_TYPE attach_type $WHERE sec "cgroup/$WHERE"
RETCODE=$?
set -e
cilium-map-migrate -e $OUT -r $RETCODE
Expand Down
2 changes: 1 addition & 1 deletion images/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

ARG COMPILERS_IMAGE=quay.io/cilium/image-compilers:6ed96e618f68cd941b62b546fc8d161db0144d84@sha256:5245610a830b14972d5b287fc0318ac6ab0d420e4afc9b5db9032a04fd706d32
ARG CILIUM_RUNTIME_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
ARG CILIUM_RUNTIME_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4
ARG TESTER_IMAGE=quay.io/cilium/image-tester:eb76f0d4d585946bb0267b4c4478cceed17bbd87@sha256:c9a598cdc4843e62ab4e430f36343ca06d5292506261f17e466e0f1cbb48ddbb
ARG GOLANG_IMAGE=docker.io/library/golang:1.16.5@sha256:6ff0e09b47d0e93823978da613c449056cda25c058ebc4031f93c05a76905a8c
ARG CILIUM_LLVM_IMAGE=quay.io/cilium/cilium-llvm:0147a23fdada32bd51b4f313c645bcb5fbe188d6@sha256:24fd3ad32471d0e45844c856c38f1b2d4ac8bd0a2d4edf64cffaaa3fd0b21202
Expand Down
2 changes: 1 addition & 1 deletion images/cilium-test/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Copyright 2020-2021 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

ARG CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:c3cbbfef61132ae6c42e458e2ea0743c4904c6b1@sha256:0743586e88287e306bc744ceb3584a2a09d072061c3e95be9f39e61ada763a60
ARG CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:2fad9bc7a22fcfd347341a653d1c9178ef687f5e@sha256:1b3b3a41398287b48bb551d927538da510e8e3fda7968779ddb449e3817772fd
ARG UBUNTU_IMAGE=docker.io/library/ubuntu:20.04@sha256:cf31af331f38d1d7158470e095b132acd126a7180a54f263d386da88eb681d93

FROM ${UBUNTU_IMAGE} as rootfs
Expand Down
4 changes: 2 additions & 2 deletions images/cilium/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# Copyright 2020-2021 Authors of Cilium
# SPDX-License-Identifier: Apache-2.0

ARG CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:c3cbbfef61132ae6c42e458e2ea0743c4904c6b1@sha256:0743586e88287e306bc744ceb3584a2a09d072061c3e95be9f39e61ada763a60
ARG CILIUM_RUNTIME_IMAGE=quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0
ARG CILIUM_BUILDER_IMAGE=quay.io/cilium/cilium-builder:2fad9bc7a22fcfd347341a653d1c9178ef687f5e@sha256:1b3b3a41398287b48bb551d927538da510e8e3fda7968779ddb449e3817772fd
ARG CILIUM_RUNTIME_IMAGE=quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4

# cilium-envoy from github.com/cilium/proxy
#
Expand Down
3 changes: 2 additions & 1 deletion images/runtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG UBUNTU_IMAGE=docker.io/library/ubuntu:20.04@sha256:cf31af331f38d1d7158470e09

ARG CILIUM_LLVM_IMAGE=quay.io/cilium/cilium-llvm:0147a23fdada32bd51b4f313c645bcb5fbe188d6@sha256:24fd3ad32471d0e45844c856c38f1b2d4ac8bd0a2d4edf64cffaaa3fd0b21202
ARG CILIUM_BPFTOOL_IMAGE=quay.io/cilium/cilium-bpftool:b5ba881d2a7ec68d88ecd72efd60ac551c720701@sha256:458282e59657b8f779d52ae2be2cdbeecfe68c3d807ff87c97c8d5c6f97820a9
ARG CILIUM_IPROUTE2_IMAGE=quay.io/cilium/cilium-iproute2:4db2c4bdf00ce461406e1c82aada461356fac935@sha256:e4c9ba92996a07964c1b7cd97c4aac950754ec75d7ac8c626a99c79acd0479ab
ARG CILIUM_IPROUTE2_IMAGE=quay.io/cilium/cilium-iproute2:b95218f8a87ed0fab576e829b662fa83d385c253@sha256:17a86087560e862f6d93c6770895d7af26a37f53e82c534e5dae4e9909720d82

FROM ${CILIUM_LLVM_IMAGE} as llvm-dist
FROM ${CILIUM_BPFTOOL_IMAGE} as bpftool-dist
Expand Down Expand Up @@ -47,6 +47,7 @@ RUN --mount=type=bind,readwrite,target=/go/src/github.com/cilium/cilium/images/r

COPY --from=llvm-dist /usr/local/bin/clang /usr/local/bin/llc /bin/
COPY --from=bpftool-dist /usr/local /usr/local
COPY --from=iproute2-dist /usr/lib/libbpf* /usr/lib
COPY --from=iproute2-dist /usr/local /usr/local

ARG TARGETPLATFORM
Expand Down
2 changes: 1 addition & 1 deletion jenkinsfiles/ginkgo-gke.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pipeline {
env.DOCKER_TAG = env.DOCKER_TAG + "-race"
env.RACE = 1
env.LOCKDEBUG = 1
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0"
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jenkinsfiles/ginkgo-kernel.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pipeline {
env.DOCKER_TAG = env.DOCKER_TAG + "-race"
env.RACE = 1
env.LOCKDEBUG = 1
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0"
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion jenkinsfiles/ginkgo-runtime-kernel.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pipeline {
)}"""
BASE_IMAGE="""${sh(
returnStdout: true,
script: 'if [ "${run_with_race_detection}" = "" ]; then echo -n "scratch"; else echo -n "quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0"; fi'
script: 'if [ "${run_with_race_detection}" = "" ]; then echo -n "scratch"; else echo -n "quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4"; fi'
)}"""
}

Expand Down
2 changes: 1 addition & 1 deletion jenkinsfiles/kubernetes-upstream.Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pipeline {
env.DOCKER_TAG = env.DOCKER_TAG + "-race"
env.RACE = 1
env.LOCKDEBUG = 1
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:28b5a8658b596d12d80b0e7dad3efc2e77ec2d65@sha256:fbf8eee141101fade247dbe94cf84ca3bdcd92b96108996c50859ab7edd607d0"
env.BASE_IMAGE = "quay.io/cilium/cilium-runtime:92a9d1e3347d4473053fe0704f62a5bc5649af07@sha256:c4a3b4509f30ce5ccce8deeb00e66ddff3dcd3c48111f3f47659b1d5c22177d4"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/k8sT/manifests/demo-customcalls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ metadata:
spec:
containers:
- name: cilium-builder
image: quay.io/cilium/cilium-builder:c3cbbfef61132ae6c42e458e2ea0743c4904c6b1@sha256:0743586e88287e306bc744ceb3584a2a09d072061c3e95be9f39e61ada763a60
image: quay.io/cilium/cilium-builder:2fad9bc7a22fcfd347341a653d1c9178ef687f5e@sha256:1b3b3a41398287b48bb551d927538da510e8e3fda7968779ddb449e3817772fd
workingDir: /cilium
command: ["sleep"]
args:
Expand Down