Setting squid's udp_incoming_address address to 127.0.0.1 stop its DNS requests working
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
squid (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: squid
Ubuntu 8.04, squid 2.6.18-1ubuntu3.
By default, squid was listening for TCP connections and UDP packets on
all interfaces. This can be checked with
sudo netstat -tulep | grep -i squid
I wanted to make listen only on localhost for incoming HTTP connections
on port 3128, the default port, and also only send and receive on
localhost for inter-squid ICP packets since I've no other squids to talk
to.
Editing /etc/squid/
for the TCP port.
Setting `udp_incoming_
socket(s) to be only on that interface, but also caused squid to stop
proxying. /var/log/
incoming request.
2008/06/11 21:45:00| comm_udp_sendto: FD 6, 212.159.6.10, port 53: (22) Invalid argument
2008/06/11 21:45:00| idnsSendQuery: FD 6: sendto: (22) Invalid argument
strace(8) confirmed that squid was attempting DNS lookups on the
request's host but sendto(2) was returning EINVAL. lsof(8) can be used
to confirm that the DNS request is trying to be sent to my ISPs DNS
server through a UDP socket bound to the loopback interface. The socket
used by idnsSendQuery() for DNS requests is initialised in
src/dns_
if (DnsSocket < 0) {
int port;
struct in_addr addr;
if (Config.
addr = Config.
else
addr = Config.
DnsSocket = comm_open(
addr,
0,
"DNS Socket");
By default, Config.
Config.
opened on 0.0.0.0, all interfaces, so sendto() to the DNS server works
wherever it is. By setting `udp_incoming_
squid send UDP DNS requests out of 127.0.0.1 destined for the Internet;
EINVAL.
It should be possible to specify a new `dns_outgoing_
item separately and have that default to 0.0.0.0. At it stands, I have
to have squid sitting on the Internet, listening for UDP packets from
the Internet, when it doesn't need them.
Having found the problem, I find it was known about in 2003.
http://
I really think this needs addressing. It's more reassuring to have
servers listening on as few interfaces as necessary.
Is there a reason you're not using udp_outgoing_ address? Solved the problem for me.