Begin icmp6 in controller -> pass special info

This commit is contained in:
Nico Schottelius 2019-03-03 22:36:25 +01:00
parent b3e51d550a
commit 7f1e9f6252
5 changed files with 81 additions and 22 deletions

View file

@ -7,6 +7,8 @@
| | Write mail / phone | x |
| 2019-02-22 | Have all papers handed in | |
| | | |
| 2019-02-22 | Have rough definition of tasks | x |
| | | |
| 2019-02-23 | python2 / ipaddress is buggy | x |
| | p4utils is python2 only support | |
| | bmpy_utils is not installable with pip | |
@ -29,24 +31,42 @@
| | * Reading about multicast / trying to figure out dynamic membership | |
| | | |
| | - Challenges | |
| | * Some issues with python2 (ipaddr) - slowing down | |
| | * Some issues with python2 (ipaddr) - slowing down | x |
| | https://github.com/phihag/ipaddress/issues/46 | |
| | * Forwarded and received icmp6 packets are not "accepted" | |
| | | |
| | - Questions | |
| | * Re-using code (lee howard) | |
| | * Multicast | |
| | * A lot of redundant code / different tables / repeating | |
| | * Multicast: in controller | x |
| | * Re-using code (lee howard) -> ok & mention | x |
| | * A lot of redundant code / different tables / repeating: use if's | x |
| | * 65k parsing is insane | x |
| | | |
| | - Next steps: | |
| | * Supporting MLD | |
| | * Save stuff in the controller | |
| | * checkout ipaddr bug / status | |
| | * Variable length / icmp6 in the controller | |
| | * Go simple... | |
| | * Meeting Edgar & Alexander week after | |
| | * Summary on Slack | |
| | * 1130 meeting now | |
| | | |
| 2019-03-01 | Feature list / priority list / roadmap clear | x |
| | Joining P4 Slack | |
| | | |
| 2019-03-03 | icmp6 revised: | |
| | - add address to table for forwarding to controller | x |
| | - select correct format for forwarding | |
| | - decode in controller | |
| | - send back to switch | |
| | - test with host | |
| | | |
| | | |
| 2019-02-22 | Have rough definition of tasks | |
| 2019-03-01 | Feature list / priority list / roadmap clear | |
| 2019-03-08 | NAT46 1:1 table TCP/UDP working | |
| 2019-03-15 | NAT46 1:1 table ICMP, ICMPv6 working | |
| 2019-03-08 | NAT46 1:1 table ICMP, ICMPv6 working | |
| | Will need some switch local ip addresses | |
| | | |
| 2019-03-15 | NAT46 1:1 table TCP/UDP working | |
| | | |
| 2019-03-29 | Jool SIIT / range / offset support https://www.jool.mx/en/run-vanilla.html | |
| | Jool EAMT support https://www.jool.mx/en/run-eam.html | |
| | Bidirectional support | |
@ -86,12 +106,14 @@
**** DONE Parse icmp
**** DONE Parse icmpv6
**** DONE Add (static) egress configuration
**** DONE Calculate ICMP6 checksums
**** TODO Calculate ICMP6 checksums
***** Need to include the payload!?!!
**** TODO Implement minimal neighbor discovery
***** TODO For the switch
****** DONE Register IPv6 address in table
****** TODO Parse ICMPv6 up to neighbor solicitation
****** TODO Use NDP (Neighbor Solicitation (NDP) , Neighbor Advertisement (NDP))
****** DONE Parse ICMPv6 up to neighbor solicitation -> no: checksum problem
****** DONE Use NDP (Neighbor Solicitation (NDP) , Neighbor Advertisement (NDP)) -> no: controller
****** Approach 2: use cpu header, forward information to controller
***** TODO For other nodes -> multicast
***** TODO Maybe implement link local addresses (missing at the moment)
****** ff02::/??
@ -397,21 +419,18 @@ listening on h1-eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
4 packets received by filter
0 packets dropped by kernel
root@ubuntu:~/master-thesis#
***** When pinging we see
DEBUG:main:INCOMING: <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:61::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0xd343 res=0 tgt=2001:db8:61::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>>
DEBUG:main:INCOMING: <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:61::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0xd343 res=0 tgt=2001:db8:61::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>>
DEBUG:main:INCOMING: <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:61::1 dst=ff02::1:ff00:42 |<ICMPv6ND_NS type=Neighbor Solicitation code=0 cksum=0xd343 res=0 tgt=2001:db8:61::42 |<ICMPv6NDOptSrcLLAddr type=1 len=1 lladdr=00:00:0a:00:00:01 |>>>>
***** Hosts
****** Left side: IPv6
****** Right side: IPv4
***** Included in the header
**** Requirements
-
*** Performance comparison
*** Feature/Functionality difference / overview
**** Not included

