Was opening snmp_port, icp_port, htcp_port under the v4-mapping assumption.
This forces the ports both listening and outgoing to IPv4-only unless
v4-mapping is actually available in the system.
#include "htcp.h"
#include "acl/FilledChecklist.h"
#include "acl/Acl.h"
+#include "ip/tools.h"
#include "SquidTime.h"
#include "Store.h"
#include "StoreClient.h"
Ip::Address incomingAddr = Config.Addrs.udp_incoming;
incomingAddr.SetPort(Config.Port.htcp);
+ if (!Ip::EnableIpv6 && !incomingAddr.SetIPv4()) {
+ debugs(31, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << incomingAddr << " is not an IPv4 address.");
+ fatal("HTCP port cannot be opened.");
+ }
+
AsyncCall::Pointer call = asyncCall(31, 2,
"htcpIncomingConnectionOpened",
HtcpListeningStartedDialer(&htcpIncomingConnectionOpened));
Ip::Address outgoingAddr = Config.Addrs.udp_outgoing;
outgoingAddr.SetPort(Config.Port.htcp);
+ if (!Ip::EnableIpv6 && !outgoingAddr.SetIPv4()) {
+ debugs(31, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << outgoingAddr << " is not an IPv4 address.");
+ fatal("HTCP port cannot be opened.");
+ }
enter_suid();
htcpOutSocket = comm_open_listener(SOCK_DGRAM,
IPPROTO_UDP,
#include "SwapDir.h"
#include "icmp/net_db.h"
#include "ip/Address.h"
+#include "ip/tools.h"
#include "ipc/StartListening.h"
#include "rfc1738.h"
addr = Config.Addrs.udp_incoming;
addr.SetPort(port);
+ if (!Ip::EnableIpv6 && !addr.SetIPv4()) {
+ debugs(12, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << addr << " is not an IPv4 address.");
+ fatal("ICP port cannot be opened.");
+ }
+
AsyncCall::Pointer call = asyncCall(12, 2,
"icpIncomingConnectionOpened",
IcpListeningStartedDialer(&icpIncomingConnectionOpened, addr));
if ( !addr.IsNoAddr() ) {
enter_suid();
addr.SetPort(port);
+
+ if (!Ip::EnableIpv6 && !addr.SetIPv4()) {
+ debugs(49, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << addr << " is not an IPv4 address.");
+ fatal("ICP port cannot be opened.");
+ }
+
theOutIcpConnection = comm_open_listener(SOCK_DGRAM,
IPPROTO_UDP,
addr,
if (Config.Port.snmp > 0) {
Config.Addrs.snmp_incoming.SetPort(Config.Port.snmp);
+ if (!Ip::EnableIpv6 && !Config.Addrs.snmp_incoming.SetIPv4()) {
+ debugs(49, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << Config.Addrs.snmp_incoming << " is not an IPv4 address.");
+ fatal("SNMP port cannot be opened.");
+ }
AsyncCall::Pointer call = asyncCall(49, 2,
"snmpIncomingConnectionOpened",
SnmpListeningStartedDialer(&snmpIncomingConnectionOpened));
if (!Config.Addrs.snmp_outgoing.IsNoAddr()) {
Config.Addrs.snmp_outgoing.SetPort(Config.Port.snmp);
+ if (!Ip::EnableIpv6 && !Config.Addrs.snmp_outgoing.SetIPv4()) {
+ debugs(49, DBG_CRITICAL, "ERROR: IPv6 is disabled. " << Config.Addrs.snmp_outgoing << " is not an IPv4 address.");
+ fatal("SNMP port cannot be opened.");
+ }
AsyncCall::Pointer call = asyncCall(49, 2,
"snmpOutgoingConnectionOpened",
SnmpListeningStartedDialer(&snmpOutgoingConnectionOpened));