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 windows packet capture #943

Merged
merged 1 commit into from
Jun 10, 2021
Merged

Fix windows packet capture #943

merged 1 commit into from
Jun 10, 2021

Conversation

buger
Copy link
Owner

@buger buger commented Jun 10, 2021

Issues is that Go built-in net.Interfaces function in newer Windows versions return wrong interface names, which libpcap can't consume.
Now we use pcap.FindDevices instead of net.Interfaces.
See this Article for deep understanding of the issue https://haydz.github.io/2020/07/06/Go-Windows-NIC.html

Additionally, found a bug causing big memory allocations, for large requests, when we perform check if messages finished or not. Because of this bug chunked body encoding check was not working properly.
Was not caught in tests, because test was working on packet array level, and this issue happens when dealing with TCP message object.

Also a small fix which helps map "localhost" host name to the loopback interface. Previously if you set smth like: --input-raw localhost:80 if will continue using all interfaces, now it will do capture only for singe interface.

Added a small fix for windows Makefile task, it now generates proper file name.

Issues is that Go built-in net.Interfaces function in newer Windows versions return wrong interface names, which libpcap can't consume.
Now we use pcap.FindDevices instead of net.Interfaces.
See this Article for deep understanding of the issue https://haydz.github.io/2020/07/06/Go-Windows-NIC.html

Additionally found a bug causing big memory allocations, for large requests, when we perform check if messages finished or not.
Because of this bug chunked body encoding check was not working properly.
Was not catched in tests, because test was working on packet array level, and this issue happens when deailng with TCP messag object.

Additionally added a small fix for windows Makefile task, it now generate proper file name.
@@ -19,6 +19,7 @@ package proto
import (
"bufio"
"bytes"
_ "fmt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

a blank import should be only in a main or test package, or have a comment justifying it

@@ -3,6 +3,7 @@ package tcp
import (
"encoding/binary"
"encoding/hex"
_ "fmt"
Copy link
Collaborator

Choose a reason for hiding this comment

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

a blank import should be only in a main or test package, or have a comment justifying it

@buger buger merged commit 58ff886 into master Jun 10, 2021
@buger buger deleted the fix/windows-capture branch June 10, 2021 11:46
xingren23 referenced this pull request in xingren23/goreplay Sep 4, 2021
Issues is that Go built-in net.Interfaces function in newer Windows versions return wrong interface names, which libpcap can't consume.
Now we use pcap.FindDevices instead of net.Interfaces.
See this Article for deep understanding of the issue https://haydz.github.io/2020/07/06/Go-Windows-NIC.html

Additionally, found a bug causing big memory allocations, for large requests, when we perform check if messages finished or not.
Because of this bug chunked body encoding check was not working properly.
Was not caught in tests, because test was working on packet array level, and this issue happens when dealing with TCP message object.

Additionally, added a small fix for windows Makefile task, it now generates proper file name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants