Fix nanoswitch not setting DHCP lease time
The original implementation of this used an accessor (due to
confusing naming on dhcpv4's part) and passed the value to be set the
default value. Found when testing with the new DHCP client which
correctly rejected these leases as invalid.
Test Plan: Works with the new DHCP client and in E2E
X-Origin-Diff: phab/D654
GitOrigin-RevId: 841b161a02809d3c43768ff7a529905f90290f2c
diff --git a/core/cmd/nanoswitch/nanoswitch.go b/core/cmd/nanoswitch/nanoswitch.go
index 7f17b1e..edf69bc 100644
--- a/core/cmd/nanoswitch/nanoswitch.go
+++ b/core/cmd/nanoswitch/nanoswitch.go
@@ -52,7 +52,7 @@
reply.GatewayIPAddr = switchIP
reply.UpdateOption(dhcpv4.OptDNS(net.IPv4(10, 42, 0, 3))) // SLIRP fake DNS server
reply.UpdateOption(dhcpv4.OptRouter(switchIP))
- reply.IPAddressLeaseTime(12 * time.Hour)
+ reply.UpdateOption(dhcpv4.OptIPAddressLeaseTime(12 * time.Hour))
reply.UpdateOption(dhcpv4.OptSubnetMask(switchSubnetMask))
}