Software /
code /
prosody
Comparison
net/dns.lua @ 7056:7b0651e4534f
net.dns: Allow a zone id in resolv.conf (eg like %eth0)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 04 Jan 2016 15:46:06 +0100 |
parent | 7054:94d5e2f33a10 |
child | 7059:7ec52755622f |
comparison
equal
deleted
inserted
replaced
7055:23de70d19e77 | 7056:7b0651e4534f |
---|---|
598 else -- posix | 598 else -- posix |
599 local resolv_conf = io.open("/etc/resolv.conf"); | 599 local resolv_conf = io.open("/etc/resolv.conf"); |
600 if resolv_conf then | 600 if resolv_conf then |
601 for line in resolv_conf:lines() do | 601 for line in resolv_conf:lines() do |
602 line = line:gsub("#.*$", "") | 602 line = line:gsub("#.*$", "") |
603 :match('^%s*nameserver%s+([%x:%.]*)%s*$'); | 603 :match('^%s*nameserver%s+([%x:%.]*%%?%S*)%s*$'); |
604 if line then | 604 if line then |
605 local ip = new_ip(line); | 605 local ip = new_ip(line); |
606 if ip then | 606 if ip then |
607 self:addnameserver(ip.addr); | 607 self:addnameserver(ip.addr); |
608 end | 608 end |