From: Amos Jeffries Date: Wed, 25 Dec 2013 21:34:33 +0000 (-0700) Subject: WCCPv2: fix assertion 'Cannot convert non-IPv4 to IPv4' on FreeBSD X-Git-Tag: SQUID_3_4_2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=940086932945dd471cadf89299413c57626092c3;p=thirdparty%2Fsquid.git WCCPv2: fix assertion 'Cannot convert non-IPv4 to IPv4' on FreeBSD FreeBSD does not set the from-address on recv() if there was an error reading the packet. This can result in Ip::Address assertion if the error is not checked for before the IP address is mapped into Squid internal format. --- diff --git a/src/wccp2.cc b/src/wccp2.cc index b2c695a3a9..23b9e63da1 100644 --- a/src/wccp2.cc +++ b/src/wccp2.cc @@ -1172,14 +1172,13 @@ wccp2HandleUdp(int sock, void *not_used) /* FIXME INET6 : drop conversion boundary */ Ip::Address from_tmp; + from_tmp.setIPv4(); len = comm_udp_recvfrom(sock, &wccp2_i_see_you, WCCP_RESPONSE_SIZE, 0, from_tmp); - /* FIXME INET6 : drop conversion boundary */ - from_tmp.getSockAddr(from); if (len < 0) return; @@ -1190,6 +1189,9 @@ wccp2HandleUdp(int sock, void *not_used) if (ntohl(wccp2_i_see_you.type) != WCCP2_I_SEE_YOU) return; + /* FIXME INET6 : drop conversion boundary */ + from_tmp.getSockAddr(from); + debugs(80, 3, "Incoming WCCPv2 I_SEE_YOU length " << ntohs(wccp2_i_see_you.length) << "."); /* Record the total data length */