Add correct parsers

This commit is contained in:
Nico Schottelius 2019-07-29 16:29:12 +02:00
parent 0c68b1b82c
commit 597d10b33f
4 changed files with 59 additions and 10 deletions

View File

@ -4112,7 +4112,7 @@ Fragmented ICMP/ICMPv6 packets will not be translated by IP/ICMP translators.
**** TODO Security issue: not checking checksums before
- Could be implemented
** Log various
** TODO Log various
*** 2019-06-06
No device seen after loading modules after reboot - netfpga.
Trying to reprogram
@ -8028,8 +8028,29 @@ netpfga_dummy.p4(20): warning: >>: shifting value with 8 bits by 11
netpfga_dummy.p4(20): warning: >>: shifting value with 8 bits by 11
sume_metadata.dst_port = (bit<8>) hdr.ethernet.ethertype >> 11;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
*** TODO 2019-07-29: set egress based on
*** TODO 2019-07-29: set egress based on v4/v6 header: v7.1
**** ipv4: no output anywhere (only sent package seen)
**** ipv6: no output anywhere (only sent package seen)
**** arp: no output anywhere (only sent package seen)
**** log
#+BEGIN_CENTER
nico@ESPRIMO-P956:~$ sudo tcpdump -lni enp2s0f1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp2s0f1, link-type EN10MB (Ethernet), capture size 262144 bytes
16:17:23.691885 IP 10.0.0.200 > 10.0.0.1: ICMP echo request, id 16038, seq 1, length 64
16:17:24.710323 IP 10.0.0.200 > 10.0.0.1: ICMP echo request, id 16038, seq 2, length 64
16:18:16.198657 IP6 2001:db8:42::42 > 2001:db8:42::1: ICMP6, echo request, seq 1, length 64
16:18:17.222343 IP6 2001:db8:42::42 > 2001:db8:42::1: ICMP6, echo request, seq 2, length 64
16:20:25.296638 IP6 2001:db8:42::42 > ff02::1:ff00:6000: ICMP6, neighbor solicitation, who has 2001:db8:42::6000, length 32
16:20:26.310284 IP6 2001:db8:42::42 > ff02::1:ff00:6000: ICMP6, neighbor solicitation, who has 2001:db8:42::6000, length 32
16:20:27.334276 IP6 2001:db8:42::42 > ff02::1:ff00:6000: ICMP6, neighbor solicitation, who has 2001:db8:42::6000, length 32
16:20:37.660293 ARP, Request who-has 10.0.0.250 tell 10.0.0.200, length 28
16:20:38.662166 ARP, Request who-has 10.0.0.250 tell 10.0.0.200, length 28
16:20:39.686165 ARP, Request who-has 10.0.0.250 tell 10.0.0.200, length 28
#+END_CENTER
**** 2019-07-29: found bug in PARSER!!!!
** The NetPFGA saga
Problems encountered:
- The logfile for a compile run is 10k+ lines

View File

@ -0,0 +1,12 @@
#ifndef PORT_BY_IP_ENDING
#define PORT_BY_IP_ENDING
if(hdr.ipv6.isValid()) {
set_egress_port((bit<8>) (hdr.ipv6.dst_addr & 0xff));
}
if(hdr.ipv4.isValid()) {
set_egress_port((bit<8>) (hdr.ipv4.dst_addr & 0xff));
}
#endif

View File

@ -20,12 +20,15 @@ parser RealParser(
out digest_data_t digest_data,
inout sume_metadata_t standard_metadata) {
state start {
packet.extract(hdr.ethernet);
// meta.unused = 0;
digest_data.unused = 0;
transition accept;
}
#include "parsers.p4"
// state start {
// packet.extract(hdr.ethernet);
// digest_data.unused = 0;
// transition accept;
// }
}
@Xilinx_MaxPacketRegion(1024)
@ -90,6 +93,16 @@ control TopPipe(
* Deparser
*/
control RealDeParser(
packet_out packet,
in Parsed_packet hdr,
in user_metadata_t meta,
inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) {
#include "deparser.p4"
}
@Xilinx_MaxPacketRegion(1024)
control TopDeparser(
packet_out b,
@ -98,9 +111,12 @@ control TopDeparser(
inout digest_data_t digest_data,
inout sume_metadata_t sume_metadata) {
RealDeParser() realdeparser;
apply {
b.emit(p.ethernet);
realdeparser.apply(b, p, user_metadata, digest_data, sume_metadata);
}
}
/********************************************************************************

View File

@ -17,7 +17,7 @@
meta.v6sum = 0;
meta.headerdiff = 0;
#ifdef _SUME_SWITCH_P4_
#ifdef _SUME_SWITCH_P4_
digest_data.unused = 0; /* avoid compiler warning */
#endif