diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..fcc7356 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1,9 @@ +*.pdf +plan.tex +*.aux +*.glo +*.lof +*.log +*.lot +*.out +*.toc diff --git a/doc/Thesis.pdf b/doc/Thesis.pdf deleted file mode 100644 index d46b2dd..0000000 Binary files a/doc/Thesis.pdf and /dev/null differ diff --git a/doc/plan.org b/doc/plan.org index c63e3f1..3d99750 100644 --- a/doc/plan.org +++ b/doc/plan.org @@ -104,10 +104,22 @@ user@T:~# iptables -t mangle -A PREROUTING \ **** Cisco (?) *** P4 based implementation TBD -**** Static mappings - - need table - - need tcp & udp translation +**** General + - IPv6 subnet 2001:db8::/32 + - IPv6 hosts are in 2001:db8:6::/64 + - IPv6 default router (::/0) is 2001:db8:6::42/64 + - IPv4 mapped Internet "NAT64 prefix" 2001:db8:4444::/96 (should + go into a table) + - IPv4 hosts are in 10.0.4.0/24 + - IPv6 in IPv4 mapped hosts are in 10.0.6.0/24 + - IPv4 default router = 10.0.0.42 +**** Static mappings + - likely need table(s) + - need tcp & udp translation +***** Hosts +****** Left side: IPv6 +****** Right side: IPv4 **** Requirements - *** Performance comparison diff --git a/p4app/static-mapping.sh b/p4app/static-mapping.sh new file mode 100644 index 0000000..d6d50f8 --- /dev/null +++ b/p4app/static-mapping.sh @@ -0,0 +1,37 @@ +#!/bin/sh + +set -x + +# cleanup +for i in 1 2 3 4; do + mx h$i "ip addr flush dev $dev" +done + +# host 1/2+42 need NDP for reaching themselves +for i in 1 2; do + dev="h$i-eth0" + # add and enable ipv6 + mx h$i "sysctl net.ipv6.conf.{lo,h$i-eth0}.disable_ipv6=0" + mx h$i "ip addr add 2001:db8:6::$i/64 dev $dev" + mx h$i "ip -6 route add default via 2001:db8:6::42" + + # add neighbors + for j in 1 2 42; do + mx h$i "ip -6 neigh add 2001:db8:6::${j} dev $dev lladdr 00:00:0a:00:00:0${j}" + done +done + +# host 3/4 need ARP, also need access to .42 (virtual IP) +for i in 3 4; do + dev="h$i-eth0" + mx h$i "ip addr add 10.0.0.$i/24 dev $dev" + + # add arp + for j in 1 2 42; do + mx h$i "ip neigh add 10.0.0.${j} dev $dev lladdr 00:00:0a:00:00:${j}" + done +done + +for i in 1 2 3 4; do + mx h$i "ip neigh show" +done diff --git a/p4src/checksums.p4 b/p4src/checksums.p4 new file mode 100644 index 0000000..b202b43 --- /dev/null +++ b/p4src/checksums.p4 @@ -0,0 +1,28 @@ +/* -*- P4_16 -*- */ +#ifndef CHECKSUMS_P4 +#define CHECKSUMS_P4 + +#include +#include + +#include "headers.p4" + +/************************************************************************* +************* C H E C K S U M V E R I F I C A T I O N ************* +*************************************************************************/ + +control MyVerifyChecksum(inout headers hdr, inout metadata meta) { + apply {} +} + +/************************************************************************* +************** C H E C K S U M C O M P U T A T I O N ************** +*************************************************************************/ + +control MyComputeChecksum(inout headers hdr, inout metadata meta) { + apply { + } +} + + +#endif diff --git a/p4src/headers.p4 b/p4src/headers.p4 index 290dff1..e8f735c 100644 --- a/p4src/headers.p4 +++ b/p4src/headers.p4 @@ -14,6 +14,7 @@ typedef bit<9> port_t; const bit<16> TYPE_IPV4 = 0x0800; const bit<16> TYPE_IPV6 = 0x86DD; const bit<8> TYPE_TCP = 6; +const bit<8> TCP_SEQ_LEN = 4; header ethernet_t { diff --git a/p4src/settings.p4 b/p4src/settings.p4 new file mode 100644 index 0000000..194843d --- /dev/null +++ b/p4src/settings.p4 @@ -0,0 +1,12 @@ +/* -*- P4_16 -*- */ +/* table sizes, register widths, and such */ +#ifndef SETTINGS_P4 +#define SETTINGS_P4 + +#include +#include + +#define THE_ANSWER_TO_LIFE_THE_UNIVERSE_AND_EVERYTHING 42 + + +#endif diff --git a/p4src/static-mapping.p4 b/p4src/static-mapping.p4 new file mode 100644 index 0000000..f81e36a --- /dev/null +++ b/p4src/static-mapping.p4 @@ -0,0 +1,49 @@ +/* -*- P4_16 -*- */ +#include +#include + +#include "headers.p4" +#include "parsers.p4" +#include "checksums.p4" +#include "settings.p4" + + +/************************************************************************* +************** I N G R E S S P R O C E S S I N G ******************* +*************************************************************************/ + +control MyIngress(inout headers hdr, + inout metadata meta, + inout standard_metadata_t standard_metadata) { + + apply { + + } +} + +/************************************************************************* +**************** E G R E S S P R O C E S S I N G ******************* +*************************************************************************/ + +control MyEgress(inout headers hdr, + inout metadata meta, + inout standard_metadata_t standard_metadata) { + apply { + /* set tcp header valid after modifying it -- keep this in mind*/ + // hdr.tcp.setValid(); + + } +} + +/************************************************************************* +*********************** S W I T C H ******************************* +*************************************************************************/ + +V1Switch( +MyParser(), +MyVerifyChecksum(), +MyIngress(), +MyEgress(), +MyComputeChecksum(), +MyDeparser() +) main;