Skip to content

Commit dbe3452

Browse files
committed
bugfix: parse ipv4 src/dst error
1 parent b1ce50c commit dbe3452

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nl/tc_linux.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1533,7 +1533,7 @@ func (p *TcPedit) SetIPv6Dst(ip6 net.IP) {
15331533
}
15341534

15351535
func (p *TcPedit) SetIPv4Src(ip net.IP) {
1536-
u32 := NativeEndian().Uint32(ip[:4])
1536+
u32 := NativeEndian().Uint32(ip.To4())
15371537

15381538
tKey := TcPeditKey{}
15391539
tKeyEx := TcPeditKeyEx{}
@@ -1549,7 +1549,7 @@ func (p *TcPedit) SetIPv4Src(ip net.IP) {
15491549
}
15501550

15511551
func (p *TcPedit) SetIPv4Dst(ip net.IP) {
1552-
u32 := NativeEndian().Uint32(ip[:4])
1552+
u32 := NativeEndian().Uint32(ip.To4())
15531553

15541554
tKey := TcPeditKey{}
15551555
tKeyEx := TcPeditKeyEx{}

0 commit comments

Comments
 (0)