Skip to content

Commit a625e94

Browse files
test(DHCPServer): ensure non-static interfaces do not initialize a dhcp server #781
1 parent d9f7fbf commit a625e94

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,4 +518,18 @@ class APIModelsDHCPServerTestCase extends TestCase {
518518
$dhcp_server->update(apply: true);
519519
$this->assert_str_contains((new Command('cat /var/dhcpd/etc/dhcpd.conf'))->output, 'peer address 192.168.1.2;');
520520
}
521+
522+
/**
523+
* Ensures non-static interfaces are exempt from DHCP server initialization. This is a regression test for #781
524+
*/
525+
public function test_non_static_interfaces_exempt_from_dhcp_server_initialization(): void {
526+
# Temporarily add a mock interface using pppoe for IPv4
527+
Model::set_config('interfaces/opt1/ipaddr', 'pppoe');
528+
529+
# Init a DHCP server model. This should trigger initialization logic.
530+
new DHCPServer();
531+
532+
# Ensure a config entry was not initialized for the non-static interface
533+
$this->assert_is_false(array_key_exists('opt1', Model::get_config('dhcpd')));
534+
}
521535
}

0 commit comments

Comments
 (0)