fix: dhcpv6 leasetime segfault loop
We are trying to get an IP-address lifetime, but we do not have it yet. Signed-off-by: Serge Logvinov <serge.logvinov@sinextra.dev> Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
afb679586a
commit
91a49c4e7c
@ -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()
|
||||
|
||||
@ -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
|
||||
}
|
||||
@ -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) {
|
||||
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user