Correct state parser to match on icmp6.type

This commit is contained in:
Nico Schottelius 2019-03-23 14:30:20 +01:00
parent 68bb8e9edd
commit 39c280cd33
3 changed files with 14 additions and 14 deletions

View file

@ -8,15 +8,16 @@
#include "headers.p4"
parser MyParser(packet_in packet,
out headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
out headers hdr,
inout metadata meta,
inout standard_metadata_t standard_metadata) {
state start {
packet.extract(hdr.ethernet);
transition select(hdr.ethernet.ethertype){
TYPE_IPV4: ipv4;
TYPE_IPV6: ipv6;
default: accept;
}
}
@ -48,7 +49,7 @@ parser MyParser(packet_in packet,
state icmp6 {
packet.extract(hdr.icmp6);
transition select(hdr.ipv6.next_header){
transition select(hdr.icmp6.type) {
ICMP6_NS: icmp6_neighbor_solicitation;
default: accept;
}
@ -66,23 +67,23 @@ parser MyParser(packet_in packet,
/* Leaf */
state tcp {
packet.extract(hdr.tcp);
transition accept;
packet.extract(hdr.tcp);
transition accept;
}
state udp {
packet.extract(hdr.udp);
transition accept;
packet.extract(hdr.udp);
transition accept;
}
// state icmp6 {
// packet.extract(hdr.icmp6);
// transition accept;
// }
// packet.extract(hdr.icmp6);
// transition accept;
// }
state icmp {
packet.extract(hdr.icmp);
transition accept;
packet.extract(hdr.icmp);
transition accept;
}
}

View file

@ -67,7 +67,6 @@ control MyIngress(inout headers hdr,
hdr.icmp6_option_link_layer_addr.ll_length = 1; /* 1* 64 bit */
hdr.icmp6_option_link_layer_addr.mac_addr = mac_addr;
/* version1: rebuilding packet */
/*
truncate((bit<32>)(112 + 320 + 32)/8);