summaryrefslogtreecommitdiffhomepage
path: root/tunnel
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-04 00:35:07 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-03-27 00:36:40 +0200
commit046cb992f265cbb2ae4a26ca5aa028dcc1a3cfaf (patch)
tree06467b2a707304ac09c7f1ca66addc08a0fe946f /tunnel
parent10de11420810449c2d2073c2c6c2c605f92aa427 (diff)
WIP: dhcp temporary NA using DUIDLLT
Diffstat (limited to 'tunnel')
-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}