fix byte order

master
Christian Ulrich 2020-07-13 09:38:58 +02:00
parent c6d4fadd6e
commit 504445a118
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 2 additions and 2 deletions

View File

@ -68,8 +68,8 @@ proc parseEthernetPacket*(input: string): IpPacket =
let etherHeader = cast[ptr Ether_header](input.cstring)
if ntohs(etherHeader.ether_type) == ETHERTYPE_IP:
let ipHeader = cast[ptr Ip](cast[int](input.cstring) + sizeof(Ether_header))
let ipSrcScalar = ntohl(ipHeader.ip_src.s_addr)
let ipDstScalar = ntohl(ipHeader.ip_dst.s_addr)
let ipSrcScalar = ipHeader.ip_src.s_addr
let ipDstScalar = ipHeader.ip_dst.s_addr
let ipSrc = IpAddress(family: Ipv4,
address_v4: cast[array[4, uint8]](ipSrcScalar))
let ipDst = IpAddress(family: Ipv4,