summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 06bafec)
raw | patch | inline | side by side (parent: 06bafec)
author | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Mon, 4 Dec 2006 20:17:49 +0000 (21:17 +0100) | ||
committer | Florian Forster <octo@crystal.wlan.home.verplant.org> | |
Mon, 4 Dec 2006 20:17:49 +0000 (21:17 +0100) |
The 32bit members apparently are Linux or glibc specific, so don't use them.
src/utils_dns.c | patch | blob | history |
diff --git a/src/utils_dns.c b/src/utils_dns.c
index 2c710093cf7329e4c4c86a7b0497de4102531f34..221bac4bfdcb27c9022e75b20a406946e19bc842 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
{
int i;
- for (i = 0; i < 4; i++)
- if (a->s6_addr32[i] != b->s6_addr32[i])
+ assert (sizeof (struct in6_addr) == 16);
+
+ for (i = 0; i < 16; i++)
+ if (a->s6_addr[i] != b->s6_addr[i])
break;
- if (i >= 4)
+ if (i >= 16)
return (0);
- return (a->s6_addr32[i] > b->s6_addr32[i] ? 1 : -1);
+ return (a->s6_addr[i] > b->s6_addr[i] ? 1 : -1);
} /* int cmp_addrinfo */
static inline int ignore_list_match (const struct in6_addr *addr)
{
if (ai_ptr->ai_family == AF_INET)
{
- addr.s6_addr32[0] = 0;
- addr.s6_addr32[1] = 0;
- addr.s6_addr32[2] = htonl (0x0000FFFF);
- addr.s6_addr32[3] = ((struct sockaddr_in *) ai_ptr->ai_addr)->sin_addr.s_addr;
+ memset (&addr, '\0', sizeof (addr));
+ addr.s6_addr[10] = 0xFF;
+ addr.s6_addr[11] = 0xFF;
+ memcpy (addr.s6_addr + 12, &((struct sockaddr_in *) ai_ptr->ai_addr)->sin_addr, 4);
ignore_list_add (&addr);
}
memset (ia, 0, sizeof (struct in6_addr));
if ((AF_INET == family) && (sizeof (uint32_t) == buf_len))
{
- ia->s6_addr32[2] = htonl (0x0000FFFF);
- ia->s6_addr32[3] = *((uint32_t *) buf);
+ ia->s6_addr[10] = 0xFF;
+ ia->s6_addr[11] = 0xFF;
+ memcpy (ia->s6_addr + 12, buf, buf_len);
}
else if ((AF_INET6 == family) && (sizeof (struct in6_addr) == buf_len))
{
return 1;
}
+#if HAVE_NET_IF_PPP_H
static int
handle_ppp(const u_char * pkt, int len)
{
memcpy(buf, pkt, len);
return handle_ip((struct ip *) buf, len);
}
+#endif /* HAVE_NET_IF_PPP_H */
static int
handle_null(const u_char * pkt, int len)
@@ -611,9 +616,11 @@ void handle_pcap(u_char *udata, const struct pcap_pkthdr *hdr, const u_char *pkt
case DLT_EN10MB:
status = handle_ether (pkt, hdr->caplen);
break;
+#if HAVE_NET_IF_PPP_H
case DLT_PPP:
status = handle_ppp (pkt, hdr->caplen);
break;
+#endif
#ifdef DLT_LOOP
case DLT_LOOP:
status = handle_loop (pkt, hdr->caplen);
case DLT_EN10MB:
handle_datalink = handle_ether;
break;
-#if USE_PPP
+#if HAVE_NET_IF_PPP_H
case DLT_PPP:
handle_datalink = handle_ppp;
break;
return 0;
} /* static int main(int argc, char *argv[]) */
#endif
+/*
+ * vim:shiftwidth=4:tabstop=8:softtabstop=4
+ */