I post this here as I do not find a better place to post this question.
I have my domain (example.com) DNS service with cloudlfare. And I'm using the home.example.com subdomain for all the hosts at home. So my router FQDN is router.home.example.com, and my nas is then nas.home.example.com etc etc.
in order to have my router accessible from the internet I would like to use the ddns cloudlfare scripts (https://github.com/openwrt/packages/tree/master/net/ddns-scripts).
I have entered the details correctly as far as I can tell via the Luci screens, and in the ddns logs I also see that the script is able to query the cloudflare API to get the correct rec_id for the router.home.example.com dns A record.
the following https call is made to cloudflare:
https://www.cloudflare.com/api_json.html? a=rec_load_all& tkn=1234567890abcdef1234567890abcdef& email@example.com& z=example.com
and I see the correct details in the logs:
rec_id '1234567890' detected for host/domain 'router.home.example.com'
so far so good ...
then the update https call is created .. and there things go wrong:
https://www.cloudflare.com/api_json.html? a=rec_edit& tkn=1234567890abcdef1234567890abcdef& id=1234567890& firstname.lastname@example.org& z=example.com& type=A& name=router& content=220.127.116.11& service_mode=0& ttl=1
so instead of setting the name variable to 'router.home' .. the script sets it to just 'router'
When looking into the scripts I see that in the first call the cloudflare the script is using the FQDN that you configured (router.home.example.com) to find the correct rec_id from the JSON output and it is using the variable
__DOMAIN as the zone details (see line 67 on this page :
(sorry .. new user .. so limited number of links allowed)
so far so good again ..
in the update URL it is using the
__SUBDOM variable in the 'name' field of the update so aparently that is set incorrect.
__SUBDOM variables are populated by using the split_FQDN function from here
and there I see nothing really wrong with how it gets split .. so why is the '__SUBDOM' variable (parameter $4 in the
split_FQDN function) not populated with router.home?
any help would be appreciated