Skip to content

Commit bd92adf

Browse files
Fixed minor bug that prevent interfaces from being update with the same if value
1 parent 03fedbf commit bd92adf

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ class APIInterfaceUpdate extends APIModel {
5353

5454
private function __validate_if() {
5555
if (isset($this->initial_data["if"])) {
56-
$this->validated_data["if"] = trim($this->initial_data["if"]);
57-
// Check that our interface exists and is not in use
58-
if (!array_key_exists($this->initial_data["if"], $this->if_list)) {
56+
$if_info = $this->if_list[$this->initial_data["if"]];
57+
# Return an error if the requested physical interface does not exist
58+
if (empty($if_info)) {
5959
$this->errors[] = APIResponse\get(3000);
60-
} elseif (isset($this->if_list[$this->initial_data["if"]]["in_use"])) {
60+
}
61+
# Return an error if the physical interface is already in use by a different interface object
62+
elseif (isset($if_info["in_use"]) and $if_info["in_use"] !== $this->id) {
6163
$this->errors[] = APIResponse\get(3001);
6264
}
6365
$this->validated_data["if"] = $this->initial_data["if"];

0 commit comments

Comments
 (0)