Skip to content

Commit

Permalink
ddns-scripts: introduce use_network option
Browse files Browse the repository at this point in the history
This new option is used to prevent issues caused when forcing the network
interface used on GNU Wget and cURL when the interface is IPv6 and the DDNS
provider host is IPv4-only.

An example would be trying to update an IPv6 from HE 6in4 interface to OVH,
which is IPv4-only:
Non-authoritative answer:
dns.eu.ovhapis.com      canonical name = eu.ovhapis.com.
Name:   eu.ovhapis.com
Address: 141.95.186.231

 131133  note : PID '21141' started at 2025-02-21 13:11
 131133       : ddns version  : 2.8.2-52
 131133       : uci configuration:
ddns.router6.dns_server='dns100.ovh.net'
ddns.router6.domain='****domain****'
ddns.router6.enabled='1'
ddns.router6.interface='henet'
ddns.router6.ip_network='henet'
ddns.router6.ip_source='network'
ddns.router6.lookup_host='****lookup_host****'
ddns.router6.password='***PW***'
ddns.router6.service_name='ovh.com'
ddns.router6.use_https='1'
ddns.router6.use_ipv6='1'
ddns.router6.use_syslog='2'
ddns.router6.username='****username****'
ddns.router6=service
 131133       : verbose mode  : 0 - run normal, NO console output
 131133       : check interval: 600 seconds
 131133       : force interval: 259200 seconds
 131133       : retry interval: 60 seconds
 131133       : retry max count : 0 times
 131133       : No old process
 131133       : last update: never
 131133       : Detect registered/public IP
 131133       : #> /usr/bin/drill -V0 -u ****domain**** @dns100.ovh.net AAAA >/var/run/ddns/router6.dat 2>/var/run/ddns/router6.err
 131133       : Registered IP '2600:XXXX:XXXX::XXXX' detected
 131133  info : Starting main loop at 2025-02-21 13:11
 131133       : Detect current IP on 'network'
 131133       : Current IP '2001:XXXX:XXXX:XXXX::XXXX' detected on network 'henet'
 131133       : Update needed - L: '2001:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX' <> R: '2600:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX'
 131133       : Force communication via IP '2001:XXXX:XXXX:XXXX::XXXX'
 131133       : #> /usr/bin/wget --hsts-file=/tmp/.wget-hsts -nv -t 1 -O /var/run/ddns/router6.dat -o /var/run/ddns/router6.err --bind-address=2001:XXXX:XXXX:XXXX::XXXX --no-proxy 'https://***USERNAME***:***PW***@dns.eu.ovhapis.com/nic/update?system=dyndns&hostname=***HOSTNAME***&myip=2001:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX'
 131133 ERROR : GNU Wget Error: '4'
 131133       : failed: Address family not supported by protocol.
 131133  WARN : Transfer failed - retry 1/0 in 60 seconds

Signed-off-by: Álvaro Fernández Rojas <[email protected]>
  • Loading branch information
Noltari committed Feb 21, 2025
1 parent 65cbccf commit ae21063
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion net/ddns-scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk

PKG_NAME:=ddns-scripts
PKG_VERSION:=2.8.2
PKG_RELEASE:=64
PKG_RELEASE:=65

PKG_LICENSE:=GPL-2.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ do_transfer() {
[ $# -ne 1 ] && write_log 12 "Error in 'do_transfer()' - wrong number of parameters"

# Use ip_network as default for bind_network if not separately specified
[ -z "$bind_network" ] && [ "$ip_source" = "network" ] && [ "$ip_network" ] && bind_network="$ip_network"
[ -z "$bind_network" ] && [ $use_network -ne 0 ] && [ "$ip_source" = "network" ] && [ "$ip_network" ] && bind_network="$ip_network"

# lets prefer GNU Wget because it does all for us - IPv4/IPv6/HTTPS/PROXY/force IP version
if [ -n "$WGET_SSL" ] && [ $USE_CURL -eq 0 ]; then # except global option use_curl is set to "1"
Expand Down
1 change: 1 addition & 0 deletions net/ddns-scripts/files/usr/lib/ddns/dynamic_dns_updater.sh
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ ERR_LAST=$? # save return code - equal 0 if SECTION_ID found
# set defaults if not defined
[ -z "$enabled" ] && enabled=0
[ -z "$retry_max_count" ] && retry_max_count=0 # endless retry
[ -z "$use_network" ] && use_network=1 # use network address
[ -z "$use_syslog" ] && use_syslog=2 # syslog "Notice"
[ -z "$use_https" ] && use_https=0 # not use https
[ -z "$use_logfile" ] && use_logfile=1 # use logfile by default
Expand Down
10 changes: 10 additions & 0 deletions net/ddns-scripts/samples/ddns.config_sample
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ config service "myddns"
# default: none
option param_opt ""

###########
# use network interface when communicating with your DDNS provider.
# forcing the network interface causes problems when communicating to DDNS
# provider IPv4-only hosts via IPv6-only interaces.
# setting this to 0 disables the following arguments:
# GNU Wget: "--bind-address"
# cURL: "--interface"
# default: "1" use network interface
option use_network "1"

###########
# use HTTPS for secure communication with you DDNS provider
# personally found some providers having problems when not sending
Expand Down

0 comments on commit ae21063

Please sign in to comment.