zone update fixes

This commit is contained in:
Gilles Grandou 2021-04-21 17:04:38 +02:00
parent ff4302cf0a
commit b1a296f05a

View File

@ -288,7 +288,7 @@ def livebox_add_port_nat(port, addr):
'origin': 'webui', 'origin': 'webui',
'sourceInterface': 'data', 'sourceInterface': 'data',
'destinationIPAddress': addr, 'destinationIPAddress': addr,
'protocol': '6', 'protocol': '6,17',
'internalPort': port, 'internalPort': port,
'enable': True, 'enable': True,
} }
@ -303,7 +303,8 @@ def livebox_add_pinhole(port, addr):
'sourceInterface': 'data', 'sourceInterface': 'data',
'destinationPort': port, 'destinationPort': port,
'destinationIPAddress': addr, 'destinationIPAddress': addr,
'protocol': '6', 'protocol': '6,17',
'ipversion': '6',
'enable': True, 'enable': True,
} }
r = sysbus.requete('Firewall:setPinhole', a) r = sysbus.requete('Firewall:setPinhole', a)
@ -341,20 +342,21 @@ def send_update_mail(mail_to, mail_from, zone_domain, update, mail_ignore_list,
msg['To' ] = mail_to msg['To' ] = mail_to
txt = "Livebox update\n\n" txt = "Livebox update\n\n"
txt = txt + "WAN IPv4 : %s\n" % wan['ipv4']
txt = txt + "WAN IPv6 : %s\n" % wan['ipv6']
txt = txt + "\nZone %s has been updated:\n" % zone_domain
if updated['add']:
txt = txt + "\nUpdated entries:\n"
for prot,name,addr in update['add']: for prot,name,addr in update['add']:
txt = txt + " %-20s %-4s %s\n" % (name,prot,addr) txt = txt + " %-20s %-4s %s\n" % (name,prot,addr)
if update['delete']:
txt = txt + "\nRemoved entries:\n" txt = txt + "\nRemoved entries:\n"
for prot,name,addr in update['delete']: for prot,name,addr in update['delete']:
txt = txt + " %-20s %-4s %s\n" % (name,prot,addr) txt = txt + " %-20s %-4s %s\n" % (name,prot,addr)
txt = txt + '\n' txt = txt + '\n'
txt = txt + "WAN IPv4 : %s\n" % wan['ipv4']
txt = txt + "WAN IPv6 : %s\n" % wan['ipv6']
msg.set_content(txt) msg.set_content(txt)
@ -392,6 +394,9 @@ if update:
success = ovh_update_zone(zone_domain, zone, update, sync_zone) success = ovh_update_zone(zone_domain, zone, update, sync_zone)
livebox_update_fw(zone, update, sync_zone) livebox_update_fw(zone, update, sync_zone)
if success: if success:
try:
send_update_mail(mail_to, mail_from, zone_domain, update, mail_ignore_list, wan) send_update_mail(mail_to, mail_from, zone_domain, update, mail_ignore_list, wan)
except:
pass
write_zone_list(zone_filename, zone, update) write_zone_list(zone_filename, zone, update)