Skip to content

Commit

Permalink
Check size of MAC vector before reading the element
Browse files Browse the repository at this point in the history
While clearing the neutron router, Agent some times receives NULL object
without any properties. As this is not a delete operation
ServiceInstance attempts to calcualte the properties of the instance by
traversing the node grpah. When VMI is seen, it attempts to read the mac
address which as such is not preset leading to crash.

As a fix, the mac address is read only if the Mac vector has some
element in it.

Change-Id: Idd2afde67f56728408e5c553d772f30d00a246af
closes-bug: #1474272
  • Loading branch information
divakardhar committed Aug 3, 2015
1 parent af7d08d commit 513b289
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/vnsw/agent/oper/service_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,23 @@ static void FindAndSetInterfaces(
properties->interface_count++;
if(vmi_props.service_interface_type == "left") {
properties->vmi_inside = IdPermsGetUuid(vmi->id_perms());
properties->mac_addr_inside = vmi->mac_addresses().at(0);
if (vmi->mac_addresses().size()) {
properties->mac_addr_inside = vmi->mac_addresses().at(0);
}
properties->ip_addr_inside = FindInterfaceIp(graph, adj);
}
else if(vmi_props.service_interface_type == "right") {
properties->vmi_outside = IdPermsGetUuid(vmi->id_perms());
properties->mac_addr_outside = vmi->mac_addresses().at(0);
if (vmi->mac_addresses().size()) {
properties->mac_addr_outside = vmi->mac_addresses().at(0);
}
properties->ip_addr_outside = FindInterfaceIp(graph, adj);
}
else if(vmi_props.service_interface_type == "management") {
properties->vmi_management = IdPermsGetUuid(vmi->id_perms());
properties->mac_addr_management = vmi->mac_addresses().at(0);
if (vmi->mac_addresses().size()) {
properties->mac_addr_management = vmi->mac_addresses().at(0);
}
properties->ip_addr_management = FindInterfaceIp(graph, adj);
}

Expand Down

0 comments on commit 513b289

Please sign in to comment.