Coder Social home page Coder Social logo

gopacket's Introduction

Build Status Go Version Latest Version License Open Issues GoDoc

GoPacket

This library provides packet decoding capabilities for Go.

Forked from the popular gopacket repo by Google, this fork was created to ensure the project doesn't become stale and bugfixes, new protocols and performance improvements can be merged into it. submit your PRs here :)

See godoc for more details.

Minimum Go supported is 1.19

gopacket's People

Contributors

actaeon avatar adriantam avatar akrennmair avatar bensarifathi avatar bmeadors avatar darxriggs avatar david415 avatar dustin avatar elchavar avatar florianl avatar gconnell avatar gebn avatar hkwi avatar jcrussell avatar jdknezek avatar kanemathers avatar kaorimatz avatar lhausermann avatar lrsk avatar miekg avatar mosajjal avatar nl5887 avatar notti avatar ophum avatar palen avatar randstr avatar safchain avatar sentryo avatar tzneal avatar x-way avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

gopacket's Issues

use ReadPacketData(), handle not close

When I use the ReadPacketData () function in a loop, I cannot close

57 @ 0x40adeb 0x2248d4b 0x2246267 0x2245fd3 0x2245fce 0x2245c3c 0x224f3a8 0x474ca1
#	0x2248d4a	github.com/gopacket/gopacket/pcap._Cfunc_pcap_next_ex_escaping+0x4a					_cgo_gotypes.go:568
#	0x2246266	github.com/gopacket/gopacket/pcap.(*Handle).getNextBufPtrLocked.(*Handle).pcapNextPacketEx.func1+0x66	/root/go/pkg/mod/github.com/gopacket/[email protected]/pcap/pcap_unix.go:399
#	0x2245fd2	github.com/gopacket/gopacket/pcap.(*Handle).pcapNextPacketEx+0x72					/root/go/pkg/mod/github.com/gopacket/[email protected]/pcap/pcap_unix.go:399
#	0x2245fcd	github.com/gopacket/gopacket/pcap.(*Handle).getNextBufPtrLocked+0x6d					/root/go/pkg/mod/github.com/gopacket/[email protected]/pcap/pcap.go:312
#	0x2245c3b	github.com/gopacket/gopacket/pcap.(*Handle).ReadPacketData+0x7b						/root/go/pkg/mod/github.com/gopacket/[email protected]/pcap/pcap.go:252


57 @ 0x44188e 0x452e18 0x452def 0x470c45 0x4974bd 0x22464d2 0x22464b4 0x224f23f 0x474ca1
#	0x470c44	sync.runtime_SemacquireMutex+0x24						/usr/local/go/src/runtime/sema.go:77
#	0x4974bc	sync.(*Mutex).lockSlow+0x15c							/usr/local/go/src/sync/mutex.go:171
#	0x22464d1	sync.(*Mutex).Lock+0xb1								/usr/local/go/src/sync/mutex.go:90
#	0x22464b3	github.com/gopacket/gopacket/pcap.(*Handle).Close+0x93				/root/go/pkg/mod/github.com/gopacket/[email protected]/pcap/pcap.go:390

GTPv1U SerializeTo: GTPExtensionHeaders out of place

When encoding a packet that contains a GTPv1U layer that is not the last layer, the GTPExtensionHeaders are incorrectly placed at the end of the packet, instead of right after the GTPv1U minimum header before the next layer.

Environment

Go v1.22.4
GoPacket revision 8c73654

This issue is copied from google/gopacket#1175 but adjusted for this fork.

Snippet to Reproduce

https://go.dev/play/p/3hnQC2spi_k

package main

import (
	"encoding/hex"
	"fmt"
	"net"

	"github.com/gopacket/gopacket"
	"github.com/gopacket/gopacket/layers"
)

