Simplify MPLS analysis.

This commit is contained in:
Jan Grashoefer 2020-09-01 13:22:05 +02:00 committed by Tim Wojtulewicz
parent 38337d799b
commit 3f3f00030d
7 changed files with 27 additions and 35 deletions

View file

@ -28,28 +28,6 @@ bool MPLSAnalyzer::AnalyzePacket(size_t len, const uint8_t* data, Packet* packet
}
// According to RFC3032 the encapsulated protocol is not encoded.
// We assume that what remains is IP.
//TODO: Make that configurable
if ( sizeof(struct ip) >= len )
{
packet->Weird("no_ip_in_mpls_payload");
return false;
}
auto ip = (const struct ip*)data;
if ( ip->ip_v == 4 )
packet->l3_proto = L3_IPV4;
else if ( ip->ip_v == 6 )
packet->l3_proto = L3_IPV6;
else
{
// Neither IPv4 nor IPv6.
packet->Weird("no_ip_in_mpls_payload");
return false;
}
packet->hdr_size = (data - packet->data);
packet->session_analysis = true;
return true;
// We use the configured default analyzer.
return ForwardPacket(len, data, packet);
}