Skip to content

Commit

Permalink
arm64
Browse files Browse the repository at this point in the history
Signed-off-by: Hang Yan <[email protected]>
  • Loading branch information
hangyan committed Oct 22, 2024
1 parent 24f880a commit 42d2d33
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ uninstall-hooks:
.PHONY: bin
bin:
@mkdir -p $(BINDIR)

CGO_ENABLED=1 GOOS=linux $(GO) build -o $(BINDIR) $(GOFLAGS) -ldflags '$(LDFLAGS)' antrea.io/antrea/cmd/...

.trivy-bin:
Expand Down Expand Up @@ -512,3 +513,4 @@ markdownlint-fix:
spelling-fix:
@echo "===> Updating incorrect spellings <==="
$(CURDIR)/hack/update-spelling.sh

30 changes: 30 additions & 0 deletions hack/build-arm-libpcap.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# Copyright 2020 Antrea Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

PCAPV="1.10.5"

pushd .
apt-get update && apt-get install -y flex bison gcc-aarch64-linux-gnu
mkdir -p /tmp/pcap
cd /tmp/pcap || exit

wget http://www.tcpdump.org/release/libpcap-${PCAPV}.tar.gz
export CC=aarch64-linux-gnu-gcc
tar -zxvf libpcap-${PCAPV}.tar.gz
cd libpcap-${PCAPV} || exit
./configure --host=aarch64-linux --with-pcap=linux
make
popd || exit
7 changes: 7 additions & 0 deletions hack/release/prepare-assets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ for build in "${ANTREA_AGENT_BUILDS[@]}"; do
arch="${args[1]}"
suffix="${args[2]}"

if [ "$arch" == "arm64" ]; then
bash ./hack/build-arm-libpcap.sh
export CC=aarch64-linux-gnu-gcc
export CGO_LDFLAGS="-static -L/tmp/pcap/libpcap-$PCAPV"
export LDFLAGS="-linkmode=external -extldflags=-static -s -w"
fi
GOOS=$os GOARCH=$arch BINDIR="$OUTPUT_DIR" ANTREA_AGENT_BINARY_NAME="antrea-agent-$suffix" make antrea-agent-release
unset CC
done

ANTREA_CNI_BUILDS=(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ const (
// reason for timeout
captureTimeoutReason = "PacketCapture timeout"
defaultTimeoutDuration = time.Second * time.Duration(crdv1alpha1.DefaultPacketCaptureTimeout)
timeoutCheckInterval = 10 * time.Second

captureStatusUpdatePeriod = 10 * time.Second

Expand Down Expand Up @@ -433,6 +432,9 @@ func (c *Controller) performCapture(captureState *packetCaptureState, device str
return err
}
afpacketHandle, err := newAfpacketHandle(device, szFrame, szBlock, numBlocks, false, timeout)
if err != nil {
return err
}
err = afpacketHandle.setBPFFilter(filter, snapshotLen)
if err != nil {
return err
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
// Copyright 2024 Antrea Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package packetcapture

import (
Expand Down

0 comments on commit 42d2d33

Please sign in to comment.