View file

@ -1,3 +1,5 @@
from __future__ import unicode_literals
import nnpy
import struct
@ -16,17 +18,28 @@ import argparse
import subprocess
# Broken in python2
#import ipaddress
import ipaddress
logging.basicConfig()
log = logging.getLogger("main")
class CpuHeader(Packet):
name = 'CpuPacket'
fields_desc = [BitField('ingress_port', 0, 16)]
class L2Controller(object):
def __init__(self, sw_name):
# Command line mapping
self.modes = ['base', 'router']
self.info={}
self.info['ndp_multicast'] = ipaddress.ip_network("ff02::1:ff00:0/104")
self.address_suffix = 42
# Network / egress
@ -145,9 +158,13 @@ class L2Controller(object):
self.controller.table_clear("v6_addresses")
for v6addr in self.v6_addresses[self.mode]:
self.controller.table_add("v6_addresses", "icmp6_answer", [v6addr['addr']])
self.controller.table_add("v6_addresses", "send_to_controller", [v6addr['addr']])
def gen_ndp_multicast_addr(self, addr):
""" append the 24 bit of the address to the multicast address"""
return ipaddress.ip_address(int(self.info['ndp_multicast']) + (int(addr) & 0xffffff))
def config_hosts(self):
""" Assumptions:
- all routes are networks (no /128 v6 or /32 v4
@ -207,10 +224,15 @@ class L2Controller(object):
self.debug_print_pkg(pkg)
if packet.type == 0x800:
if packet.type == 0x0800:
pass
elif packet.type == 0x86dd:
pass
elif packet.type == 0x4242:
# CPU header included
print("Special handling needed")
pass
else:
print("Broken pkg: {}".format(pkg))
return

View file

@ -22,7 +22,7 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
apply {
bit<32> icmp6_len = 1; /* for icmp6 NS */
bit<32> icmp6_len = 32; /* for icmp6 NS */
update_checksum (
hdr.icmp6.isValid(),

View file

@ -14,6 +14,8 @@ typedef bit<16> mcast_t;
const bit<16> TYPE_IPV4 = 0x0800;
const bit<16> TYPE_IPV6 = 0x86DD;
const bit<16> TYPE_CPU = 0x4242;
const bit<8> PROTO_ICMP = 1;
const bit<8> PROTO_TCP = 6;

View file

@ -28,6 +28,11 @@ control MyIngress(inout headers hdr,
clone3(CloneType.I2E, 100, meta);
}
action controller_reply() {
hdr.ethernet.etherType = TYPE_CPU;
clone3(CloneType.I2E, 100, meta);
}
/* Output PKG on correct ports (plural) */
action multicast_pkg(mcast_t mcast_grp) {
standard_metadata.mcast_grp = mcast_grp;
@ -131,7 +136,7 @@ control MyIngress(inout headers hdr,
// hdr.ipv6.next_header: exact;
}
actions = {
icmp6_answer;
// icmp6_answer;
send_to_controller;
NoAction;
}
@ -197,6 +202,17 @@ control MyEgress(inout headers hdr,
/* set tcp header valid after modifying it -- keep this in mind*/
// hdr.tcp.setValid();
// If ingress clone
if (standard_metadata.instance_type == 1){
// hdr.cpu.setValid();
// hdr.cpu.srcAddr = hdr.ethernet.srcAddr;
// hdr.cpu.ingress_port = (bit<16>)meta.ingress_port;
// hdr.ethernet.etherType = L2_LEARN_ETHER_TYPE;
// truncate((bit<32>)22); //ether+cpu header
}
}
}