Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4d536c4
fix(DHCPServer): accept OUI-partial MAC entries in mac_allow/mac_deny…
Nov 15, 2026
140c2b2
fix(NetworkInterface): only validate descr filter-name rules on CHANG…
Nov 15, 2026
86de385
Merge pull request #971 from lemassykoi/fix/dhcp-mac-validator-partial
jaredhendrickson13 Nov 19, 2026
08b55e8
Merge pull request #976 from lemassykoi/fix/networkinterface-descr-un…
jaredhendrickson13 Nov 19, 2026
1533c76
feat(NetworkInterface): expose DHCPv6 client PD fields (dhcp6-ia-pd-l…
lemassykoi Nov 19, 2026
114bb92
Merge branch 'master' of github.com:jaredhendrickson13/pfsense-api in…
jaredhendrickson13 Nov 19, 2026
494615f
docs: update default version in README install commands
jaredhendrickson13 Nov 19, 2026
aa7e187
docs: add notice that this project is reaching eol
jaredhendrickson13 Nov 19, 2026
89144f6
feat: support pfSense CE 2.9.1 and Plus 26.07.1
jaredhendrickson13 Nov 19, 2026
c34558f
style: run prettier on changed files
jaredhendrickson13 Nov 19, 2026
f41a954
test(NetworkInterface): fix broken NetworkInterface tests
jaredhendrickson13 Nov 19, 2026
8d3d19b
test(NetworkInterface): fix broken interface descr length test
jaredhendrickson13 Nov 19, 2026
c4c80d5
test(NetworkInterface): fix additional broken interface length tests
jaredhendrickson13 Nov 19, 2026
81b1b30
test(NetworkInterface): fix additional broken interface length tests
jaredhendrickson13 Nov 19, 2026
1559ad2
ci: update python version used in release workflow
jaredhendrickson13 Nov 19, 2026
aca4a6b
ci: update python version used in quality workflow
jaredhendrickson13 Nov 19, 2026
a2eecf9
ci: source oas schema from 2.9.0 in quality workflow
jaredhendrickson13 Nov 19, 2026
0636409
feat: support pfSense CE 2.9.2 and Plus 26.07.2
jaredhendrickson13 Nov 20, 2026
a7f7039
ci: check oas schema with correct pf version
jaredhendrickson13 Nov 20, 2026
938a733
ci: correct freebsd version in oas checks
jaredhendrickson13 Nov 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
strategy:
matrix:
include:
- PFSENSE_VERSION: pfSense-2.8.1-RELEASE
FREEBSD_ID: freebsd15
- PFSENSE_VERSION: pfSense-2.9.0-RELEASE
FREEBSD_ID: freebsd16
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
Expand Down Expand Up @@ -105,8 +105,8 @@ jobs:
strategy:
matrix:
include:
- PFSENSE_VERSION: pfSense-2.8.1-RELEASE
FREEBSD_ID: freebsd15
- PFSENSE_VERSION: pfSense-2.9.0-RELEASE
FREEBSD_ID: freebsd16
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
Expand Down Expand Up @@ -136,6 +136,10 @@ jobs:
FREEBSD_ID: freebsd15
- PFSENSE_VERSION: pfSense-2.9.0-RELEASE
FREEBSD_ID: freebsd16
- PFSENSE_VERSION: pfSense-2.9.1-RELEASE
FREEBSD_ID: freebsd16
- PFSENSE_VERSION: pfSense-2.9.2-RELEASE
FREEBSD_ID: freebsd16

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
needs: ["check_black"]
strategy:
matrix:
PYTHON_VERSION: ["3.10", "3.11"]
PYTHON_VERSION: ["3.14"]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Set up Python ${{ matrix.PYTHON_VERSION }}
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ concurrency: build
# Sets global environment variables for releases
env:
SWAGGER_UI_VERSION: "5.17.10"
PYTHON_VERSION: "3.10"
PYTHON_VERSION: "3.14"
DEFAULT_PFSENSE_VERSION: "2.9.0"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand All @@ -30,6 +30,10 @@ jobs:
PFSENSE_VERSION: "2.8.1"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "2.9.0"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "2.9.1"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "2.9.2"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "25.11.1"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
Expand All @@ -38,6 +42,10 @@ jobs:
PFSENSE_VERSION: "26.03.1"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "26.07"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "26.07.1"
- FREEBSD_VERSION: FreeBSD-16.0-CURRENT
PFSENSE_VERSION: "26.07.2"

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ The pfSense REST API package is an unofficial, open-source REST and GraphQL API
firewalls. It is designed to be light-weight, fast, and easy to use. This guide will help you get started with the REST
API package and provide you with the information you need to configure and use the package effectively.

> [!IMPORTANT]
> This project will soon come to end. For more information on the path forward and migration to the official
> pfSense API, please refer to the [announcement](https://github.com/pfrest/pfSense-pkg-RESTAPI/discussions/962).

## Key Features

- 200+ REST endpoints available for managing your firewall and associated services
Expand All @@ -36,13 +40,13 @@ commands are included below for quick reference.
Install on pfSense CE:

```bash
pkg-static add https://github.com/pfrest/pfSense-pkg-RESTAPI/releases/latest/download/pfSense-2.8.1-pkg-RESTAPI.pkg
pkg-static add https://github.com/pfrest/pfSense-pkg-RESTAPI/releases/latest/download/pfSense-2.9.2-pkg-RESTAPI.pkg
```

Install on pfSense Plus:

```bash
pkg-static -C /dev/null add https://github.com/pfrest/pfSense-pkg-RESTAPI/releases/latest/download/pfSense-26.03.1-pkg-RESTAPI.pkg
pkg-static -C /dev/null add https://github.com/pfrest/pfSense-pkg-RESTAPI/releases/latest/download/pfSense-26.07.2-pkg-RESTAPI.pkg
```

> [!WARNING]
Expand Down
4 changes: 4 additions & 0 deletions docs/INSTALL_AND_CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ run pfSense. It's recommended to follow Netgate's [minimum hardware requirements

- pfSense CE 2.8.1
- pfSense CE 2.9.0
- pfSense CE 2.9.1
- pfSense CE 2.9.2
- pfSense Plus 25.11.1
- pfSense Plus 26.03
- pfSense Plus 26.03.1
- pfSense Plus 26.07
- pfSense Plus 26.07.1
- pfSense Plus 26.07.2

!!! Warning
Installation of the package on unsupported versions of pfSense may result in unexpected behavior and/or system instability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,17 @@ class DHCPServer extends Model {
many: true,
maximum_length: 17,
verbose_name: 'MAC Allow',
validators: [new MACAddressValidator()],
help_text: 'MAC addresses this DHCP server is allowed to provide leases for.',
validators: [new MACAddressValidator(allow_partial: true)],
help_text: 'MAC addresses this DHCP server is allowed to provide leases for. OUI prefixes (partial MACs, e.g. `EC:71:DB`) are accepted to match all devices of a vendor (GUI parity).',
);
$this->mac_deny = new StringField(
default: [],
allow_empty: true,
many: true,
maximum_length: 17,
verbose_name: 'MAC Deny',
validators: [new MACAddressValidator()],
help_text: 'MAC addresses this DHCP server is not allowed to provide leases for.',
validators: [new MACAddressValidator(allow_partial: true)],
help_text: 'MAC addresses this DHCP server is not allowed to provide leases for. OUI prefixes (partial MACs, e.g. `EC:71:DB`) are accepted to match all devices of a vendor (GUI parity).',
);
$this->domainsearchlist = new StringField(
default: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,18 @@ class DHCPServerAddressPool extends Model {
allow_empty: true,
many: true,
maximum_length: 17,
validators: [new MACAddressValidator()],
validators: [new MACAddressValidator(allow_partial: true)],
verbose_name: 'MAC Allow',
help_text: 'MAC addresses this DHCP server is allowed to provide leases for.',
help_text: 'MAC addresses this DHCP server is allowed to provide leases for. OUI prefixes (partial MACs, e.g. `EC:71:DB`) are accepted to match all devices of a vendor (GUI parity).',
);
$this->mac_deny = new StringField(
default: [],
allow_empty: true,
many: true,
maximum_length: 17,
validators: [new MACAddressValidator()],
validators: [new MACAddressValidator(allow_partial: true)],
verbose_name: 'MAC Deny',
help_text: 'MAC addresses this DHCP server is not allowed to provide leases for.',
help_text: 'MAC addresses this DHCP server is not allowed to provide leases for. OUI prefixes (partial MACs, e.g. `EC:71:DB`) are accepted to match all devices of a vendor (GUI parity).',
);
$this->domainsearchlist = new StringField(
default: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ class NetworkInterface extends Model {
public ForeignModelField $gatewayv6;
public BooleanField $ipv6usev4iface;
public BooleanField $slaacusev4iface;
public BooleanField $dhcp6prefixonly;
public StringField $dhcp6_ia_pd_len;
public StringField $prefix_6rd;
public StringField $gateway_6rd;
public IntegerField $prefix_6rd_v4plen;
Expand Down Expand Up @@ -94,10 +96,7 @@ class NetworkInterface extends Model {
required: true,
unique: true,
maximum_length: 128,
validators: [
new FilterNameValidator(),
new UniqueFromForeignModelValidator(model: 'FirewallAlias', field: 'name'),
],
validators: [new UniqueFromForeignModelValidator(model: 'FirewallAlias', field: 'name')],
verbose_name: 'Description',
help_text: 'The descriptive name for this interface.',
);
Expand Down Expand Up @@ -367,6 +366,43 @@ class NetworkInterface extends Model {
verbose_name: 'SLAAC Use IPv4 Interface',
help_text: 'Enable or disable IPv6 using the IPv4 connectivity link (PPPoE).',
);

$this->dhcp6prefixonly = new BooleanField(
default: false,
conditions: ['typev6' => 'dhcp6'],
verbose_name: 'Request Only an IPv6 Prefix',
help_text: 'Only request an IPv6 prefix, do not request an IPv6 address.',
);
$this->dhcp6_ia_pd_len = new StringField(
required: false,
default: 'none',
allow_empty: false,
conditions: ['typev6' => 'dhcp6'],
choices: [
'none',
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
],
internal_name: 'dhcp6-ia-pd-len',
maximum_length: 4,
verbose_name: 'DHCPv6 Prefix Delegation size',
help_text: 'The delegated prefix length provided by the DHCPv6 server. `none` disables delegation; numeric values are the IA-PD length (16 -> /48 ... 0 -> /64). Normally specified by the ISP.',
);
$this->prefix_6rd = new StringField(
required: true,
unique: true,
Expand Down Expand Up @@ -445,6 +481,16 @@ class NetworkInterface extends Model {
* @returns string The validated $descr to set.
* @throws ValidationError When the `$descr` value is invalid. */
public function validate_descr(string $descr): string {
# Only apply the filter-name validation when the descr CHANGES. pfSense
# revalidates every field on PATCH, so validating an unchanged value
# would lock entire interfaces whose pre-existing descr predates these
# rules (e.g. 'LAN', which matches a reserved pf filter token) — the
# GUI allows such interfaces to be edited without renaming.
$initial = $this->initial_object;
if ($initial !== null and $initial->descr->value === $descr) {
return $descr;
}

# Ensure OpenVPN interfaces are 22 characters or less
if (str_starts_with($this->if->value, 'ovpn') and strlen($descr) > 22) {
throw new ValidationError(
Expand Down Expand Up @@ -477,6 +523,11 @@ class NetworkInterface extends Model {
);
}

# Filter-name rules apply to NEW/CHANGED descr values only (moved
# from the field-level validator so unchanged legacy values are
# not re-validated on unrelated PATCHes).
(new FilterNameValidator())->validate($descr, 'descr');

return $descr;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,4 +677,18 @@ class APIModelsDHCPServerTestCase extends TestCase {
# Delete the test interface
$interface->delete();
}

/**
* Ensures OUI-partial MAC entries (vendor prefixes, a supported pfSense GUI feature) are accepted in
* mac_allow/mac_deny. Regression test: these fields are revalidated on every PATCH, so strict validation
* locked entire scopes containing legacy partial entries behind HTTP 400 MAC_ADDRESS_VALIDATOR_FAILED.
*/
public function test_accept_oui_partial_mac_entries(): void {
$this->assert_does_not_throw(function (): void {
$dhcp_server = new DHCPServer(id: 'lan', async: false);
$dhcp_server->mac_deny->value = ['EC:71:DB', '00:60:6E', 'B8:27:EB'];
$dhcp_server->mac_allow->value = ['DC:A6:32'];
$dhcp_server->update();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class APIModelsNetworkInterfaceTestCase extends TestCase {
$test_model->if->value = 'ovpn1';

# Ensure the validation succeeds when value is an acceptable length
$test_model->validate_descr('length is ok');
$test_model->validate_descr('lengthisok');
},
);
}
Expand Down Expand Up @@ -82,7 +82,7 @@ class APIModelsNetworkInterfaceTestCase extends TestCase {
$test_model->if->value = 'ipsec1';

# Ensure the validation succeeds when value is an acceptable length
$test_model->validate_descr('length is ok');
$test_model->validate_descr('lengthisok');
},
);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ class APIModelsNetworkInterfaceTestCase extends TestCase {
$test_model->if->value = 'gif1';

# Ensure the validation succeeds when value is an acceptable length
$test_model->validate_descr('length is ok');
$test_model->validate_descr('lengthisok');
},
);
}
Expand Down Expand Up @@ -142,7 +142,7 @@ class APIModelsNetworkInterfaceTestCase extends TestCase {
$test_model->if->value = 'gre1';

# Ensure the validation succeeds when value is an acceptable length
$test_model->validate_descr('length is ok');
$test_model->validate_descr('lengthisok');
},
);
}
Expand Down Expand Up @@ -876,4 +876,79 @@ class APIModelsNetworkInterfaceTestCase extends TestCase {
}

# TODO: Needs Tests to ensure other interface types are correctly configured on the backend

/**
* Checks that a NEW descr value violating filter-name rules is rejected
* (FilterNameValidator now runs in validate_descr for changed values).
*/
public function test_descr_new_value_rejects_reserved_name(): void {
$this->assert_throws_response(
response_id: 'FILTER_NAME_VALIDATOR_RESERVED_NAME_USED',
code: 400,
callable: function () {
$test_model = new NetworkInterface();
$test_model->if->value = 'igc0';
$test_model->validate_descr('LAN');
},
);
}

/**
* Checks that validate_descr accepts reserved legacy values when the
* descr is UNCHANGED from the initial object (regression: pfSense
* revalidates every field on PATCH; validating an unchanged value
* locked whole interfaces whose descr predates the rules).
*/
public function test_descr_unchanged_legacy_value_not_revalidated(): void {
$this->assert_does_not_throw(
callable: function () {
$test_model = new NetworkInterface();
$test_model->if->value = 'igc0';

# Simulate a loaded object whose initial descr is a legacy
# reserved token (e.g. created before the validator existed)
$test_model->initial_object = $test_model->copy();
$test_model->initial_object->descr->value = 'LAN';
$test_model->descr->value = 'LAN';

# Unchanged descr -> no filter-name validation
$test_model->validate_descr('LAN');
},
);
}

/**
* Checks that dhcp6_ia_pd_len accepts the GUI choices ('none' and the
* 16..0 IA-PD lengths) and rejects out-of-set values.
*/
public function test_dhcp6_ia_pd_len_choices(): void {
$this->assert_does_not_throw(
callable: function () {
$test_model = new NetworkInterface();
$test_model->typev6->value = 'dhcp6';
$test_model->dhcp6_ia_pd_len->value = '0';
$test_model->dhcp6_ia_pd_len->validate();
},
);

$this->assert_does_not_throw(
callable: function () {
$test_model = new NetworkInterface();
$test_model->typev6->value = 'dhcp6';
$test_model->dhcp6_ia_pd_len->value = 'none';
$test_model->dhcp6_ia_pd_len->validate();
},
);

$this->assert_throws_response(
response_id: 'FIELD_INVALID_CHOICE',
code: 400,
callable: function () {
$test_model = new NetworkInterface();
$test_model->typev6->value = 'dhcp6';
$test_model->dhcp6_ia_pd_len->value = '999';
$test_model->dhcp6_ia_pd_len->validate();
},
);
}
}
Loading