net/dns.lua
changeset 7059 7b0651e4534f
parent 7057 94d5e2f33a10
child 7062 7ec52755622f
equal deleted inserted replaced
7058:23de70d19e77 7059: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