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

Added VRF changes for IPv6 link local enhancements #1862

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all 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
27 changes: 27 additions & 0 deletions orchagent/vrforch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "vxlanorch.h"
#include "flowcounterrouteorch.h"
#include "directory.h"
#include "routeorch.h"

using namespace std;
using namespace swss;
Expand All @@ -23,6 +24,7 @@ extern sai_object_id_t gSwitchId;
extern Directory<Orch*> gDirectory;
extern PortsOrch* gPortsOrch;
extern FlowCounterRouteOrch* gFlowCounterRouteOrch;
extern RouteOrch* gRouteOrch;

bool VRFOrch::addOperation(const Request& request)
{
Expand Down Expand Up @@ -104,6 +106,20 @@ bool VRFOrch::addOperation(const Request& request)
}
}

/* Add link-local fe80::/10 CPU route for the VRF. */
IpPrefix default_link_local_prefix("fe80::/10");
gRouteOrch->addLinkLocalRouteToMe(router_id, default_link_local_prefix);
SWSS_LOG_NOTICE("Created link local ipv6 route %s to cpu in VRF %s", default_link_local_prefix.to_string().c_str(), vrf_name.c_str());

/* All the interfaces have the same MAC address and hence the same
* auto-generated link-local ipv6 address with eui64 interface-id.
* Hence add a single /128 route entry for the link-local interface
* address pointing to the CPU port.
*/
IpPrefix linklocal_prefix = gRouteOrch->getLinkLocalEui64Addr();
gRouteOrch->addLinkLocalRouteToMe(router_id, linklocal_prefix);
SWSS_LOG_NOTICE("Created link local ipv6 route %s to cpu in VRF %s", linklocal_prefix.to_string().c_str(), vrf_name.c_str());

vrf_table_[vrf_name].vrf_id = router_id;
vrf_table_[vrf_name].ref_count = 0;
vrf_id_table_[router_id] = vrf_name;
Expand Down Expand Up @@ -170,6 +186,17 @@ bool VRFOrch::delOperation(const Request& request)
return false;

sai_object_id_t router_id = vrf_table_[vrf_name].vrf_id;

/* Delete link-local ipv6 address with eui64 /128 CPU route for the VRF. */
IpPrefix linklocal_prefix = gRouteOrch->getLinkLocalEui64Addr();
gRouteOrch->delLinkLocalRouteToMe(router_id, linklocal_prefix);
SWSS_LOG_NOTICE("Deleted link local ipv6 route %s to cpu in VRF %s", linklocal_prefix.to_string().c_str(), vrf_name.c_str());

/* Delete link-local fe80::/10 CPU route for the VRF. */
IpPrefix default_link_local_prefix("fe80::/10");
gRouteOrch->delLinkLocalRouteToMe(router_id, default_link_local_prefix);
SWSS_LOG_NOTICE("Deleted link local ipv6 route %s to cpu in VRF %s", default_link_local_prefix.to_string().c_str(), vrf_name.c_str());

sai_status_t status = sai_virtual_router_api->remove_virtual_router(router_id);
if (status != SAI_STATUS_SUCCESS)
{
Expand Down
Loading