Browse Source

Add socat helper scripts

master
Nico Schottelius 3 years ago
parent
commit
955985528c
  1. 3
      bin/socat-connect-tcp-v4
  2. 3
      bin/socat-listen-tcp-v4
  3. 3
      bin/socat-listen-tcp-v6
  4. 2
      doc/Results.tex
  5. 103
      doc/appendix.tex
  6. 80
      doc/plan.org

3
bin/socat-connect-tcp-v4

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

3
bin/socat-listen-tcp-v4

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

3
bin/socat-listen-tcp-v6

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

2
doc/Results.tex

@ -38,6 +38,8 @@ Unclear errors: broken board
Due to the very fragile nature of the build framework from the
NetFPGA-Live repository,
Renaming VARIABLES in the definition of
Reproducibility:
\section{\label{Results:P4}P4}

103
doc/appendix.tex

@ -32,7 +32,7 @@ For all test cases the following network settings on esprimo:
\end{verbatim}
\subsection{Test 1: IPv4 egress settings work}
Scenario: simple egress port setting
Scenario: simple egress port setting for the IPv4 addresses
Step 1: getting correct values for table entries from python:
@ -189,6 +189,107 @@ listening on enp2s0f1, link-type EN10MB (Ethernet), capture size 262144 bytes
Result: success, packet is seen twice.
% ------------------------------------------------------------------------------
\subsection{Test 3: NAT64}
Additionally to the preparations done in test 1 and 2, the following
steps were taken:
Step 1: getting IP address values via Python
\begin{verbatim}
>>> int(ipaddress.IPv6Address(u"2001:db8:42::2a"))
42540766411362381960998550477184434218L
>>> int(ipaddress.IPv6Address(u"2001:db8:42::"))
42540766411362381960998550477184434176L
>>> int(ipaddress.IPv4Address(u"10.0.0.0"))
167772160
>>> int(ipaddress.IPv4Address(u"10.0.0.66"))
167772226
\end{verbatim}
Add table entry for 2001:db8:42:2a to be translated to 10.0.0.42:
\begin{verbatim}
>> table_cam_add_entry realmain_nat64_0 realmain.nat64_static 42540766411362381960998550477184434218 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
fields = [(u'hit', 1), (u'action_run', 3), (u'v6_src', 128), (u'v4_dst', 32), (u'nat64_prefix', 128), (u'table_id', 16)]
action_name = TopPipe.realmain.nat64_static
field_vals = [2, '42540766411362381960998550477184434176', '167772160', '42540766411362381960998550477184434176', '0']
CAM_Init_ValidateContext() - done
WROTE 0x44020050 = 0x002a
WROTE 0x44020054 = 0x0000
WROTE 0x44020058 = 0x420000
WROTE 0x4402005c = 0x20010db8
WROTE 0x44020080 = 0x0000
WROTE 0x44020084 = 0x0000
WROTE 0x44020088 = 0x0000
WROTE 0x4402008c = 0xdb80042
WROTE 0x44020090 = 0x2001
WROTE 0x44020094 = 0x0a00
WROTE 0x44020098 = 0x0000
WROTE 0x4402009c = 0x0000
WROTE 0x440200a0 = 0xdb80042
WROTE 0x440200a4 = 0x22001
READ 0x44020044 = 0x0001
WROTE 0x44020040 = 0x0001
READ 0x44020044 = 0x0001
READ 0x44020044 = 0x0001
success
>>
\end{verbatim}
Add table entry for 10.0.0.66 to be translated to 2001:db8:42:42:
\begin{verbatim}
>> table_cam_add_entry realmain_nat46_0 realmain.nat46_static 167772226 => 42540766411362381960998550477184434176 167772160 42540766411362381960998550477184434176 0
fields = [(u'hit', 1), (u'action_run', 3), (u'v6_src', 128), (u'v4_dst', 32), (u'nat64_prefix', 128), (u'table_id', 16)]
action_name = TopPipe.realmain.nat46_static
field_vals = [2, '42540766411362381960998550477184434176', '167772160', '42540766411362381960998550477184434176', '0']
CAM_Init_ValidateContext() - done
WROTE 0x44020150 = 0xa000042
WROTE 0x44020180 = 0x0000
WROTE 0x44020184 = 0x0000
WROTE 0x44020188 = 0x0000
WROTE 0x4402018c = 0xdb80042
WROTE 0x44020190 = 0x2001
WROTE 0x44020194 = 0x0a00
WROTE 0x44020198 = 0x0000
WROTE 0x4402019c = 0x0000
WROTE 0x440201a0 = 0xdb80042
WROTE 0x440201a4 = 0x22001
READ 0x44020144 = 0x0001
WROTE 0x44020140 = 0x0001
READ 0x44020144 = 0x0001
READ 0x44020144 = 0x0001
success
>>
\end{verbatim}
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
\end{verbatim}
Step 4: ping test should translate, but fail with wrong checksum:
\begin{verbatim}
\end{verbatim}
\begin{verbatim}
\end{verbatim}
\chapter{\label{appendixB}Appendix B?}

