error bridge veth
All checks were successful
Build and Deploy MITM Webserver / build (push) Successful in 9s

This commit is contained in:
2026-03-07 15:41:08 +01:00
parent 264da68f11
commit 5aac5974f5
2 changed files with 33 additions and 6 deletions

View File

@@ -36,8 +36,13 @@ if [[ -z "$BRIDGE" ]]; then
exit 1
fi
if ! command -v tc >/dev/null 2>&1 || ! command -v clang >/dev/null 2>&1; then
echo "Missing required tools: tc and clang must be installed." >&2
if ! command -v tc >/dev/null 2>&1 || ! command -v clang >/dev/null 2>&1 || ! command -v ip >/dev/null 2>&1 || ! command -v bridge >/dev/null 2>&1; then
echo "Missing required tools: tc, clang, ip, and bridge must be installed." >&2
exit 1
fi
if ! ip link show "$BRIDGE" >/dev/null 2>&1; then
echo "Bridge interface not found: $BRIDGE" >&2
exit 1
fi
@@ -46,9 +51,16 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SRC_DIR="$SCRIPT_DIR/ebpf"
MARK_OBJ="$BUILD_DIR/mark_packet_id.o"
CAPTURE_OBJ="$BUILD_DIR/prepend_capture_header.o"
MULTIARCH_INCLUDE=""
if command -v gcc >/dev/null 2>&1; then
GCC_TRIPLE="$(gcc -dumpmachine 2>/dev/null || true)"
if [[ -n "$GCC_TRIPLE" && -d "/usr/include/$GCC_TRIPLE" ]]; then
MULTIARCH_INCLUDE="-I/usr/include/$GCC_TRIPLE"
fi
fi
clang -O2 -g -target bpf -c "$SRC_DIR/mark_packet_id.c" -o "$MARK_OBJ"
clang -O2 -g -target bpf -c "$SRC_DIR/prepend_capture_header.c" -o "$CAPTURE_OBJ"
clang -O2 -g -target bpf ${MULTIARCH_INCLUDE:+$MULTIARCH_INCLUDE} -c "$SRC_DIR/mark_packet_id.c" -o "$MARK_OBJ"
clang -O2 -g -target bpf ${MULTIARCH_INCLUDE:+$MULTIARCH_INCLUDE} -c "$SRC_DIR/prepend_capture_header.c" -o "$CAPTURE_OBJ"
if ! ip link show "$MIRROR_IF" >/dev/null 2>&1; then
ip link add "$MIRROR_IF" type veth peer name "$CAPTURE_IF"