File tree Expand file tree Collapse file tree
pfSense-pkg-API/files/etc/inc/api/models Expand file tree Collapse file tree Original file line number Diff line number Diff 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 " ];
You can’t perform that action at this time.
0 commit comments