+headers +parsers [udp, icmp, icmp6]

This commit is contained in:
Nico Schottelius 2019-02-22 00:01:53 +01:00
commit 214ccd4479
3 changed files with 49 additions and 3 deletions

View file

@ -26,7 +26,10 @@ parser MyParser(packet_in packet,
meta.tcp_length = hdr.ipv4.totalLen - 16w20;
transition select(hdr.ipv4.protocol){
TYPE_TCP: tcp;
PROTO_TCP: tcp;
PROTO_UDP: udp;
PROTO_ICMP: icmp;
default: accept;
}
}
@ -36,16 +39,34 @@ parser MyParser(packet_in packet,
meta.tcp_length = hdr.ipv6.payload_length;
transition select(hdr.ipv6.next_header){
TYPE_TCP: tcp;
PROTO_TCP: tcp;
PROTO_UDP: udp;
PROTO_ICMP6: icmp6;
default: accept;
}
}
/* Leaf */
state tcp {
packet.extract(hdr.tcp);
transition accept;
}
state udp {
packet.extract(hdr.udp);
transition accept;
}
state icmp6 {
packet.extract(hdr.icmp6);
transition accept;
}
state icmp {
packet.extract(hdr.icmp);
transition accept;
}
}
/*************************************************************************