Skip to content

Commit

Permalink
dns/ddclient: stop trying to updat 'None' address
Browse files Browse the repository at this point in the history
Looks like the type check was off leading to update an empty address.
Now instead check first and throw a warning.  The condition might be
transient but try to hint at the user that the setup is likely broken.
  • Loading branch information
fichtner committed Aug 22, 2023
1 parent dd58c38 commit be0ef6b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""
import syslog
import hashlib
import uuid
import time
Expand Down Expand Up @@ -120,8 +121,13 @@ def execute(self):
interface = self.settings['interface'] if self.settings.get('interface' ,'').strip() != '' else None
)


if self._current_address != '' and (
if self._current_address == None:
syslog.syslog(
syslog.LOG_WARNING,
"Account %s no global IP address detected, check config if warning persists" % (self.description)
)
return False
elif (
self._state.get('ip') is None or
self._current_address != self._state.get('ip') or
self.state.get('md5') != self.md5
Expand Down
6 changes: 4 additions & 2 deletions dns/ddclient/src/opnsense/scripts/ddclient/lib/poller.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,15 @@ def run(self):
for acc in self._accounts.values():
if time.time() - acc.atime > self.poll_interval:
if self.is_verbose:
syslog.syslog(syslog.LOG_NOTICE, "Account %s execute" % acc.description)
syslog.syslog(syslog.LOG_NOTICE, "Account %s executing" % acc.description)
try:
if acc.execute():
if self.is_verbose:
syslog.syslog(syslog.LOG_NOTICE, "Account %s changed" % acc.description)
syslog.syslog(syslog.LOG_NOTICE, "Account %s updated" % acc.description)
needs_flush = True
else:
if self.is_verbose:
syslog.syslog(syslog.LOG_NOTICE, "Account %s not modified" % acc.description)
# update last accessed timestamp
acc.update_state(None)
except Exception as e:
Expand Down

0 comments on commit be0ef6b

Please sign in to comment.