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

Code changes to support IPv6 Link local enhancements #1463

Merged
merged 31 commits into from
Aug 5, 2021
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a5f21ff
Code changes to support IPv6 Link local enchancements
AkhileshSamineni Oct 10, 2020
b0257fc
Updated pytest for ipv6 link-local.
AkhileshSamineni Oct 21, 2020
c8fabd8
Few fixes for docker-vs pytest.
AkhileshSamineni Oct 22, 2020
0b9e8d1
Corrected the changes as per design change.
AkhileshSamineni Apr 5, 2021
54c974b
Added the removed file.
AkhileshSamineni Apr 5, 2021
a6ed450
Removed hasIp2MeAddr function.
AkhileshSamineni Apr 14, 2021
e85122e
Added vs testcase for interface.
AkhileshSamineni Jun 7, 2021
2642fa2
Fixed LGTM issue.
AkhileshSamineni Jun 7, 2021
37afab4
Added vs testcase for LAG and Vlan interfaces.
AkhileshSamineni Jun 7, 2021
a167064
Addressed review comments
AkhileshSamineni Jun 25, 2021
2b7d62c
Validation check added in remove_vlan()
AkhileshSamineni Jul 1, 2021
373cc3e
Added vlan verification using dvs_vlan
AkhileshSamineni Jul 1, 2021
e2d14b0
Corrected vlan verification
AkhileshSamineni Jul 1, 2021
dda4999
Correction in Vlan create function
AkhileshSamineni Jul 1, 2021
0e1cb06
Modified in Vlan create
AkhileshSamineni Jul 2, 2021
7574a3a
Few more corrections
AkhileshSamineni Jul 2, 2021
bf6336a
Added validation checks in remove_vrf
AkhileshSamineni Jul 2, 2021
ae7a169
Added different VRs in the testcase
AkhileshSamineni Jul 2, 2021
1e03523
Few correction in create_vrf
AkhileshSamineni Jul 3, 2021
f99203e
Cleanup in remove_vrf
AkhileshSamineni Jul 3, 2021
c9fa5ea
Added few more cleanup
AkhileshSamineni Jul 3, 2021
5d36b60
Added few more cleanup in create_vrf
AkhileshSamineni Jul 3, 2021
122afaa
Reverted the changes tried for l3 vxlan test case
AkhileshSamineni Jul 4, 2021
cb780ed
Added few prints to debug further
AkhileshSamineni Jul 6, 2021
2c62ef6
Added few more changes in test case
AkhileshSamineni Jul 6, 2021
47faa87
Added few more changes in test case2
AkhileshSamineni Jul 6, 2021
adfb5d5
Reverted/Removed few changes to verify the l3 vxlan test case
AkhileshSamineni Jul 22, 2021
e2448d6
Removed the VRF changes
AkhileshSamineni Jul 26, 2021
37ed2cf
Removed the extra line in file
AkhileshSamineni Jul 26, 2021
d774cea
Addressed minor comment
AkhileshSamineni Aug 2, 2021
3e615e2
Added changes to skip the link-local neighbors based on ipv6_link_loc…
AkhileshSamineni Aug 4, 2021
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
24 changes: 18 additions & 6 deletions cfgmgr/intfmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
string proxy_arp = "";
string grat_arp = "";
string mpls = "";
string ipv6_link_local_mode = "";

for (auto idx : data)
{
Expand Down Expand Up @@ -506,11 +507,14 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
{
mpls = value;
}

if (field == "nat_zone")
else if (field == "nat_zone")
{
nat_zone = value;
}
else if (field == "ipv6_use_link_local_only")
{
ipv6_link_local_mode = value;
}
}

if (op == SET_COMMAND)
Expand Down Expand Up @@ -551,6 +555,7 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
FieldValueTuple fvTuple("nat_zone", nat_zone);
data.push_back(fvTuple);
}

/* Set mpls */
if (!setIntfMpls(alias, mpls))
{
Expand All @@ -562,6 +567,13 @@ bool IntfMgr::doIntfGeneralTask(const vector<string>& keys,
FieldValueTuple fvTuple("mpls", mpls);
data.push_back(fvTuple);
}

/* Set ipv6 mode */
if (!ipv6_link_local_mode.empty())
Copy link
Collaborator

Choose a reason for hiding this comment

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

HLD mentions about setting the sysctl variable - sysctl -w net.ipv6.conf.default.disable_ipv6=1
Where is this handled. Also, could you please revise the HLD based on the implementation. The flows are different b/w HLD and implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the HLD. Setting sysctl variable is not needed as IPv6 is enabled by default as per new design.

{
FieldValueTuple fvTuple("ipv6_use_link_local_only", ipv6_link_local_mode);
data.push_back(fvTuple);
}
}

if (!parentAlias.empty())
Expand Down Expand Up @@ -731,8 +743,8 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
std::vector<FieldValueTuple> fvVector;
FieldValueTuple f("family", ip_prefix.isV4() ? IPV4_NAME : IPV6_NAME);

