Phasing in icmp6 in the switch
This commit is contained in:
parent
7e2262cab5
commit
5620add27f
5 changed files with 28 additions and 3 deletions
|
@ -492,6 +492,7 @@ DEBUG:main:INCOMING: <Ether dst=33:33:ff:00:00:42 src=00:00:0a:00:00:01 type=0x
|
||||||
**** EAMT/Jool: https://www.jool.mx/en/eamt.html
|
**** EAMT/Jool: https://www.jool.mx/en/eamt.html
|
||||||
**** Solicited node multicast address https://en.wikipedia.org/wiki/Solicited-node_multicast_address
|
**** Solicited node multicast address https://en.wikipedia.org/wiki/Solicited-node_multicast_address
|
||||||
**** Scapy / IPv6: https://www.idsv6.de/Downloads/IPv6PacketCreationWithScapy.pdf
|
**** Scapy / IPv6: https://www.idsv6.de/Downloads/IPv6PacketCreationWithScapy.pdf
|
||||||
|
**** V1 model: https://github.com/p4lang/p4c/blob/master/p4include/v1model.p4
|
||||||
* Proposal / task description
|
* Proposal / task description
|
||||||
** Task description for mystudies
|
** Task description for mystudies
|
||||||
*** High speed NAT64 with P4
|
*** High speed NAT64 with P4
|
||||||
|
|
|
@ -175,10 +175,14 @@ class L2Controller(object):
|
||||||
self.controller.table_clear("v6_addresses")
|
self.controller.table_clear("v6_addresses")
|
||||||
for v6addr in self.v6_addresses[self.mode]:
|
for v6addr in self.v6_addresses[self.mode]:
|
||||||
icmp6_addr = self.gen_ndp_multicast_addr(v6addr)
|
icmp6_addr = self.gen_ndp_multicast_addr(v6addr)
|
||||||
|
another_addr = v6addr +1
|
||||||
|
|
||||||
self.controller.table_add("v6_addresses", "controller_reply", [str(v6addr)], [str(self.task['ICMP6_GENERAL'])])
|
self.controller.table_add("v6_addresses", "controller_reply", [str(v6addr)], [str(self.task['ICMP6_GENERAL'])])
|
||||||
self.controller.table_add("v6_addresses", "controller_reply", [str(icmp6_addr)], [str(self.task['ICMP6_NS'])])
|
self.controller.table_add("v6_addresses", "controller_reply", [str(icmp6_addr)], [str(self.task['ICMP6_NS'])])
|
||||||
|
|
||||||
|
# Experimental
|
||||||
|
self.controller.table_add("v6_addresses", "icmp6_echo_reply", [str(another_addr)])
|
||||||
|
|
||||||
def config_hosts(self):
|
def config_hosts(self):
|
||||||
""" Assumptions:
|
""" Assumptions:
|
||||||
- all routes are networks (no /128 v6 or /32 v4
|
- all routes are networks (no /128 v6 or /32 v4
|
||||||
|
|
|
@ -22,6 +22,11 @@ control MyVerifyChecksum(inout headers hdr, inout metadata meta) {
|
||||||
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
control MyComputeChecksum(inout headers hdr, inout metadata meta) {
|
||||||
apply {
|
apply {
|
||||||
|
|
||||||
|
if(meta.calc_icmp6_checksum) {
|
||||||
|
hdr.icmp6.checksum = 42; /* must be correct */
|
||||||
|
}
|
||||||
|
|
||||||
|
verify_checksum_with_payload<T, O>(in bool condition, in T data, inout O checksum, HashAlgorithm algo);
|
||||||
// GRRRRR bit<32> icmp6_len = 32; /* for icmp6 NS */
|
// GRRRRR bit<32> icmp6_len = 32; /* for icmp6 NS */
|
||||||
|
|
||||||
// GRRRRR update_checksum (
|
// GRRRRR update_checksum (
|
||||||
|
|
|
@ -35,6 +35,7 @@ const bit<8> ICMP6_NA = 136;
|
||||||
const task_t TASK_ICMP6_NS = 1;
|
const task_t TASK_ICMP6_NS = 1;
|
||||||
const task_t TASK_ICMP6_GENERAL = 2;
|
const task_t TASK_ICMP6_GENERAL = 2;
|
||||||
const task_t TASK_DEBUG = 3;
|
const task_t TASK_DEBUG = 3;
|
||||||
|
const task_t TASK_ICMP6_REPLY = 4;
|
||||||
|
|
||||||
|
|
||||||
header ethernet_t {
|
header ethernet_t {
|
||||||
|
@ -132,6 +133,7 @@ struct metadata {
|
||||||
port_t ingress_port;
|
port_t ingress_port;
|
||||||
task_t task;
|
task_t task;
|
||||||
bit<16> tcp_length;
|
bit<16> tcp_length;
|
||||||
|
bool calc_icmp6_checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
|
@ -51,6 +51,20 @@ control MyIngress(inout headers hdr,
|
||||||
hdr.icmp6.type = ICMP6_NA;
|
hdr.icmp6.type = ICMP6_NA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
action icmp6_echo_reply() {
|
||||||
|
mac_addr_t mac_tmp = hdr.ethernet.dst_addr;
|
||||||
|
hdr.ethernet.dst_addr = hdr.ethernet.src_addr;
|
||||||
|
hdr.ethernet.src_addr = mac_tmp;
|
||||||
|
|
||||||
|
ipv6_addr_t addr_tmp = hdr.ipv6.dst_addr;
|
||||||
|
hdr.ipv6.dst_addr = hdr.ipv6.src_addr;
|
||||||
|
hdr.ipv6.src_addr = addr_tmp;
|
||||||
|
|
||||||
|
hdr.icmp6.type = ICMP6_ECHO_REPLY;
|
||||||
|
|
||||||
|
meta.calc_icmp6_checksum = true;
|
||||||
|
}
|
||||||
|
|
||||||
/********************** Reply to NDP for US ***********************************/
|
/********************** Reply to NDP for US ***********************************/
|
||||||
table ndp_answer {
|
table ndp_answer {
|
||||||
key = {
|
key = {
|
||||||
|
@ -144,6 +158,7 @@ control MyIngress(inout headers hdr,
|
||||||
actions = {
|
actions = {
|
||||||
controller_debug;
|
controller_debug;
|
||||||
controller_reply;
|
controller_reply;
|
||||||
|
icmp_echo_reply;
|
||||||
NoAction;
|
NoAction;
|
||||||
}
|
}
|
||||||
size = ADDRESS_TABLE_SIZE;
|
size = ADDRESS_TABLE_SIZE;
|
||||||
|
@ -165,7 +180,6 @@ control MyIngress(inout headers hdr,
|
||||||
default_action = NoAction;
|
default_action = NoAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
table v4_networks {
|
table v4_networks {
|
||||||
key = {
|
key = {
|
||||||
hdr.ipv4.dst_addr: lpm;
|
hdr.ipv4.dst_addr: lpm;
|
||||||
|
@ -181,11 +195,10 @@ control MyIngress(inout headers hdr,
|
||||||
/********************** APPLYING TABLES ***********************************/
|
/********************** APPLYING TABLES ***********************************/
|
||||||
apply {
|
apply {
|
||||||
if(hdr.ipv6.isValid()) {
|
if(hdr.ipv6.isValid()) {
|
||||||
|
|
||||||
/* FIXME: structure / use .hit to do logic */
|
/* FIXME: structure / use .hit to do logic */
|
||||||
// ndp_answer.apply();
|
// ndp_answer.apply();
|
||||||
|
|
||||||
//ndp.apply(); /* flood or if it is us - answer */
|
//ndp.apply(); /* flood or if it is us - answer */
|
||||||
|
|
||||||
v6_addresses.apply();
|
v6_addresses.apply();
|
||||||
v6_networks.apply();
|
v6_networks.apply();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue