-
-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error on dhcpd update #488
Comments
I can't seem to reproduce this on a fresh install of pfSense 2.7.2 running API v1.7.4:
I'm assuming you are also on the latest version of the API? If so, the error seems to suggest that request data is either becoming malformed or the stored values of the object you are updating is corrupt/unexpected. Can you provide the XML config of the DHCP server you're updating? |
I should be on the latest API version: pkg info | grep -i pfsense-pkg-api XML Config: Full disclosure, I'm a noob and could be doing something very stupid. Apologies if I'm wasting time. |
Hmm doesn't seem like you're doing anything wrong here. Your API call and config look fine to me. Let's do some debugging:
|
Sorry for the delay, took a bit for security to let this through (aka, I went on vacation) |
No worries, thanks for providing that. What does your |
Only dhcp interface is WAN. |
The behavior here is very strange because the line that causes the error is stating that the interface's
But the endpoint does checks beforehand on the provided interface to ensure the interface has a static IPv4, which would return an error if it's pfsense-api/pfSense-pkg-API/files/etc/inc/api/models/APIServicesDHCPdUpdate.inc Lines 63 to 64 in 5db64cd
I'd like to do a little more debugging if you don't mind:
Hopefully this will provide some better insight into what's happening here. |
Don't think this'll help :( # cat /tmp/dhcpd_update_debug.log |
Hmm yeah that's definitely not what I was hoping for. From everything I'm seeing there is no reason this error should be being thrown here and so far I still haven't been able to reproduce the issue. It's possible there's a bigger problem with the PHP environment or your pfSense instance. There are a few things you can try if you haven't already:
|
Figured it out. I had the interface incorrect and was pointing to the WAN, which although is set to dhcp on the backend, isn't actually dhcp and can't be enabled/changed. I'd say it is a bug however, that the call would return a 200. I'd expect it to error out gracefully, or at least complain about it. |
Describe the bug
Error and Crash when updating DHCPd. Seems to be reproducible on demand. It actually succeeds in the update and the configuration is applied, but the error/crash still occur. Here's the crash report:
Crash report begins. Anonymous machine information:
amd64
14.0-CURRENT
FreeBSD 14.0-CURRENT amd64 1400094 #1 RELENG_2_7_2-n255948-8d2b56da39c: Wed Dec 6 20:45:47 UTC 2023 root@freebsd:/var/jenkins/workspace/pfSense-CE-snapshots-2_7_2-main/obj/amd64/StdASW5b/var/jenkins/workspace/pfSense-CE-snapshots-2_7_2-main/sources/F
Crash report details:
PHP Errors:
[25-Jun-2024 10:37:59 Etc/UTC] PHP Fatal error: Uncaught TypeError: Unsupported operand types: int - string in /etc/inc/api/framework/APITools.inc:1042
Stack trace:
#0 /etc/inc/api/models/APIServicesDHCPdUpdate.inc(97): APITools\is_ipv4_in_cidr(3232240740, 'dhcp/')
#1 /etc/inc/api/models/APIServicesDHCPdUpdate.inc(40): APIServicesDHCPdUpdate->__validate_range_from()
#2 /etc/inc/api/framework/APIModel.inc(199): APIServicesDHCPdUpdate->validate_payload()
#3 /etc/inc/api/framework/APIModel.inc(211): APIModel->validate()
#4 /etc/inc/api/endpoints/APIServicesDHCPd.inc(28): APIModel->call()
#5 /etc/inc/api/framework/APIEndpoint.inc(66): APIServicesDHCPd->put()
#6 /usr/local/www/api/v1/services/dhcpd/index.php(3): APIEndpoint->listen()
#7 {main}
thrown in /etc/inc/api/framework/APITools.inc on line 1042
No FreeBSD crash data found.
To Reproduce
curl -X 'PUT'
'https:///api/v1/services/dhcpd'
-H 'accept: application/json'
-H 'Content-Type: application/json'
-d '{
"interface": "<name>",
"enable": true,
"range_from": "192.168.2.100",
"range_to": "192.168.2.200"
}'
Expected behavior
DHCP server is created/updated on the specified interface without a crash
Screenshots or Response
See above crash report
pfSense Version & Package Version:
Affected Endpoints:
The text was updated successfully, but these errors were encountered: