Skip to content

Commit

Permalink
fix: avoid panic in DHCPv6 operator on nil dereference
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
smira committed Apr 5, 2022
1 parent 9e3d438 commit 18d0038
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
d.mu.Lock()
defer d.mu.Unlock()

if reply.Options.OneIANA() != nil {
if reply.Options.OneIANA() != nil && reply.Options.OneIANA().Options.OneAddress() != nil {
addr, _ := netaddr.FromStdIPNet(&net.IPNet{
IP: reply.Options.OneIANA().Options.OneAddress().IPv6Addr,
Mask: net.CIDRMask(128, 128),
Expand Down

0 comments on commit 18d0038

Please sign in to comment.