Skip to content

Commit

Permalink
fix: dhcpv6 leasetime segfault loop
Browse files Browse the repository at this point in the history
We are trying to get an IP-address lifetime, but we do not have it yet.

Signed-off-by: Serge Logvinov <[email protected]>
Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
sergelogvinov authored and smira committed May 12, 2022
1 parent afb6795 commit 91a49c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions internal/app/machined/pkg/controllers/network/operator/dhcp6.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (d *DHCP6) TimeServerSpecs() []network.TimeServerSpecSpec {
return d.timeservers
}

func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
func (d *DHCP6) parseReply(reply *dhcpv6.Message) (leaseTime time.Duration) {
d.mu.Lock()
defer d.mu.Unlock()

Expand All @@ -165,6 +165,8 @@ func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
ConfigLayer: network.ConfigOperator,
},
}

leaseTime = reply.Options.OneIANA().Options.OneAddress().ValidLifetime
} else {
d.addresses = nil
}
Expand Down Expand Up @@ -215,6 +217,8 @@ func (d *DHCP6) parseReply(reply *dhcpv6.Message) {
} else {
d.timeservers = nil
}

return leaseTime
}

func (d *DHCP6) renew(ctx context.Context) (time.Duration, error) {
Expand Down Expand Up @@ -243,9 +247,7 @@ func (d *DHCP6) renew(ctx context.Context) (time.Duration, error) {

d.logger.Debug("DHCP6 REPLY", zap.String("link", d.linkName), zap.String("dhcp", collapseSummary(reply.Summary())))

d.parseReply(reply)

return reply.Options.OneIANA().Options.OneAddress().ValidLifetime, nil
return d.parseReply(reply), nil
}

func (d *DHCP6) waitIPv6LinkReady(ctx context.Context, iface *net.Interface) error {
Expand Down

0 comments on commit 91a49c4

Please sign in to comment.