func main() {
	payload := gopacket.Payload{0xA0, 0xA1, 0xA2, 0xA3}
	udpI := &layers.UDP{SrcPort: 6363, DstPort: 6363}
	ip4I := &layers.IPv4{Version: 4, TTL: 64, Protocol: layers.IPProtocolUDP, SrcIP: net.ParseIP("192.168.60.4"), DstIP: net.ParseIP("192.168.60.3")}
	gtpExt := []layers.GTPExtensionHeader{{Type: 0x85, Content: []byte{10, 01}}}
	gtp := &layers.GTPv1U{Version: 1, ProtocolType: 1, MessageType: 0xFF, MessageLength: uint16(8 + 20 + 8 + len(payload)), TEID: 0x10000008, GTPExtensionHeaders: gtpExt}
	udp := &layers.UDP{SrcPort: 2152, DstPort: 2152}
	ip4 := &layers.IPv4{Version: 4, TTL: 64, Protocol: layers.IPProtocolUDP, SrcIP: net.ParseIP("192.168.37.2"), DstIP: net.ParseIP("192.168.37.1")}
	eth := &layers.Ethernet{SrcMAC: net.HardwareAddr{0x02, 0x00, 0x00, 0x00, 0x00, 0x02}, DstMAC: net.HardwareAddr{0x02, 0x00, 0x00, 0x00, 0x00, 0x01}, EthernetType: layers.EthernetTypeIPv4}
	udp.SetNetworkLayerForChecksum(ip4)
	udpI.SetNetworkLayerForChecksum(ip4I)

	buf := gopacket.NewSerializeBuffer()
	if e := gopacket.SerializeLayers(buf, gopacket.SerializeOptions{
		FixLengths:       true,
		ComputeChecksums: true,
	}, eth, ip4, udp, gtp, ip4I, udpI, payload); e != nil {
		panic(e)
	}

	fmt.Println(hex.EncodeToString(buf.Bytes()))
}

Expected Output

0200000000010200000000020800 Ethernet
4500004c000000004011af4dc0a82502c0a82501 outer-IPv4
086808680038d511 outer-UDP
34ff00281000000800000085010a0100 GTPv1U
450000200000000040118175c0a83c04c0a83c03 inner-IPv4
18db18db000c9182 inner-UDP
a0a1a2a3 payload

Actual Output

0200000000010200000000020800 Ethernet
4500004c000000004011af4dc0a82502c0a82501 outer-IPv4
086808680038d511 outer-UDP
34ff002810000008 GTPv1U:header
450000200000000040118175c0a83c04c0a83c03 inner-IPv4
18db18db000c9182 inner-UDP
a0a1a2a3 payload
00000085010a0100 GTPv1U:extension

Root Cause

data, err := b.AppendBytes(4)

SerializeBuffer.AppendBytes is called on a non-empty buffer, so that extension headers are placed after the inner layers.

Failed to build a a statically linked binary

New to gopacket, I have a error when building a statically linked binary. Here is the build command:

CGO_ENABLED=1 GOARCH=amd64 CC=gcc go build -mod vendor \
	-ldflags "-linkmode external -extldflags -static" \
	-gcflags=-l -o bin/linux/amd64/vesuvius cmd/main.go

The build error:

