summaryrefslogtreecommitdiffhomepage
path: root/tunnel/tools
diff options
context:
space:
mode:
authorMikael Magnusson <mikma@users.sourceforge.net>2023-03-07 20:18:07 +0100
committerMikael Magnusson <mikma@users.sourceforge.net>2023-07-05 21:41:01 +0200
commit56825456261abc1c321ee1aa68e5e9389487edf3 (patch)
tree35e07d7db15378745794787ffe669e69abf5a2c4 /tunnel/tools
parent1ff676630ddfc17633042769ec24d5abd30c93da (diff)
WIP: add valid and preferred lifetime to dhcp leases
Diffstat (limited to 'tunnel/tools')
-rw-r--r--tunnel/tools/libwg-go/dhcp.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/tunnel/tools/libwg-go/dhcp.go b/tunnel/tools/libwg-go/dhcp.go
index b7919151..4af5b0cb 100644
--- a/tunnel/tools/libwg-go/dhcp.go
+++ b/tunnel/tools/libwg-go/dhcp.go
@@ -12,6 +12,7 @@ import (
"github.com/insomniacslk/dhcp/iana"
gen "golang.zx2c4.com/wireguard/android/gen"
+ "google.golang.org/protobuf/types/known/durationpb"
)
const (
@@ -131,13 +132,13 @@ func getAddressesFromReply(reply *dhcpv6.Message) []*gen.Lease{
ianaOpts := iana.Options.Get(dhcpv6.OptionIAAddr)
for _, opt := range ianaOpts {
- addr :=opt.(*dhcpv6.OptIAAddress).IPv6Addr
+ addrOpt := opt.(*dhcpv6.OptIAAddress)
lease := &gen.Lease{
Address: &gen.InetAddress{
- Address: addr,
+ Address: addrOpt.IPv6Addr,
},
- // PreferredLifetime: ,
- // ValidLifetime: ,
+ PreferredLifetime: durationpb.New(addrOpt.PreferredLifetime),
+ ValidLifetime: durationpb.New(addrOpt.ValidLifetime),
}
leases = append(leases, lease)
}