Browse Source

Correct state parser to match on icmp6.type

master
Nico Schottelius 3 years ago
parent
commit
39c280cd33
  1. 27
      p4src/parsers.p4
  2. 1
      p4src/static-mapping.p4
  3. 0
      pcap/switch-ping6-2019-03-23-1321-h1.pcap

27
p4src/parsers.p4

@ -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;
}
}

1
p4src/static-mapping.p4

@ -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);

0
pcap/ndp-switch-2019-03-23-1321-h1.pcap → pcap/switch-ping6-2019-03-23-1321-h1.pcap

Loading…
Cancel
Save