Skip to content

Commit 21a6bf1

Browse files
feat: rename iptables block binary to azure-block-iptables (#3913)
* feat: iptables block using LSM BPF * feat: makefile changes * chore: cleanup * Update bpf-prog/block-iptables/bpf/src/block_iptables.bpf.c Co-authored-by: Copilot <[email protected]> Signed-off-by: Santhosh Prabhu <[email protected]> * chore: fix const * fix: dockerfiles, bug * test: add test for bpf attach/detach * feat: add event tracking * feat: add event counting * chore: dockerfiles * fix: nolint for generated code * fix: nolint for generated code * fix: golangci skip * fix:skip directory with generated code * chore:skip block iptales generated code * chore: fix * fix: run go generate first * fix: use installed go * fix: install bpf libraries * fix: remove file * fix: roll back linter changes * fix: add code generation to tests * chore: switch to dual license * fix: run generate before lint * fix: install libs * fix: fix linting, address some comments * fix: address comments, fix lint * fix: missed change * fix: compile only on linux * fix: compile only on linux * fix: address comments * fix: address comments * chore: dockerfiles * fix: address comments * chore:dockerfiles * fix: address comments * chore: dockerfiles * fix: address comments * fix: add azure- prefix to block-iptables * fix: rename subdir * fix: import path * Update .github/workflows/golangci.yaml Co-authored-by: Copilot <[email protected]> Signed-off-by: Santhosh Prabhu <[email protected]> * Update .github/workflows/golangci.yaml Co-authored-by: Copilot <[email protected]> Signed-off-by: Santhosh Prabhu <[email protected]> * fix: remove redundant files * fix: add code owner * chore: dockerfiles * chore: add more owners to bpf-prog * chore:dockerfiles --------- Signed-off-by: Santhosh Prabhu <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent e0e07f9 commit 21a6bf1

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

.github/workflows/golangci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
uses: actions/upload-artifact@v4
3030
with:
3131
name: generated-bpf-program-code
32-
path: ./bpf-prog/block-iptables/pkg/blockservice
32+
path: ./bpf-prog/azure-block-iptables/pkg/blockservice
3333
golangci:
3434
strategy:
3535
fail-fast: false
@@ -50,7 +50,7 @@ jobs:
5050
uses: actions/download-artifact@v4
5151
with:
5252
name: generated-bpf-program-code
53-
path: ./bpf-prog/block-iptables/pkg/blockservice
53+
path: ./bpf-prog/azure-block-iptables/pkg/blockservice
5454
- name: golangci-lint
5555
uses: golangci/golangci-lint-action@v6
5656
with:

Makefile

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ endif
3333
# Interrogate the git repo and set some variables
3434
REPO_ROOT ?= $(shell git rev-parse --show-toplevel)
3535
REVISION ?= $(shell git rev-parse --short HEAD)
36-
ACN_VERSION ?= $(shell git describe --exclude "azure-iptables-monitor*" --exclude "azure-ip-masq-merger*" --exclude "azure-ipam*" --exclude "dropgz*" --exclude "zapai*" --exclude "ipv6-hp-bpf*" --exclude "block-iptables*" --tags --always)
36+
ACN_VERSION ?= $(shell git describe --exclude "azure-iptables-monitor*" --exclude "azure-ip-masq-merger*" --exclude "azure-ipam*" --exclude "dropgz*" --exclude "zapai*" --exclude "ipv6-hp-bpf*" --exclude "azure-block-iptables*" --tags --always)
3737
IPV6_HP_BPF_VERSION ?= $(notdir $(shell git describe --match "ipv6-hp-bpf*" --tags --always))
38-
BLOCK_IPTABLES_VERSION ?= $(notdir $(shell git describe --match "block-iptables*" --tags --always))
38+
AZURE_BLOCK_IPTABLES_VERSION ?= $(notdir $(shell git describe --match "azure-block-iptables*" --tags --always))
3939
AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always))
4040
AZURE_IP_MASQ_MERGER_VERSION ?= $(notdir $(shell git describe --match "azure-ip-masq-merger*" --tags --always))
4141
AZURE_IPTABLES_MONITOR_VERSION ?= $(notdir $(shell git describe --match "azure-iptables-monitor*" --tags --always))
@@ -49,7 +49,7 @@ AZURE_IPAM_DIR = $(REPO_ROOT)/azure-ipam
4949
AZURE_IP_MASQ_MERGER_DIR = $(REPO_ROOT)/azure-ip-masq-merger
5050
AZURE_IPTABLES_MONITOR_DIR = $(REPO_ROOT)/azure-iptables-monitor
5151
IPV6_HP_BPF_DIR = $(REPO_ROOT)/bpf-prog/ipv6-hp-bpf
52-
BLOCK_IPTABLES_DIR = $(REPO_ROOT)/bpf-prog/block-iptables
52+
AZURE_BLOCK_IPTABLES_DIR = $(REPO_ROOT)/bpf-prog/azure-block-iptables
5353

