Skip to content

Commit

Permalink
fix: moving link extracting counter to the class
Browse files Browse the repository at this point in the history
  • Loading branch information
optdcw committed Oct 29, 2023
1 parent e0fe351 commit b2b6c84
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions input/ndp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ __attribute__((constructor)) static void register_this_plugin()
register_plugin(&rec);
}

uint64_t le48toh(uint8_t *data) {
uint64_t le48toh(const uint8_t *data) {
uint64_t result = ((uint64_t)data[5] << 40) |
((uint64_t)data[4] << 32) |
((uint64_t)data[3] << 24) |
Expand All @@ -62,9 +62,6 @@ void packet_ndp_handler(parser_opt_t *opt, const struct ndp_packet *ndp_packet,
#endif
ts.tv_sec = le32toh(ndp_header->timestamp_sec);
ts.tv_usec = le32toh(ndp_header->timestamp_nsec) / 1000;
if(m_index_reserved) {
opt->link_index = le48toh(ndp_header->reserved);
}

Packet *pkt = parse_packet(opt, ts, ndp_packet->data, ndp_packet->data_length, ndp_packet->data_length);
if(pkt) {
Expand Down Expand Up @@ -132,6 +129,10 @@ InputPlugin::Result NdpPacketReader::get(PacketBlock &packets)
read_pkts++;

/* Counter for input channel */
opt.link_index = 0;
if(m_index_reserved) {
opt.link_index = le48toh(ndp_header->reserved);
}
packet_ndp_handler(&opt, ndp_packet, ndp_header);
}

Expand Down

0 comments on commit b2b6c84

Please sign in to comment.