/*
- * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
#include <cerrno>
/* START Legacy includes pattern */
-/* TODO: clean this up so we dont have per-OS requirements.
+/* TODO: clean this up so we do not have per-OS requirements.
The files are checked for existence individually
and can be wrapped
*/
* Working on setting up a proper firewall for a network containing some
* Win'95 computers at our Univ, I've discovered that some smart students
* avoid the restrictions easily just changing their IP addresses in Win'95
- * Contol Panel... It has been getting boring, so I took Squid-1.1.18
+ * Control Panel... It has been getting boring, so I took Squid-1.1.18
* sources and added a new acl type for hard-wired access control:
*
* acl <name> arp <Ethernet address> ...
/* 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());
+ int xerrno = errno;
+ debugs(28, DBG_IMPORTANT, "Attempt to open socket for EUI retrieval failed: " << xstrerr(xerrno));
clear();
return false;
}
ifc.ifc_buf = (char *)ifbuffer;
if (ioctl(tmpSocket, SIOCGIFCONF, &ifc) < 0) {
- debugs(28, DBG_IMPORTANT, "Attempt to retrieve interface list failed: " << xstrerror());
+ int xerrno = errno;
+ debugs(28, DBG_IMPORTANT, "Attempt to retrieve interface list failed: " << xstrerr(xerrno));
clear();
close(tmpSocket);
return false;
/* Query ARP table */
if (-1 == ioctl(tmpSocket, SIOCGARP, &arpReq)) {
- /*
- * Query failed. Do not log failed lookups or "device
- * not supported"
- */
-
- if (ENXIO == errno)
- (void) 0;
- else if (ENODEV == errno)
- (void) 0;
- else
- debugs(28, DBG_IMPORTANT, "ARP query " << ipAddr << " failed: " << ifr->ifr_name << ": " << xstrerror());
+ int xerrno = errno;
+ // Query failed. Do not log failed lookups or "device not supported"
+ if (ENXIO != xerrno && ENODEV != xerrno)
+ debugs(28, DBG_IMPORTANT, "ARP query " << ipAddr << " failed: " << ifr->ifr_name << ": " << xstrerr(xerrno));
continue;
}
/* 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());
+ int xerrno = errno;
+ debugs(28, DBG_IMPORTANT, "Attempt to open socket for EUI retrieval failed: " << xstrerr(xerrno));
clear();
return false;
}
mib[4] = NET_RT_FLAGS;
+#if defined(RTF_LLDATA)
+ mib[5] = RTF_LLDATA;
+#else
mib[5] = RTF_LLINFO;
+#endif
if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) {
debugs(28, DBG_CRITICAL, "Can't estimate ARP table size!");