Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On a routing vlan, the neighbor entry in the /31 subnet is not added to hardware #771

Merged
merged 6 commits into from
Jan 28, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ bool IntfsOrch::setIntf(const string& alias, sai_object_id_t vrf_id, const IpPre

if (port.m_type == Port::VLAN && ip_prefix->isV4())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?. Subnet broadcasting is not supported for IPv6.

{
addDirectedBroadcast(port, ip_prefix->getBroadcastIp());
addDirectedBroadcast(port, *ip_prefix);
}

m_syncdIntfses[alias].ip_addresses.insert(*ip_prefix);
Expand Down Expand Up @@ -344,9 +344,10 @@ void IntfsOrch::doTask(Consumer &consumer)
{
removeSubnetRoute(port, ip_prefix);
removeIp2MeRoute(vrf_id, ip_prefix);

if(port.m_type == Port::VLAN && ip_prefix.isV4())
{
removeDirectedBroadcast(port, ip_prefix.getBroadcastIp());
removeDirectedBroadcast(port, ip_prefix);
}

m_syncdIntfses[alias].ip_addresses.erase(ip_prefix);
Expand Down Expand Up @@ -623,10 +624,20 @@ void IntfsOrch::removeIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_pref
}
}

void IntfsOrch::addDirectedBroadcast(const Port &port, const IpAddress &ip_addr)
void IntfsOrch::addDirectedBroadcast(const Port &port, const IpPrefix &ip_prefix)
{
sai_status_t status;
sai_neighbor_entry_t neighbor_entry;
IpAddress ip_addr;

/* For /31 v4 subnets, there is no broadcast address, hence don't
* add a broadcast route. */
if (ip_prefix.getMaskLength() == 31)
{
return;
}
ip_addr = ip_prefix.getBroadcastIp();

neighbor_entry.rif_id = port.m_rif_id;
neighbor_entry.switch_id = gSwitchId;
copy(neighbor_entry.ip_address, ip_addr);
Expand All @@ -646,10 +657,19 @@ void IntfsOrch::addDirectedBroadcast(const Port &port, const IpAddress &ip_addr)
SWSS_LOG_NOTICE("Add broadcast route for ip:%s", ip_addr.to_string().c_str());
}

void IntfsOrch::removeDirectedBroadcast(const Port &port, const IpAddress &ip_addr)
void IntfsOrch::removeDirectedBroadcast(const Port &port, const IpPrefix &ip_prefix)
{
sai_status_t status;
sai_neighbor_entry_t neighbor_entry;
IpAddress ip_addr;

/* For /31 v4 subnets, there is no broadcast address */
if (ip_prefix.getMaskLength() == 31)
{
return;
}
ip_addr = ip_prefix.getBroadcastIp();

neighbor_entry.rif_id = port.m_rif_id;
neighbor_entry.switch_id = gSwitchId;
copy(neighbor_entry.ip_address, ip_addr);
Expand Down
4 changes: 2 additions & 2 deletions orchagent/intfsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ class IntfsOrch : public Orch
void addIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_prefix);
void removeIp2MeRoute(sai_object_id_t vrf_id, const IpPrefix &ip_prefix);

void addDirectedBroadcast(const Port &port, const IpAddress &ip_addr);
void removeDirectedBroadcast(const Port &port, const IpAddress &ip_addr);
void addDirectedBroadcast(const Port &port, const IpPrefix &ip_prefix);
void removeDirectedBroadcast(const Port &port, const IpPrefix &ip_prefix);
};

#endif /* SWSS_INTFSORCH_H */