Skip to content

Commit

Permalink
Merge "While sending RA, adjust offset correctly if vlan is also adde…
Browse files Browse the repository at this point in the history
…d." into R3.1
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Jul 22, 2016
2 parents 99dc82a + aed96a7 commit b95a6ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 13 additions & 4 deletions src/vnsw/agent/services/icmpv6_handler.cc
Expand Up @@ -156,8 +156,12 @@ bool Icmpv6Handler::RouterAdvertisement(Icmpv6Proto *proto) {
pkt_info_->AllocPacketBuffer(agent(), PktHandler::ICMPV6, ICMP_PKT_SIZE, 0);
pkt_info_->eth = (struct ether_header *)(pkt_info_->pkt);
pkt_info_->ip6 = (ip6_hdr *)(pkt_info_->pkt + sizeof(struct ether_header));
uint32_t vlan_offset = 0;
if (vmi->tx_vlan_id() != VmInterface::kInvalidVlanId)
vlan_offset += 4;
icmp_ = pkt_info_->transp.icmp6 =
(icmp6_hdr *)(pkt_info_->pkt + sizeof(struct ether_header) + sizeof(ip6_hdr));
(icmp6_hdr *)(pkt_info_->pkt + sizeof(struct ether_header) +
vlan_offset + sizeof(ip6_hdr));
Ip6Address prefix;
uint8_t plen;
if (vmi->vn()->GetPrefix(vmi->primary_ip6_addr(), &prefix, &plen)) {
Expand Down Expand Up @@ -352,7 +356,8 @@ void Icmpv6Handler::SolicitedMulticastIpAndMac(const Ip6Address &dip,
}

void Icmpv6Handler::SendNeighborSolicit(const Ip6Address &sip,
const Ip6Address &dip, uint32_t itf,
const Ip6Address &dip,
const VmInterface *vmi,
uint32_t vrf) {
if (pkt_info_->packet_buffer() == NULL) {
pkt_info_->AllocPacketBuffer(agent(), PktHandler::ICMPV6, ICMP_PKT_SIZE,
Expand All @@ -361,16 +366,20 @@ void Icmpv6Handler::SendNeighborSolicit(const Ip6Address &sip,

pkt_info_->eth = (struct ether_header *)(pkt_info_->pkt);
pkt_info_->ip6 = (ip6_hdr *)(pkt_info_->pkt + sizeof(struct ether_header));
uint32_t vlan_offset = 0;
if (vmi->tx_vlan_id() != VmInterface::kInvalidVlanId)
vlan_offset += 4;
icmp_ = pkt_info_->transp.icmp6 =
(icmp6_hdr *)(pkt_info_->pkt + sizeof(struct ether_header) +
sizeof(ip6_hdr));
vlan_offset + sizeof(ip6_hdr));
uint8_t solicited_mcast_ip[16], source_ip[16];
MacAddress dmac;
memcpy(source_ip, sip.to_bytes().data(), sizeof(source_ip));
SolicitedMulticastIpAndMac(dip, solicited_mcast_ip, dmac);
uint16_t len = FillNeighborSolicit((uint8_t *)icmp_, dip, source_ip,
solicited_mcast_ip);
SendIcmpv6Response(itf, vrf, source_ip, solicited_mcast_ip, dmac, len);
SendIcmpv6Response(vmi->id(), vrf, source_ip,
solicited_mcast_ip, dmac, len);
}

bool Icmpv6Handler::IsDefaultGatewayConfigured(uint32_t ifindex,
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/services/icmpv6_handler.h
Expand Up @@ -23,7 +23,7 @@ class Icmpv6Handler : public ProtoHandler {
bool Run();
bool RouterAdvertisement(Icmpv6Proto *proto);
void SendNeighborSolicit(const Ip6Address &sip, const Ip6Address &dip,
uint32_t itf, uint32_t vrf);
const VmInterface *vmi, uint32_t vrf);

private:
bool CheckPacket();
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/services/icmpv6_proto.cc
Expand Up @@ -272,7 +272,7 @@ bool Icmpv6RouteState::SendNeighborSolicit() {
continue;
}
it->second++;
handler.SendNeighborSolicit(gw_ip_.to_v6(), vm_ip_.to_v6(), it->first,
handler.SendNeighborSolicit(gw_ip_.to_v6(), vm_ip_.to_v6(), vm_intf,
vrf_id_);
vrf_state_->icmp_proto()->IncrementStatsNeighborSolicit(vm_intf);
ret = true;
Expand Down

0 comments on commit b95a6ca

Please sign in to comment.