diff --git a/dash-pipeline/bmv2/dash_inbound.p4 b/dash-pipeline/bmv2/dash_inbound.p4 index 9a087c479..f96c3029e 100644 --- a/dash-pipeline/bmv2/dash_inbound.p4 +++ b/dash-pipeline/bmv2/dash_inbound.p4 @@ -37,6 +37,7 @@ control inbound(inout headers_t hdr, inbound_routing_stage.apply(hdr, meta); + meta.routing_actions = dash_routing_actions_t.ENCAP_U0; do_tunnel_encap(hdr, meta, meta.u0_encap_data.underlay_dmac, diff --git a/dash-pipeline/bmv2/dash_pipeline.p4 b/dash-pipeline/bmv2/dash_pipeline.p4 index 0e3e13a3a..13a31e916 100644 --- a/dash-pipeline/bmv2/dash_pipeline.p4 +++ b/dash-pipeline/bmv2/dash_pipeline.p4 @@ -299,8 +299,13 @@ control dash_ingress( routing_action_apply.apply(hdr, meta); - /* Underlay routing */ - meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr; + /* Underlay routing, using meta.dst_ip_addr as lookup key */ + if (meta.routing_actions & dash_routing_actions_t.ENCAP_U1 != 0) { + meta.dst_ip_addr = (bit<128>)hdr.u1_ipv4.dst_addr; + } + else if (meta.routing_actions & dash_routing_actions_t.ENCAP_U0 != 0) { + meta.dst_ip_addr = (bit<128>)hdr.u0_ipv4.dst_addr; + } underlay.apply( hdr