Add tcp_length

This commit is contained in:
Nico Schottelius 2019-02-21 23:27:55 +01:00
parent 64109ce917
commit b795374efb
2 changed files with 3 additions and 2 deletions

View file

@ -79,6 +79,7 @@ struct headers {
}
struct metadata {
bit<16> tcp_length;
}
#endif

View file

@ -23,7 +23,7 @@ parser MyParser(packet_in packet,
state ipv4 {
packet.extract(hdr.ipv4);
meta.tcpLength = hdr.ipv4.totalLen - 16w20;
meta.tcp_length = hdr.ipv4.totalLen - 16w20;
transition select(hdr.ipv4.protocol){
TYPE_TCP: tcp;
@ -33,7 +33,7 @@ parser MyParser(packet_in packet,
state ipv6 {
packet.extract(hdr.ipv6);
meta.tcpLength = hdr.ipv6.payload_length;
meta.tcp_length = hdr.ipv6.payload_length;
transition select(hdr.ipv6.next_header){
TYPE_TCP: tcp;