Skip to content

Commit

Permalink
Merge pull request #703 from linux-on-ibm-z/udp_test_update_s390x
Browse files Browse the repository at this point in the history
network order functionality changed based on endianess
  • Loading branch information
tomdee authored May 4, 2017
2 parents 80e01f4 + dd396c9 commit 40ad362
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/ip/ipnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ func (ip IP4) ToIP() net.IP {
}

func (ip IP4) NetworkOrder() uint32 {
a, b, c, d := byte(ip>>24), byte(ip>>16), byte(ip>>8), byte(ip)
return uint32(a) | (uint32(b) << 8) | (uint32(c) << 16) | (uint32(d) << 24)
if NativelyLittle() {
a, b, c, d := byte(ip>>24), byte(ip>>16), byte(ip>>8), byte(ip)
return uint32(a) | (uint32(b) << 8) | (uint32(c) << 16) | (uint32(d) << 24)
} else {
return uint32(ip)
}
}

func (ip IP4) String() string {
Expand Down

0 comments on commit 40ad362

Please sign in to comment.