From 83d22499d7cfa78a67e375718b4b1bd60e06fa2e Mon Sep 17 00:00:00 2001 From: schillinge Date: Wed, 20 Feb 2019 11:04:08 +0100 Subject: [PATCH] Update MAC address to match the next hop If the mac address is not updated the receiving host will reject the packet since it sees a MAC address which does not belong to him. Change-Id: I95edc11572b2ada8841b504ed8eee743613cce09 Signed-off-by: schillinge --- src/emuvim/api/openstack/resources/port_chain.py | 1 + src/emuvim/dcemulator/net.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/emuvim/api/openstack/resources/port_chain.py b/src/emuvim/api/openstack/resources/port_chain.py index 1f2a367..e9ce057 100644 --- a/src/emuvim/api/openstack/resources/port_chain.py +++ b/src/emuvim/api/openstack/resources/port_chain.py @@ -96,6 +96,7 @@ class PortChain(object): compute.dc.net.setChain( server_egress.name, server_ingress.name, egress_port.intf_name, ingress_port.intf_name, + mod_dl_dst=ingress_port.mac_address, cmd="add-flow", cookie=self.cookie, priority=10, bidirectional=False, monitor=False, skip_vlan_tag=True ) diff --git a/src/emuvim/dcemulator/net.py b/src/emuvim/dcemulator/net.py index 1bbc5bf..340f340 100755 --- a/src/emuvim/dcemulator/net.py +++ b/src/emuvim/dcemulator/net.py @@ -759,6 +759,7 @@ class DCNetwork(Containernet): cmd = kwargs.get('cmd') path = kwargs.get('path') index = kwargs.get('pathindex') + mod_dl_dst = kwargs.get('mod_dl_dst') vlan = kwargs.get('vlan') priority = kwargs.get('priority', DEFAULT_PRIORITY) @@ -826,6 +827,12 @@ class DCNetwork(Containernet): else: # middle nodes match += ',dl_vlan=%s' % vlan + if mod_dl_dst: + action = {} + action['type'] = 'SET_FIELD' + action['field'] = 'eth_dst' + action['value'] = mod_dl_dst + flow['actions'].append(action) # output action must come last action = {} -- 2.25.1