1
0
mirror of https://github.com/fumiama/water.git synced 2026-06-05 02:00:29 +08:00

Fix to use To4()

This will also produce a runtime error if non-IPv4 addresses are passed
in.
This commit is contained in:
Sean Purser-Haskell
2016-05-10 11:30:32 +08:00
parent 735b3a96b7
commit 93f6384fdd

View File

@@ -29,7 +29,7 @@ func IPv4Source(packet []byte) net.IP {
}
func SetIPv4Source(packet []byte, source net.IP) {
copy(packet[12:16], source)
copy(packet[12:16], source.To4())
}
func IPv4Destination(packet []byte) net.IP {
@@ -37,7 +37,7 @@ func IPv4Destination(packet []byte) net.IP {
}
func SetIPv4Destination(packet []byte, dest net.IP) {
copy(packet[16:20], dest)
copy(packet[16:20], dest.To4())
}
func IPv4Payload(packet []byte) []byte {