Skip to content

Commit e9f11f7

Browse files
Charlie17Liaboch
authored andcommitted
bugfix: parse ipv4 src/dst error
1 parent 1f4f72c commit e9f11f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nl/tc_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ func (p *TcPedit) SetIPv6Dst(ip6 net.IP) {
15801580
}
15811581

15821582
func (p *TcPedit) SetIPv4Src(ip net.IP) {
1583-
u32 := NativeEndian().Uint32(ip[:4])
1583+
u32 := NativeEndian().Uint32(ip.To4())
15841584

15851585
tKey := TcPeditKey{}
15861586
tKeyEx := TcPeditKeyEx{}
@@ -1596,7 +1596,7 @@ func (p *TcPedit) SetIPv4Src(ip net.IP) {
15961596
}
15971597

15981598
func (p *TcPedit) SetIPv4Dst(ip net.IP) {
1599-
u32 := NativeEndian().Uint32(ip[:4])
1599+
u32 := NativeEndian().Uint32(ip.To4())
16001600

16011601
tKey := TcPeditKey{}
16021602
tKeyEx := TcPeditKeyEx{}

0 commit comments

Comments
 (0)