| 636 | } |
| 637 | |
| 638 | static uint32_t |
| 639 | hash_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 |
no test coverage detected