diff options
author | Luca Deri <deri@ntop.org> | 2016-08-05 17:29:33 +0200 |
---|---|---|
committer | Luca Deri <deri@ntop.org> | 2016-08-05 17:29:33 +0200 |
commit | 9e207f7f24fd693c8d5a095db43dd7077e9fc903 (patch) | |
tree | 484fe350b9c810bd357ec202c9ca6467366c1e62 /src/lib/protocols/openvpn.c | |
parent | 5ec1b685d897f6e942d5b826c94805224a16156a (diff) |
Fix for systems without beXXtoh
Diffstat (limited to 'src/lib/protocols/openvpn.c')
-rw-r--r-- | src/lib/protocols/openvpn.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib/protocols/openvpn.c b/src/lib/protocols/openvpn.c index 9f9449df7..f13b274c8 100644 --- a/src/lib/protocols/openvpn.c +++ b/src/lib/protocols/openvpn.c @@ -37,7 +37,7 @@ #define P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) (P_HARD_RESET_PACKET_ID_OFFSET(hmac_size) + 8) static inline u_int32_t get_packet_id(const u_int8_t * payload, u_int8_t hms) { - return be32toh(*(u_int32_t*)(payload + P_HARD_RESET_PACKET_ID_OFFSET(hms))); + return ntohl(*(u_int32_t*)(payload + P_HARD_RESET_PACKET_ID_OFFSET(hms))); } static inline int8_t check_pkid_and_detect_hmac_size(const u_int8_t * payload) { @@ -66,18 +66,18 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct, opcode = ovpn_payload[0] & P_OPCODE_MASK; if (flow->ovpn_counter == 0 && (opcode == P_CONTROL_HARD_RESET_CLIENT_V1 || - opcode == P_CONTROL_HARD_RESET_CLIENT_V2)) { + opcode == P_CONTROL_HARD_RESET_CLIENT_V2)) { if (check_pkid_and_detect_hmac_size(ovpn_payload) > 0) { memcpy(flow->ovpn_session_id, ovpn_payload+1, 8); NDPI_LOG(NDPI_PROTOCOL_OPENVPN, ndpi_struct, NDPI_LOG_DEBUG, - "session key: %02x%02x%02x%02x%02x%02x%02x%02x\n", - flow->ovpn_session_id[0], flow->ovpn_session_id[1], flow->ovpn_session_id[2], flow->ovpn_session_id[3], - flow->ovpn_session_id[4], flow->ovpn_session_id[5], flow->ovpn_session_id[6], flow->ovpn_session_id[7]); + "session key: %02x%02x%02x%02x%02x%02x%02x%02x\n", + flow->ovpn_session_id[0], flow->ovpn_session_id[1], flow->ovpn_session_id[2], flow->ovpn_session_id[3], + flow->ovpn_session_id[4], flow->ovpn_session_id[5], flow->ovpn_session_id[6], flow->ovpn_session_id[7]); } } else if (flow->ovpn_counter == 1 && (opcode == P_CONTROL_HARD_RESET_SERVER_V1 || - opcode == P_CONTROL_HARD_RESET_SERVER_V2)) { + opcode == P_CONTROL_HARD_RESET_SERVER_V2)) { hmac_size = check_pkid_and_detect_hmac_size(ovpn_payload); @@ -89,9 +89,9 @@ void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct, ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN); else NDPI_LOG(NDPI_PROTOCOL_OPENVPN, ndpi_struct, NDPI_LOG_DEBUG, - "key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\n", - session_remote[0], session_remote[1], session_remote[2], session_remote[3], - session_remote[4], session_remote[5], session_remote[6], session_remote[7]); + "key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\n", + session_remote[0], session_remote[1], session_remote[2], session_remote[3], + session_remote[4], session_remote[5], session_remote[6], session_remote[7]); } } else if (flow->ovpn_counter >= 2) NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_OPENVPN); |