Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,12 @@
"priority":9996
},
"OP":"SET"
},
{
"ACL_RULE_TABLE:dataacl:default_rule":{
"PACKET_ACTION":"DROP",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Add one more attribute: "ETHER_TYPE":"0x0800",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Shouldn't none-ip packet be dropped as well?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

all packet includes lldp, arp, lacp, they should not be dropped. It is better to limit to only ip.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Didn't quite get it. Shouldn't we have an explicit ACL rule to allow lldp/arp packets?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The implicit rule is to drop all IP and IPv6 packets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Modified so that it drops IP packets only.

"priority":1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All capitalized to make it look unified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Resolved.

},
"OP":"SET"
}
]
12 changes: 11 additions & 1 deletion src/sonic-config-engine/translate_acl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ def dump_json(filename, data):
with open(filename, 'w') as outfile:
json.dump(data, outfile, indent=4, sort_keys=True, separators=(',', ':'))

def default_deny_rule(table_name):
rule_props = {}
rule_data = {}
rule_data["ACL_RULE_TABLE:"+table_name+":default_rule"] = rule_props
rule_data["OP"] = "SET"
rule_props["priority"] = 1
rule_props["PACKET_ACTION"] = "DROP"
return rule_data

def generate_rule_json(table_name, rule, max_priority, mirror):
rule_idx = rule.config.sequence_id
rule_props = {}
Expand Down Expand Up @@ -120,7 +129,8 @@ def generate_table_json(aclset, aclname, ports, mirror, max_priority, output_pat
rule_props = generate_rule_json(table_name, aclentry, max_priority, mirror)
if rule_props:
rule_data.append(rule_props)

if not mirror:
rule_data.append(default_deny_rule(table_name))
dump_json(os.path.join(output_path, "rules_for_"+table_name+".json"), rule_data)

def translate_acl_fixed_port(filename, output_path, port, max_priority):
Expand Down