- Timestamp:
- 01/14/19 17:36:22 (2 years ago)
- Branches:
- develop
- Children:
- 063d5dd
- Parents:
- 2f9b609
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/protocols_l2.c
r2f9b609 r385678b 588 588 return NULL; 589 589 } 590 590 591 if (link == NULL) { 592 return NULL; 593 } 594 591 595 switch(linktype) { 592 596 /* Packet Metadata headers, not layer2 headers */ … … 618 622 return trace_get_payload_from_ethernet(link,ethertype,remaining); 619 623 case TRACE_TYPE_NONE: 624 if (*remaining == 0) { 625 return NULL; 626 } 627 620 628 if ((*(char*)link&0xF0) == 0x40) 621 629 *ethertype=TRACE_ETHERTYPE_IP; /* IPv4 */ 622 630 else if ((*(char*)link&0xF0) == 0x60) 623 631 *ethertype=TRACE_ETHERTYPE_IPV6; /* IPv6 */ 632 else 633 return NULL; /* No idea */ 624 634 return link; /* I love the simplicity */ 625 635 case TRACE_TYPE_PPP: … … 646 656 647 657 case TRACE_TYPE_OPENBSD_LOOP: 658 if (*remaining <= 4) { 659 return NULL; 660 } 648 661 link = link + 4; /* Loopback header is 4 bytes */ 649 662 if ((*(char*)link&0xF0) == 0x40) … … 651 664 else if ((*(char*)link&0xF0) == 0x60) 652 665 *ethertype=TRACE_ETHERTYPE_IPV6; /* IPv6 */ 666 else 667 return NULL; 653 668 return link; /* I love the simplicity */ 654 669
Note: See TracChangeset
for help on using the changeset viewer.