diff --git a/doc/plan.org b/doc/plan.org index c951497..62cd5df 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -98,12 +98,21 @@ | | * Send recap / mail next week | | | | * week after 1130 Thursday | | | | | | +| 2019-03-07 | ICMP6 checksumming works!!! | x | +| | -> more fields needed to be included! | | | | | | -| 2019-03-08 | NAT64 1:1 table ICMP, ICMPv6 working | | +| 2019-03-13 | Tried/trying to get vagrant VM or P4* running on the notebook | | +| | | | +| 2019-03-14 | NAT64 static rewrite | | +| | - table support | | +| | - checksum not yet ported for translations | | +| | | | +| | | | +| 2019-03-30 | NAT64 1:1 table ICMP, ICMPv6 working | | | | Will need some switch local ip addresses | | | | | | | | | | -| 2019-03-15 | NAT64 1:1 table TCP/UDP working | | +| 2019-04-12 | NAT64 1:1 table TCP/UDP working | | | | | | | | | | | 2019-03-29 | Jool SIIT / range / offset support https://www.jool.mx/en/run-vanilla.html | | @@ -145,6 +154,440 @@ *** DONE Setup P4 base / structure *** DONE Create minimal controller for populating tables *** DONE Checkout / review egress settings +*** TODO Get p4 VM / vagrant running +**** DONE install libvirtd-daemon +**** DONE install ebtables +**** DONE install dnsmasq +*** TODO Get p4c & co. running on the notebook +**** DONE mininet via packages +**** DONE p4c +(virtualenv-with-site) [17:43] line:build% make install +[ 0%] Built target update_includes +[ 0%] Built target linkgraphs +[ 0%] Built target linkbmv2 +[ 0%] Built target linkp4cebpf +[ 0%] Built target linkp4test +[ 1%] Built target p4c_driver +[ 4%] Built target p4ctoolkit +[ 12%] Built target irgenerator +[ 14%] Generating IR class files +[ 14%] Built target genIR +[ 18%] Built target ir +[ 18%] Built target mkv1dirs +[ 18%] Built target mkp4dirs +[ 45%] Built target frontend +[ 51%] Built target midend +[ 51%] Built target mkP4configdir +[ 64%] Built target controlplane +[ 68%] Built target bmv2backend +[ 75%] Built target p4c-bm2-psa +[ 81%] Built target p4c-bm2-ss +[ 84%] Built target p4c-ebpf +[ 87%] Built target p4test +[ 90%] Built target p4c-graphs +[ 93%] Built target gtest +[100%] Built target gtestp4c +Install the project... +-- Install configuration: "RELEASE" +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include/p4d2model.p4 +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include/v1model.p4 +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include/core.p4 +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include/psa.p4 +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4c +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/driver.py +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/util.py +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/config.py +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/__init__.py +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/main.py +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/p4c.bmv2.cfg +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4c_src/p4c.ebpf.cfg +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4c-bm2-ss +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4c-bm2-psa +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4c-ebpf +-- Up-to-date: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/share/p4c/p4include/ebpf_model.p4 +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4test +-- Installing: /home/nico/vcs/master-thesis/support/p4c-installation/bin/p4c-graphs +(virtualenv-with-site) [0:42] line:build% ls /home/nico/vcs/master-thesis/support/p4c-installation/bin/ +p4c p4c-bm2-psa p4c-bm2-ss p4c-ebpf p4c-graphs p4test +(virtualenv-with-site) [0:42] line:build% +**** TODO install behavioral-model + +**** TODO Debug / reread the virtualbox script from the lecture +**** TODO Get p4c installed / running + https://github.com/p4lang/p4c +***** log +[16:31] line:p4c% git submodule update --init --recursive + +root@line:~# apt install bison \ +> build-essential \ +> cmake \ +> flex \ +> g++ \ +> libboost-dev \ +> libboost-graph-dev \ +> libboost-iostreams1.58-dev \ +> libfl-dev \ +> libgc-dev \ +> libgmp-dev \ +> pkg-config \ +> python-ipaddr \ +> python-pip \ +> python-setuptools \ +> tcpdump +Reading package lists... Done +Building dependency tree +Reading state information... Done +Package libboost-iostreams1.58-dev is not available, but is referred to by another package. +This may mean that the package is missing, has been obsoleted, or +is only available from another source + +E: Package 'libboost-iostreams1.58-dev' has no installation candidate +root@line:~# apt install libpcap-dev libelf-dev llvm clang iproute2 net-tools + +[16:33] line:p4c% . ~/vcs/master-thesis/support/virtualenv2/bin/activate +(virtualenv2) [16:35] line:p4c% pip install tenjin \ + pyroute2 \ + ply==3.8 \ + scapy==2.4.0 +***** Using newer version of libboost-iostreams1.58-dev +***** buidling +(virtualenv2) [16:36] line:p4c% mkdir build && \ + cd build && \ + cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3' +***** missing protobuf +(virtualenv2) [16:36] line:p4c% mkdir build && \ + cd build && \ + cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3' + + cd build && \ + cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3'-- The C compiler identification is GNU 8.3.0 +-- The CXX compiler identification is GNU 8.3.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Found PythonInterp: /home/nico/vcs/master-thesis/support/virtualenv2/bin/python (found version "2.7.16") +-- Found FLEX: /usr/bin/flex (found version "2.6.4") +-- Found BISON: /usr/bin/bison (found suitable version "3.3.2", minimum required is "3.0.2") +CMake Error at /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137 (message): + Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR) (Required is at + least version "3.0.0") +Call Stack (most recent call first): + /usr/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) + /usr/share/cmake-3.13/Modules/FindProtobuf.cmake:595 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) + CMakeLists.txt:81 (find_package) + + +-- Configuring incomplete, errors occurred! +See also "/home/nico/vcs/master-thesis/support/p4c/build/CMakeFiles/CMakeOutput.log". +See also "/home/nico/vcs/master-thesis/support/p4c/build/CMakeFiles/CMakeError.log". +(virtualenv2) [16:36] line:build% apt search protobuf + +(virtualenv2) [16:38] line:build% sudo apt install python-protobuf protobuf-compiler + +(virtualenv2) [16:38] line:build% cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3' +-- Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.a;-lpthread (found suitable version "3.6.1", minimum required is "3.0.0") +-- Boost version: 1.67.0 +-- Found the following Boost libraries: +-- iostreams +-- regex +-- Found LibGc: /usr/lib/x86_64-linux-gnu/libgccpp.so (found suitable version "7.6.4", minimum required is "7.2.0") +-- Found Threads: TRUE +-- Found LibGmp: /usr/lib/x86_64-linux-gnu/libgmpxx.so +-- Looking for clock_gettime in rt +-- Looking for clock_gettime in rt - found +-- Looking for execinfo.h +-- Looking for execinfo.h - found +-- Looking for ucontext.h +-- Looking for ucontext.h - found +-- Looking for C++ include cxxabi.h +-- Looking for C++ include cxxabi.h - found +-- Looking for memchr +-- Looking for memchr - found +-- Looking for pipe2 +-- Looking for pipe2 - found +-- Looking for GC_print_stats +-- Looking for GC_print_stats - found +-- Found PY_difflib: /usr/lib/python2.7/difflib.pyc +-- Found PY_shutil: /usr/lib/python2.7/shutil.pyc +-- Found PY_tempfile: /usr/lib/python2.7/tempfile.pyc +-- Found PY_subprocess: /usr/lib/python2.7/subprocess.pyc +-- Found PY_re: /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/re.pyc +-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) +-- Program 'simple_switch_CLI' (https://github.com/p4lang/behavioral-model.git) not found; +Searched . +Will not run BMv2 tests. (missing: SIMPLE_SWITCH SIMPLE_SWITCH_CLI) +-- Program 'psa_switch_CLI' (https://github.com/p4lang/behavioral-model.git) not found; +Searched . +Will not run PSA BMv2 tests. (missing: PSA_SWITCH PSA_SWITCH_CLI) +-- Performing Test _HAVE_OPTION_Wall_ +-- Performing Test _HAVE_OPTION_Wall_ - Success +-- Performing Test _HAVE_OPTION_Wextra_ +-- Performing Test _HAVE_OPTION_Wextra_ - Success +-- Performing Test _HAVE_OPTION_Wnooverloadedvirtual_ +-- Performing Test _HAVE_OPTION_Wnooverloadedvirtual_ - Success +-- Performing Test _HAVE_OPTION_Wnodeprecated_ +-- Performing Test _HAVE_OPTION_Wnodeprecated_ - Success +-- Using the GNU gold linker. +-- Available extensions +CMake Warning at backends/bmv2/CMakeLists.txt:193 (MESSAGE): + BMv2 simple switch is not available, not adding v1model BMv2 tests + + +CMake Warning at backends/bmv2/CMakeLists.txt:199 (MESSAGE): + BMv2 PSA switch is not available, not adding PSA BMv2 tests + + +-- Found LLVM 7.0.1 +-- Added 14 tests to 'ebpf-kernel' (0 xfails) +-- Added 14 tests to 'ebpf-bcc' (0 xfails) +-- Added 14 tests to 'ebpf' (0 xfails) +-- Added 161 tests to 'p4' (0 xfails) +-- Added 506 tests to 'p4' (4 xfails) +-- Added 204 tests to 'p14_to_16' (0 xfails) +-- CTest parallel: -j 8 +-- Configuring done +-- Generating done +-- Build files have been written to: /home/nico/vcs/master-thesis/support/p4c/build + +***** testing in build directory: works +/home/nico/vcs/master-thesis/support/p4c/build +***** Changing install path + +CMAKE_INSTALL_PREFIX +cmake .. '-DCMAKE_CXX_FLAGS:STRING=-O3' -DCMAKE_INSTALL_PREFIX=/home/nico/vcs/master-thesis/support/p4c-installation + +**** TODO Get p4utils running (?) +**** log of python, p4app, p4c installation +[16:16] line:support% virtualenv virtualenv2 +Running virtualenv with interpreter /usr/bin/python2 +New python executable in /home/nico/vcs/master-thesis/support/virtualenv2/bin/python2 +Also creating executable in /home/nico/vcs/master-thesis/support/virtualenv2/bin/python +Installing setuptools, pkg_resources, pip, wheel...done. +[16:16] line:support% + +[16:18] line:p4-utils-nsg% . ~/vcs/master-thesis/support/virtualenv2/bin/activate +(virtualenv2) [16:19] line:p4-utils-nsg% which pip +/home/nico/vcs/master-thesis/support/virtualenv2/bin/pip +(virtualenv2) [16:19] line:p4-utils-nsg% +***** pip install -e . +****** Missing python development headers + copying psutil/tests/test_memory_leaks.py -> build/lib.linux-x86_64-2.7/psutil/tests + running build_ext + building 'psutil._psutil_linux' extension + creating build/temp.linux-x86_64-2.7 + creating build/temp.linux-x86_64-2.7/psutil + x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-UboFgi/python2.7-2.7.16~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=561 -DPSUTIL_LINUX=1 -I/usr/include/python2.7 -c psutil/_psutil_common.c -o build/temp.linux-x86_64-2.7/psutil/_psutil_common.o + psutil/_psutil_common.c:9:10: fatal error: Python.h: No such file or directory + #include + ^~~~~~~~~~ + compilation terminated. + error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 + + +root@line:~# apt install python2-dev +****** installing, but missing mininet.net +(virtualenv2) [16:21] line:p4-utils-nsg% pip install -e "." +DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. +Obtaining file:///home/nico/vcs/master-thesis/support/p4-utils-nsg +Requirement already satisfied: setuptools in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from p4utils==0.2) (40.8.0) +Requirement already satisfied: networkx in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from p4utils==0.2) (2.2) +Requirement already satisfied: ipaddress in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from p4utils==0.2) (1.0.22) +Requirement already satisfied: scapy in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from p4utils==0.2) (2.4.2) +Requirement already satisfied: psutil in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from p4utils==0.2) (5.6.1) +Requirement already satisfied: decorator>=4.3.0 in /home/nico/vcs/master-thesis/support/virtualenv2/lib/python2.7/site-packages (from networkx->p4utils==0.2) (4.3.2) +Installing collected packages: p4utils + Found existing installation: p4utils 0.2 + Not uninstalling p4utils at /home/nico/vcs/master-thesis/support/p4-utils-nsg, outside environment /home/nico/vcs/master-thesis/support/virtualenv2 + Can't uninstall 'p4utils'. No files were found to uninstall. + Running setup.py develop for p4utils +Successfully installed p4utils +(virtualenv2) [16:21] line:p4-utils-nsg% +**** log Try2: using virtualenv that uses site packages for using mininet +[17:13] line:support% virtualenv --system-site-packages virtualenv-with-site +Running virtualenv with interpreter /usr/bin/python2 +New python executable in /home/nico/vcs/master-thesis/support/virtualenv-with-site/bin/python2 +Also creating executable in /home/nico/vcs/master-thesis/support/virtualenv-with-site/bin/python +Installing setuptools, pkg_resources, pip, wheel...done. +[17:23] line:support% . ./virtualenv-with-site/bin/activate +(virtualenv-with-site) [17:23] line:support% +(virtualenv-with-site) [17:23] line:p4-utils-nsg% pip install -e . +(virtualenv-with-site) [17:23] line:p4-utils-nsg% pip install -e . +DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. +Obtaining file:///home/nico/vcs/master-thesis/support/p4-utils-nsg +Requirement already satisfied: setuptools in /home/nico/vcs/master-thesis/support/virtualenv-with-site/lib/python2.7/site-packages (from p4utils==0.2) (40.8.0) +Collecting networkx (from p4utils==0.2) +Requirement already satisfied: ipaddress in /usr/lib/python2.7/dist-packages (from p4utils==0.2) (1.0.17) +Requirement already satisfied: scapy in /usr/lib/python2.7/dist-packages (from p4utils==0.2) (2.4.0) +Collecting psutil (from p4utils==0.2) +Collecting decorator>=4.3.0 (from networkx->p4utils==0.2) + Using cached https://files.pythonhosted.org/packages/f1/cd/7c8240007e9716b14679bc217a1baefa4432aa30394f7e2ec40a52b1a708/decorator-4.3.2-py2.py3-none-any.whl +Installing collected packages: decorator, networkx, psutil, p4utils + Running setup.py develop for p4utils +Successfully installed decorator-4.3.2 networkx-2.2 p4utils psutil-5.6.1 +(virtualenv-with-site) [17:23] line:p4-utils-nsg% which p4run +/home/nico/vcs/master-thesis/support/virtualenv-with-site/bin/p4run +(virtualenv-with-site) [17:24] line:p4-utils-nsg% + +p4c --target bmv2 --arch v1model --std p4-16 "../p4src/static-mapping.p4" -o "/home/nico/vcs/master-thesis/p4src" +../p4src/static-mapping.p4(80): [--Wwarn=unused] warning: Table ndp_answer is not used; removing + table ndp_answer { + ^^^^^^^^^^ +../p4src/static-mapping.p4(96): [--Wwarn=unused] warning: Table port2mcast is not used; removing + table port2mcast { + ^^^^^^^^^^ +../p4src/static-mapping.p4(111): [--Wwarn=unused] warning: Table addr2mcast is not used; removing + table addr2mcast { + ^^^^^^^^^^ +../p4src/static-mapping.p4(128): [--Wwarn=unused] warning: Table ndp is not used; removing + table ndp { + ^^^ +Switch port mapping: +s1: 1:h1 2:h2 3:h3 4:h4 5:sw-cpu +**** Trying local vagrant VM +***** libvirtd missing user +root@line:~# libvirtd +2019-03-12 16:39:14.556+0000: 20235: info : libvirt version: 5.0.0, package: 1 (Guido Günther Wed, 16 Jan 2019 10:31:33 +0100) +2019-03-12 16:39:14.556+0000: 20235: info : hostname: line +2019-03-12 16:39:14.556+0000: 20235: error : virGetUserID:1038 : invalid argument: Failed to parse user 'libvirt-qemu' +2019-03-12 16:39:14.556+0000: 20235: error : virStateInitialize:662 : Initialization of QEMU state driver failed: invalid argument: Failed to parse user 'libvirt-qemu' +2019-03-12 16:39:14.556+0000: 20235: error : daemonRunStateInit:799 : Driver state initialization failed +root@line:~# useradd -m libvirt-qemu +root@line:~# + +root@line:~# strace -fF -e open libvirtd +strace: deprecated option -F ignored +strace: Process 20602 attached +strace: Process 20603 attached +strace: Process 20604 attached +strace: Process 20605 attached +strace: Process 20606 attached +strace: Process 20607 attached +strace: Process 20608 attached +strace: Process 20609 attached +strace: Process 20610 attached +strace: Process 20611 attached +strace: Process 20612 attached +strace: Process 20613 attached +strace: Process 20614 attached +strace: Process 20615 attached +strace: Process 20616 attached +strace: Process 20617 attached +strace: Process 20618 attached +[pid 20618] +++ exited with 0 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20618, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20619 attached +[pid 20619] +++ exited with 0 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20619, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20620 attached +strace: Process 20621 attached +strace: Process 20622 attached +[pid 20622] +++ exited with 0 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20622, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20623 attached +[pid 20623] +++ exited with 0 +++ +[pid 20621] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20623, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20624 attached +[pid 20624] +++ exited with 0 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20624, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20625 attached +[pid 20625] +++ exited with 0 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20625, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20626 attached +[pid 20626] +++ exited with 0 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20626, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20627 attached +[pid 20627] +++ exited with 0 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20627, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20628 attached +[pid 20621] +++ exited with 0 +++ +strace: Process 20629 attached +strace: Process 20630 attached +strace: Process 20631 attached +strace: Process 20632 attached +strace: Process 20633 attached +[pid 20631] +++ exited with 0 +++ +[pid 20633] +++ exited with 1 +++ +[pid 20630] +++ exited with 0 +++ +[pid 20628] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20630, si_uid=1001, si_status=0, si_utime=0, si_stime=0} --- +[pid 20632] +++ exited with 1 +++ +[pid 20629] +++ exited with 1 +++ +[pid 20628] +++ exited with 1 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20628, si_uid=1001, si_status=1, si_utime=1, si_stime=0} --- +2019-03-12 16:40:53.098+0000: 20617: info : libvirt version: 5.0.0, package: 1 (Guido Günther Wed, 16 Jan 2019 10:31:33 +0100) +2019-03-12 16:40:53.098+0000: 20617: info : hostname: line +2019-03-12 16:40:53.098+0000: 20617: error : virQEMUCapsNewForBinaryInternal:4681 : internal error: Failed to probe QEMU binary with QMP: qemu-system-i386: cannot create PID file: Cannot open pid file: Permission denied + +2019-03-12 16:40:53.098+0000: 20617: warning : virQEMUCapsLogProbeFailure:4628 : Failed to probe capabilities for /usr/bin/qemu-system-i386: internal error: Failed to probe QEMU binary with QMP: qemu-system-i386: cannot create PID file: Cannot open pid file: Permission denied + +strace: Process 20634 attached +strace: Process 20635 attached +strace: Process 20636 attached +strace: Process 20637 attached +strace: Process 20638 attached +strace: Process 20639 attached +[pid 20637] +++ exited with 0 +++ +[pid 20639] +++ exited with 1 +++ +[pid 20636] +++ exited with 0 +++ +[pid 20634] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20636, si_uid=1001, si_status=0, si_utime=0, si_stime=0} --- +[pid 20638] +++ exited with 1 +++ +[pid 20635] +++ exited with 1 +++ +[pid 20634] +++ exited with 1 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20634, si_uid=1001, si_status=1, si_utime=1, si_stime=0} --- +2019-03-12 16:40:53.145+0000: 20617: error : virQEMUCapsNewForBinaryInternal:4681 : internal error: Failed to probe QEMU binary with QMP: qemu-system-x86_64: cannot create PID file: Cannot open pid file: Permission denied + +2019-03-12 16:40:53.145+0000: 20617: warning : virQEMUCapsLogProbeFailure:4628 : Failed to probe capabilities for /usr/bin/qemu-system-x86_64: internal error: Failed to probe QEMU binary with QMP: qemu-system-x86_64: cannot create PID file: Cannot open pid file: Permission denied + +strace: Process 20640 attached +[pid 20640] +++ exited with 0 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20640, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20641 attached +[pid 20641] +++ exited with 0 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20641, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +strace: Process 20642 attached +[pid 20642] +++ exited with 2 +++ +[pid 20601] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20642, si_uid=0, si_status=2, si_utime=0, si_stime=0} --- +strace: Process 20643 attached +[pid 20643] +++ exited with 0 +++ +[pid 20617] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=20643, si_uid=0, si_status=0, si_utime=0, si_stime=0} --- +[pid 20617] +++ exited with 0 +++ +[pid 20601] --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} --- +^Cstrace: Process 20601 detached +strace: Process 20602 detached +strace: Process 20603 detached +strace: Process 20604 detached +strace: Process 20605 detached +strace: Process 20606 detached +strace: Process 20607 detached +strace: Process 20608 detached +strace: Process 20609 detached +strace: Process 20610 detached +strace: Process 20611 detached +strace: Process 20612 detached +strace: Process 20613 detached +strace: Process 20614 detached +strace: Process 20615 detached +strace: Process 20616 detached +strace: Process 20620 detached +**** Creating network +**** Adding hosts: + h1 h2 h3 h4 +**** Adding switches: + Cannot find required executable simple_switch. + Please make sure that it is installed and available in your $PATH: + (/home/nico/vcs/master-thesis/support/virtualenv-with-site/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/nico/vcs/master-thesis/support/p4c/build/) + (virtualenv-with-site) root@line:/home/nico/vcs/master-thesis/p4app# *** TODO Implement ICMP <-> ICMP6 translation **** DONE Parse icmp **** DONE Parse icmpv6 @@ -202,10 +645,9 @@ multicast address of the target address." ***** If destination is within ff02::1:ff00:0/104, multicast **** DONE Make switch answer icmp6 echo request for -**** TODO Make switch answer icmp echo request for -**** TODO Introduce mixed mode: switch: icmp6 echo reply, controller: NDP +**** DONE Introduce mixed mode: switch: icmp6 echo reply, controller: NDP ***** DONE try 1: reply seen, but checksum is incorrect -***** TODO try 2: analysing tagya checksumming code +***** DONE try 2: analysing tagya checksumming code static uint16_t ip6_checksum(struct ip6 *ip6, uint32_t data_len, uint8_t proto) { uint32_t sum = 0; @@ -265,8 +707,6 @@ static int xlate_payload_4to6(struct pkt *p, struct ip6 *ip6) p->icmp->cksum = ones_add(cksum, ~(129 - 0)); } return 0; - - **** DONE Add default route for v6 hosts p4@ubuntu:~/master-thesis$ mx h1 ip -6 r sudo: unable to resolve host ubuntu @@ -274,9 +714,11 @@ sudo: unable to resolve host ubuntu fe80::/64 dev h1-eth0 proto kernel metric 256 pref medium default via 2001:db8::42 dev h1-eth0 metric 1024 pref medium p4@ubuntu:~/master-thesis$ -**** TODO Add default route for v4 hosts +**** Implement IPv4 side handling +***** TODO Make switch answer icmp echo request for +***** TODO Add default route for v4 hosts **** TODO Translate ipv6 --> ipv4 with a (freely programmable) prefix -***** TODO Insert prefix into switch +***** TODO Insert prefix into switch: v6_networks ***** TODO Implement the calculation ***** TODO Sketch the flow for session handling for icmp6 w/o packet loss - switch receives icmp6 packet for known prefix @@ -608,7 +1050,7 @@ DEBUG:main:INCOMING: {} -> {}".format(v6_nat64_prefix, v6_network, v4_network)) + + self.controller.table_add("v6_networks", "nat64_static", nat64_prefix, [net_ipv6], [net_ipv4]) + self.controller.table_add("v4_networks", "nat46_static", [net_ipv4], [net_ipv6]) + + def config_hosts(self): """ Assumptions: - all routes are networks (no /128 v6 or /32 v4 @@ -204,9 +240,18 @@ class L2Controller(object): self.config_v6_host(host, str(net), str(ipaddr), dev, router) + for v4route in self.v4_routes[self.mode]: + host = "h{}".format(v4route['port']) + dev = "{}-eth0".format(host) + net = v4route['net'] + ipaddr = "{}/{}".format(net[1],net.prefixlen) + router = str(net[self.info['switch_suffix']]) + + self.config_v4_host(host, str(net), str(ipaddr), dev, router) + @staticmethod def config_v6_host(host, net, ipaddr, dev, router=None): - log.debug("Config host: {} {}->{} on {}".format(host, net, ipaddr, dev)) + log.debug("Config v6 host: {} {}->{} on {}".format(host, net, ipaddr, dev)) subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev]) for v6dev in [ "lo", "default", "all", dev ]: @@ -216,10 +261,18 @@ class L2Controller(object): subprocess.call(["mx", host, "ip", "link", "set", dev, "down"]) subprocess.call(["mx", host, "ip", "link", "set", dev, "up"]) - # Now add global address subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev]) - # add default gw if in router mode + if router: + subprocess.call(["mx", host, "ip", "route", "add", "default", "via", router]) + + @staticmethod + def config_v4_host(host, net, ipaddr, dev, router=None): + log.debug("Config v4 host: {} {}->{} on {}".format(host, net, ipaddr, dev)) + + subprocess.call(["mx", host, "ip", "addr", "flush", "dev", dev]) + subprocess.call(["mx", host, "ip", "addr", "add", ipaddr, "dev", dev]) + if router: subprocess.call(["mx", host, "ip", "route", "add", "default", "via", router]) diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 index 9d21e3a..3c92641 100644 --- a/p4src/static-mapping.p4 +++ b/p4src/static-mapping.p4 @@ -66,15 +66,68 @@ control MyIngress(inout headers hdr, meta.cast_length = (bit<32>) hdr.ipv6.payload_length; } - /* this needs SESSIONS!! - - icmp6: (src addr, dst addr, ID??, ) - - tcp: (src port, dst port, dst_addr, src addr) - - udp: (src port, dst port, dst_addr, src addr) - */ - // action nat64_static(ipv4_addr_t nataddr, ipv6_addr_t nat64_prefix) { - // hdr.ipv4.dst_addr = hdr.ipv6.dst_addr - nat64_prefix; - // hdr.ipv4.dst_addr = hdr.ipv6.dst_addr - nat64_prefix; - // } + action nat64_static(ipv4_addr_t v6_network, ipv4_addr_t v4_network) { + ipv6_addr_t src_offset = hdr.ipv6.src_addr - v6_network; + ipv4_addr_t src = v4_network + (ipv4_addr_t) src_offset; + + ipv4_addr_t dst_offset = hdr.ipv6.dst_addr - LPM_MATCH_NETWORK_ADDRESS_IN_TABLE; + + nat64_generic(src, dst); + } + + action nat46_static(ipv4_addr_t v4_network, ipv6_addr_t nat64_prefix ) { + ipv6_addr_t src = hdr.ipv4.dst_addr - v4_network; + ipv6_addr_t src = hdr.ipv4.dst_addr - v4_network; + + nat46_generic(src, dst); + } + + /* NAT64 protocol unspecific changes */ + action nat64_generic(ipv4_addr_t src, ipv4_addr_t dst) { + /* Stuff that might need to be fixed */ + hdr.ipv4.version = (bit<4>)4; + hdr.ipv4.diff_serv = (bit<6>)0; // no ToS + hdr.ipv4.ecn = (bit<2>)0; // unsupported + + hdr.ipv4.ihl = (bit<4>) 5; // internet header length -- needs to be dynamic! + hdr.ipv4.totalLen = (bit<16>) hdr.ipv6.payload_length + 5; // should probably also dynamic + + hdr.ipv4.identification = (bit<16>) 0; // no support for fragments + hdr.ipv4.flags = (bit<3>) 0; // DF bit and more fragments, unsupported ATM + hdr.ipv4.fragOffset = (bit<13>) 0; // 0 as there are no fragments + + /* Stuff that should be fine */ + hdr.ethernet.ethertype = TYPE_IPV4; + + hdr.ipv4.dst_addr = dst; + hdr.ipv4.src_addr = src; + + hdr.ipv4.ttl = hdr.ipv6.hop_limit; + hdr.ipv4.protocol = hdr.ipv6.next_header; + + hdr.ipv6.setInvalid(); + hdr.ipv4.setValid(); + } + + /* NAT46: protocol unspecific changes */ + action nat46_generic(ipv6_addr_t src, ipv6_addr_t dst) { + hdr.ethernet.ethertype=TYPE_IPV6; + + hdr.ipv6.dst_addr = dst; + hdr.ipv6.src_addr = src; + + hdr.ipv6.version = (bit<4>)6; + hdr.ipv6.traffic_class = (bit<8>) hdr.ipv4.diff_serv; + hdr.ipv6.flow_label = (bit<20>) 0; + hdr.ipv6.payload_length = (bit<16>) hdr.ipv4.totalLen - 20; + + hdr.ipv6.next_header = hdr.ipv4.protocol; + hdr.ipv6.hop_limit = hdr.ipv4.ttl; + + hdr.ipv4.setInvalid(); + hdr.ipv6.setValid(); + } + /********************** Reply to NDP for US ***********************************/ table ndp_answer { @@ -185,6 +238,7 @@ control MyIngress(inout headers hdr, set_egress_port; controller_debug; controller_reply; + nat64_static; NoAction; } size = ROUTING_TABLE_SIZE; @@ -197,6 +251,7 @@ control MyIngress(inout headers hdr, } actions = { set_egress_port; + nat46_static; NoAction; } size = ROUTING_TABLE_SIZE;