fix(dhcp): can not renew an ip address

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>
This commit is contained in:
Songmin Li
2024-09-14 22:00:20 +08:00
committed by Casey Callendrello
parent e4950728ce
commit d61e7e5e1f
310 changed files with 12785 additions and 11182 deletions

46
vendor/modules.txt vendored
View File

@@ -69,19 +69,6 @@ github.com/coreos/go-iptables/iptables
# github.com/coreos/go-systemd/v22 v22.5.0
## explicit; go 1.12
github.com/coreos/go-systemd/v22/activation
# github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c
## explicit
github.com/d2g/dhcp4
# github.com/d2g/dhcp4client v1.0.0
## explicit
github.com/d2g/dhcp4client
# github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5
## explicit
github.com/d2g/dhcp4server
github.com/d2g/dhcp4server/leasepool
github.com/d2g/dhcp4server/leasepool/memorypool
# github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4
## explicit
# github.com/go-logr/logr v1.4.2
## explicit; go 1.18
github.com/go-logr/logr
@@ -105,9 +92,25 @@ github.com/google/go-cmp/cmp/internal/value
# github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5
## explicit; go 1.22
github.com/google/pprof/profile
# github.com/insomniacslk/dhcp v0.0.0-20240829085014-a3a4c1f04475
## explicit; go 1.20
github.com/insomniacslk/dhcp/dhcpv4
github.com/insomniacslk/dhcp/dhcpv4/nclient4
github.com/insomniacslk/dhcp/iana
github.com/insomniacslk/dhcp/interfaces
github.com/insomniacslk/dhcp/rfc1035label
# github.com/josharian/native v1.1.0
## explicit; go 1.13
github.com/josharian/native
# github.com/mattn/go-shellwords v1.0.12
## explicit; go 1.13
github.com/mattn/go-shellwords
# github.com/mdlayher/packet v1.1.2
## explicit; go 1.20
github.com/mdlayher/packet
# github.com/mdlayher/socket v0.5.1
## explicit; go 1.20
github.com/mdlayher/socket
# github.com/networkplumbing/go-nft v0.4.0
## explicit; go 1.16
github.com/networkplumbing/go-nft/nft
@@ -154,6 +157,13 @@ github.com/onsi/gomega/types
## explicit; go 1.19
github.com/opencontainers/selinux/go-selinux
github.com/opencontainers/selinux/pkg/pwalkdir
# github.com/pierrec/lz4/v4 v4.1.21
## explicit; go 1.14
github.com/pierrec/lz4/v4
github.com/pierrec/lz4/v4/internal/lz4block
github.com/pierrec/lz4/v4/internal/lz4errors
github.com/pierrec/lz4/v4/internal/lz4stream
github.com/pierrec/lz4/v4/internal/xxh32
# github.com/pkg/errors v0.9.1
## explicit
github.com/pkg/errors
@@ -163,6 +173,10 @@ github.com/safchain/ethtool
# github.com/sirupsen/logrus v1.9.3
## explicit; go 1.13
github.com/sirupsen/logrus
# github.com/u-root/uio v0.0.0-20240224005618-d2acac8f3701
## explicit; go 1.21
github.com/u-root/uio/rand
github.com/u-root/uio/uio
# github.com/vishvananda/netlink v1.3.0
## explicit; go 1.12
github.com/vishvananda/netlink
@@ -184,9 +198,9 @@ golang.org/x/net/context
golang.org/x/net/html
golang.org/x/net/html/atom
golang.org/x/net/html/charset
golang.org/x/net/internal/iana
golang.org/x/net/internal/socket
golang.org/x/net/ipv4
# golang.org/x/sync v0.8.0
## explicit; go 1.18
golang.org/x/sync/errgroup
# golang.org/x/sys v0.26.0
## explicit; go 1.18
golang.org/x/sys/unix