Skip to content

Commit 1ae0209

Browse files
authored
Merge pull request #328 from mssonicbld/sonicbld/202603-merge
```<br>* a295d6b - (HEAD -> 202603) Merge branch '202511' of https://github.com/sonic-net/sonic-utilities into 202603 (2026-05-14) [Sonic Automation] * 3136803 - (origin/202511) [acl-loader] Include `IP_TYPE=IP` in `IP_PROTOCOL` rules (#4540) (2026-05-14) [mssonicbld]<br>```
2 parents 97e8a9d + a295d6b commit 1ae0209

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

acl_loader/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,12 @@ def convert_rule_to_db_schema(self, table_name, rule, skip_action_validation=Fal
774774
deep_update(rule_props, self.convert_transport(table_name, rule_idx, rule))
775775
deep_update(rule_props, self.convert_input_interface(table_name, rule_idx, rule))
776776

777+
if "IP_PROTOCOL" in rule_props and "IP_TYPE" not in rule_props:
778+
# If we don't include IP_TYPE as a qualifier in the IP_PROTOCOL rule
779+
# we could match on non-IP packets if the bits at the same offset match
780+
# https://github.com/sonic-net/sonic-mgmt/issues/23960
781+
rule_props["IP_TYPE"] = "IP"
782+
777783
self.validate_rule_fields(rule_props)
778784

779785
return rule_data

tests/acl_loader_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ def test_load_rules_when_capability_table_is_empty(self, acl_loader):
7676
"VLAN_ID": 369,
7777
"ETHER_TYPE": "2048",
7878
"IP_PROTOCOL": 6,
79+
'IP_TYPE': 'IP',
7980
"SRC_IP": "20.0.0.2/32",
8081
"DST_IP": "30.0.0.3/32",
8182
"PACKET_ACTION": "FORWARD",
@@ -94,6 +95,7 @@ def test_vlan_id_translation(self, acl_loader):
9495
"VLAN_ID": 369,
9596
"ETHER_TYPE": "2048",
9697
"IP_PROTOCOL": 6,
98+
'IP_TYPE': 'IP',
9799
"SRC_IP": "20.0.0.2/32",
98100
"DST_IP": "30.0.0.3/32",
99101
"PACKET_ACTION": "FORWARD",
@@ -134,6 +136,7 @@ def test_v4_rule_inv4v6_table(self, acl_loader):
134136
"VLAN_ID": 369,
135137
"ETHER_TYPE": 2048,
136138
"IP_PROTOCOL": 6,
139+
'IP_TYPE': 'IP',
137140
"SRC_IP": "20.0.0.2/32",
138141
"DST_IP": "30.0.0.3/32",
139142
"PACKET_ACTION": "FORWARD",
@@ -147,6 +150,7 @@ def test_v6_rule_inv4v6_table(self, acl_loader):
147150
assert acl_loader.rules_info[("DATAACLV4V6", "RULE_2")] == {
148151
"ETHER_TYPE": 34525,
149152
"IP_PROTOCOL": 58,
153+
'IP_TYPE': 'IP',
150154
"SRC_IPV6": "::1/128",
151155
"DST_IPV6": "::1/128",
152156
"PACKET_ACTION": "FORWARD",
@@ -170,6 +174,7 @@ def test_icmp_translation(self, acl_loader):
170174
"ICMP_TYPE": 3,
171175
"ICMP_CODE": 0,
172176
"IP_PROTOCOL": 1,
177+
'IP_TYPE': 'IP',
173178
"SRC_IP": "20.0.0.2/32",
174179
"DST_IP": "30.0.0.3/32",
175180
"ETHER_TYPE": "2048",
@@ -208,6 +213,7 @@ def test_icmp_translation_in_custom_acl_table_type(self, acl_loader):
208213
"ICMP_TYPE": 136,
209214
"ICMP_CODE": 0,
210215
"IP_PROTOCOL": 1,
216+
'IP_TYPE': 'IP',
211217
"PACKET_ACTION": "FORWARD",
212218
"PRIORITY": "9998"
213219
}
@@ -220,6 +226,7 @@ def test_icmpv6_translation_in_custom_acl_table_type(self, acl_loader):
220226
"ICMPV6_TYPE": 136,
221227
"ICMPV6_CODE": 0,
222228
"IP_PROTOCOL": 58,
229+
'IP_TYPE': 'IP',
223230
"PACKET_ACTION": "FORWARD",
224231
"PRIORITY": "9998"
225232
}

0 commit comments

Comments
 (0)