Skip to content

Commit

Permalink
Merge "Compute forwarding mode correctly while parsing packet receive…
Browse files Browse the repository at this point in the history
…d from a physical interface." into R3.2
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Dec 1, 2016
2 parents 9de0432 + 8f31feb commit 065a95b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/vnsw/agent/pkt/pkt_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ PktHandler::PktModuleName PktHandler::ParsePacket(const AgentHdr &hdr,
}

// Compute L2/L3 forwarding mode for packet
pkt_info->l3_forwarding = ComputeForwardingMode(pkt_info);
pkt_info->l3_forwarding = ComputeForwardingMode(pkt_info, intf);

pkt_info->vrf = pkt_info->agent_hdr.vrf;

Expand Down Expand Up @@ -297,9 +297,10 @@ void PktHandler::PktModuleEnqueue(PktModuleName mod, const AgentHdr &hdr,
// Compute L2/L3 forwarding mode for pacekt.
// Forwarding mode is L3 if,
// - Packet uses L3 label
// - DMAC in packet is VRRP Mac or VHOST MAC
// - DMAC in packet is VRRP Mac or VHOST MAC or receiving physical interface MAC
// Else forwarding mode is L2
bool PktHandler::ComputeForwardingMode(PktInfo *pkt_info) const {
bool PktHandler::ComputeForwardingMode(PktInfo *pkt_info,
const Interface *intf) const {
if (pkt_info->tunnel.type.GetType() == TunnelType::MPLS_GRE ||
pkt_info->tunnel.type.GetType() == TunnelType::MPLS_UDP) {
return pkt_info->l3_label;
Expand All @@ -313,6 +314,11 @@ bool PktHandler::ComputeForwardingMode(PktInfo *pkt_info) const {
return true;
}

if (intf && intf->type() == Interface::PHYSICAL &&
pkt_info->dmac == intf->mac()) {
return true;
}

return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/pkt/pkt_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ class PktHandler {
int ParseUDPTunnels(PktInfo *pkt_info, uint8_t *pkt);
int ParseVxlan(PktInfo *pkt_info, uint8_t *pkt);
int ParseUdp(PktInfo *pkt_info, uint8_t *pkt);
bool ComputeForwardingMode(PktInfo *pkt_info) const;
bool ComputeForwardingMode(PktInfo *pkt_info, const Interface *intf) const;

void SetOuterIp(PktInfo *pkt_info, uint8_t *pkt);
void SetOuterMac(PktInfo *pkt_info);
Expand Down

0 comments on commit 065a95b

Please sign in to comment.