diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-04 00:35:07 +0100 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2023-03-30 23:17:27 +0200 |
commit | d51c82900c5375e0ad956107676555756596b4dc (patch) | |
tree | cd21ed96518f41e248328622675ca3e8ce83d4e4 /tunnel/tools/libwg-go | |
parent | 50877f0938222e9711f3e212d33ecc51afeccee9 (diff) |
WIP: dhcp temporary NA using DUIDLLT
Diffstat (limited to 'tunnel/tools/libwg-go')
-rw-r--r-- | tunnel/tools/libwg-go/dhcp.go | 5 |
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} |