Browse Source

++documentation

master
Nico Schottelius 3 years ago
parent
commit
7c42eefd40
  1. 20
      bin/gen_nat64_table_entries.py
  2. 2
      bin/socat-connect-tcp-v4
  3. 2
      bin/socat-listen-tcp-v4
  4. 2
      bin/socat-listen-tcp-v6
  5. 12
      doc/appendix.tex
  6. 43
      doc/plan.org
  7. 8
      p4src/minip4_solution.p4

20
bin/gen_nat64_table_entries.py

@ -0,0 +1,20 @@
#!/bin/sh
cat <<EOF
table_cam_add_entry realmain_v4_networks_0 realmain.set_egress_port 167772202 => 16 0 0 0 0
table_cam_add_entry realmain_v4_networks_0 realmain.set_egress_port 167772164 => 16 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434182 => 64 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477184434242 => 64 0 0 0 0
table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477352206378 => 64 0 0 0 0
# 2001:db8:42:2a to be translated to 10.0.0.42:
table_cam_add_entry realmain_nat64_0 realmain.nat64_static 42540766411362381960998550477184434218 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
# 2001:db8:42::a00:2a to 10.0.0.42
table_cam_add_entry realmain_nat64_0 realmain.nat64_static 42540766411362381960998550477352206378 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
# 10.0.0.66 to be translated to 2001:db8:42:42
table_cam_add_entry realmain_nat46_0 realmain.nat46_static 167772226 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
EOF

2
bin/socat-connect-tcp-v4

@ -1,3 +1,3 @@
#!/bin/sh
set -x
echo from-v4-ok | socat - TCP:10.0.0.66:2345

2
bin/socat-listen-tcp-v4

@ -1,3 +1,3 @@
#!/bin/sh
set -x
echo TCPv4-ok | socat - TCP-LISTEN:2345

2
bin/socat-listen-tcp-v6

@ -1,3 +1,3 @@
#!/bin/sh
set -x
echo TCPv6-ok | socat - TCP6-LISTEN:2345

12
doc/appendix.tex

@ -244,6 +244,12 @@ success
\end{verbatim}
Add table entry for 2001:db8:42::a00:2a to be translated to 10.0.0.66:
\begin{verbatim}
\end{verbatim}
Add table entry for 10.0.0.66 to be translated to 2001:db8:42:42:
\begin{verbatim}
@ -275,8 +281,10 @@ success
Step 3: setting neighbor entries
\begin{verbatim}
root@ESPRIMO-P956:~# ip neigh add 10.0.0.66 lladdr f8:f2:1e:09:62:d1 dev enp2s0f0
nico@ESPRIMO-P956:~$ sudo ip -6 neigh add 2001:db8:42::2a lladdr f8:f2:1e:09:62:d0 dev enp2s0f1
sudo ip neigh add 10.0.0.66 lladdr f8:f2:1e:09:62:d1 dev enp2s0f0
sudo ip -6 neigh add 2001:db8:42::2a lladdr f8:f2:1e:09:62:d0 dev enp2s0f1
sudo ip -6 neighbor add 2001:db8:42::a00:2a lladdr f8:f2:1e:09:62:d0 dev enp2s0f1
\end{verbatim}
Step 4: ping test should translate, but fail with wrong checksum:

43
doc/plan.org

