From 046cb992f265cbb2ae4a26ca5aa028dcc1a3cfaf Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Sat, 4 Mar 2023 00:35:07 +0100 Subject: WIP: dhcp temporary NA using DUIDLLT --- tunnel/tools/libwg-go/dhcp.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tunnel') 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} -- cgit v1.2.3