eui[3] = (u_char) a4;
eui[4] = (u_char) a5;
eui[5] = (u_char) a6;
+
+ debugs(28, 4, "id=" << (void*)this << " decoded " << asc);
return true;
}
bool
Eui::Eui48::encode(char *buf, const int len)
{
- if (len < SZ_EUI48_BUF) return false;
+ if (len < SZ_EUI48_BUF)
+ return false;
snprintf(buf, len, "%02x:%02x:%02x:%02x:%02x:%02x",
eui[0] & 0xff, eui[1] & 0xff,
eui[2] & 0xff, eui[3] & 0xff,
eui[4] & 0xff, eui[5] & 0xff);
+
+ debugs(28, 4, "id=" << (void*)this << " encoded " << buf);
return true;
}
bool
Eui::Eui48::lookup(const Ip::Address &c)
{
-#if !_SQUID_WINDOWS_
-#endif /* !_SQUID_WINDOWS_ */
-
Ip::Address ipAddr = c;
ipAddr.port(0);
ipAddr.getSockAddr(*sa);
/* Query ARP table */
+ debugs(28, 4, "id=" << (void*)this << " query ARP table");
if (ioctl(tmpSocket, SIOCGARP, &arpReq) != -1) {
/* Skip non-ethernet interfaces */
close(tmpSocket);
return false;
}
- debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ debugs(28, 4, "id=" << (void*)this << " got address "<< std::setfill('0') << std::hex <<
std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
/* Attempt ARP lookup on each interface */
offset = 0;
-
+ debugs(28, 4, "id=" << (void*)this << " query ARP on each interface (" << ifc.ifc_len << " found)");
while (offset < ifc.ifc_len) {
ifr = (struct ifreq *) (ifbuffer + offset);
offset += sizeof(*ifr);
- /* Skip loopback and aliased interfaces */
- if (0 == strncmp(ifr->ifr_name, "lo", 2))
+ debugs(28, 4, "id=" << (void*)this << " found interface " << ifr->ifr_name);
+
+ /* Skip loopback and aliased interfaces */
+ if (!strncmp(ifr->ifr_name, "lo", 2))
continue;
- if (NULL != strchr(ifr->ifr_name, ':'))
+ if (strchr(ifr->ifr_name, ':'))
continue;
- debugs(28, 4, "Looking up ARP address for " << ipAddr << " on " << ifr->ifr_name);
+ debugs(28, 4, "id=" << (void*)this << " looking up ARP address for " << ipAddr << " on " << ifr->ifr_name);
/* Set up structures for ARP lookup */
}
/* Skip non-ethernet interfaces */
- if (arpReq.arp_ha.sa_family != ARPHRD_ETHER)
+ if (arpReq.arp_ha.sa_family != ARPHRD_ETHER) {
+ debugs(28, 4, "id=" << (void*)this << "... not an Ethernet interface");
continue;
+ }
- debugs(28, 4, "Got address "<< std::setfill('0') << std::hex <<
+ debugs(28, 4, "id=" << (void*)this << " got address "<< std::setfill('0') << std::hex <<
std::setw(2) << (arpReq.arp_ha.sa_data[0] & 0xff) << ":" <<
std::setw(2) << (arpReq.arp_ha.sa_data[1] & 0xff) << ":" <<
std::setw(2) << (arpReq.arp_ha.sa_data[2] & 0xff) << ":" <<
/*
* Address was not found on any interface
*/
- debugs(28, 3, HERE << ipAddr << " NOT found");
+ debugs(28, 3, "id=" << (void*)this << ' ' << ipAddr << " NOT found");
clear();
return false;
bool
Eui::Eui64::decode(const char *asc)
{
- if (eui64_aton(asc, (struct eui64 *)eui) != 0) return false;
+ if (eui64_aton(asc, (struct eui64 *)eui) != 0) {
+ debugs(28, 4, "id=" << (void*)this << " decode fail on " << asc);
+ return false;
+ }
+ debugs(28, 4, "id=" << (void*)this << " ATON decoded " << asc);
return true;
}
snprintf(buf, len, "%02x-%02x-%02x-%02x-%02x-%02x-%02x-%02x",
eui[0], eui[1], eui[2], eui[3],
eui[4], eui[5], eui[6], eui[7]);
+ debugs(28, 4, "id=" << (void*)this << " encoded " << buf);
return true;
}
Eui::Eui64::lookup(const Ip::Address &c)
{
/* try to short-circuit slow OS lookups by using SLAAC data */
- if (lookupSlaac(c)) return true;
+ if (lookupSlaac(c))
+ return true;
// find EUI-64 some other way. NDP table lookup?
return lookupNdp(c);
Eui::Eui64::lookupSlaac(const Ip::Address &c)
{
/* RFC 4291 Link-Local unicast addresses which contain SLAAC - usually trustable. */
- if (c.isSiteLocal6() && c.isSiteLocalAuto() ) {
+ if (c.isSiteLocal6() && c.isSiteLocalAuto()) {
// strip the final 64 bits of the address...
struct in6_addr tmp;
c.getInAddr(tmp);
memcpy(eui, &(tmp.s6_addr[8]), SZ_EUI64_BUF);
-
+ debugs(28, 4, "id=" << (void*)this << " SLAAC decoded " << c);
return true;
}
+
+ debugs(28, 4, "id=" << (void*)this << " SLAAC fail on " << c << " SL-6="
+ << (c.isSiteLocal6()?'T':'F') << " AAC-6=" << (c.isSiteLocalAuto()?'T':'F'));
return false;
}
/*
* Address was not found on any interface
*/
- debugs(28, 3, HERE << c << " NOT found");
+ debugs(28, 3, "id=" << (void*)this << ' ' << c << " NOT found");
#endif /* 0 */
clear();