-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Configure DHCP Server on interface failed -- stacktrace #178
Comments
Hey! Was your host initially setup with just a WAN interface? Seems like the DHCP server configuration has not been initialized on your pfSense host before the API call was made. I've done a little bit of digging and see that the DHCP server configuration does not get initialized by default if pfSense was not initially setup with a LAN interface which is why this doesn't occur in the endpoint tests. I'm assuming this is the issue you're seeing. If so, this is something that API should be able to accommodate easily. Thanks! |
Hi, thank you for your investigation, i think you're wright! Yes, i've setup my pfsense VM with only a WAN interface (with packer, to have a generic OVA, with your API included in, but not yet used at this step). Then, i deployed the generated OVA (withTerraform), with multiple NIC, and used your API to configure these NICs with fixed ipv4 (that is ok), and try to activate DHCP Server on it (it fails with the previous error). |
Thanks for confirming. I can work on a fix for this issue and have it released in the next patch. I'll keep this issue updated with progress and once a pull request is open with this fix you can manually patch the problematic file(s) to confirm this is actually the problem you're experiencing. Thanks! |
Okay I believe I have a fix in place for this. I've tested the patched file on a fresh install pfSense that was initially setup as WAN only. Before patching the file, I would receive the same error you received above. After patching the file I was able to successful update the DHCP server configuration. If you would like to test to ensure this fixes your issue, replace the file at /etc/inc/api/models/APIServicesDHCPdUpdate.inc on your pfSense host with the version found at: https://github.com/jaredhendrickson13/pfsense-api/blob/eaea263f9dd5bc0819f50940e19a5bb61bb3ce45/pfSense-pkg-API/files/etc/inc/api/models/APIServicesDHCPdUpdate.inc If this does not fix the issue, please let me know as soon as possible so I can further debug. Thank you! |
I've tested with your patch: PER-FECT, it works as expected ! :) Juste a litlle thing, in documentation you specified that "range_from" and "range_to" are optional, but in fact they are not (despite the HTTP 200 answer): Pfsense notification: "Invalid DHCP pool, please correct the setting in Services". |
Describe the bug
Hi, in a bash script, i'm trying to create configure DHCP Server on a specific interface like that:
echo "Activating DHCPD" URL="https://$IP_PFSENSE/api/v1/services/dhcpd" curl -k -s -X PUT $URL -d @- << EOF { "client-id": "$USER", "client-token": "$PASSWORD", "interface": "CLIENT", "range_from": "192.168.63.25", "range_to": "192.168.63.40", "dnsserver": ["1.1.1.1"], "gateway": "192.168.63.254" } EOF
(sorry, this a multiline command, not well rendered here)
Expected behavior
A 200 ok HTTP Response :)
Screenshots or Response
`Crash report begins. Anonymous machine information:
amd64
12.2-STABLE
FreeBSD 12.2-STABLE fd0f54f44b5c(RELENG_2_5_0) pfSense
Crash report details:
PHP Errors:
[29-Nov-2021 21:32:14 Etc/UTC] PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /etc/inc/api/models/APIServicesDHCPdUpdate.inc:84
Stack trace:
#0 /etc/inc/api/framework/APIModel.inc(91): APIServicesDHCPdUpdate->validate_payload()
#1 /etc/inc/api/framework/APIModel.inc(101): APIModel->validate()
#2 /etc/inc/api/endpoints/APIServicesDHCPd.inc(28): APIModel->call()
#3 /etc/inc/api/framework/APIEndpoint.inc(66): APIServicesDHCPd->put()
#4 /usr/local/www/api/v1/services/dhcpd/index.php(3): APIEndpoint->listen()
#5 {main}
thrown in /etc/inc/api/models/APIServicesDHCPdUpdate.inc on line 84
[29-Nov-2021 21:33:54 Etc/UTC] PHP Fatal error: Uncaught Error: Cannot use string offset as an array in /etc/inc/api/models/APIServicesDHCPdUpdate.inc:84
Stack trace:
#0 /etc/inc/api/framework/APIModel.inc(91): APIServicesDHCPdUpdate->validate_payload()
#1 /etc/inc/api/framework/APIModel.inc(101): APIModel->validate()
#2 /etc/inc/api/endpoints/APIServicesDHCPd.inc(28): APIModel->call()
#3 /etc/inc/api/framework/APIEndpoint.inc(66): APIServicesDHCPd->put()
#4 /usr/local/www/api/v1/services/dhcpd/index.php(3): APIEndpoint->listen()
#5 {main}
thrown in /etc/inc/api/models/APIServicesDHCPdUpdate.inc on line 84
No FreeBSD crash data found.
`
pfSense Version & Package Version:
Affected Endpoints:
I didn't a similare bug in current issues. Thanks
The text was updated successfully, but these errors were encountered: