fix(ns-plug): inventory, better public IP retrival#1344
Merged
gsanchietti merged 1 commit intomainfrom Aug 22, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR improves the reliability of public IP address retrieval for the ns-plug inventory system. The change addresses issues where ifconfig.co sometimes returns HTML error pages instead of IP addresses, which could cause incorrect data to be sent to my.nethesis.it.
- Implements proper IP address validation using the
ipaddressmodule - Adds fallback mechanism using OpenDNS when ifconfig.co fails
- Returns empty string when neither method provides a valid IP address
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
The ifconfig.co site sometimes returns an HTML page and this info is wrongly sent to my.nethesis.it New behavior: - send an HTTP request to ifconfig.co and parse the response, if the remote server returns a valid IP address, return it - otherwise, try to obtain the same info by executing a DNS query to OpenDNS - return an empty string if none of the above responses are valid IP addresses
b1f6550 to
705dc9a
Compare
filippocarletti
approved these changes
Aug 19, 2025
Tbaile
approved these changes
Aug 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The ifconfig.co site sometimes returns an HTML page and this info is wrongly sent to my.nethesis.it
New behavior: