Skip to content

Commit 75e73d2

Browse files
Merge pull request #784 from jaredhendrickson13/next_patch
v2.6.5 Features & Fixes
2 parents a625e94 + cda9ffc commit 75e73d2

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

docs/NATIVE_SCHEMA.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ classes. Below is a basic outline of the schema's structure:
2020

2121
```json
2222
{
23+
"version": "v0.0.0",
2324
"endpoints": {
2425
"/endpoint/url/path": {
2526
...

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class DHCPServer extends Model {
261261
# Loop through each defined interface
262262
foreach ($this->get_config('interfaces', []) as $if_id => $if) {
263263
# Skip this interface if it is not a static interface or the subnet value is greater than or equal to 31
264-
if (empty($if['ipaddr']) or $if['ipaddr'] !== 'static' or $if->subnet->value >= 31) {
264+
if (empty($if['ipaddr']) or !is_ipaddrv4($if['ipaddr']) or $if->subnet->value >= 31) {
265265
continue;
266266
}
267267

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Schemas/NativeSchema.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use RESTAPI\Core\Model;
1010
use RESTAPI\Core\Schema;
1111
use RESTAPI\Fields\ForeignModelField;
1212
use RESTAPI\Fields\NestedModelField;
13+
use RESTAPI\Models\RESTAPIVersion;
1314
use function RESTAPI\Core\Tools\get_classes_from_namespace;
1415

1516
/**
@@ -129,7 +130,8 @@ class NativeSchema extends Schema {
129130
* @return string The full schema string for this Schema class in JSON format
130131
*/
131132
public function get_schema_str(): string {
132-
$schema = ['endpoints' => [], 'models' => []];
133+
$version = new RESTAPIVersion();
134+
$schema = ['version' => $version->current_version->value, 'endpoints' => [], 'models' => []];
133135

134136
# Get all endpoint metadata
135137
foreach (get_classes_from_namespace('RESTAPI\Endpoints') as $endpoint_class) {

pfSense-pkg-RESTAPI/files/usr/local/pkg/RESTAPI/Tests/APIModelsDHCPServerTestCase.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,9 @@ class APIModelsDHCPServerTestCase extends TestCase {
523523
* Ensures non-static interfaces are exempt from DHCP server initialization. This is a regression test for #781
524524
*/
525525
public function test_non_static_interfaces_exempt_from_dhcp_server_initialization(): void {
526+
# Ensure no config entry exists for the `opt1` DHCP server
527+
Model::del_config('dhcpd/opt1');
528+
526529
# Temporarily add a mock interface using pppoe for IPv4
527530
Model::set_config('interfaces/opt1/ipaddr', 'pppoe');
528531

0 commit comments

Comments
 (0)