/usr/local/go/pkg/tool/linux_amd64/link: running cc failed: exit status 1
/usr/bin/ld: /tmp/go-link-2925549938/000004.o: in function `_cgo_9c8efe9babca_C2func_getaddrinfo':
cgo_unix_cgo.cgo2.c:(.text+0x81): warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function `pcap_nametoaddr':
(.text+0x5): warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function `pcap_nametonetaddr':
(.text+0xed): warning: Using 'getnetbyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(nametoaddr.o): in function `pcap_nametoproto':
(.text+0x49f): warning: Using 'getprotobyname_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function `dbus_write':
(.text+0xff): undefined reference to `dbus_message_demarshal'
/usr/bin/ld: (.text+0x115): undefined reference to `dbus_connection_send'
/usr/bin/ld: (.text+0x11e): undefined reference to `dbus_connection_flush'
/usr/bin/ld: (.text+0x126): undefined reference to `dbus_message_unref'
/usr/bin/ld: (.text+0x174): undefined reference to `dbus_error_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function `dbus_read':
(.text+0x1c0): undefined reference to `dbus_connection_pop_message'
/usr/bin/ld: (.text+0x1e2): undefined reference to `dbus_connection_pop_message'
/usr/bin/ld: (.text+0x1f8): undefined reference to `dbus_connection_read_write'
/usr/bin/ld: (.text+0x262): undefined reference to `dbus_message_is_signal'
/usr/bin/ld: (.text+0x27e): undefined reference to `dbus_message_marshal'
/usr/bin/ld: (.text+0x2e6): undefined reference to `dbus_free'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function `dbus_cleanup':
(.text+0x34c): undefined reference to `dbus_connection_unref'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/libpcap.a(pcap-dbus.o): in function `dbus_activate':
(.text+0x3f6): undefined reference to `dbus_connection_open'
/usr/bin/ld: (.text+0x40e): undefined reference to `dbus_bus_register'
/usr/bin/ld: (.text+0x4fc): undefined reference to `dbus_bus_add_match'
/usr/bin/ld: (.text+0x504): undefined reference to `dbus_error_is_set'
/usr/bin/ld: (.text+0x54b): undefined reference to `dbus_bus_get'
/usr/bin/ld: (.text+0x57c): undefined reference to `dbus_error_free'
/usr/bin/ld: (.text+0x58d): undefined reference to `dbus_bus_add_match'
/usr/bin/ld: (.text+0x595): undefined reference to `dbus_error_is_set'
/usr/bin/ld: (.text+0x5ce): undefined reference to `dbus_error_free'
/usr/bin/ld: (.text+0x5da): undefined reference to `dbus_connection_unref'
/usr/bin/ld: (.text+0x606): undefined reference to `dbus_bus_get'
/usr/bin/ld: (.text+0x642): undefined reference to `dbus_error_free'
/usr/bin/ld: (.text+0x655): undefined reference to `dbus_connection_set_max_received_size'
/usr/bin/ld: (.text+0x666): undefined reference to `dbus_connection_unref'
/usr/bin/ld: (.text+0x6dc): undefined reference to `dbus_error_free'
/usr/bin/ld: (.text+0x71a): undefined reference to `dbus_error_free'
collect2: error: ld returned 1 exit status

The env I am working on:

OS: Debian bookworm
Arch: amd64
Golang version: 1.21.1
Installed C dev packges:  libpcap-dev(1.10.3-1) libdbus-1-dev(1.14.10-1~deb12u1)

It seems that after 1.10.x libpcap had a dep to dbus. I tried to specify (with CGO_CFLAGS='-I/a/b/c') the path of dbus include files but still get same errors. I don't know whether I did sth wrong or there is a bug.
P.S. building on libpcap-dev version 1.9.x and 1.8.x (no dbus) worked

Question: Injected UDP packets aren't received by application

Hi there! This is more of a general question, so I apologise if here is not the correct place to post this.

I'm reading UDP multicast packets from a host, transmitting them via TCP to another one, recalculating the checksum and injecting them into an interface. tshark/tcpdump are able to see those injected packets, but the application listening to the same interface/multicast group can't seem to receive them.

Is there any way to diagnose that, or maybe I'm missing something? I'm currently not joining the multicast group before injecting (I feel this should not be required, considering packets are injected into the interface). Any suggestions on how to get this working or diagnosing why this is happening?

Thank you so much!

  • Vito

Support BGP

Hello,

I noticed that gopacket does not have a BGP layer and was curious of the appetite for that as a new layer? I am willing to do the work on my free time. Just curious if anyone has already started and wants help.

PacketSource zeroCopy field always false

func (p *PacketSource) PacketsCtx(ctx context.Context) chan Packet {
	if p.DecodeOptions.NoCopy && p.zeroCopy {
		panic("PacketSource uses a zero copy datasource and NoCopy decoder option activated - Packets() uses a buffered channel hence packets are most likely overwritten")
	}

	const defaultPacketChannelSize = 1000
	if p.c == nil {
		p.c = make(chan Packet, defaultPacketChannelSize)
		go p.packetsToChannel(ctx)
	}
	return p.c
}

