someip#fix when run across architectures such ARM ,may be occour sigbus error(),Unhandled fault: alignment fault (0x92000021) at 0x00000000f67004aa
This commit is contained in:
@@ -87,6 +87,14 @@ static void ndpi_int_someip_add_connection (struct ndpi_detection_module_struct
|
||||
NDPI_LOG_INFO(ndpi_struct, "found SOME/IP\n");
|
||||
}
|
||||
|
||||
static u_int32_t someip_data_cover_32(u_int8_t *data)
|
||||
{
|
||||
u_int32_t value;
|
||||
|
||||
memcpy(&value,data,sizeof(u_int32_t));
|
||||
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Dissector function that searches SOME/IP headers
|
||||
*/
|
||||
@@ -111,8 +119,8 @@ void ndpi_search_someip (struct ndpi_detection_module_struct *ndpi_struct,
|
||||
}
|
||||
|
||||
//we extract the Message ID and Request ID and check for special cases later
|
||||
u_int32_t message_id = ntohl(*((u_int32_t *)&packet->payload[0]));
|
||||
u_int32_t request_id = ntohl(*((u_int32_t *)&packet->payload[8]));
|
||||
u_int32_t message_id = ntohl(someip_data_cover_32(&packet->payload[0]));
|
||||
u_int32_t request_id = ntohl(someip_data_cover_32(&packet->payload[8]));
|
||||
|
||||
NDPI_LOG_DBG2(ndpi_struct, "====>>>> SOME/IP Message ID: %08x [len: %u]\n",
|
||||
message_id, packet->payload_packet_len);
|
||||
@@ -125,7 +133,7 @@ void ndpi_search_someip (struct ndpi_detection_module_struct *ndpi_struct,
|
||||
//####Maximum packet size in SOMEIP depends on the carrier protocol, and I'm not certain how well enforced it is, so let's leave that for round 2####
|
||||
|
||||
// we extract the remaining length
|
||||
u_int32_t someip_len = ntohl(*((u_int32_t *)&packet->payload[4]));
|
||||
u_int32_t someip_len = ntohl(someip_data_cover_32(&packet->payload[4]));
|
||||
if (packet->payload_packet_len != (someip_len + 8)) {
|
||||
NDPI_LOG_DBG(ndpi_struct, "Excluding SOME/IP .. Length field invalid!\n");
|
||||
NDPI_ADD_PROTOCOL_TO_BITMASK(flow->excluded_protocol_bitmask, NDPI_PROTOCOL_SOMEIP);
|
||||
|
||||
Reference in New Issue
Block a user