os-ddclient 1.7 - PHP Error

Started by Souljacker, June 24, 2022, 08:08:45 AM

Previous topic - Next topic
Hello!

Just updated OPNsense to 22.1.9-amd64. Then i was trying to add a new service to os-ddclient-1.7. Resulted in an PHP-Error. Anyone else facing this issue?

[24-Jun-2022 08:05:09 Europe/Berlin] Exception: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8) in /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152
Stack trace:
#0 /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php(55): OPNsense\Base\ApiControllerBase->APIErrorHandler(8, 'Undefined index...', '/usr/local/opns...', 55, Array)
#1 /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php(76): OPNsense\DynDNS\FieldTypes\AccountField->addStatsFields(Object(OPNsense\Base\FieldTypes\ContainerField))
#2 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(193): OPNsense\DynDNS\FieldTypes\AccountField->actionPostLoadingEvent()
#3 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(191): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#4 /usr/local/opnsense/mvc/app/models/OPNsense/Base/FieldTypes/BaseField.php(191): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#5 /usr/local/opnsense/mvc/app/models/OPNsense/Base/BaseModel.php(361): OPNsense\Base\FieldTypes\BaseField->eventPostLoading()
#6 [internal function]: OPNsense\Base\BaseModel->__construct()
#7 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php(96): ReflectionClass->newInstance()
#8 /usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiMutableServiceControllerBase.php(207): OPNsense\Base\ApiMutableServiceControllerBase->getModel()
#9 [internal function]: OPNsense\Base\ApiMutableServiceControllerBase->statusAction()
#10 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->callActionMethod(Object(OPNsense\DynDNS\Api\ServiceController), 'statusAction', Array)
#11 [internal function]: Phalcon\Dispatcher\AbstractDispatcher->dispatch()
#12 /usr/local/opnsense/www/api.php(26): Phalcon\Mvc\Application->handle('/api/dyndns/ser...')
#13 {main}

June 24, 2022, 03:28:01 PM #1 Last Edit: June 24, 2022, 03:31:53 PM by JamesFrisch
Some issue here.

Opening Dynamic DNS gives me three popups with this warning:

An API exception occured
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8)

while the Log File shows:
52682 - [meta sequenceId="1"] WARNING: found neither ipv4 nor ipv6 address


Dynamic DNS is not even enabled. Dynamic DNS (legacy) is still active if that makes a difference.

Enabling Dynamic DNS results in a issue report.

I had the same error today after updating OPNSense to 22.1.9 and installing os-ddclient 1.7.
I added a DynDNS account and realized, that the ip address was not updated, I tried to reload the service and from there on I always get the PHP Error message, the account I had added has disappeared and I'm not able to add a new account.
All dropdown fields in the mask for adding a new account are empty.
Deinstalling and Reinstalling os-ddclient didn't help.

can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:


opnsense-patch -c plugins 33999368


the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad

I had the same issue and this fixed it.  Thanks!

This patch also fixed the issue for me, thanks AdSchellevis! Now all we need is Cloudflare API token functionality and a dashboard widget like the legacy Dynamic DNS and ddclient *might* become usable  ;)

This fixed my issue, too. Looks like I have to issue the command each time I add a service.

Quote from: AdSchellevis on June 24, 2022, 08:26:37 PM
can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:


opnsense-patch -c plugins 33999368


the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad

Quote
....  I have to issue the command each time I add a service.

No you don't, executing it again will revert the change...

The patch applied from console fixed it for me as well...thanks!

Quote from: AdSchellevis on June 26, 2022, 02:00:25 PM
Quote
....  I have to issue the command each time I add a service.

No you don't, executing it again will revert the change...

Hmm...Well I don't know then. I guess I added a second service, had the PHP errors, then I must have issued the command twice or something to that effect. Anyhoo, I managed to get three working DDNS services added, so I'm good.  :D

Thanks

June 28, 2022, 08:36:07 PM #10 Last Edit: June 28, 2022, 08:39:44 PM by MBfromOK
Quote from: AdSchellevis on June 24, 2022, 08:26:37 PM
can you try https://github.com/opnsense/plugins/commit/339993680de4453962d21546a181550bd1cc0f0f ?

To install via a console, use the following command:


opnsense-patch -c plugins 33999368


the /var/tmp/ddclient.cache  file likely contains incomplete data.

Best regards,

Ad


(FROM: https://github.com/opnsense/plugins/issues/3019)

Thanks AdSchellevis,

Running the patch (at the visible level) had the temporary effect of making the entry visible.
There were no errors displayed, and it didn't look like there was a need to add / change anything.

Now, several minutes later I am getting this:

An API exception has occured
/usr/local/opnsense/mvc/app/controllers/OPNsense/Base/ApiControllerBase.php:152: Error at /usr/local/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php:55 - Undefined index: ip (errno=8)

Secondarily: I keep seeing that the GUI doesn't support CloudFlare tokens (and tried to use one here), do you know if that is that still true?

Also, it seems like you told us to install a patch without telling us what it was or why we needed it... I chose to trust your input, but it would be great to know why you are recommending the patch and what you expect it to do (to help make sure it works and to establish expectations)

June 28, 2022, 08:42:04 PM #11 Last Edit: June 28, 2022, 09:17:09 PM by MBfromOK
I ran the patch again, got the following in the console, and can now see the Service entry in the list:

Found local copy of 33999368, skipping fetch.
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|From 339993680de4453962d21546a181550bd1cc0f0f Mon Sep 17 00:00:00 2001
|From: Ad Schellevis <ad@opnsense.org>
|Date: Fri, 24 Jun 2022 20:11:31 +0200
|Subject: [PATCH] dns/ddclient - validate statistics before usage to prevent
| missing fields, for now let's assume mtime is always filled, ip apparantly
| isn't. ref https://forum.opnsense.org/index.php?topic=28835.msg140355
|
|---
| dns/ddclient/Makefile                                           | 1 +
| .../mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php  | 2 +-
| 2 files changed, 2 insertions(+), 1 deletion(-)
|
|diff --git a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
|index 24d856e99e..b11bcaf7c0 100644
|--- a/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
|+++ b/dns/ddclient/src/opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php
--------------------------
Patching file opnsense/mvc/app/models/OPNsense/DynDNS/FieldTypes/AccountField.php using Plan A...
Hunk #1 succeeded at 50.
done
All patches have been applied successfully.  Have a nice day.


In Github issue 361 https://github.com/ddclient/ddclient/issues/361 ddclient 3.10.0 is being recommended for install by SuperSandro2000 in response to https://github.com/ddclient/ddclient/issues/361#issuecomment-1149646988.

The releases page (https://github.com/ddclient/ddclient/tree/release/release-3.10.0)shows that it has been built / uploaded to FreeBSD.ports.


Is there a path to get this release added to the OPNsense plugins (or whatever the appropriate description is) library (or get the plugin modified to use the release version instead of 3.9.1)

I'll update the port today and it'll be in 22.1.10 then, but I'm unsure if there are any upstream issues with it. We just have to do it to see it. I don't think FreeBSD ports is moving forward at the moment so we might as well update it there too.


Cheers,
Franco

Actually, 3.10.0_1 and 3.10.0_2 are pre-release versions but we might as well use it.


Cheers,
Franco