From 32be553e5075e9744e0f0793e8a09a205b2dc1c0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 12 Apr 2017 19:19:01 +0200 Subject: [PATCH 1/1] IPv6 method local: allow configuring device --- client-scripts/dyn-ns-client | 3 ++- dyn-ns-client.conf.dist | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client-scripts/dyn-ns-client b/client-scripts/dyn-ns-client index 11e4512..93b977f 100755 --- a/client-scripts/dyn-ns-client +++ b/client-scripts/dyn-ns-client @@ -85,7 +85,8 @@ def getMyIPv4(config, verbose = 0): def getMyIPv6(config, verbose = 0): '''Returns our current IPv6 address, detected as given by the configuration''' def local(): - out = subprocess.check_output(["ip", "addr"]) + device = config["IPv6"].get("device") + out = subprocess.check_output(["ip", "addr", "show"] + ([] if device is None else ["dev", device])) for line in out.decode('utf-8').split('\n'): m = re.search('inet6 ([a-fA-F0-9:]+)/64 ([a-zA-Z0-9 ]*)', line) if m is not None: diff --git a/dyn-ns-client.conf.dist b/dyn-ns-client.conf.dist index a833f43..5c13dee 100644 --- a/dyn-ns-client.conf.dist +++ b/dyn-ns-client.conf.dist @@ -12,7 +12,7 @@ password = some_secure_password # web: Call a website to detect the current, external IPv4 address. method = web -# The server to query for web-based IPv4 detection (if enabled). +# The server to query for web-based IPv4 detection (method = web). # Default: same as the global server in the default section. # This server should NOT have an AAAA record, or it may return the IPv6 address instead! server = ipv4.ns.example.com @@ -25,8 +25,11 @@ server = ipv4.ns.example.com # local: Try to detect the global IPv6 address based on the configuration of the local network interfaces. method = none -# The server to query for web-based IPv6 detection. +# The server to query for web-based IPv6 detection (method = web). # Default: same as the global server in the default section. # This server should NOT have an A record, or it may return the IPv4 address instead! server = ipv6.ns.example.com +# The network device of which to use the IPv6 address for local detection (method = local). +# If left unset, pick any device. +device = eth0 -- 2.30.2