mirror of
https://github.com/tailscale/tailscale.git
synced 2025-03-29 20:42:22 +00:00
tstest/natlab/vnet: fix first packet pcap handling
Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
88f60bd16e
commit
6f2f08ae80
@ -692,17 +692,6 @@ func (s *Server) ServeUnixConn(uc *net.UnixConn, proto Protocol) {
|
||||
}
|
||||
packetRaw = buf[4 : 4+n] // raw ethernet frame
|
||||
}
|
||||
if s.pcapWriter != nil {
|
||||
ci := gopacket.CaptureInfo{
|
||||
Timestamp: time.Now(),
|
||||
CaptureLength: len(packetRaw),
|
||||
Length: len(packetRaw),
|
||||
}
|
||||
if srcNode != nil {
|
||||
ci.InterfaceIndex = srcNode.id
|
||||
}
|
||||
must.Do(s.pcapWriter.WritePacket(ci, packetRaw))
|
||||
}
|
||||
|
||||
packet := gopacket.NewPacket(packetRaw, layers.LayerTypeEthernet, gopacket.Lazy)
|
||||
le, ok := packet.LinkLayer().(*layers.Ethernet)
|
||||
@ -728,6 +717,17 @@ func (s *Server) ServeUnixConn(uc *net.UnixConn, proto Protocol) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if s.pcapWriter != nil {
|
||||
ci := gopacket.CaptureInfo{
|
||||
Timestamp: time.Now(),
|
||||
CaptureLength: len(packetRaw),
|
||||
Length: len(packetRaw),
|
||||
}
|
||||
if srcNode != nil {
|
||||
ci.InterfaceIndex = srcNode.id
|
||||
}
|
||||
must.Do(s.pcapWriter.WritePacket(ci, packetRaw))
|
||||
}
|
||||
netw.HandleEthernetPacket(ep)
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user