OPNsense Forum

Archive => 23.1 Legacy Series => Topic started by: Erik10206 on May 22, 2023, 03:40:26 AM

Title: ddclient can't determine IP for vlan interface
Post by: Erik10206 on May 22, 2023, 03:40:26 AM
I have an opnsense install running the latest version (23.1.7_3-amd64) and was working to install Dynamic DNS. I got both cloudflare and google setup but when the service goes to read the interface's IP address, it logs this entry:

Quote2023-05-21T20:31:58-05:00   Notice   ddclient[419]   39522 - [meta sequenceId="2"] FAILED: Unable to obtain information for 'em0_vlan' -- missing ip or ifconfig command

The actual interface name is em0_vlan10. This router is nested in the network and doesn't have a direct assigned public IP. I have it set up in a lab where I'm trying to get this all configured before deploying it to the remote site it's going to live.

Here are the contents of /usr/local/etc/ddclient.conf


syslog=yes                  # log update msgs to syslog
pid=/var/run/ddclient.pid   # record PID in file.
verbose=yes

ssl=yes

usev4=ifv4, if=em0_vlan10, \
protocol=googledomains, \
login=<snip>, \
password=<snip> \
unmc.heartlandready.com

usev4=ifv4, if=em0_vlan10, \
protocol=cloudflare, \
zone=heartlandready.com, \
password=<snip> \
unmc.heartlandready.com


It looks like the config is setup correctly but somewhere down the line, the number is being dropped.
Is there something I am missing here?
Title: Re: ddclient can't determine IP for vlan interface
Post by: Erik10206 on May 22, 2023, 04:32:48 AM
Ok, so... I dug into this a bit further. I found the source and simulated the input and figured out that the address seems to be processed properly but there's a conditional that looks to be the issue.

Debug Notebook: https://cocalc.com/share/public_paths/9f8375ebc4525456211ffde578180b7a51e0d400

Based on that the is_global method is returning false (because it's an internal IP address) and not returning anything. Is it possible to have that condition respect the setting in the interface (block private networks)?

However, commenting that out didn't solve the issue. Sooooooo, I'll keep poking but I'm not sure where to look next. The message from the log entry doesn't show up in any of the script files.
Title: Re: ddclient can't determine IP for vlan interface
Post by: franco on May 22, 2023, 08:44:58 AM
https://www.iplocationtools.com/10.80.1.109 is indeed private. You can't use the interface IP method if it's private (behind NAT).


Cheers,
Franco
Title: Re: ddclient can't determine IP for vlan interface
Post by: Erik10206 on May 22, 2023, 01:11:35 PM
Yep, you're 100% correct. But I don't think that's the issue here after looking at the source. If I comment out the if statement for the is_global flag so that the IP address will return private or not, the issue isn't fixed and the log still continues to report that it fails to get the interface's IP address with the vlan id missing from the interface name.

Where does the message "Unable to obtain information for" come from? It's not a phrase in any of the py sources so I am trying to follow the code to see where the vlan id is being stripped from the interface name.
Title: Re: ddclient can't determine IP for vlan interface
Post by: franco on May 22, 2023, 02:38:21 PM
https://github.com/ddclient/ddclient/blob/841ffcbdaa009687e5fb390c4527055e929f959a/ddclient.in#L3207

I don't know but I found it... ;)


Cheers,
Franco
Title: Re: ddclient can't determine IP for vlan interface
Post by: Pande on May 24, 2023, 06:04:03 PM
I'm having the same issue but the other way arround. I USED to have a vlan interface for the ipcheck but I change it to a different one and the logs shows:

FAILED: Unable to obtain information for 'vtnet0_v' -- missing ip or ifconfig command

in ddclient.conf:

syslog=yes                  # log update msgs to syslog
pid=/var/run/ddclient.pid   # record PID in file.

ssl=yes

usev4=ifv4, if=vtnet1, \
Title: Re: ddclient can't determine IP for vlan interface
Post by: franco on May 24, 2023, 09:38:07 PM
Honestly the regex and resulting match looks horribly wrong, but I have no energy or time for ddclient.


Cheers,
Franco
Title: Re: ddclient can't determine IP for vlan interface
Post by: Erik10206 on May 26, 2023, 02:32:19 PM
Quote from: franco on May 22, 2023, 02:38:21 PM
https://github.com/ddclient/ddclient/blob/841ffcbdaa009687e5fb390c4527055e929f959a/ddclient.in#L3207

I don't know but I found it... ;)


Cheers,
Franco

Sweet. I'll clone these files and propose some fixes in a pull request. :)
Title: Re: ddclient can't determine IP for vlan interface
Post by: Erik10206 on June 01, 2023, 02:11:34 AM
The issue turned out to be a bug in the way opnsense generated the config. :)

https://github.com/opnsense/plugins/issues/3450

Looks like someone beat me to the fix so hopefully it will be bundled in the next update :)
Title: Re: ddclient can't determine IP for vlan interface
Post by: franco on June 01, 2023, 09:13:12 AM
It's included in 23.1.9 but needs a service apply from the GUI to take effect.


Cheers,
Franco