It seems p.zeroCopy always false?

Upgrade from google/gopacket to gopacket/gopacket

Hello all,

I saw this repo is the continued repo of google/gopacket. Now I'd like to upgrade as such. But I get this error, and I am not experienced in golang whatsoever.

Current code:

func vPort(p interface{}) string {
	sp := fmt.Sprintf("%d", p)
	if tcp, ok := p.(layers.TCPPort); ok {
		if name, found := layers.TCPPortNames[tcp]; found {
			sp = tui.Yellow(name)
		}
	} else if udp, ok := p.(layers.UDPPort); ok {
		if name, found := layers.UDPPortNames[udp]; found {
			sp = tui.Yellow(name)
		}
	}

	return sp
}

The errors are thrown on layers.TCPPortNames[tcp] and layers.UDPPortNames[udp]. It does not support indexing. How would I go about fixing this, apparently google/gopacket had this working.

modules/net_sniff/net_sniff_views.go:34:40: invalid operation: cannot index layers.TCPPortNames (value of type func(port layers.TCPPort) (string, bool))
modules/net_sniff/net_sniff_views.go:38:40: invalid operation: cannot index layers.UDPPortNames (value of type func(port layers.UDPPort) (string, bool))

If I am not supposed to ask this here I will remove it.

Comparison of pcap vs pcapgo vs afpacket for packet capture

This package seems to include quite a few ways to capture packets. It would be nice to have a more thorough comparison of the tradeoffs and when to use what.

From what I can tell gopacket/pcap uses the libpcap C library, which is very mature and widely used, but requires CGO, whereas gopacket/afpacket and and gopacket/pcapgo both use an AF_PACKET socket with only native Go code and no CGO (correct me if I am wrong about this).

Some questions that I could not find answers to in the documentation:

  • What difference is there between the afpacket and pcapgo package capture functionality?
  • When should I prefer one over the other?
  • How well tested / reliable is the packet capture with afpacket and pcapgo?

Strange behaviors in reassembly

I've found reassembly module exists strange behavior, which seems to exhibit different behavior compared to the tcpassembly module.

According to issue, reassembly is intended as the successor to tcpassembly. However, upon testing, I found that reassembly behaves oddly, whereas tcpassembly functions as expected.

Here are two minimal code snippets to reproduce the issue:

For tcpassembly:

package main

import (
	"log"

	"github.com/google/gopacket"
	"github.com/google/gopacket/layers"
	"github.com/google/gopacket/pcap"
	"github.com/google/gopacket/tcpassembly"
)

// tcpassembly.StreamFactory
type streamFactory struct{}

// tcpassembly.Stream
type tcpStream struct{}

func (factory *streamFactory) New(netFlow gopacket.Flow, tcpFlow gopacket.Flow) tcpassembly.Stream {
	log.Printf("New stream found: %v:%v->%v:%v\n", netFlow.Src(), tcpFlow.Src(), netFlow.Dst(), tcpFlow.Dst())
	return &tcpStream{}
}

func (stream *tcpStream) Reassembled(reassemblies []tcpassembly.Reassembly) {}

func (stream *tcpStream) ReassemblyComplete() {}

func main() {
	// Open a pcap file
	handle, err := pcap.OpenOffline("./test.pcap")
	if err != nil {
		log.Fatal(err)
	}
	defer handle.Close()

	// Create a pool of TCP streams
	pool := tcpassembly.NewStreamPool(&streamFactory{})
	assembler := tcpassembly.NewAssembler(pool)

	// Loop through packets in the file
	packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
	for packet := range packetSource.Packets() {
		if tcpLayer := packet.Layer(layers.LayerTypeTCP); tcpLayer != nil {
			tcp, _ := tcpLayer.(*layers.TCP)
			assembler.AssembleWithTimestamp(packet.NetworkLayer().NetworkFlow(), tcp, packet.Metadata().Timestamp)
		}
	}

	// Flush remaining packets
	assembler.FlushAll()
}

Output:

