From c780ca3696adab7a488c6f77cd69ae8ef417773b Mon Sep 17 00:00:00 2001 From: Divakar Date: Mon, 29 Aug 2016 23:04:33 +0530 Subject: [PATCH] Handle unicast ARP requests in source compute node Currently the unicast ARP requests are not processed in the source compute node. These packets are switched to the destination compute node and before handing the L2 packet to destined VM, these are processed. This can result in Ecmp source VM sending unicast ARP requests and destination VM (non ecmp) responding with Vhost MAC. As a fix, unicast ARP requests are also processed in source compute node itself closes-bug: #1618154 Change-Id: Ic3a456f49297b982da79acc669982909ba2df74a --- dp-core/vr_bridge.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/dp-core/vr_bridge.c b/dp-core/vr_bridge.c index 94c1a630b..4520ca8d9 100644 --- a/dp-core/vr_bridge.c +++ b/dp-core/vr_bridge.c @@ -472,13 +472,16 @@ vr_bridge_input(struct vrouter *router, struct vr_packet *pkt, dmac = (int8_t *) pkt_data(pkt); pull_len = 0; - if ((pkt->vp_type == VP_TYPE_IP) || (pkt->vp_type == VP_TYPE_IP6)) { + if ((pkt->vp_type == VP_TYPE_IP) || (pkt->vp_type == VP_TYPE_IP6) || + (pkt->vp_type == VP_TYPE_ARP)) { pull_len = pkt_get_network_header_off(pkt) - pkt_head_space(pkt); if (pull_len && !pkt_pull(pkt, pull_len)) { vr_pfree(pkt, VP_DROP_PULL); return 0; } + } + if ((pkt->vp_type == VP_TYPE_IP) || (pkt->vp_type == VP_TYPE_IP6)) { if (fmd->fmd_dscp < 0) { if (pkt->vp_type == VP_TYPE_IP) { fmd->fmd_dscp = @@ -488,7 +491,6 @@ vr_bridge_input(struct vrouter *router, struct vr_packet *pkt, vr_inet6_get_tos((struct vr_ip6 *)pkt_network_header(pkt)); } } - } else { if (fmd->fmd_dotonep < 0) { fmd->fmd_dotonep = vr_vlan_get_tos(pkt_data(pkt)); @@ -497,7 +499,6 @@ vr_bridge_input(struct vrouter *router, struct vr_packet *pkt, /* Do the bridge lookup for the packets not meant for "me" */ if (!fmd->fmd_to_me) { - /* * If DHCP packet coming from VM, Trap it to Agent before doing the bridge * lookup itself @@ -514,6 +515,26 @@ vr_bridge_input(struct vrouter *router, struct vr_packet *pkt, return 0; } } + + /* + * Handle the unicast ARP, coming from VM, not + * destined to us. Broadcast ARP requests would be handled + * in L2 multicast nexthop. Multicast ARP on fabric + * interface also would be handled in L2 multicast nexthop. + * Unicast ARP packets on fabric interface would be handled + * in plug routines of interface. + */ + if (!IS_MAC_BMCAST(dmac)) { + handled = 0; + if (pkt->vp_type == VP_TYPE_ARP) { + handled = vr_arp_input(pkt, fmd, dmac); + } else if (l4_type == L4_TYPE_NEIGHBOUR_SOLICITATION) { + handled = vr_neighbor_input(pkt, fmd, dmac); + } + + if (handled) + return 0; + } } rt.rtr_req.rtr_label_flags = 0;