Loading ccsrc/Protocols/Pcap/pcap_offline_layer.cc +6 −5 Original line number Diff line number Diff line Loading @@ -210,13 +210,14 @@ void pcap_offline_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> pcap_offline_layer::receive_data: Received %d bytes", data.lengthof()); const uint8_t *p = static_cast<const uint8_t*>(data); if ( ((*p == 0x00) && (*(p + 1) == 0x04) && (*(p + 2) == 0x00) && (*(p + 3) == 0x01)) || // Linux cooked capture v1 layer ((*p == 0x08) && (*(p + 1) == 0x00) && (*(p + 2) == 0x00) && (*(p + 3) == 0x010)) // Linux cooked capture v2 layer ) { if ((*p == 0x00) && (*(p + 1) == 0x04) && (*(p + 2) == 0x00) && (*(p + 3) == 0x01)) { // Linux cooked capture v1 layer // It's up to the user to know the protocol (IPv4/IPv6) and the source MAC address loggers::get_instance().log_to_hexa("Skipping Linux PCAP header.", data); loggers::get_instance().log_to_hexa("Skipping Linux v1 PCAP header.", data); data = OCTETSTRING(data.lengthof() - 16, 16 + static_cast<const uint8_t*>(data)); } else if ((*p == 0x08) && (*(p + 1) == 0x00) && (*(p + 2) == 0x00) && (*(p + 3) == 0x00)) { // Linux cooked capture v2 layer // It's up to the user to know the protocol (IPv4/IPv6) and the source MAC address loggers::get_instance().log_to_hexa("Skipping Linux v2 PCAP header.", data); data = OCTETSTRING(data.lengthof() - 20, 20 + static_cast<const uint8_t*>(data)); } // Pass the packet to the upper layers Loading Loading
ccsrc/Protocols/Pcap/pcap_offline_layer.cc +6 −5 Original line number Diff line number Diff line Loading @@ -210,13 +210,14 @@ void pcap_offline_layer::receive_data(OCTETSTRING &data, params ¶ms) { loggers::get_instance().log(">>> pcap_offline_layer::receive_data: Received %d bytes", data.lengthof()); const uint8_t *p = static_cast<const uint8_t*>(data); if ( ((*p == 0x00) && (*(p + 1) == 0x04) && (*(p + 2) == 0x00) && (*(p + 3) == 0x01)) || // Linux cooked capture v1 layer ((*p == 0x08) && (*(p + 1) == 0x00) && (*(p + 2) == 0x00) && (*(p + 3) == 0x010)) // Linux cooked capture v2 layer ) { if ((*p == 0x00) && (*(p + 1) == 0x04) && (*(p + 2) == 0x00) && (*(p + 3) == 0x01)) { // Linux cooked capture v1 layer // It's up to the user to know the protocol (IPv4/IPv6) and the source MAC address loggers::get_instance().log_to_hexa("Skipping Linux PCAP header.", data); loggers::get_instance().log_to_hexa("Skipping Linux v1 PCAP header.", data); data = OCTETSTRING(data.lengthof() - 16, 16 + static_cast<const uint8_t*>(data)); } else if ((*p == 0x08) && (*(p + 1) == 0x00) && (*(p + 2) == 0x00) && (*(p + 3) == 0x00)) { // Linux cooked capture v2 layer // It's up to the user to know the protocol (IPv4/IPv6) and the source MAC address loggers::get_instance().log_to_hexa("Skipping Linux v2 PCAP header.", data); data = OCTETSTRING(data.lengthof() - 20, 20 + static_cast<const uint8_t*>(data)); } // Pass the packet to the upper layers Loading