Skip to content

Commit d8b4341

Browse files
Fixed bad update payload in firewall rule unit test, removed inet46 gateway condition from firewall rule endpoints
1 parent 5e62a0f commit d8b4341

3 files changed

Lines changed: 7 additions & 4 deletions

File tree

pfSense-pkg-API/files/etc/inc/api/models/APIFirewallRuleCreate.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ class APIFirewallRuleCreate extends APIModel {
195195
$this->errors[] = APIResponse\get(4043);
196196
}
197197
# Check if the gateway IP protocol matches our rule's IP protocol
198-
elseif ($gw_protocol !== "inet46" and $gw_protocol !== $this->validated_data["ipprotocol"]) {
198+
elseif ($gw_protocol !== $this->validated_data["ipprotocol"]) {
199199
$this->errors[] = APIResponse\get(4109);
200200
}
201201
# Otherwise, the gateway is valid

pfSense-pkg-API/files/etc/inc/api/models/APIFirewallRuleUpdate.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class APIFirewallRuleUpdate extends APIModel {
218218
$this->errors[] = APIResponse\get(4043);
219219
}
220220
# Check if the gateway IP protocol matches our rule's IP protocol
221-
elseif ($gw_protocol !== "inet46" and $gw_protocol !== $this->validated_data["ipprotocol"]) {
221+
elseif ($gw_protocol !== $this->validated_data["ipprotocol"]) {
222222
$this->errors[] = APIResponse\get(4109);
223223
}
224224
# Otherwise, the gateway is valid

tests/test_api_v1_firewall_rule.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class APIUnitTestFirewallRule(unit_test_framework.APIUnitTest):
2828
"dst": "127.0.0.1",
2929
"dstport": "443",
3030
"descr": "Unit test",
31+
"log": True,
3132
"top": True
3233
}
3334
]
@@ -38,10 +39,12 @@ class APIUnitTestFirewallRule(unit_test_framework.APIUnitTest):
3839
"ipprotocol": "inet",
3940
"protocol": "tcp/udp",
4041
"src": "172.16.77.125",
41-
"srcport": "HTTP",
42+
"srcport": "8080-8081",
4243
"dst": "127.0.0.1",
43-
"dstport": "HTTP",
44+
"dstport": "2222-4444",
4445
"descr": "Updated Unit test",
46+
"gateway": "WAN_DHCP",
47+
"log": False,
4548
"top": True
4649
}
4750
]

0 commit comments

Comments
 (0)