Skip to content

Commit

Permalink
Send regular ARP requests to VMs when in server gateway mode.
Browse files Browse the repository at this point in the history
Change-Id: Ia4613fb4488714ffff29b65493c4d20543fb5409
closes-bug: #1599028
(cherry picked from commit a8258c4)
  • Loading branch information
haripk committed Jul 18, 2016
1 parent caa2b8a commit c847f96
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/vnsw/agent/cmn/agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void Agent::CopyConfig(AgentParam *params) {
test_mode_ = params_->test_mode();
tsn_enabled_ = params_->isTsnAgent();
tor_agent_enabled_ = params_->isTorAgent();
remote_vm_vrouter_ = params_->isRemoteVmVrouter();
server_gateway_mode_ = params_->isServerGatewayMode();
flow_thread_count_ = params_->flow_thread_count();
flow_trace_enable_ = params_->flow_trace_enable();
flow_add_tokens_ = params_->flow_add_tokens();
Expand Down Expand Up @@ -580,7 +580,7 @@ Agent::Agent() :
connection_state_(NULL), test_mode_(false),
xmpp_dns_test_mode_(false),
init_done_(false), simulate_evpn_tor_(false), tsn_enabled_(false),
tor_agent_enabled_(false), remote_vm_vrouter_(false),
tor_agent_enabled_(false), server_gateway_mode_(false),
flow_table_size_(0), flow_thread_count_(0), flow_trace_enable_(true),
max_vm_flows_(0), ovsdb_client_(NULL), vrouter_server_ip_(0),
vrouter_server_port_(0), vrouter_max_labels_(0), vrouter_max_nexthops_(0),
Expand Down
6 changes: 3 additions & 3 deletions src/vnsw/agent/cmn/agent.h
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,8 @@ class Agent {
void set_tsn_enabled(bool val) {tsn_enabled_ = val;}
bool tor_agent_enabled() const {return tor_agent_enabled_;}
void set_tor_agent_enabled(bool val) {tor_agent_enabled_ = val;}
bool remote_vm_vrouter() const {return remote_vm_vrouter_;}
void set_remote_vm_vrouter(bool val) {remote_vm_vrouter_= val;}
bool server_gateway_mode() const {return server_gateway_mode_;}
void set_server_gateway_mode(bool val) {server_gateway_mode_ = val;}

IFMapAgentParser *ifmap_parser() const {return ifmap_parser_;}
void set_ifmap_parser(IFMapAgentParser *parser) {
Expand Down Expand Up @@ -1210,7 +1210,7 @@ class Agent {
bool simulate_evpn_tor_;
bool tsn_enabled_;
bool tor_agent_enabled_;
bool remote_vm_vrouter_;
bool server_gateway_mode_;

// Flow information
uint32_t flow_table_size_;
Expand Down
8 changes: 4 additions & 4 deletions src/vnsw/agent/init/agent_param.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,8 @@ void AgentParam::set_agent_mode(const std::string &mode) {

void AgentParam::set_gateway_mode(const std::string &mode) {
std::string gateway_mode = boost::to_lower_copy(mode);
if (gateway_mode == "remote-vm")
gateway_mode_ = REMOTE_VM;
if (gateway_mode == "server")
gateway_mode_ = SERVER;
else if (gateway_mode == "vcpe")
gateway_mode_ = VCPE;
else
Expand Down Expand Up @@ -1243,8 +1243,8 @@ void AgentParam::LogConfig() const {
else if (agent_mode_ == TOR_AGENT)
LOG(DEBUG, "Agent Mode : TOR");

if (gateway_mode_ == REMOTE_VM)
LOG(DEBUG, "Gateway Mode : Remote VM");
if (gateway_mode_ == SERVER)
LOG(DEBUG, "Gateway Mode : Server");
else if (gateway_mode_ == VCPE)
LOG(DEBUG, "Gateway Mode : vCPE");
else if (gateway_mode_ == NONE)
Expand Down
5 changes: 2 additions & 3 deletions src/vnsw/agent/init/agent_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ class AgentParam {
// Gateway mode that the agent is running in
enum GatewayMode {
VCPE,
REMOTE_VM, // has VMs running on a remote machine and vrouter maps
// vlans to VMIs.
SERVER, // also has VMs on a remote server & vrouter maps vlans to VMIs
NONE
};

Expand Down Expand Up @@ -236,7 +235,7 @@ class AgentParam {
AgentMode agent_mode() const { return agent_mode_; }
bool isTsnAgent() const { return agent_mode_ == TSN_AGENT; }
bool isTorAgent() const { return agent_mode_ == TOR_AGENT; }
bool isRemoteVmVrouter() const { return gateway_mode_ == REMOTE_VM; }
bool isServerGatewayMode() const { return gateway_mode_ == SERVER; }
GatewayMode gateway_mode() const { return gateway_mode_; }

const AddressList &compute_node_address_list() const {
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/oper/physical_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ void PhysicalInterface::PostAdd() {
// Interfaces in VMWARE mode and having remote VMs
// must be put into promiscuous mode
if (subtype_ != VMWARE) {
if (!table->agent()->remote_vm_vrouter() ||
if (!table->agent()->server_gateway_mode() ||
subtype_ == PhysicalInterface::FABRIC) {
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/oper/vm_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ static void ComputeTypeInfo(Agent *agent, VmInterfaceConfigData *data,
// VMI is either Baremetal or Gateway interface
if (prouter->display_name() == agent->agent_name()) {
// VMI connected to local vrouter. Treat it as GATEWAY / Remote VM.
if (agent->remote_vm_vrouter()) {
if (agent->server_gateway_mode()) {
data->device_type_ = VmInterface::REMOTE_VM_VLAN_ON_VMI;
data->vmi_type_ = VmInterface::REMOTE_VM;
} else {
Expand Down
15 changes: 10 additions & 5 deletions src/vnsw/agent/services/arp_proto.cc
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,18 @@ bool ArpDBState::SendArpRequest() {

WaitForTrafficIntfMap::iterator it = wait_for_traffic_map_.begin();
for (;it != wait_for_traffic_map_.end(); it++) {
if (it->second >= kMaxRetry) {
continue;
}

const VmInterface *vm_intf = static_cast<const VmInterface *>(
vrf_state_->agent->interface_table()->FindInterface(it->first));
if (!vm_intf) {
continue;
}

if (it->second >= kMaxRetry) {
// In gateway mode with remote VMIs, send regular ARP requests
if (vm_intf->vmi_type() != VmInterface::REMOTE_VM)
continue;
}

MacAddress smac = vm_intf->GetVifMac(vrf_state_->agent);
it->second++;
arp_handler.SendArp(ARPOP_REQUEST, smac,
Expand Down Expand Up @@ -175,9 +178,11 @@ void ArpDBState::SendArpRequestForAllIntf(const InetUnicastRouteEntry *route) {
}
gw_ip_ = path->subnet_service_ip();
uint32_t intf_id = intf->id();
const VmInterface *vm_intf = static_cast<const VmInterface *>(intf);
bool wait_for_traffic = path->path_preference().wait_for_traffic();
//Build new list of interfaces in active state
if (wait_for_traffic == true) {
if (wait_for_traffic == true ||
vm_intf->vmi_type() == VmInterface::REMOTE_VM) {
WaitForTrafficIntfMap::const_iterator wait_for_traffic_it =
wait_for_traffic_map_.find(intf_id);
if (wait_for_traffic_it == wait_for_traffic_map_.end()) {
Expand Down
2 changes: 1 addition & 1 deletion src/vnsw/agent/vrouter/ksync/interface_ksync.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ int InterfaceKSyncEntry::Encode(sandesh_op::type op, char *buf, int buf_len) {
}

if (subtype_ == PhysicalInterface::VMWARE ||
ksync_obj_->ksync()->agent()->remote_vm_vrouter()) {
ksync_obj_->ksync()->agent()->server_gateway_mode()) {
flags |= VIF_FLAG_PROMISCOUS;
}
if (subtype_ == PhysicalInterface::CONFIG) {
Expand Down

0 comments on commit c847f96

Please sign in to comment.