Improve GetBestInterface error logging with troubleshooting steps (Fixes #138) #217
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.
Description
This PR addresses Issue #138 by improving the error handling logic within fakenet/diverters/windows.py.
Previously, when GetBestInterface failed (common in isolated VM environments), the tool would simply log "Failed calling GetBestInterface" and exit, leaving the user without clear direction.
Changes Proposed
Refactored get_best_interface to capture and log the specific Windows error code returned by
iphlpapi.Added comprehensive troubleshooting logs that guide the user to check for common configuration issues (e.g., missing network adapter, invalid IP, or disconnected Host-only/NAT interface).