2024/05/26 16:11:34 New stream found: 10.0.2.15:22->10.0.2.2:51734
2024/05/26 16:11:34 New stream found: 10.0.2.15:22->10.0.2.2:50112
2024/05/26 16:11:34 New stream found: 10.0.2.2:50112->10.0.2.15:22
2024/05/26 16:11:34 New stream found: 10.0.2.2:51734->10.0.2.15:22
2024/05/26 16:11:34 New stream found: 10.0.2.15:36888->104.131.8.184:443
2024/05/26 16:11:34 New stream found: 104.131.8.184:443->10.0.2.15:36888

For reassembly:

package main

import (
	"log"

	"github.com/google/gopacket"
	"github.com/google/gopacket/layers"
	"github.com/google/gopacket/pcap"
	"github.com/google/gopacket/reassembly"
)

// reassembly.StreamFactory
type streamFactory struct{}

// reassembly.Stream
type tcpStream struct{}

// Assemble context
type AssemblerContext struct {
	CaptureInfo gopacket.CaptureInfo
}

func (c *AssemblerContext) GetCaptureInfo() gopacket.CaptureInfo {
	return c.CaptureInfo
}

func (factory *streamFactory) New(netFlow, tcpFlow gopacket.Flow, tcp *layers.TCP, ac reassembly.AssemblerContext) reassembly.Stream {
	log.Printf("New stream found: %v:%v->%v:%v SYN: %v, ACK: %v, FIN: %v, RST: %v, Seq: %v, Ack: %v\n",
		netFlow.Src(), tcpFlow.Src(), netFlow.Dst(), tcpFlow.Dst(),
		tcp.SYN, tcp.ACK, tcp.FIN, tcp.RST, tcp.Seq, tcp.Ack)
	return &tcpStream{}
}

func (stream *tcpStream) Accept(tcp *layers.TCP, ci gopacket.CaptureInfo, dir reassembly.TCPFlowDirection, nextSeq reassembly.Sequence, start *bool, ac reassembly.AssemblerContext) bool {
	return true
}

func (stream *tcpStream) ReassembledSG(sg reassembly.ScatterGather, ac reassembly.AssemblerContext) {
	// Handle reassembled segments
}