5454
CNI_NET_DIR = $(REPO_ROOT)/cni/network/plugin
5555
CNI_IPAM_DIR = $(REPO_ROOT)/cni/ipam/plugin
@@ -65,7 +65,7 @@ AZURE_IPAM_BUILD_DIR = $(BUILD_DIR)/azure-ipam
6565
AZURE_IP_MASQ_MERGER_BUILD_DIR = $(BUILD_DIR)/azure-ip-masq-merger
6666
AZURE_IPTABLES_MONITOR_BUILD_DIR = $(BUILD_DIR)/azure-iptables-monitor
6767
IPV6_HP_BPF_BUILD_DIR = $(BUILD_DIR)/bpf-prog/ipv6-hp-bpf
68-
BLOCK_IPTABLES_BUILD_DIR = $(BUILD_DIR)/bpf-prog/block-iptables
68+
AZURE_BLOCK_IPTABLES_BUILD_DIR = $(BUILD_DIR)/bpf-prog/azure-block-iptables
6969
IMAGE_DIR = $(OUTPUT_DIR)/images
7070

7171
CNI_BUILD_DIR = $(BUILD_DIR)/cni
@@ -115,7 +115,7 @@ AZURE_IPAM_ARCHIVE_NAME = azure-ipam-$(GOOS)-$(GOARCH)-$(AZURE_IPAM_VERSION).$(A
115115
AZURE_IP_MASQ_MERGER_ARCHIVE_NAME = azure-ip-masq-merger-$(GOOS)-$(GOARCH)-$(AZURE_IP_MASQ_MERGER_VERSION).$(ARCHIVE_EXT)
116116
AZURE_IPTABLES_MONITOR_ARCHIVE_NAME = azure-iptables-monitor-$(GOOS)-$(GOARCH)-$(AZURE_IPTABLES_MONITOR_VERSION).$(ARCHIVE_EXT)
117117
IPV6_HP_BPF_ARCHIVE_NAME = ipv6-hp-bpf-$(GOOS)-$(GOARCH)-$(IPV6_HP_BPF_VERSION).$(ARCHIVE_EXT)
118-
BLOCK_IPTABLES_ARCHIVE_NAME = block-iptables-$(GOOS)-$(GOARCH)-$(BLOCK_IPTABLES_VERSION).$(ARCHIVE_EXT)
118+
AZURE_BLOCK_IPTABLES_ARCHIVE_NAME = azure-block-iptables-$(GOOS)-$(GOARCH)-$(AZURE_BLOCK_IPTABLES_VERSION).$(ARCHIVE_EXT)
119119

120120
# Image info file names.
121121
CNI_IMAGE_INFO_FILE = azure-cni-$(CNI_VERSION).txt
@@ -132,7 +132,7 @@ all-binaries-platforms: ## Make all platform binaries
132132

133133
# OS specific binaries/images
134134
ifeq ($(GOOS),linux)
135-
all-binaries: acncli azure-cni-plugin azure-cns azure-npm azure-ipam azure-ip-masq-merger azure-iptables-monitor ipv6-hp-bpf block-iptables
135+
all-binaries: acncli azure-cni-plugin azure-cns azure-npm azure-ipam azure-ip-masq-merger azure-iptables-monitor ipv6-hp-bpf azure-block-iptables
136136
all-images: npm-image cns-image cni-manager-image azure-ip-masq-merger-image azure-iptables-monitor-image ipv6-hp-bpf-image
137137
else
138138
all-binaries: azure-cni-plugin azure-cns azure-npm
@@ -147,7 +147,7 @@ acncli: acncli-binary acncli-archive
147147
azure-npm: azure-npm-binary npm-archive
148148
azure-ipam: azure-ipam-binary azure-ipam-archive
149149
ipv6-hp-bpf: ipv6-hp-bpf-binary ipv6-hp-bpf-archive
150-
block-iptables: block-iptables-binary block-iptables-archive
150+
azure-block-iptables: azure-block-iptables-binary azure-block-iptables-archive
151151
azure-ip-masq-merger: azure-ip-masq-merger-binary azure-ip-masq-merger-archive
152152
azure-iptables-monitor: azure-iptables-monitor-binary azure-iptables-monitor-archive
153153

@@ -174,8 +174,8 @@ azure-iptables-monitor-version: ## prints the azure-iptables-monitor version
174174
ipv6-hp-bpf-version: ## prints the ipv6-hp-bpf version
175175
@echo $(IPV6_HP_BPF_VERSION)
176176

177-
block-iptables-version: ## prints the block-iptables version
178-
@echo $(BLOCK_IPTABLES_VERSION)
177+
azure-block-iptables-version: ## prints the azure-block-iptables version
178+
@echo $(AZURE_BLOCK_IPTABLES_VERSION)
179179

180180
cni-version: ## prints the cni version
181181
@echo $(CNI_VERSION)
@@ -210,10 +210,10 @@ else ifeq ($(GOARCH),arm64)
210210
for dir in /usr/include/aarch64-linux-gnu/*; do sudo ln -sfn "$$dir" /usr/include/$$(basename "$$dir"); done
211211
endif
212212

213-
# Build the block-iptables binary.
214-
block-iptables-binary:
215-
cd $(BLOCK_IPTABLES_DIR) && CGO_ENABLED=0 go generate ./...
216-
cd $(BLOCK_IPTABLES_DIR)/cmd/block-iptables && CGO_ENABLED=0 go build -v -o $(BLOCK_IPTABLES_BUILD_DIR)/block-iptables$(EXE_EXT) -ldflags "-X main.version=$(BLOCK_IPTABLES_VERSION)" -gcflags="-dwarflocationlists=true"
213+
# Build the azure-block-iptables binary.
214+
azure-block-iptables-binary:
215+
cd $(AZURE_BLOCK_IPTABLES_DIR) && CGO_ENABLED=0 go generate ./...
216+
cd $(AZURE_BLOCK_IPTABLES_DIR)/cmd/azure-block-iptables && CGO_ENABLED=0 go build -v -o $(AZURE_BLOCK_IPTABLES_BUILD_DIR)/azure-block-iptables$(EXE_EXT) -ldflags "-X main.version=$(AZURE_BLOCK_IPTABLES_VERSION)" -gcflags="-dwarflocationlists=true"
217217

218218
# Build the Azure CNI network binary.
219219
azure-vnet-binary:
@@ -861,12 +861,12 @@ ifeq ($(GOOS),linux)
861861
cd $(IPV6_HP_BPF_BUILD_DIR) && $(ARCHIVE_CMD) $(IPV6_HP_BPF_ARCHIVE_NAME) ipv6-hp-bpf$(EXE_EXT)
862862
endif
863863

864-
# Create a block-iptables archive for the target platform.
865-
.PHONY: block-iptables-archive
866-
block-iptables-archive: block-iptables-binary
864+
# Create a azure-block-iptables archive for the target platform.
865+
.PHONY: azure-block-iptables-archive
866+
azure-block-iptables-archive: azure-block-iptables-binary
867867
ifeq ($(GOOS),linux)
868-
$(MKDIR) $(BLOCK_IPTABLES_BUILD_DIR)
869-
cd $(BLOCK_IPTABLES_BUILD_DIR) && $(ARCHIVE_CMD) $(BLOCK_IPTABLES_ARCHIVE_NAME) block-iptables$(EXE_EXT)
868+
$(MKDIR) $(AZURE_BLOCK_IPTABLES_BUILD_DIR)
869+
cd $(AZURE_BLOCK_IPTABLES_BUILD_DIR) && $(ARCHIVE_CMD) $(AZURE_BLOCK_IPTABLES_ARCHIVE_NAME) azure-block-iptables$(EXE_EXT)
870870
endif
871871

872872
##@ Utils

bpf-prog/block-iptables/cmd/block-iptables/main.go renamed to bpf-prog/azure-block-iptables/cmd/azure-block-iptables/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"syscall"
1414
"time"
1515

16-
"github.com/Azure/azure-container-networking/bpf-prog/block-iptables/pkg/bpfprogram"
16+
"github.com/Azure/azure-container-networking/bpf-prog/azure-block-iptables/pkg/bpfprogram"
1717
"github.com/cilium/ebpf/rlimit"
1818
"github.com/fsnotify/fsnotify"
1919
)

bpf-prog/block-iptables/cmd/block-iptables/main_test.go renamed to bpf-prog/azure-block-iptables/cmd/azure-block-iptables/main_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"os"
88
"testing"
99

10-
"github.com/Azure/azure-container-networking/bpf-prog/block-iptables/pkg/bpfprogram"
10+
"github.com/Azure/azure-container-networking/bpf-prog/azure-block-iptables/pkg/bpfprogram"
1111
"github.com/fsnotify/fsnotify"
1212
"github.com/pkg/errors"
1313
)

bpf-prog/block-iptables/pkg/bpfprogram/program.go renamed to bpf-prog/azure-block-iptables/pkg/bpfprogram/program.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"path/filepath"
1010
"syscall"
1111

12-
blockservice "github.com/Azure/azure-container-networking/bpf-prog/block-iptables/pkg/blockservice"
12+
blockservice "github.com/Azure/azure-container-networking/bpf-prog/azure-block-iptables/pkg/blockservice"
1313
"github.com/cilium/ebpf"
1414
"github.com/cilium/ebpf/link"
1515
"github.com/pkg/errors"

0 commit comments

Comments
 (0)