Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/sflowtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,26 @@ static void decodeLinkLayer(SFSample *sample)
sample->s.gotIPV6 = YES;
sample->s.offsetToIPV6 = (ptr - start);
}

if(type_len == 0x8847) {
/* MPLS unicast - 4 bytes */
ptr += 4;
/* look at first byte of possible IP header.... */
if((*ptr >> 4) == 4) {
/* IPV4 - check again that we have enough header bytes */
if((end - ptr) < sizeof(struct myiphdr)) return;
if((*ptr & 15) < 5) return; /* not IP (hdr len must be 5 quads or more) */
/* survived all the tests - store the offset to the start of the ip header */
sample->s.gotIPV4 = YES;
sample->s.offsetToIPV4 = (ptr - start);
}
else if((*ptr >> 4) == 6) {
/* IPV6 */
/* survived all the tests - store the offset to the start of the ip6 header */
sample->s.gotIPV6 = YES;
sample->s.offsetToIPV6 = (ptr - start);
}
}
}

/*_________________---------------------------__________________
Expand Down