80
doc/plan.org

@ -8143,8 +8143,86 @@ success
#+END_CENTER
*** 2019-07-31: reading about \verb vs. \texttt
*** DONE 2019-07-31: reading about \verb vs. \texttt -> changing font sizes
CLOSED: [2019-08-01 Thu 11:40]
- probably want \verb, but cannot use in \newcommand
*** DONE 2019-08-01: Setting up NAT64 on NetPFGA: not working
CLOSED: [2019-08-01 Thu 20:42]
- table settings see appendix
Testing ping:
#+BEGIN_CENTER
nico@ESPRIMO-P956:~$ ping6 -c2 2001:db8:42::2a
PING 2001:db8:42::2a(2001:db8:42::2a) 56 data bytes
#+END_CENTER
Not seeing any packets on the translated side
testing from v4 to v6 seems to work:
#+BEGIN_CENTER
nico@ESPRIMO-P956:~$ ping -c2 10.0.0.66
PING 10.0.0.66 (10.0.0.66) 56(84) bytes of data.
--- 10.0.0.66 ping statistics ---
2 packets transmitted, 0 received, 100% packet loss, time 1015ms
nico@ESPRIMO-P956:~$
#+END_CENTER
Outgoing interface
#+BEGIN_CENTER
20:52:29.518980 IP 10.0.0.42 > 10.0.0.66: ICMP echo request, id 13302, seq 1, length 64
20:52:30.534323 IP 10.0.0.42 > 10.0.0.66: ICMP echo request, id 13302, seq 2, length 64
#+END_CENTER
Incoming interface
#+BEGIN_CENTER
20:52:29.519021 IP6 2001:db8:42::a00:2a > 2001:db8:42::42: ICMP6, echo request, seq 1, length 64
20:52:30.534394 IP6 2001:db8:42::a00:2a > 2001:db8:42::42: ICMP6, echo request, seq 2, length 64
#+END_CENTER
THIS is actually the ipv4 source address:
#+BEGIN_CENTER
>>> int(ipaddress.IPv6Address(u"2001:db8:42::a00:2a"))
42540766411362381960998550477352206378L
#+END_CENTER
Adding new table entry:
#+BEGIN_CENTER
>> table_cam_add_entry realmain_v6_networks_0 realmain.set_egress_port 42540766411362381960998550477352206378 => 64 0 0 0 0
fields = [(u'hit', 1), (u'action_run', 3), (u'out_port', 8), (u'out_port', 8), (u'mac_addr', 48), (u'task', 16), (u'table_id', 16)]
action_name = TopPipe.realmain.set_egress_port
field_vals = [1, '64', '0', '0', '0', '0']
CAM_Init_ValidateContext() - done
WROTE 0x44020350 = 0xa00002a
WROTE 0x44020354 = 0x0000
WROTE 0x44020358 = 0x420000
WROTE 0x4402035c = 0x20010db8
WROTE 0x44020380 = 0x0000
WROTE 0x44020384 = 0x0000
WROTE 0x44020388 = 0x40000000
WROTE 0x4402038c = 0x0001
READ 0x44020344 = 0x0001
WROTE 0x44020340 = 0x0001
READ 0x44020344 = 0x0001
READ 0x44020344 = 0x0001
success
>>
#+END_CENTER
** The NetPFGA saga
Problems encountered:
- The logfile for a compile run is 10k+ lines

Loading…
Cancel
Save