feat: allow empty junk packets

This commit is contained in:
Mark Puha 2025-06-20 21:22:56 +02:00
parent 3c2aaf43b4
commit 5680162c72
3 changed files with 20 additions and 7 deletions

View file

@ -7,10 +7,24 @@ RUN go mod download && \
FROM alpine:3.19 FROM alpine:3.19
ARG AWGTOOLS_RELEASE="1.0.20241018" 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 && \ RUN apk --no-cache add iproute2 iptables bash && \
cd /usr/bin/ && \ cd /usr/bin/ && \
wget https://github.com/amnezia-vpn/amneziawg-tools/releases/download/v${AWGTOOLS_RELEASE}/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 && \ # unzip -j alpine-3.19-amneziawg-tools.zip && \
chmod +x /usr/bin/awg /usr/bin/awg-quick && \ chmod +x /usr/bin/awg /usr/bin/awg-quick && \
ln -s /usr/bin/awg /usr/bin/wg && \ ln -s /usr/bin/awg /usr/bin/wg && \
ln -s /usr/bin/awg-quick /usr/bin/wg-quick ln -s /usr/bin/awg-quick /usr/bin/wg-quick

View file

@ -50,9 +50,6 @@ func (handler *SpecialHandshakeHandler) GenerateSpecialJunk() [][]byte {
// TODO: create tests // TODO: create tests
if !handler.isFirstDone { if !handler.isFirstDone {
handler.isFirstDone = true handler.isFirstDone = true
handler.nextItime = time.Now().Add(handler.ITimeout)
return handler.SpecialJunk.GeneratePackets()
} else if !handler.isTimeToSendSpecial() { } else if !handler.isTimeToSendSpecial() {
return nil return nil
} }

View file

@ -378,7 +378,8 @@ func (device *Device) handleDeviceLine(key, value string, tempAwg *awg.Protocol)
tempAwg.ASecCfg.IsSet = true tempAwg.ASecCfg.IsSet = true
case "i1", "i2", "i3", "i4", "i5": case "i1", "i2", "i3", "i4", "i5":
if len(value) == 0 { 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) generators, err := awg.Parse(key, value)
@ -390,7 +391,8 @@ func (device *Device) handleDeviceLine(key, value string, tempAwg *awg.Protocol)
tempAwg.HandshakeHandler.IsSet = true tempAwg.HandshakeHandler.IsSet = true
case "j1", "j2", "j3": case "j1", "j2", "j3":
if len(value) == 0 { 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) generators, err := awg.Parse(key, value)