From 5680162c72b383f3268a2a5d15b376eea1dc8cbf Mon Sep 17 00:00:00 2001 From: Mark Puha Date: Fri, 20 Jun 2025 21:22:56 +0200 Subject: [PATCH] feat: allow empty junk packets --- Dockerfile | 18 ++++++++++++++++-- device/awg/special_handshake_handler.go | 3 --- device/uapi.go | 6 ++++-- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4999eb..6d60440 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,10 +7,24 @@ RUN go mod download && \ FROM alpine:3.19 ARG AWGTOOLS_RELEASE="1.0.20241018" + +RUN apk add linux-headers build-base +COPY awg-tools /awg-tools +RUN pwd && ls -la / && ls -la /awg-tools +WORKDIR /awg-tools/src +# RUN ls -la && pwd && ls awg-tools +RUN make +RUN mkdir -p build && \ + cp wg ./build/awg && \ + cp wg-quick/linux.bash ./build/awg-quick + +RUN cp build/awg /usr/bin/awg +RUN cp build/awg-quick /usr/bin/awg-quick + RUN apk --no-cache add iproute2 iptables bash && \ cd /usr/bin/ && \ - wget https://github.com/amnezia-vpn/amneziawg-tools/releases/download/v${AWGTOOLS_RELEASE}/alpine-3.19-amneziawg-tools.zip && \ - unzip -j alpine-3.19-amneziawg-tools.zip && \ + # wget https://github.com/amnezia-vpn/amneziawg-tools/releases/download/v${AWGTOOLS_RELEASE}/alpine-3.19-amneziawg-tools.zip && \ + # unzip -j alpine-3.19-amneziawg-tools.zip && \ chmod +x /usr/bin/awg /usr/bin/awg-quick && \ ln -s /usr/bin/awg /usr/bin/wg && \ ln -s /usr/bin/awg-quick /usr/bin/wg-quick diff --git a/device/awg/special_handshake_handler.go b/device/awg/special_handshake_handler.go index 40b575d..e582d97 100644 --- a/device/awg/special_handshake_handler.go +++ b/device/awg/special_handshake_handler.go @@ -50,9 +50,6 @@ func (handler *SpecialHandshakeHandler) GenerateSpecialJunk() [][]byte { // TODO: create tests if !handler.isFirstDone { handler.isFirstDone = true - handler.nextItime = time.Now().Add(handler.ITimeout) - - return handler.SpecialJunk.GeneratePackets() } else if !handler.isTimeToSendSpecial() { return nil } diff --git a/device/uapi.go b/device/uapi.go index 42f6777..9f2718d 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -378,7 +378,8 @@ func (device *Device) handleDeviceLine(key, value string, tempAwg *awg.Protocol) tempAwg.ASecCfg.IsSet = true case "i1", "i2", "i3", "i4", "i5": if len(value) == 0 { - return ipcErrorf(ipc.IpcErrorInvalid, "%s should be non null", key) + device.log.Verbosef("UAPI: received empty %s", key) + return nil } generators, err := awg.Parse(key, value) @@ -390,7 +391,8 @@ func (device *Device) handleDeviceLine(key, value string, tempAwg *awg.Protocol) tempAwg.HandshakeHandler.IsSet = true case "j1", "j2", "j3": if len(value) == 0 { - return ipcErrorf(ipc.IpcErrorInvalid, "%s should be non null", key) + device.log.Verbosef("UAPI: received empty %s", key) + return nil } generators, err := awg.Parse(key, value)