------------------------------------------------------------ revno: 12414 revision-id: squid3@treenet.co.nz-20121124035733-xdnvz6zah2k2m6x4 parent: squid3@treenet.co.nz-20121124035637-7z9yevkqfocppjhv committer: Amos Jeffries branch nick: 3.3 timestamp: Fri 2012-11-23 20:57:33 -0700 message: libeui: Warn and fail nicely on socket errors looking up ARP record If something nasty happened (out of FD or similar) socket() may fail. Report these events and continue with unknown EUI value. Detected by Coverity Scan. Issue 740393 ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20121124035733-xdnvz6zah2k2m6x4 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 31bd0feb241ed22c62343d1fde86e0fec66c19f6 # timestamp: 2012-11-24 03:57:58 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20121124035637-\ # 7z9yevkqfocppjhv # # Begin patch === modified file 'src/eui/Eui48.cc' --- src/eui/Eui48.cc 2012-08-15 15:17:32 +0000 +++ src/eui/Eui48.cc 2012-11-24 03:57:33 +0000 @@ -176,6 +176,11 @@ /* IPv6 builds do not provide the first http_port as an IPv4 socket for ARP */ int tmpSocket = socket(AF_INET,SOCK_STREAM,0); + if (tmpSocket < 0) { + debugs(28, DBG_IMPORTANT, "Attempt to open socket for EUI retrieval failed: " << xstrerror()); + clear(); + return false; + } /* * The linux kernel 2.2 maintains per interface ARP caches and @@ -315,6 +320,11 @@ /* IPv6 builds do not provide the first http_port as an IPv4 socket for ARP */ int tmpSocket = socket(AF_INET,SOCK_STREAM,0); + if (tmpSocket < 0) { + debugs(28, DBG_IMPORTANT, "Attempt to open socket for EUI retrieval failed: " << xstrerror()); + clear(); + return false; + } /* Set up structures for ARP lookup with blank interface name */ struct arpreq arpReq;