Project

General

Profile

Actions

Regression #16045

closed

Dynamic DNS IPv6 tries to use IPv4 address

Added by Bart Schapendonk 10 months ago. Updated 5 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Dynamic DNS
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
25.07
Release Notes:
Force Exclusion
Affected Version:
2.8.0
Affected Architecture:

Description

Feb 13 08:49:54 php-fpm 34382 /services_dyndns_edit.php: Dynamic DNS: updatedns() starting
Feb 13 08:49:54 php-fpm 34382 /services_dyndns_edit.php: Dynamic DNS cloudflare-v6 (wg.example.com): _update() starting.
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: HTTP/2 400
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: date: Thu, 13 Feb 2025 07:49:55 GMT
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: content-type: application/json
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: cf-ray: <REDACTED>
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: cf-cache-status: DYNAMIC
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: set-cookie: __cflb=<REDACTED>; SameSite=Lax; path=/; expires=Thu, 13-Feb-25 10:19:56 GMT; HttpOnly
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: vary: Accept-Encoding
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: cf-auditlog-id: 0194fe49-29cb-718a-9cb1-da60775f27ca
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: set-cookie: __cf_bm=<REDACTED>; path=/; expires=Thu, 13-Feb-25 08:19:55 GMT; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: set-cookie: __cfruid=<REDACTED>; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: set-cookie: _cfuvid=<REDACTED>; path=/; domain=.api.cloudflare.com; HttpOnly; Secure; SameSite=None
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header: server: cloudflare
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header:
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Header:
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Response Data: {"result":null,"success":false,"errors":[{"code":9006,"message":"Content for AAAA record must be a valid IPv6 address."}],"messages":[]}
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Dynamic DNS cloudflare-v6 (wg.example.com): _checkStatus() starting.
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: phpDynDNS (wg): PAYLOAD: {"result":null,"success":false,"errors":[{"code":9006,"message":"Content for AAAA record must be a valid IPv6 address."}],"messages":[]}
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: phpDynDNS (wg): UNKNOWN ERROR - Content for AAAA record must be a valid IPv6 address.
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Dynamic DNS cloudflare-v6 (wg.example.com): _checkStatus() ending.
Feb 13 08:49:55 php-fpm 34382 /services_dyndns_edit.php: Dynamic DNS cloudflare-v6 (wg.example.com): _update() ending.

Actions #1

Updated by Bart Schapendonk 10 months ago

Sorry, my cat slapped the submit button whith his tail before I could finish.

This is on: "25.03-BETA (amd64) built on Tue Feb 4 1:23:00 CET 2025", it worked on 24.11.

I added the following line log_error(sprintf("dnsIP: %s", $this->_dnsIP)); above $response = curl_exec($ch); (https://github.com/pfsense/pfsense/blob/ba43ae3191b64ff05a60f1faca79a6ad0d127abc/src/etc/inc/dyndns.class#L1792) of the IP that is being used to update the AAAA record.

This resulted in a IPv4 address instead of a IPv6 address.


Feb 13 10:21:13 php-fpm 97602 /services_dyndns_edit.php: Dynamic DNS cloudflare-v6 (wg.example.com): _update() starting.
Feb 13 10:21:14 php-fpm 97602 /services_dyndns_edit.php: dnsIP: 149.143.x.x

Actions #2

Updated by Bart Schapendonk 10 months ago

This patch fixes some things and at first glance it looks to work?

But most likely its broken in more places. Looks like the issues is that _addressFamily is null and this falling back to AF_INET. I found two places where it should be set to AF_INET6.

diff --git a/src/etc/inc/dyndns.class b/src/etc/inc/dyndns.class
index 5c1f6ae0f4..31f07b38ea 100644
--- a/src/etc/inc/dyndns.class
+++ b/src/etc/inc/dyndns.class
@@ -357,7 +357,7 @@
                                case 'route53-v6':
                                case 'spdyn-v6':
                                case 'yandex-v6':
-                                       $this->_addressFamily = $this->_curlIpresolveV4 ? AF_INET : null;
+                                       $this->_addressFamily = $this->_curlIpresolveV4 ? AF_INET : AF_INET6;
                                        break;
                                default:
                                        $this->_addressFamily = null;
diff --git a/src/usr/local/www/services_dyndns.php b/src/usr/local/www/services_dyndns.php
index 94a96f1833..26fbaadf0c 100644
--- a/src/usr/local/www/services_dyndns.php
+++ b/src/usr/local/www/services_dyndns.php
@@ -128,7 +128,7 @@ foreach (config_get_path("dyndnses/dyndns", []) as $dyndns):
                        $icon_title = "Failed";
                }
        } else if (file_exists($filename_v6)) {
-               $ipv6addr = dyndnsCheckIP($dyndns['interface'], array_get_path($dyndns, 'check_ip_mode'));
+               $ipv6addr = dyndnsCheckIP($dyndns['interface'], array_get_path($dyndns, 'check_ip_mode'), AF_INET6);
                $cached_ipv6_s = explode("|", file_get_contents($filename_v6));
                $cached_ipv6 = $cached_ipv6_s[0];

---
I can't reply (Plus target version cannot be blank), but edit seems to work.
The new patch still pushes a IPv4 value, I believe this because $this->_addressFamily still has an invalide value and is used later on to switch between V4 and V6 behaviour.

Actions #3

Updated by Marcos M 10 months ago

  • Assignee set to Marcos M
Actions #4

Updated by Marcos M 10 months ago

  • Status changed from New to In Progress

Please try the following patch: Show

Actions #5

Updated by Marcos M 10 months ago

  • Subject changed from Dynamic DNS IPv6 to Dynamic DNS IPv6 tries to use IPv4 address
  • Status changed from In Progress to Feedback
  • Target version set to 2.8.0
  • % Done changed from 0 to 100
  • Plus Target Version set to 25.03
  • Release Notes changed from Default to Force Exclusion
  • Affected Version set to 2.8.0
Actions #6

Updated by Marcos M 9 months ago

  • Status changed from Feedback to Resolved
Actions #7

Updated by Jim Pingle 5 months ago

  • Plus Target Version changed from 25.03 to 25.07
Actions

Also available in: Atom PDF