Skip to content

Commit

Permalink
Merge "* Delete allowed-address pair entries before adding new ones I…
Browse files Browse the repository at this point in the history
…f mac address for a IP is update, layer3 route was getting deleted if the new mac was lesser than older mac. Delete allowed-address-pair first then add the new entries to avoid this scenario. Closes-bug:#1547677"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Feb 22, 2016
2 parents bceb69e + bddef88 commit b2b0819
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
19 changes: 18 additions & 1 deletion src/vnsw/agent/oper/test/test_aap.cc
Expand Up @@ -269,6 +269,23 @@ TEST_F(TestAap, EvpnRoute_1) {
EXPECT_TRUE(vm_intf->allowed_address_pair_list().list_.size() == 0);
}

TEST_F(TestAap, EvpnRoute_with_mac_change) {
Ip4Address ip = Ip4Address::from_string("10.10.10.10");
MacAddress mac("0a:0b:0c:0d:0e:0f");
MacAddress mac1("0a:0b:0c:0d:0e:0e");

VmInterface *vm_intf = static_cast<VmInterface *>(VmPortGet(1));
AddAap("intf1", 1, ip, mac.ToString());
EXPECT_TRUE(RouteFind("vrf1", ip, 32));
EXPECT_TRUE(EvpnRouteGet("vrf1", mac, ip, 0));
EXPECT_TRUE(vm_intf->allowed_address_pair_list().list_.size() == 1);

AddAap("intf1", 1, ip, mac1.ToString());
EXPECT_TRUE(RouteFind("vrf1", ip, 32));
EXPECT_FALSE(EvpnRouteGet("vrf1", mac, ip, 0));
EXPECT_TRUE(EvpnRouteGet("vrf1", mac1, ip, 0));
}

#if 0
TEST_F(TestAap, EvpnRoute_3) {
struct PortInfo input[] = {
Expand Down Expand Up @@ -1074,7 +1091,7 @@ TEST_F(TestAap, StateMachine_18) {
client->WaitForIdle();
}

TEST_F(TestAap, StateMachine_16) {
TEST_F(TestAap, StateMachine_19) {
Ip4Address ip = Ip4Address::from_string("10.10.10.10");
MacAddress mac("0a:0b:0c:0d:0e:0f");

Expand Down
29 changes: 16 additions & 13 deletions src/vnsw/agent/oper/vm_interface.cc
Expand Up @@ -2878,27 +2878,30 @@ void VmInterface::UpdateAllowedAddressPair(bool force_update, bool policy_change
bool l2, bool old_layer2_forwarding,
bool old_layer3_forwarding) {
AllowedAddressPairSet::iterator it =
allowed_address_pair_list_.list_.begin();
allowed_address_pair_list_.list_.begin();
while (it != allowed_address_pair_list_.list_.end()) {
AllowedAddressPairSet::iterator prev = it++;
if (prev->del_pending_) {
prev->L2DeActivate(this);
prev->DeActivate(this);
allowed_address_pair_list_.list_.erase(prev);
}
}

for (it = allowed_address_pair_list_.list_.begin();
it != allowed_address_pair_list_.list_.end(); it++) {
/* V4 AAP entries should be enabled only if ipv4_active_ is true
* V6 AAP entries should be enabled only if ipv6_active_ is true
*/
if ((!ipv4_active_ && prev->addr_.is_v4()) ||
(!ipv6_active_ && prev->addr_.is_v6())) {
if ((!ipv4_active_ && it->addr_.is_v4()) ||
(!ipv6_active_ && it->addr_.is_v6())) {
continue;
}
if (prev->del_pending_) {
prev->L2DeActivate(this);
prev->DeActivate(this);
allowed_address_pair_list_.list_.erase(prev);
if (l2) {
it->L2Activate(this, force_update, policy_change,
old_layer2_forwarding, old_layer3_forwarding);
} else {
if (l2) {
prev->L2Activate(this, force_update, policy_change,
old_layer2_forwarding, old_layer3_forwarding);
} else {
prev->Activate(this, force_update, policy_change);
}
it->Activate(this, force_update, policy_change);
}
}
}
Expand Down

0 comments on commit b2b0819

Please sign in to comment.