func (stream *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool {
	// Complete handling for the stream
	return true
}

func main() {
	// Open a pcap file
	handle, err := pcap.OpenOffline("./test.pcap")
	if err != nil {
		log.Fatal(err)
	}
	defer handle.Close()

	// Create a pool of TCP streams
	pool := reassembly.NewStreamPool(&streamFactory{})
	assembler := reassembly.NewAssembler(pool)

	// Loop through packets in the file
	packetSource := gopacket.NewPacketSource(handle, handle.LinkType())
	for packet := range packetSource.Packets() {
		if tcpLayer := packet.Layer(layers.LayerTypeTCP); tcpLayer != nil {
			tcp, _ := tcpLayer.(*layers.TCP)
			assembler.AssembleWithContext(packet.NetworkLayer().NetworkFlow(), tcp, &AssemblerContext{
				CaptureInfo: packet.Metadata().CaptureInfo,
			})
		}
	}

	// Flush remaining packets
	assembler.FlushAll()
}

Output

2024/05/26 16:21:52 New stream found: 10.0.2.15:22->10.0.2.2:51734 SYN: false, ACK: true, FIN: false, RST: false, Seq: 1760721761, Ack: 332436703
2024/05/26 16:21:52 New stream found: 10.0.2.15:22->10.0.2.2:50112 SYN: false, ACK: true, FIN: false, RST: false, Seq: 2397881296, Ack: 7564907
2024/05/26 16:21:52 New stream found: 10.0.2.15:36888->104.131.8.184:443 SYN: true, ACK: false, FIN: false, RST: false, Seq: 956211534, Ack: 0
2024/05/26 16:21:52 New stream found: 10.0.2.15:36888->104.131.8.184:443 SYN: false, ACK: true, FIN: false, RST: false, Seq: 956212383, Ack: 832772637

In the test pcap, reassembly seems to call the New function multiple times for the same stream, which is unexpected. Also, the New function should be triggered by the first packet of a stream, but it being called with a sequence number 956212383 that is not the first in the stream.

test.pcap.zip

pcapng support

Hello all,

I am using bettercap, and I would like to see if I can update it to using pcapng instead of pcap file format. Bettercap used the old google/gopacket, I updated it to use gopacket/gopacket. Go team gopacket! Now the way my software uses bettercap is mainly by capturing WiFi packets. Does gopacket support this in combo with pcapng? If anyone could tell I am on the right track, I probably need to change the way data is gathered or created, I reckon. Or am I doing this completely wrong, I am new to Golang programming.

Here is the code so far and the result with hcxpcapngtool.

func (w *WiFi) SaveHandshakesTo(fileName string, linkType layers.LinkType) error {
	// check if folder exists first
	dirName := filepath.Dir(fileName)
	if _, err := os.Stat(dirName); err != nil {
		if err = os.MkdirAll(dirName, os.ModePerm); err != nil {
			return err
		}
	}

	fp, err := os.OpenFile(fileName, os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)
	if err != nil {
		return err
	}
	defer fp.Close()
	pcapgo.DefaultNgInterface.Name = "wlan0mon"
	writer, err := pcapgo.NewNgWriter(fp, linkType)
	if err != nil {
		return err
	}
	defer writer.Flush()

	w.RLock()
	defer w.RUnlock()

	for _, ap := range w.aps {
		for _, station := range ap.Clients() {
			// if half (which includes also complete) or has pmkid
			if station.Handshake.Any() {
				err = nil
				station.Handshake.EachUnsavedPacket(func(pkt gopacket.Packet) {
					if err == nil {
						err = writer.WritePacket(pkt.Metadata().CaptureInfo, pkt.Data())
					}
				})
				if err != nil {
					return err
				}
			}
		}
	}

	return nil
}

image

FR - File handle minimum delay and original packet delay options

Feature request:

When using a file based capture, instead of feeding packets as fast as possible, provide options to insert either original packet delay, or a static delay. possibly a minimum delay option as well when using original.

I realize I could do this myself by making an interface wrapper, but it seems like something worth requesting upstream.

SEGFAULT when getting layer payload

Hi, first time reporting an issue here so apologies if there's any missing info or context. Basically, both of these two lines below are the problem

(https://github.com/jkmancuso/home_sniffer/blob/main/packet_capture.go#L80-L81)
packet.NetworkLayer().LayerPayload()
packet.ApplicationLayer().LayerPayload()

NetworkLayer() and ApplicationLayer() work fine until I try to grab the layer payload. Getting

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x3cd834]

It may be relevant to add that this is running on a Raspberry PI with Debian 12.
Linux raspberrypi 6.6.20+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux
go version go1.22.3 linux/arm64
using gopacket v1.2.0

Can't build on Linux ARM

Hey guys! We heavily utilize gopacket (specifically pcapgo) in one of our projects. We use GitHub Actions to handle CI, and noticed that Linux ARM builds started failing when we switched from google/gopacket to gopacket/gopacket.

This is all of the information that the runner gives us, but hopefully it's helpful :) We don't actively need our project on Linux ARM, so we just removed that build from the pipeline. It's probably be good to get this straightened out though :D

Thanks!

 --> linux/arm error: exit status 1
Stderr: # github.com/gopacket/gopacket/pcapgo
Error: /home/runner/go/pkg/mod/github.com/gopacket/[email protected]/pcapgo/capture.go:112:29: cannot use tstamp.Sec (variable of type int32) as int64 value in argument to time.Unix
Error: /home/runner/go/pkg/mod/github.com/gopacket/[email protected]/pcapgo/capture.go:112:41: cannot use tstamp.Nsec (variable of type int32) as int64 value in argument to time.Unix
Error: /home/runner/go/pkg/mod/github.com/gopacket/[email protected]/pcapgo/capture.go:115:29: cannot use tstamp.Sec (variable of type int32) as int64 value in argument to time.Unix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.