[controller] setup v4 dst/src correctly

This commit is contained in:
Nico Schottelius 2019-05-06 13:06:09 +02:00
parent 8b5126e371
commit 34e3b84a1d

View file

@ -547,8 +547,17 @@ class L2Controller(object):
tcp_dst_port = pkg[TCP].dport tcp_dst_port = pkg[TCP].dport
# FIXME: range, reuse, etc. # FIXME: range, reuse, etc.
ipv4_src_addr = self.nat64_session_net[self.mode] idx = self.nat64_session_net[self.mode]['v4_idx']
self.nat64_session_net[self.mode] += 1 self.nat64_session_net[self.mode]['v4_idx'] += 1
ipv4_src_addr = self.nat64_session_net[self.mode]['v4_net'][idx]
ipv6_dst_addr = ipaddress.IPv6Address(pkg[IPv6].dst)
ipv4_dst_addr = int(ipv6_dst_addr) - int(self.nat64_session_net[self.mode]['v6_net'][0])
log.debug("src v4={}, dst v6 = {}, dst v4 = {}".format(ipv4_src_addr,
ipv6_dst_addr,
ipv4_dst_addr)
self.controller.table_add("nat64_tcp_session", self.controller.table_add("nat64_tcp_session",