Use interface with default route on Linux#733
Merged
phillip-stephens merged 2 commits intozmap:mainfrom Nov 30, 2023
Tim---:fix-default-gw
Merged
Use interface with default route on Linux#733phillip-stephens merged 2 commits intozmap:mainfrom Tim---:fix-default-gw
phillip-stephens merged 2 commits intozmap:mainfrom
Tim---:fix-default-gw
Conversation
phillip-stephens
requested changes
Nov 17, 2023
Contributor
There was a problem hiding this comment.
Overall, this looks good.
The one issue I see is that when I ran Valgrind against main without and with this code change, with had an extra 16 bytes still reachable.
We have over 4 MB of total memory still reachable according to Valgrind in main, so this is relatively a small issue (that this issue was raised to address), but we shouldn't introduce more still reachable memory, IMO.
Valgrind Comparison
Alex's PR - (tested his fix applied to main)
==13== LEAK SUMMARY:
==13== definitely lost: 8 bytes in 1 blocks
==13== indirectly lost: 0 bytes in 0 blocks
==13== possibly lost: 0 bytes in 0 blocks
==13== still reachable: 4,343,736 bytes in 304 blocks
==13== suppressed: 0 bytes in 0 blocks
Default main
==13== LEAK SUMMARY:
==13== definitely lost: 8 bytes in 1 blocks
==13== indirectly lost: 0 bytes in 0 blocks
==13== possibly lost: 0 bytes in 0 blocks
==13== still reachable: 4,343,720 bytes in 303 blocks
==13== suppressed: 0 bytes in 0 blocks
phillip-stephens
approved these changes
Nov 30, 2023
Contributor
phillip-stephens
left a comment
There was a problem hiding this comment.
LGTM, thanks @Tim--- for the contribution!
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.
It seems that patch bf5ed24 changed the way zmap finds the default interface.
It used to use
get_default_gwto find the interface with the default route. Now it usespcap_lookupdevwhich takes the first interface suitable for packet capture, but does not ensure that it has the default route.This patch reverts to the old behavior and is consistent with
get_gateway-bsd.h.