Fix VPN Issues, ARP Interface Bug and IPv6 Trouble#22
Merged
Conversation
commit 77650d562033cb0978d4417fcb2eeb0508045ce7
Author: williamhedenskog <94441813+pilsnerfrajz@users.noreply.github.com>
Date: Sun Sep 7 23:52:57 2025 +0200
Use old code but iterate if array
commit 83660fe6b20a13919762be3ca409564a7f03ae70
Author: williamhedenskog <94441813+pilsnerfrajz@users.noreply.github.com>
Date: Sun Sep 7 23:48:14 2025 +0200
Create struct to save info about each interface
commit 77650d562033cb0978d4417fcb2eeb0508045ce7
Author: williamhedenskog <94441813+pilsnerfrajz@users.noreply.github.com>
Date: Sun Sep 7 23:52:57 2025 +0200
Use old code but iterate if array
commit 83660fe6b20a13919762be3ca409564a7f03ae70
Author: williamhedenskog <94441813+pilsnerfrajz@users.noreply.github.com>
Date: Sun Sep 7 23:48:14 2025 +0200
Create struct to save info about each interface
…nto vpn-routing
Change pcap filter to be more specific to the address families. Update IPv6 pseudo header to use new struct. Use memcpy in case of any errors in assigning values. Make Linux kernel add IPv6 header when sending TCP packets, instead of manually crafting that as well.
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.
Fix VPN Issues, ARP Interface Bug and IPv6 Trouble
When troubleshooting the VPN problems, multiple issues were found and fixed. This PR
Closes #14, closes #15.
VPN
It seems that VPN routing was never really an issue, but instead the processing of the packets. The encapsulation of VPN packets was not accounted for properly during packet parsing, but this now works correctly on both macOS and Linux. This also fixed an issue where null bytes are skipped, which was not necessary on Linux.
When using VPN, there are some issues in detecting SYN-ACKs. The current fix is to detect the ACK-response from the target, following the RST packet from the scanner if a port is open. There should not be any ACKs if the port is closed.
IPv6 was not enabled in my VPN settings which contributed to the difficulties in troubleshooting the problems.
File Changes
src/syn_scan.cIPv6 Pseudo Header
IPv6 was not enabled in my VPN settings which made routing to external hosts impossible. There was also an issue in the structure of the IPv6 pseudo header, leading to incorrect checksum calculations. A field was removed and the
nextfield was changed from 1 to 4 bytes. The checksum issues would cause targets to drop packets and even screw up routing.File Changes
src/ping.chtonl()to pack bits correctly.include/headers.hu_int8_ttou_int32_tIPv6 Port Scan and Testing
The above changes, fixed the issues with IPv6 port scanning on external hosts. Now a test is added to check for open ports on the IPv6 version of scanme.nmap.org. This IP was also added to the ICMPv6 test, as the previous IP had changed, failing the test.
File Changes
tests/syn_scan_test.candtests/ping_test.cARP Interfaces
When investigating the VPN issues, errors in ARP requests were detected on Linux. Depending on the order the interfaces were parsed, the previous code sometimes did not find any interface to send ARP frames on. The new code parses all available interfaces and then selects a suitable one if available.
File Changes
src/arp.cTesting
Ensure IPv6 is enabled in VPN settings.
make testnow passes every test assuming the targets are up.