// Don't send link local config to AppDB and Orchagent
if (ip_prefix.getIp().getAddrScope() != IpAddress::AddrScope::LINK_SCOPE)
// Don't send ipv4 link local config to AppDB and Orchagent
if ((ip_prefix.isV4() == false) or (ip_prefix.getIp().getAddrScope() != IpAddress::AddrScope::LINK_SCOPE))
prsunny marked this conversation as resolved.
Show resolved Hide resolved
{
FieldValueTuple s("scope", "global");
fvVector.push_back(s);
Expand All @@ -745,8 +757,8 @@ bool IntfMgr::doIntfAddrTask(const vector<string>& keys,
{
setIntfIp(alias, "del", ip_prefix);

// Don't send link local config to AppDB and Orchagent
if (ip_prefix.getIp().getAddrScope() != IpAddress::AddrScope::LINK_SCOPE)
// Don't send ipv4 link local config to AppDB and Orchagent
if ((ip_prefix.isV4() == false) or (ip_prefix.getIp().getAddrScope() != IpAddress::AddrScope::LINK_SCOPE))
{
m_appIntfTableProducer.del(appKey);
m_stateIntfTable.del(keys[0] + state_db_key_delimiter + keys[1]);
Expand Down
3 changes: 0 additions & 3 deletions neighsyncd/neighsync.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ void NeighSync::onMsg(int nlmsg_type, struct nl_object *obj)
key+= ":";

nl_addr2str(rtnl_neigh_get_dst(neigh), ipStr, MAX_ADDR_SIZE);
/* Ignore IPv6 link-local addresses as neighbors */
prsunny marked this conversation as resolved.
Show resolved Hide resolved
if (family == IPV6_NAME && IN6_IS_ADDR_LINKLOCAL(nl_addr_get_binary_addr(rtnl_neigh_get_dst(neigh))))
return;
/* Ignore IPv6 multicast link-local addresses as neighbors */
if (family == IPV6_NAME && IN6_IS_ADDR_MC_LINKLOCAL(nl_addr_get_binary_addr(rtnl_neigh_get_dst(neigh))))
return;
Expand Down
13 changes: 13 additions & 0 deletions orchagent/neighorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,19 @@ void NeighOrch::doTask(Consumer &consumer)

IpAddress ip_address(key.substr(found+1));

/* Verify Ipv4 LinkLocal and skip neighbor entry added for RFC5549 */
if ((ip_address.getAddrScope() == IpAddress::LINK_SCOPE) && (ip_address.isV4()))
{
/* Check if this prefix is not a configured ip, if so allow */
IpPrefix ipll_prefix(ip_address.getV4Addr(), 16);
if (!m_intfsOrch->isPrefixSubnet (ipll_prefix, alias))
prsunny marked this conversation as resolved.
Show resolved Hide resolved
{
SWSS_LOG_NOTICE("Skip IPv4LL neighbor %s, Intf:%s op: %s ", ip_address.to_string().c_str(), alias.c_str(), op.c_str());
it = consumer.m_toSync.erase(it);
continue;
}
}

NeighborEntry neighbor_entry = { ip_address, alias };

if (op == SET_COMMAND)
Expand Down
25 changes: 23 additions & 2 deletions orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ RouteOrch::RouteOrch(DBConnector *db, vector<table_name_with_pri_t> &tableNames,
IpPrefix linklocal_prefix = getLinkLocalEui64Addr();

addLinkLocalRouteToMe(gVirtualRouterId, linklocal_prefix);
SWSS_LOG_NOTICE("Created link local ipv6 route %s to cpu", linklocal_prefix.to_string().c_str());

/* Add fe80::/10 subnet route to forward all link-local packets
* destined to us, to CPU */
IpPrefix default_link_local_prefix("fe80::/10");

addLinkLocalRouteToMe(gVirtualRouterId, default_link_local_prefix);
SWSS_LOG_NOTICE("Created link local ipv6 route %s to cpu", default_link_local_prefix.to_string().c_str());

/* TODO: Add the link-local fe80::/10 route to cpu in every VRF created from
* vrforch::addOperation. */
}

std::string RouteOrch::getLinkLocalEui64Addr(void)
Expand Down Expand Up @@ -205,6 +205,27 @@ void RouteOrch::addLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal
SWSS_LOG_NOTICE("Created link local ipv6 route %s to cpu", linklocal_prefix.to_string().c_str());
}

void RouteOrch::delLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix)
{
sai_route_entry_t unicast_route_entry;
unicast_route_entry.switch_id = gSwitchId;
unicast_route_entry.vr_id = vrf_id;
copy(unicast_route_entry.destination, linklocal_prefix);
subnet(unicast_route_entry.destination, unicast_route_entry.destination);

sai_status_t status = sai_route_api->remove_route_entry(&unicast_route_entry);
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to delete link local ipv6 route %s to cpu, rv:%d",
linklocal_prefix.getIp().to_string().c_str(), status);
return;
}

gCrmOrch->decCrmResUsedCounter(CrmResourceType::CRM_IPV6_ROUTE);

SWSS_LOG_NOTICE("Deleted link local ipv6 route %s to cpu", linklocal_prefix.to_string().c_str());
}

bool RouteOrch::hasNextHopGroup(const NextHopGroupKey& nexthops) const
{
return m_syncdNextHopGroups.find(nexthops) != m_syncdNextHopGroups.end();
Expand Down
7 changes: 4 additions & 3 deletions orchagent/routeorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ class RouteOrch : public Orch, public Subject
bool createFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id, vector<sai_attribute_t> &nhg_attrs);
bool removeFineGrainedNextHopGroup(sai_object_id_t &next_hop_group_id);

void addLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix);
void delLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix);
std::string getLinkLocalEui64Addr(void);
prsunny marked this conversation as resolved.
Show resolved Hide resolved

private:
SwitchOrch *m_switchOrch;
NeighOrch *m_neighOrch;
Expand Down Expand Up @@ -188,9 +192,6 @@ class RouteOrch : public Orch, public Subject
bool addLabelRoutePost(const LabelRouteBulkContext& ctx, const NextHopGroupKey &nextHops);
bool removeLabelRoutePost(const LabelRouteBulkContext& ctx);

std::string getLinkLocalEui64Addr(void);
void addLinkLocalRouteToMe(sai_object_id_t vrf_id, IpPrefix linklocal_prefix);

void doTask(Consumer& consumer);
void doLabelTask(Consumer& consumer);
};
Expand Down
Loading