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-23 22:32:11 +0100 |
commit | a92e45e2d616c7d000afe96d857d6a63801d5c06 (patch) | |
tree | 513371961ea88a4177888ea62d8cc137f33b44fb | |
parent | cfcf3d9bb088a27b7490a205652ae95038923b9e (diff) |
WIP: dhcp temporary NA using DUIDLLT
-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} |