google / google/gopacket

How to send icmpv6NS packets through gopacket

Open
#936 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
6.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

```go
ethernetLayer := &layers.Ethernet{
SrcMAC: srcMac,
DstMAC: dstMac,
EthernetType: layers.EthernetTypeIPv6,
}

ipv6layers := &layers.IPv6{
Version: 6,
SrcIP: srcIP,
DstIP: snm,
NextHeader: layers.IPProtocolICMPv6,

}

icmplayers := &layers.ICMPv6NeighborSolicitation{
TargetAddress: srcIP,

}

buffer := gopacket.NewSerializeBuffer()
opts := gopacket.SerializeOptions{
FixLengths: true,
ComputeChecksums: true,
}
err := gopacket.SerializeLayers(buffer, opts,
ethernetLayer,
ipv6layers,
icmplayers,
)
```

Through the above construction of data packet transmission, it is found that the data packet is defective in wireshark capture.

Is there something wrong with the icmp-layers construction?

![image](https://user-images.githubusercontent.com/22125180/154905724-a37a4698-0552-4715-9eda-dc4247770ec0.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.