Change protocol in case of icmp6->icmp

This commit is contained in:
Nico Schottelius 2019-03-27 13:49:39 +01:00
parent b12388c7e5
commit e349de5859
2 changed files with 23 additions and 6 deletions

View file

@ -467,7 +467,7 @@ DEBUG:main:v6 reassambled=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00:01 ty
debugging MIGHT come from nat64 table!
**** DONE Add table name support in debug messages
**** TODO Why getting IPv6 packets in
**** DONE Why getting IPv6 packets in
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=fe80::200:aff:fe00:1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x37df res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_V6_NETWORKS
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=fe80::200:aff:fe00:1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x37df res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_V6_NETWORKS
INFO:main:unhandled reassambled=<Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x86dd |<IPv6 version=6 tc=0 fl=0 plen=32 nh=ICMPv6 hlim=255 src=2001:db8::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0x13a7 res=0 tgt=2001:db8::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>> from table TABLE_NAT64
@ -475,7 +475,13 @@ INFO:main:unhandled reassambled=<Ether dst=00:00:0a:00:00:42 src=00:00:0a:00:00
**** TODO Solve logic problem: Valid headers
- If ipv6 header is valid && nat64 will be made and afterwards v4 egress needs to be applied
- If ipv4 header is valid && nat46 will be made and afterwards v6 egress needs to be applied
**** TODO Check translated fields
***** DONE source correctly translated to 10.1.1.1
***** DONE destination correctly translated to 10.0.0.1 -> pings h3
***** DONE egress is correct, comes out at h3
***** TODO protocol 58 is wrong -> should be 1
**** TODO transform protocol specific: icmp6 -> icmp
**** TODO transform protocol specific: icmp -> icmp6
**** TODO Make switch answer IPv4 icmp echo request for
**** TODO Add / check default route for v4 hosts
*** TODO Get p4 VM / vagrant running

View file

@ -71,11 +71,25 @@ control MyIngress(inout headers hdr,
hdr.ipv4.src_addr = src;
hdr.ipv4.ttl = hdr.ipv6.hop_limit;
hdr.ipv4.protocol = hdr.ipv6.next_header;
switch(hdr.ipv6.next_header) {
PROTO_ICMP6: {
nat64_icmp6;
}
}
hdr.ipv6.setInvalid();
}
action nat64_icmp6()
{
hdr.ipv4.protocol = PROTO_ICMP; // overwrite generic same protocol assumption
}
/* NAT46: protocol unspecific changes */
action nat46_generic(ipv6_addr_t src, ipv6_addr_t dst) {
hdr.ipv6.setValid();
@ -384,6 +398,3 @@ MyEgress(),
MyComputeChecksum(),
MyDeparser()
) main;
// truncate((bit<32>)22); //ether+cpu header