Skip to content
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(inputs.ping): Check addr length to avoid crash #15601

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

powersj
Copy link
Contributor

@powersj powersj commented Jul 8, 2024

Summary

This will check the length of the slice to avoid a crash and moves this set up to Gather and out of Init to allow continued operation.

Checklist

  • No AI generated code was used in this PR

Related issues

fixes: #15591

@telegraf-tiger telegraf-tiger bot added area/ping fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins labels Jul 8, 2024
@powersj powersj self-assigned this Jul 8, 2024
@powersj powersj marked this pull request as ready for review July 8, 2024 20:29
@powersj powersj added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Jul 8, 2024
@powersj powersj assigned srebhan and DStrand1 and unassigned powersj Jul 8, 2024
@DStrand1 DStrand1 changed the title fix(inputs.ping): Check addr lenght to avoid crash fix(inputs.ping): Check addr length to avoid crash Jul 9, 2024
@DStrand1 DStrand1 removed their assignment Jul 9, 2024
Copy link
Contributor

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@powersj is there a way to detect the case where the interface goes down? I'm asking because when given the name, the interface might have another IP when coming up next time...

Approving anyway in case you think this is a premature optimization...

@srebhan srebhan assigned powersj and unassigned srebhan Jul 10, 2024
@powersj
Copy link
Contributor Author

powersj commented Jul 10, 2024

I'm asking because when given the name, the interface might have another IP when coming up next time...

Ah good point - We would need to see if the error message had anything about the interface being down, otherwise probably not. I'm going to land as this was already an issue before since we were setting the address in init before, but if someone brings this up we can revisit.

@powersj powersj merged commit 3a05c38 into influxdata:master Jul 10, 2024
31 checks passed
@powersj powersj deleted the fix/15591 branch July 10, 2024 13:50
@github-actions github-actions bot added this to the v1.31.2 milestone Jul 10, 2024
powersj added a commit that referenced this pull request Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ping fix pr to fix corresponding bug plugin/input 1. Request for new input plugins 2. Issues/PRs that are related to input plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

inputs.ping plugin crashes telegraf when interface is down
3 participants