diff --git a/dyndomain b/dyndomain index a9dea32..0cfed57 100755 --- a/dyndomain +++ b/dyndomain @@ -19,7 +19,7 @@ from ovh import ovh def load_conf(): global zone_filename, log_filename global wan_hostname, zone_domain, zone_subdomain - global hosts_list, hosts_ipv4_nat_list + global hosts_list, hosts_ipv4_nat_list, hosts_alias_list global mail_from, mail_to conf = configparser.ConfigParser(allow_no_value=True) @@ -36,6 +36,7 @@ def load_conf(): hosts_list = [ host for host in conf['Hosts'] ] hosts_ipv4_nat_list = [ host for host in conf['NatHosts'] ] + hosts_alias_list = conf['Aliases'] def ping(hostname): @@ -43,6 +44,7 @@ def ping(hostname): ret = subprocess.run(cmd.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE) return 0 if ret.returncode else 1 + def get_ipv6_hosts(): r = sysbus.requete('Devices:get') @@ -51,6 +53,8 @@ def get_ipv6_hosts(): if not 'IPv6Address' in h or not h['IPv6Address']: continue hostname = h['Name'] + if hostname in hosts_alias_list: + hostname = hosts_alias_list[hostname] for a in h['IPv6Address']: if a['Scope'] != 'global' or a['Status'] != 'reachable': continue diff --git a/home-sample.conf b/home-sample.conf index 42b915f..8ae1f9e 100644 --- a/home-sample.conf +++ b/home-sample.conf @@ -13,6 +13,9 @@ mypc1 mypc2 mypc3 +[Aliases] +mypc1-wifi = mypc1 + [NatHosts] mypc2 mypc4