-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix crash in pillar if NTP FQDN is an empty string #4536
base: master
Are you sure you want to change the base?
Conversation
Under some conditions e.g. when set from Monitor TUI NTP FQDN can be an empty string which causes a crash pillar;panic: runtime error: index out of range -1] pillar;goroutine 170248 [running]: pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithSrcIP({0x0, 0x0}, {0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:79 +0x4d4 pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveCacheWrap.func1({0x0, 0x0}, {0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:122 +0x1ca pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithPortsLambda.func1({0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:198 +0x17b pillar;created by github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithPortsLambda pillar; /pillar/devicenetwork/dns.go:182 +0x98a Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
d1cdbd7
to
f741145
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing offline, @michel-zededa decided to add filtering out empty servers in the sanitize function:
Line 333 in f2651ce
func (config *DevicePortConfig) DoSanitize(log *base.LogObject, args DPCSanitizeArgs) { |
@OhmSpectator , I think you mean @rucoder 😉 |
Why so complicated? The next one who is using
|
@christoph-zededa, the point was to filter out these broken entries as soon as possible and never face them again. My understanding was that this function ( |
if len(strings.TrimSpace(ntpServer)) == 0 { | ||
continue | ||
} | ||
|
||
ip := net.ParseIP(ntpServer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you use TrimSpace about, don't you want to use the trimmed string here as well?
I see. |
@rucoder are we abandoning the PR? |
@OhmSpectator no 😀 |
okaaay |
Under some conditions e.g. when set from Monitor TUI NTP FQDN can be an empty string which causes a crash
pillar;panic: runtime error: index out of range -1]
pillar;goroutine 170248 [running]:
pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithSrcIP({0x0, 0x0}, {0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:79 +0x4d4
pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveCacheWrap.func1({0x0, 0x0}, {0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:122 +0x1ca
pillar;github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithPortsLambda.func1({0xc002631950, 0x10, 0x10}, {0xc002631960, 0x10, 0x10}) pillar; /pillar/devicenetwork/dns.go:198 +0x17b
pillar;created by github.com/lf-edge/eve/pkg/pillar/devicenetwork.ResolveWithPortsLambda pillar; /pillar/devicenetwork/dns.go:182 +0x98a