Skip to content
Merged
Show file tree
Hide file tree
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
14 changes: 11 additions & 3 deletions orchagent/intfsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,22 @@ void IntfsOrch::doTask(Consumer &consumer)
SWSS_LOG_NOTICE("Create subnet route pre:%s\n", ip_prefix.to_string().c_str());
}

vector<sai_attribute_t> ip2me_attrs;
sai_attribute_t ip2me_attr;
ip2me_attr.id = SAI_ROUTE_ATTR_PACKET_ACTION;
ip2me_attr.value.s32 = SAI_PACKET_ACTION_FORWARD;
ip2me_attrs.push_back(ip2me_attr);

ip2me_attr.id = SAI_ROUTE_ATTR_NEXT_HOP_ID;
ip2me_attr.value.oid = m_portsOrch->getCpuPort();
ip2me_attrs.push_back(ip2me_attr);

unicast_route_entry.vr_id = gVirtualRouterId;
unicast_route_entry.destination.addr_family = SAI_IP_ADDR_FAMILY_IPV4;
unicast_route_entry.destination.addr.ip4 = ip_prefix.getIp().getV4Addr();
unicast_route_entry.destination.mask.ip4 = 0xFFFFFFFF;

attr.id = SAI_ROUTE_ATTR_PACKET_ACTION;
attr.value.s32 = SAI_PACKET_ACTION_TRAP;
status = sai_route_api->create_route(&unicast_route_entry, 1, &attr);
status = sai_route_api->create_route(&unicast_route_entry, ip2me_attrs.size(), ip2me_attrs.data());
if (status != SAI_STATUS_SUCCESS)
{
SWSS_LOG_ERROR("Failed to create packet action trap route ip:%s %d\n", ip_prefix.getIp().to_string().c_str(), status);
Expand Down
5 changes: 5 additions & 0 deletions orchagent/portsorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,11 @@ void PortsOrch::setPort(string alias, Port p)
m_portList[alias] = p;
}

sai_object_id_t PortsOrch::getCpuPort()
{
return m_cpuPort;
}

bool PortsOrch::setPortAdminStatus(sai_object_id_t id, bool up)
{
SWSS_LOG_ENTER();
Expand Down
1 change: 1 addition & 0 deletions orchagent/portsorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class PortsOrch : public Orch

bool getPort(string alias, Port &port);
void setPort(string alias, Port port);
sai_object_id_t getCpuPort();

private:
Table *m_counterTable;
Expand Down