Skip to content

Commit

Permalink
fix: fix conversion from netip to tcpip
Browse files Browse the repository at this point in the history
Signed-off-by: Spike Curtis <[email protected]>
  • Loading branch information
spikecurtis committed May 22, 2024
1 parent 30fcb10 commit 8318164
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions net/tstun/tap_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,8 @@ func packLayer2UDP(payload []byte, srcMAC, dstMAC net.HardwareAddr, src, dst net
buf := make([]byte, header.EthernetMinimumSize+header.UDPMinimumSize+header.IPv4MinimumSize+len(payload))
payloadStart := len(buf) - len(payload)
copy(buf[payloadStart:], payload)
srcB := src.Addr().As4()
srcIP := tcpip.Address(srcB[:])
dstB := dst.Addr().As4()
dstIP := tcpip.Address(dstB[:])
srcIP := tcpip.AddrFromSlice(src.Addr().AsSlice())
dstIP := tcpip.AddrFromSlice(dst.Addr().AsSlice())
// Ethernet header
eth := header.Ethernet(buf)
eth.Encode(&header.EthernetFields{
Expand Down

0 comments on commit 8318164

Please sign in to comment.