Skip to content

Commit c37dce9

Browse files
fix: don't restrict interface gateway assignment by id
Addresses an issue that prevented gateways from being assigned to an interface when the REST API 'represent_interfaces_as' setting was not set to 'id'. Previously the related RoutingGateway model query used the interface's literal id value, but when interfaces are not represented by its id the query will always return nothing, therefor a gateway cannot be assigned
1 parent 0856ab9 commit c37dce9

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Models/NetworkInterface.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ class NetworkInterface extends Model {
165165
$this->gateway = new ForeignModelField(
166166
model_name: ['RoutingGateway', 'RoutingGatewayGroup'],
167167
model_field: 'name',
168-
model_query: ['ipprotocol' => 'inet', 'interface' => &$this->id],
168+
model_query: ['ipprotocol' => 'inet'],
169169
allow_null: true,
170170
conditions: ['typev4' => 'static'],
171171
help_text: 'Sets the upstream gateway this interface will use. This is only applicable for WAN-type interfaces.',
@@ -313,7 +313,7 @@ class NetworkInterface extends Model {
313313
$this->gatewayv6 = new ForeignModelField(
314314
model_name: ['RoutingGateway', 'RoutingGatewayGroup'],
315315
model_field: 'name',
316-
model_query: ['ipprotocol' => 'inet6', 'interface' => &$this->id],
316+
model_query: ['ipprotocol' => 'inet6'],
317317
allow_null: true,
318318
conditions: ['typev6' => 'staticv6'],
319319
help_text: 'Sets the upstream IPv6 gateway this interface will use. This is only applicable for WAN-type interfaces.',

0 commit comments

Comments
 (0)