
The dhcp server is systemd-networkd, and the dhcp plugin can request an ip but can not renew it. The systemd-networkd just ignore the renew request. ``` 2024/09/14 21:46:00 no DHCP packet received within 10s 2024/09/14 21:46:00 retrying in 31.529038 seconds 2024/09/14 21:46:42 no DHCP packet received within 10s 2024/09/14 21:46:42 retrying in 63.150490 seconds 2024/09/14 21:47:45 98184616c91f15419f5cacd012697f85afaa2daeb5d3233e28b0ec21589fb45a/iot/eth1: no more tries 2024/09/14 21:47:45 98184616c91f15419f5cacd012697f85afaa2daeb5d3233e28b0ec21589fb45a/iot/eth1: renewal time expired, rebinding 2024/09/14 21:47:45 Link "eth1" down. Attempting to set up 2024/09/14 21:47:45 98184616c91f15419f5cacd012697f85afaa2daeb5d3233e28b0ec21589fb45a/iot/eth1: lease rebound, expiration is 2024-09-14 22:47:45.309270751 +0800 CST m=+11730.048516519 ``` Follow the https://datatracker.ietf.org/doc/html/rfc2131#section-4.3.6, following options must not be sent in renew - Requested IP Address - Server Identifier Since the upstream code has been inactive for 6 years, we should switch to another dhcpv4 library. The new selected one is https://github.com/insomniacslk/dhcp. Signed-off-by: Songmin Li <lisongmin@protonmail.com>
112 lines
3.0 KiB
YAML
112 lines
3.0 KiB
YAML
---
|
|
name: test
|
|
|
|
on:
|
|
pull_request: {}
|
|
|
|
env:
|
|
LINUX_ARCHES: "amd64 386 arm arm64 s390x mips64le ppc64le riscv64"
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- uses: ibiqlik/action-yamllint@v3
|
|
with:
|
|
format: auto
|
|
- uses: golangci/golangci-lint-action@v6
|
|
with:
|
|
version: v1.61.0
|
|
args: -v
|
|
verify-vendor:
|
|
name: Verify vendor directory
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Install Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: Check module vendoring
|
|
run: |
|
|
go mod tidy
|
|
go mod vendor
|
|
test -z "$(git status --porcelain)" || (echo "please run 'go mod tidy && go mod vendor', and submit your changes"; exit 1)
|
|
build:
|
|
name: Build all linux architectures
|
|
needs: lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: Build on all supported architectures
|
|
run: |
|
|
set -e
|
|
for arch in ${LINUX_ARCHES}; do
|
|
echo "Building for arch $arch"
|
|
GOARCH=$arch ./build_linux.sh
|
|
rm bin/*
|
|
done
|
|
test-linux:
|
|
name: Run tests on Linux amd64
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Install kernel module
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install linux-modules-extra-$(uname -r)
|
|
- name: Install nftables
|
|
run: sudo apt-get install nftables
|
|
- name: Install dnsmasq(dhcp server)
|
|
run: |
|
|
sudo apt-get install dnsmasq
|
|
sudo systemctl disable --now dnsmasq
|
|
- uses: actions/checkout@v4
|
|
- name: setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: Set up Go for root
|
|
run: |
|
|
sudo ln -sf `which go` `sudo which go` || true
|
|
sudo go version
|
|
|
|
- name: Install test binaries
|
|
run: |
|
|
go install github.com/containernetworking/cni/cnitool@latest
|
|
go install github.com/mattn/goveralls@latest
|
|
go install github.com/modocache/gover@latest
|
|
|
|
- name: test
|
|
run: PATH=$PATH:$(go env GOPATH)/bin COVERALLS=1 ./test_linux.sh
|
|
|
|
- name: Send coverage to coveralls
|
|
env:
|
|
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
PATH=$PATH:$(go env GOPATH)/bin
|
|
gover
|
|
goveralls -coverprofile=gover.coverprofile -service=github
|
|
test-win:
|
|
name: Build and run tests on Windows
|
|
needs: build
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: go.mod
|
|
- name: test
|
|
run: bash ./test_windows.sh
|