Add code to mimic if in action

New table logic, new actions
This commit is contained in:
Nico Schottelius 2019-03-27 19:43:49 +01:00
commit d6264a32a4
2 changed files with 74 additions and 84 deletions

View file

@ -38,6 +38,17 @@ table_id_fields = {
5: 'TABLE_V4_NETWORKS'
}
table_proto = {
'ICMP6_ECHO_REQUEST' : 128,
'ICMP6_ECHO_REPLY' : 129,
'ICMP6_NS' : 135,
'ICMP6_NA' : 136,
'ICMP_ECHO_REPLY' : 0,
'ICMP_ECHO_REQUEST' : 8
}
class CpuHeader(Packet):
name = 'CpuPacket'
fields_desc = [
@ -273,17 +284,41 @@ class L2Controller(object):
v6_src, v6_dst, v4_dst,
v4_src, v4_dst, v6_src))
# [str(v6_src)
self.controller.table_add("nat64", "nat64_static",
[str(v6_dst)],
self.controller.table_add("nat64_icmp6",
"nat64_icmp6_echo_request",
[str(v6_dst),
str(table_proto['ICMP6_ECHO_REQUEST'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
# [str(v4_src)
self.controller.table_add("nat46", "nat46_static",
[str(v4_dst)],
self.controller.table_add("nat64_icmp6",
"nat64_icmp6_echo_reply",
[str(v6_dst),
str(table_proto['ICMP6_ECHO_REPLY'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
self.controller.table_add("nat46_icmp",
"nat46_icmp_echo_reply",
[str(v4_dst)
str(table_proto['ICMP_ECHO_REPLY'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]
)
self.controller.table_add("nat46_icmp",
"nat46_icmp_echo_request",
[str(v4_dst)
str(table_proto['ICMP_ECHO_REQUEST'])
],
[str(v6_src.network_address),
str(v4_dst.network_address),
str(v6_dst.network_address)]