@ -8091,7 +8091,8 @@ It works!!!!!
*** DONE 2019-07-29: documentation: `portland.sty' not found: removed include
CLOSED: [2019-07-29 Mon 20:27]
*** TODO 2019-07-31: Test final NAT64 code: v6 egress
*** DONE 2019-07-31: Test final NAT64 code: v6,v4 egress: working
CLOSED: [2019-08-01 Thu 21:09]
#+BEGIN_CENTER
>>> int(ipaddress.IPv6Address(u"2001:db8:42::70b4"))
42540766411362381960998550477184463028L
@ -8221,8 +8222,48 @@ success
>>
#+END_CENTER
*** DONE 2019-08-01: trying tcp connect from v4 to v6: missing NDP
CLOSED: [2019-08-01 Thu 21:08]
#+BEGIN_CENTER
nico@ESPRIMO-P956:~/master-thesis/bin$ ./socat-connect-tcp-v4
nico@ESPRIMO-P956:~/master-thesis/bin$ ./socat-listen-tcp-v6
nico@ESPRIMO-P956:~$ sudo tcpdump -ni enp2s0f1
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp2s0f1, link-type EN10MB (Ethernet), capture size 262144 bytes
21:07:18.187732 IP6 2001:db8:42::a00:2a.47214 > 2001:db8:42::42.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,$
ackOK,TS val 1139415246 ecr 0,nop,wscale 7], length 0
21:07:18.187785 IP6 2001:db8:42::42 > ff02::1:ff00:2a: ICMP6, neighbor solicitation, who has 2001:db8:42::a00:2a, length 32
21:07:19.206272 IP6 2001:db8:42::42 > ff02::1:ff00:2a: ICMP6, neighbor solicitation, who has 2001:db8:42::a00:2a, length 32
21:07:19.206382 IP6 2001:db8:42::a00:2a.47214 > 2001:db8:42::42.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,$
ackOK,TS val 1139416265 ecr 0,nop,wscale 7], length 0
21:07:20.230196 IP6 2001:db8:42::42 > ff02::1:ff00:2a: ICMP6, neighbor solicitation, who has 2001:db8:42::a00:2a, length 32
21:07:21.222351 IP6 2001:db8:42::a00:2a.47214 > 2001:db8:42::42.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,s
ackOK,TS val 1139418281 ecr 0,nop,wscale 7], length 0
nico@ESPRIMO-P956:~$ sudo tcpdump -ni enp2s0f0 [3/838]tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp2s0f0, link-type EN10MB (Ethernet), capture size 262144 bytes
21:07:18.187648 IP 10.0.0.42.47214 > 10.0.0.66.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,sackOK,TS val 113$
415246 ecr 0,nop,wscale 7], length 0
21:07:19.206330 IP 10.0.0.42.47214 > 10.0.0.66.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,sackOK,TS val 113$
416265 ecr 0,nop,wscale 7], length 0
21:07:21.222273 IP 10.0.0.42.47214 > 10.0.0.66.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,sackOK,TS val 113$
418281 ecr 0,nop,wscale 7], length 0
21:07:25.318332 IP 10.0.0.42.47214 > 10.0.0.66.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,sackOK,TS val 113$
422377 ecr 0,nop,wscale 7], length 0
21:07:33.510274 IP 10.0.0.42.47214 > 10.0.0.66.2345: Flags [S], seq 1223033717, win 29200, options [mss 1460,sackOK,TS val 1139
430569 ecr 0,nop,wscale 7], length 0
^C
#+END_CENTER
*** DONE 2019-08-02: add reverse NAT64 entry
CLOSED: [2019-08-02 Fri 10:19]
#+BEGIN_CENTER
table_cam_add_entry realmain_nat64_0 realmain.nat64_static 42540766411362381960998550477352206378 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
#+END_CENTER
*** TODO 2019-08-02: ipv4 checksum after nat64 is empty!
** The NetPFGA saga
Problems encountered:
- The logfile for a compile run is 10k+ lines

8
p4src/minip4_solution.p4

@ -2,6 +2,7 @@
#include <sume_switch.p4>
#include "headers.p4"
#define Parsed_packet headers
#define user_metadata_t metadata
@ -22,13 +23,6 @@ parser RealParser(
#include "parsers.p4"
// state start {
// packet.extract(hdr.ethernet);
// digest_data.unused = 0;
// transition accept;
// }
}
@Xilinx_MaxPacketRegion(1024)

Loading…
Cancel
Save