MCPcopy Create free account
hub / github.com/F-Stack/f-stack / hash_pkt

Function hash_pkt

freebsd/netinet/siftr.c:638–666  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638static uint32_t
639hash_pkt(struct mbuf *m, uint32_t offset)
640{
641 uint32_t hash;
642
643 hash = 0;
644
645 while (m != NULL && offset > m->m_len) {
646 /*
647 * The IP packet payload does not start in this mbuf, so
648 * need to figure out which mbuf it starts in and what offset
649 * into the mbuf's data region the payload starts at.
650 */
651 offset -= m->m_len;
652 m = m->m_next;
653 }
654
655 while (m != NULL) {
656 /* Ensure there is data in the mbuf */
657 if ((m->m_len - offset) > 0)
658 hash = hash32_buf(m->m_data + offset,
659 m->m_len - offset, hash);
660
661 m = m->m_next;
662 offset = 0;
663 }
664
665 return (hash);
666}
667
668/*
669 * Check if a given mbuf has the SIFTR mbuf tag. If it does, log the fact that

Callers 1

siftr_chkpktFunction · 0.85

Calls 1

hash32_bufFunction · 0.85

Tested by

no test coverage detected