From 52d214404d7c4699a5ddcbf19fc0a54c90e18acb Mon Sep 17 00:00:00 2001 From: GnomeZworc Date: Mon, 24 Aug 2026 21:18:52 +0200 Subject: [PATCH] f-43: dhcp: fix default route create for nothing #43 Signed-off-by: GnomeZworc --- internal/dhcp/generate.go | 2 ++ internal/dhcp/struct.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/dhcp/generate.go b/internal/dhcp/generate.go index 2b6c72f..40250f6 100644 --- a/internal/dhcp/generate.go +++ b/internal/dhcp/generate.go @@ -19,6 +19,8 @@ func GenerateConfig(c Config) (string, map[string]string, error) { } if c.DefaultGateway != nil { fmt.Fprintf(&sb, "dhcp-option=3,%s\n", c.DefaultGateway.String()) + } else { + fmt.Fprintf(&sb, "dhcp-option=3\n") } fmt.Fprintf(&sb, "dhcp-option=6,1.1.1.1,8.8.8.8\n\n") diff --git a/internal/dhcp/struct.go b/internal/dhcp/struct.go index bf6ace9..bacb1e0 100644 --- a/internal/dhcp/struct.go +++ b/internal/dhcp/struct.go @@ -10,7 +10,7 @@ type Config struct { Network *net.IPNet VPCGateway net.IP // next-hop for VPCRoute (option 121) VPCRoute *net.IPNet // if non-nil, emit dhcp-option=121,VPCRoute,VPCGateway - DefaultGateway net.IP // if non-nil, emit dhcp-option=3,DefaultGateway + DefaultGateway net.IP // if non-nil, emit dhcp-option=3,DefaultGateway; if nil, emit a bare dhcp-option=3 to suppress the dnsmasq default Name string ConfDir string }