Questions tagged [gopacket]
46 questions
2
votes
0 answers
gopacket layers TCP struct ACK vs Ack
I am trying to construct TCP packets using the golang libraries gopacket and layers. In layers there is a struct aptly called TCP. There are two ACK fields and I am unsure why there is such a distinction. One is a bool and one is a uint16. What is…

rpb
- 87
- 1
- 8
1
vote
0 answers
How to get syn and syn+ack time use gopacket within connection?
I want to obtain the latency between syn and syn+ack for a connection.
Example:
syn and syn+ack latency
syn+ack and ack latency
http get and http resp latency
client sniffer server
syn ------------------->
<---------------------syn+ack
…

world hello
- 11
- 2
1
vote
1 answer
gopacket: DecodeLayers on an IP-in-IP Packet
If I have data I'm putting through a DecodingLayerParser and some of that data could have IP Protocol 4 (IP-in-IP) packets included, how would I get it to capture BOTH IPv4 headers in the packet? I can only seem to get it to capture one of…

markzz
- 1,185
- 11
- 23
1
vote
1 answer
Encapsulating all traffic with a GRE header
Summary
I am attempting to GRE encapsulate all traffic from server1 to server2 and I am testing this by pinging the IP address 10.1.1.1 on server2. I have also set up tcpdump on server2 to verify that the traffic is indeed being…

amb1s1
- 1,995
- 5
- 22
- 26
1
vote
1 answer
Unbale to capturing packets with high-precision time stamp with go packet
I am trying to capture the live packets from available interface. My code is developed in go lang and for capturing purpose, I am using google's go packet library.
I am able to capture packets but I am unable to get precise timestamp.
If I run the…

Ashish
- 39
- 1
1
vote
1 answer
fatal error: pcap.h: No such file or directory remote: 34 | #include
I'm getting this issue and the most common solution (sudo apt-get install libpcap-dev) isn't working for me.
I'm on a mac and when I try to install it using Homebrew it gives me:
"Warning: No available formula with the name "libpcap-dev". Did you…

Orhan Tasci
- 13
- 5
1
vote
1 answer
Go DNS trouble with TCP transport fine with UDP
I've tried everything I can think of and I'm hitting a brick wall. I wonder if anyone is able to point me in the right direction or possibly spot the issue?
I'm having a go at writing my own DNS server for a couple of reasons, the main a learning…

X01
- 35
- 5
1
vote
0 answers
Parse GMS Packet with GoPacket
I tried this code (below) for sniffing GSM packet with rtl-sdr device:
import rtl "github.com/jpoirier/gortlsdr"
var buffer = make([]uint8, rtl.DefaultBufLength)
for{
rtl.ReadSync(buffer, rtl.DefaultBufLength)
…

Towhid Zeinali
- 197
- 2
- 9
1
vote
1 answer
Multiple go routines read pcap files cannot improve performance?
I need to read about 600 pcap files, each file is about 100MB.
I use gopacket to load pcap file, and check it.
Case1: uses 1 routine to check.
Case2: uses 40 routines to check.
And I found that the time consumed by case1 and case2 are…

Jacky
- 73
- 1
- 7
1
vote
0 answers
Use gopacket to measure TCP/UDP bandwidth
I'm supposed to use gopacket to run some network tests like measure the bandwidth of a TCP/UDP connection. I'm aware of the fact that the lib allows the capture, injection and analysis of packets, but I can't think of a proper way to measure the…

med.b
- 465
- 2
- 12
- 21
1
vote
1 answer
No blocking Eternet capture
I use this code to capture Ehternet packet:
var snapshotLen int32 = 102400
var promiscuous bool = true
var timeout time.Duration = 1 * time.Second
var handle *pcap.Handle
handle, err = pcap.OpenLive(device, snapshotLen, promiscuous, timeout)
err =…

ipStack
- 381
- 1
- 12
1
vote
1 answer
How to properly write a custom Layer when NextDecoder depends on the previous layer, not the current one?
I am writing custom layer decoders with gopacket.
LayerA contains a field Type that can be one of the following values:
B-only, the next layer is LayerB, followed by a raw payload
C-only, the next layer is LayerC, followed by a raw payload
B-C, the…

anonom
- 125
- 11
1
vote
1 answer
gopacket ubuntu16.04 error undefined: pcapErrorNotActivated
root@ubuntu:~/processNet/processNet# go run testversion.go
github.com/google/gopacket/pcap
/home/go/src/github.com/google/gopacket/pcap/pcap.go:30:22: undefined: pcapErrorNotActivated
/home/go/src/github.com/google/gopacket/pcap/pcap.go:52:17:…

somnus
- 11
- 3
1
vote
0 answers
Runtime error when I use goroutines to capture packets from multiple interfaces device using "github.com/google/gopacket/pcap"
I want to capture packets on 4 interfaces devices eth0, eth1, eth2, and eth3 by using "github.com/google/gopacket/pcap" . The machine I am using have large number of traffic. Lets say it is in lacks per minute. I used goroutines to capture packets…

Pooja
- 11
- 5
1
vote
1 answer
Adding custom layer to packet from capture fails
I am trying to implement my own decoding layer ontop of TCP, so far it only works when I create a packet without any Eth/IP/TCP header and set its layer to my custom layer manually. The data of the custom protocol is inside an ordinary TCP…

user669
- 31
- 5