Skip to content

Commit 79afcb3

Browse files
authored
[Dual-ToR] handle 'mux_tunnel_egress_acl' attrib in order to change ACL configuration (drop on ingress/egress) on standby ToR (sonic-net#2646)
- What I did Use "mux_tunnel_ingress_acl" to set ACL rules on ingress/egress side depending on attribute value ("disabled/enabled"). - Why I did it We need to drop data-plane traffic and handle Control-plane traffic in the Dual-ToR scenario. But we can't do it on Mellanox platform and process traffic on ingress. To workaround it we can set ACL rules on egress ports, so will process control plane on ingress and drop Data-plane traffic that came from standby port on egress - How I verified it check "show mux status" on standby ToR - Mux status should be healthy. check "show what-just-happened" on standby ToR - no ICMP drop expected on standby ports. Signed-off-by: Andriy Yurkiv <[email protected]>
1 parent c2b01ba commit 79afcb3

File tree

4 files changed

+12
-3
lines changed

4 files changed

+12
-3
lines changed

orchagent/aclorch.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -3188,6 +3188,7 @@ void AclOrch::initDefaultTableTypes()
31883188
builder.withName(TABLE_TYPE_DROP)
31893189
.withBindPointType(SAI_ACL_BIND_POINT_TYPE_PORT)
31903190
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_TC))
3191+
.withMatch(make_shared<AclTableMatch>(SAI_ACL_TABLE_ATTR_FIELD_IN_PORTS))
31913192
.build()
31923193
);
31933194

orchagent/aclorch.h

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595

9696
#define MLNX_MAX_RANGES_COUNT 16
9797
#define INGRESS_TABLE_DROP "IngressTableDrop"
98+
#define EGRESS_TABLE_DROP "EgressTableDrop"
9899
#define RULE_OPER_ADD 0
99100
#define RULE_OPER_DELETE 1
100101

orchagent/muxorch.cpp

+9-3
Original file line numberDiff line numberDiff line change
@@ -791,8 +791,14 @@ MuxAclHandler::MuxAclHandler(sai_object_id_t port, string alias)
791791
{
792792
SWSS_LOG_ENTER();
793793

794+
string value;
795+
shared_ptr<DBConnector> m_config_db = shared_ptr<DBConnector>(new DBConnector("CONFIG_DB", 0));
796+
unique_ptr<Table> m_systemDefaultsTable = unique_ptr<Table>(new Table(m_config_db.get(), "SYSTEM_DEFAULTS"));
797+
m_systemDefaultsTable->hget("mux_tunnel_egress_acl", "status", value);
798+
is_ingress_acl_ = value != "enabled";
799+
794800
// There is one handler instance per MUX port
795-
string table_name = MUX_ACL_TABLE_NAME;
801+
string table_name = is_ingress_acl_ ? MUX_ACL_TABLE_NAME : EGRESS_TABLE_DROP;
796802
string rule_name = MUX_ACL_RULE_NAME;
797803

798804
port_ = port;
@@ -830,7 +836,7 @@ MuxAclHandler::MuxAclHandler(sai_object_id_t port, string alias)
830836
MuxAclHandler::~MuxAclHandler(void)
831837
{
832838
SWSS_LOG_ENTER();
833-
string table_name = MUX_ACL_TABLE_NAME;
839+
string table_name = is_ingress_acl_ ? MUX_ACL_TABLE_NAME : EGRESS_TABLE_DROP;
834840
string rule_name = MUX_ACL_RULE_NAME;
835841

836842
SWSS_LOG_NOTICE("Un-Binding port %" PRIx64 "", port_);
@@ -876,7 +882,7 @@ void MuxAclHandler::createMuxAclTable(sai_object_id_t port, string strTable)
876882
auto dropType = gAclOrch->getAclTableType(TABLE_TYPE_DROP);
877883
assert(dropType);
878884
acl_table.validateAddType(*dropType);
879-
acl_table.stage = ACL_STAGE_INGRESS;
885+
acl_table.stage = is_ingress_acl_ ? ACL_STAGE_INGRESS : ACL_STAGE_EGRESS;
880886
gAclOrch->addAclTable(acl_table);
881887
bindAllPorts(acl_table);
882888
}

orchagent/muxorch.h

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class MuxAclHandler
5555
// class shared dict: ACL table name -> ACL table
5656
static std::map<std::string, AclTable> acl_table_;
5757
sai_object_id_t port_ = SAI_NULL_OBJECT_ID;
58+
bool is_ingress_acl_ = true;
5859
string alias_;
5960
};
6061

0 commit comments

Comments
 (0)