From 8b73112432c00379ee9e3381e1f031d0cd17e390 Mon Sep 17 00:00:00 2001 From: Akhilesh Samineni Date: Mon, 9 Aug 2021 08:20:05 -0700 Subject: [PATCH 1/2] Added VRF changes for IPv6 link local. Signed-off-by: Akhilesh Samineni --- orchagent/vrforch.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/orchagent/vrforch.cpp b/orchagent/vrforch.cpp index 19ca5c0fd8..31c84992a7 100644 --- a/orchagent/vrforch.cpp +++ b/orchagent/vrforch.cpp @@ -101,6 +101,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; @@ -165,6 +179,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) { From c2bf0c3f30d813e3f47ab224814bf7463c0385f1 Mon Sep 17 00:00:00 2001 From: Akhilesh Samineni Date: Mon, 9 Aug 2021 08:45:59 -0700 Subject: [PATCH 2/2] Included routeorch header file --- orchagent/vrforch.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/orchagent/vrforch.cpp b/orchagent/vrforch.cpp index 31c84992a7..c42dc11af7 100644 --- a/orchagent/vrforch.cpp +++ b/orchagent/vrforch.cpp @@ -12,6 +12,7 @@ #include "vrforch.h" #include "vxlanorch.h" #include "directory.h" +#include "routeorch.h" using namespace std; using namespace swss; @@ -20,6 +21,7 @@ extern sai_virtual_router_api_t* sai_virtual_router_api; extern sai_object_id_t gSwitchId; extern Directory gDirectory; extern PortsOrch* gPortsOrch; +extern RouteOrch* gRouteOrch; bool VRFOrch::addOperation(const Request& request) {