fix byte order
This commit is contained in:
parent
c6d4fadd6e
commit
504445a118
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue