diff options
author | Luca Deri <deri@ntop.org> | 2019-06-29 17:34:08 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2019-06-29 17:34:08 +0200 |
commit | e9e647f04310cddbee5356068c032d819027a877 (patch) | |
tree | 7603b97c8da5181b76ba9b9418821929645cfe8e /src | |
parent | 81d3fc8a24c5625b94c1d1aa24b2ac214d976eea (diff) |
ntohl Portability fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/ndpi_main.c | 6 | ||||
-rw-r--r-- | src/lib/protocols/quic.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/lib/ndpi_main.c b/src/lib/ndpi_main.c index fcc159350..aad91e169 100644 --- a/src/lib/ndpi_main.c +++ b/src/lib/ndpi_main.c @@ -3610,7 +3610,7 @@ void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_struct, if(ndpi_struct->direction_detect_disable) { packet->packet_direction = flow->packet_direction; } else { - if(iph != NULL && le32toh(iph->saddr) < le32toh(iph->daddr)) + if(iph != NULL && ntohl(iph->saddr) < ntohl(iph->daddr)) packet->packet_direction = 1; #ifdef NDPI_DETECTION_SUPPORT_IPV6 @@ -3634,7 +3634,7 @@ void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_struct, packet->num_retried_bytes = 0; if(!ndpi_struct->direction_detect_disable) - packet->packet_direction = (le16toh(tcph->source) < le16toh(tcph->dest)) ? 1 : 0; + packet->packet_direction = (ntohs(tcph->source) < ntohs(tcph->dest)) ? 1 : 0; if(tcph->syn != 0 && tcph->ack == 0 && flow->l4.tcp.seen_syn == 0 && flow->l4.tcp.seen_syn_ack == 0 && flow->l4.tcp.seen_ack == 0) { @@ -3697,7 +3697,7 @@ void ndpi_connection_tracking(struct ndpi_detection_module_struct *ndpi_struct, } } else if(udph != NULL) { if(!ndpi_struct->direction_detect_disable) - packet->packet_direction = (le16toh(udph->source) < le16toh(udph->dest)) ? 1 : 0; + packet->packet_direction = (htons(udph->source) < htons(udph->dest)) ? 1 : 0; } if(flow->packet_counter < MAX_PACKET_COUNTER && packet->payload_packet_len) { diff --git a/src/lib/protocols/quic.c b/src/lib/protocols/quic.c index d14538e0d..d67414fdf 100644 --- a/src/lib/protocols/quic.c +++ b/src/lib/protocols/quic.c @@ -100,8 +100,8 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, && (packet->payload[i+1] == 'N') && (packet->payload[i+2] == 'I') && (packet->payload[i+3] == 0)) { - u_int32_t offset = le32toh(*((u_int32_t*)&packet->payload[i+4])); - u_int32_t prev_offset = le32toh(*((u_int32_t*)&packet->payload[i-4])); + u_int32_t offset = ntohl(*((u_int32_t*)&packet->payload[i+4])); + u_int32_t prev_offset = ntohl(*((u_int32_t*)&packet->payload[i-4])); int len = offset-prev_offset; int sni_offset = i+prev_offset+1; |