Project

General

Profile

Actions

Bug #16170

open

Incorrect logic for detection of DNS server change in cases where the ISP does not provide search domains in DHCPv6 renewal

Added by Patrik Stahlman 6 days ago. Updated 5 days ago.

Status:
Feedback
Priority:
Normal
Assignee:
Category:
DHCP (IPv6)
Target version:
Start date:
Due date:
% Done:

100%

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

Description

For 25.03-BETA-3 (25.03.b.20250427.2348) I applied commit https://github.com/pfsense/pfsense/commit/5c2c11b.patch by marcosm to reduce the system log noise from DHCPv6 renewal. However, I noticed the log kept filling up with renewal logging, so I added some debug printouts and found the root cause to why the patch does not work on my system and with my ISP. It is however nothing wrong in the commit itself, the problem is in the original code on which it relies.

These lines of code in /etc/rc.newwanipv6 does not give the expected result, $dns_changed is always true even though packet trace show no change in DNS servers received. Note, the line number corresponds to a file with the 5c2c11b applied.

176 /**
177  * @var bool Used for only action when the DNS information changes.
178  */
179 $dns_changed = true;
180 if (($new_domain_name_servers_received === false) && ($new_searchdomains_received === false)) {
181         $dns_changed = false;
182 }

My debug shows that $new_searchdomains_received is not defined at this point so the comparison with false fails. From the code I can see that new_searchdomains_received is only set if $new_domain_name is provided, something my ISP doesn't do for resedential lines.

A belt-and-braces approach to a fix could look something like this


--- rc.newwanipv6       2025-04-30 16:20:38.697476000 +0200
+++ rc.newwanipv6.new   2025-04-30 18:43:51.298711700 +0200
@@ -176,9 +176,9 @@
 /**
  * @var bool Used for only action when the DNS information changes.
  */
-$dns_changed = true;
-if (($new_domain_name_servers_received === false) && ($new_searchdomains_received === false)) {
-       $dns_changed = false;
+$dns_changed = false;
+if ((isset($new_domain_name_servers_received) && ($new_domain_name_servers_received === true)) || (isset($new_searchdomains_received) && ($new_searchdomains_received === true))) {
+       $dns_changed = true;
 }

I have successfully tested the patch on my system, where no search domain is provided, but YMMV.

Actions #1

Updated by Patrik Stahlman 5 days ago

As expected, in 25.03-BETA on May 1 (25.03.b.20250429.1329) the issue mentioned in the OP still remains, each DHCPv6 renew spams the log even though Marcos M added a change to reduce it.

<snip>
May 1 18:20:04     php-fpm     57707     /rc.newwanipv6: Removing static route for monitor XXXX and adding a new route through YYYY
May 1 18:20:04     php-fpm     57707     /rc.newwanipv6: Removing static route for monitor XXXX and adding a new route through YYYY
May 1 18:20:04     php-fpm     57707     /rc.newwanipv6: rc.newwanipv6: on (IP address: X) (interface: wan) (real interface: igb0).
May 1 18:20:04     php-fpm     57707     /rc.newwanipv6: rc.newwanipv6: Info: received RENEW on igb0 (previous IP address: X).
May 1 18:20:04     php-fpm     57707     /rc.newwanipv6: rc.newwanipv6: Info: starting on igb0.

The patch provided above applies cleanly to 25.03.b.20250429.1329, and fixes the issue:

May 1 18:36:46     php-fpm     57707     /rc.newwanipv6: rc.newwanipv6: Info: starting on igb0.
May 1 18:36:44     php-fpm     30954     /rc.newwanipv6: rc.newwanipv6: Info: starting on igb0. 
May 1 18:21:55     php-fpm     58964     System Patches: Patch applied successfully (ID: 681256680da2e, DESCR: fix issue with DHCPv6 rc.newwanipv6 always detecting change in DNS)
Actions #2

Updated by Marcos M 5 days ago

  • Project changed from pfSense Plus to pfSense
  • Category changed from DHCP Client (IPv6) to DHCP (IPv6)
  • Status changed from New to In Progress
  • Assignee set to Marcos M
  • Target version set to 2.8.0
  • Release Notes changed from Default to Force Exclusion
  • Affected Plus Version deleted (25.03)
  • Plus Target Version set to 25.03
  • Affected Version set to 2.8.0
Actions #3

Updated by Marcos M 5 days ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100
Actions

Also available in: Atom PDF