m/n/c/n/dhcp4c: support route configuration (including RFC 3442)
This implements support for configuring routes other than the default
route via our DHCP client. It extends the DHCP lease interface with a
method to return canonicalized routes from a lease containing Router,
StaticRoute or ClasslessStaticRouting options.
It also extends and renames the former ManageDefaultRoutes callback into
ManageRoutes and makes it use the new canonicalized routing data instead
of just the default router.
Change-Id: Ie6ec20d67c0e9cdfa6be088324b42e0d811e81e9
Reviewed-on: https://review.monogon.dev/c/monogon/+/482
Reviewed-by: Sergiusz Bazanski <serge@monogon.tech>
diff --git a/metropolis/test/nanoswitch/nanoswitch.go b/metropolis/test/nanoswitch/nanoswitch.go
index e44fc80..6d0b6bb 100644
--- a/metropolis/test/nanoswitch/nanoswitch.go
+++ b/metropolis/test/nanoswitch/nanoswitch.go
@@ -299,7 +299,7 @@
logger.Fatalf("Failed to create DHCP client: %v", err)
}
dhcpClient.RequestedOptions = []dhcpv4.OptionCode{dhcpv4.OptionRouter}
- dhcpClient.LeaseCallback = dhcpcb.Compose(dhcpcb.ManageIP(externalLink), dhcpcb.ManageDefaultRoute(externalLink))
+ dhcpClient.LeaseCallback = dhcpcb.Compose(dhcpcb.ManageIP(externalLink), dhcpcb.ManageRoutes(externalLink))
supervisor.Run(ctx, "dhcp-client", dhcpClient.Run)
if err := os.WriteFile("/proc/sys/net/ipv4/ip_forward", []byte("1\n"), 0644); err != nil {
logger.Fatalf("Failed to write ip forwards: %v", err)