From d5fb908e986f3804025294a672889ac474b12f3e Mon Sep 17 00:00:00 2001 From: Naveen N Date: Fri, 26 Feb 2016 14:22:43 +0530 Subject: [PATCH] * In case of IPv6 ICMP errors parse thru inner payload and frame the flow key. Closes-bug:#1542207 Change-Id: I66793922b0bba02c43c9eebde86bafa7e8035e9e --- src/vnsw/agent/pkt/pkt_handler.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/vnsw/agent/pkt/pkt_handler.cc b/src/vnsw/agent/pkt/pkt_handler.cc index 1d2f801a42e..79e42767bc6 100644 --- a/src/vnsw/agent/pkt/pkt_handler.cc +++ b/src/vnsw/agent/pkt/pkt_handler.cc @@ -454,6 +454,21 @@ int PktHandler::ParseIpPacket(PktInfo *pkt_info, PktType::Type &pkt_type, icmp->icmp6_type == ICMP6_ECHO_REPLY) { pkt_info->dport = ICMP6_ECHO_REPLY; pkt_info->sport = htons(icmp->icmp6_id); + } else if (IsFlowPacket(pkt_info) && + icmp->icmp6_type < ICMP6_ECHO_REQUEST) { + //Agent has to look at inner payload + //and recalculate the parameter + //Handle this only for packets requiring flow miss + ParseIpPacket(pkt_info, pkt_type, pkt + len + sizeof(icmp)); + //Swap the key parameter, which would be used as key + IpAddress src_ip = pkt_info->ip_saddr; + pkt_info->ip_saddr = pkt_info->ip_daddr; + pkt_info->ip_daddr = src_ip; + if (pkt_info->ip_proto != IPPROTO_ICMPV6) { + uint16_t port = pkt_info->sport; + pkt_info->sport = pkt_info->dport; + pkt_info->dport = port; + } } else { pkt_info->sport = 0; }