Software /
code /
prosody
Changeset
2741:fcd30b72c50c
net.dns: More reliable parsing of resolv.conf - allow multiple nameserver IPs on one line (thanks dersd)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 05 Mar 2010 18:15:08 +0000 |
parents | 2740:2442c54cf9ec |
children | 2742:6c0a081cd766 |
files | net/dns.lua |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/net/dns.lua Fri Mar 05 16:45:46 2010 +0000 +++ b/net/dns.lua Fri Mar 05 18:15:08 2010 +0000 @@ -538,8 +538,13 @@ local resolv_conf = io.open("/etc/resolv.conf"); if resolv_conf then for line in resolv_conf:lines() do - local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$'); - if address then self:addnameserver(address) end + line = line:gsub("#.*$", "") + :match('^%s*nameserver%s+(.*)%s*$'); + if line then + line:gsub("%f[%d.](%d+%.%d+%.%d+%.%d+)%f[^%d.]", function (address) + self:addnameserver(address) + end); + end end end if not self.server or #self.server == 0 then