Skip to content

Commit aae68c9

Browse files
committed
fix: avoid panic in DHCPv6 operator on nil dereference
Log (lines for Talos v1): ``` [talos] operator panicked {"component": "controller-runtime", "controller": "network.OperatorSpecController", "stack": "github.com/talos-systems/talos/internal/app/machined/pkg/controllers/network.(*operatorRunState).runWithPanicHandler.func1\x5cn\x5ct/src/internal/app/machined/pkg/controllers/network/operator_spec.go:137\x5cnruntime.gopanic\x5cn\x5ct/toolchain/go/src/runtime/panic.go:1038\x5cnruntime.panicmem\x5cn\x5ct/toolchain/go/src/runtime/panic.go:221\x5cnruntime.sigpanic\x5cn\x5ct/toolchain/go/src/runtime/signal_unix.go:735\x5cngithub.com/talos-systems/talos/internal/app/machined/pkg/controllers/network/operator.(*DHCP6).parseReply\x5cn\x5ct/src/internal/app/machined/pkg/controllers/network/operator/dhcp6.go:145\x5cngithub.com/talos-systems/talos/internal/app/machined/pkg/controllers/network/operator.(*DHCP6).renew\x5cn\x5ct/src/internal/app/machined/pkg/controllers/network/operator/dhcp6.go:208\x5cngithub.com/talos-systems/talos/internal/app/machined/pkg/controllers/network/operator.(*DHCP6).Run\x5cn\x5ct/src ``` Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com> (cherry picked from commit 18d0038)
1 parent 36f60ea commit aae68c9

File tree

1 file changed

+1
-1
lines changed
  • internal/app/machined/pkg/controllers/network/operator

1 file changed

+1
-1
lines changed

internal/app/machined/pkg/controllers/network/operator/dhcp6.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
140140
d.mu.Lock()
141141
defer d.mu.Unlock()
142142

143-
if reply.Options.OneIANA() != nil {
143+
if reply.Options.OneIANA() != nil && reply.Options.OneIANA().Options.OneAddress() != nil {
144144
addr, _ := netaddr.FromStdIPNet(&net.IPNet{
145145
IP: reply.Options.OneIANA().Options.OneAddress().IPv6Addr,
146146
Mask: net.CIDRMask(128, 128),

0 commit comments

Comments
 (0)