summaryrefslogtreecommitdiffhomepage
path: root/tunnel/tools/libwg-go/dhcp.go
diff options
context:
space:
mode:
Diffstat (limited to 'tunnel/tools/libwg-go/dhcp.go')
-rw-r--r--tunnel/tools/libwg-go/dhcp.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/tunnel/tools/libwg-go/dhcp.go b/tunnel/tools/libwg-go/dhcp.go
index f6f25739..b7919151 100644
--- a/tunnel/tools/libwg-go/dhcp.go
+++ b/tunnel/tools/libwg-go/dhcp.go
@@ -4,6 +4,7 @@ import (
"context"
"net"
"net/netip"
+ "time"
"github.com/insomniacslk/dhcp/dhcpv4"
"github.com/insomniacslk/dhcp/dhcpv6"
@@ -36,8 +37,9 @@ func newClientIDOpt(duid dhcpv6.DUID) dhcpv4.Option {
}
func getDuid(hwAddr net.HardwareAddr) dhcpv6.DUID {
- duid := &dhcpv6.DUIDLL{
+ duid := &dhcpv6.DUIDLLT{
HWType: iana.HWTypeEthernet,
+ Time: uint32(time.Now().Unix()),
LinkLayerAddr: hwAddr,
}
@@ -91,6 +93,7 @@ func RunDhcp(ctx context.Context, laddr, raddr netip.Addr) ([]*gen.Lease, error)
d.linkAddr = net.ParseIP("fe80::101")
d.peerAddr = net.ParseIP("::1")
+ // TODO generate hostname and hwAddr from public key
hostName := "foobar"
d.fqdn = hostName + ".m7n.se"
d.hwAddr = []byte{41, 42, 43, 44, 45, 46}