Commit Diff
Diff:
dc729c6b129a81fdfeef155196a38a4dd36f7f96
df41eab0f4452ddb1203cbd167ab64355fb314d7
Commit:
df41eab0f4452ddb1203cbd167ab64355fb314d7
Tree:
46484ccbdc1c5e2fbe79b6c536bfce785cba5e81
Author:
pbug <pbug@delphinusdns.org>
Committer:
pbug <pbug@delphinusdns.org>
Date:
Wed Oct 6 10:42:54 2010 UTC
Message:
* make linux compile with the new IPv6 code compiles on OpenSuse 10.3
blob - 12aac33b6a8bc9804971e8693e92c1e5244fc136
blob + 1344a2fdc1cb189adcabb87b7ce0c06437a1eae6
--- include.h
+++ include.h
@@ -70,4 +70,14 @@
#include "endian.h"
#endif
+#ifdef __linux__
+struct ip6_hdr_pseudo {
+ struct in6_addr ip6ph_src;
+ struct in6_addr ip6ph_dst;
+ u_int32_t ip6ph_len;
+ u_int8_t ip6ph_zero[3];
+ u_int8_t ip6ph_nxt;
+} __packed;
+#endif
+
#endif
blob - 1bdc06fbd5b4b4ce04b4886f9cb4b5898aa91128
blob + b4fcb42b7d34ab48c564e53d83717d9f1536a843
--- recurse.c
+++ recurse.c
@@ -85,7 +85,7 @@ struct recurseentry {
} *rn1, *rn2, *rnp;
-static const char rcsid[] = "$Id: recurse.c,v 1.28 2010/10/05 12:28:47 pbug Exp $";
+static const char rcsid[] = "$Id: recurse.c,v 1.29 2010/10/06 10:42:54 pbug Exp $";
/*
* INIT_RECURSE - initialize the recurse singly linked list
@@ -2162,7 +2162,9 @@ netlookup6(DB *db, struct recurses *sr)
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(sr->port);
+#ifndef __linux__
sin6.sin6_len = sizeof(struct sockaddr_in6);
+#endif
if (bind(sr->so, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) {
syslog(LOG_ERR, "bind: %m");
blob - 1ce5dbec007e7fcc521c9fadf9514e8186959a95
blob + 7b17d5c5851781da5d27d036b9caa75ee780dbd8
--- reply.c
+++ reply.c
@@ -77,7 +77,7 @@ struct collects {
} *cn1, *cn2, *cnp;
-static const char rcsid[] = "$Id: reply.c,v 1.37 2010/10/05 12:28:47 pbug Exp $";
+static const char rcsid[] = "$Id: reply.c,v 1.38 2010/10/06 10:42:54 pbug Exp $";
/*
* REPLY_A() - replies a DNS question (*q) on socket (so)
@@ -2313,10 +2313,17 @@ reply_raw6(int so, char *reply, int outlen, struct rec
sin_src = (struct sockaddr_in6 *)(&sr->source);
sin_dst = (struct sockaddr_in6 *)(&sr->dest);
+#ifdef __linux__
+ udp->source = sin_dst->sin6_port;
+ udp->dest = sin_src->sin6_port;
+ udp->len = htons(udplen);
+ udp->check = 0;
+#else
udp->uh_sport = sin_dst->sin6_port;
udp->uh_dport = sin_src->sin6_port;
udp->uh_ulen = htons(udplen);
udp->uh_sum = 0;
+#endif
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
@@ -2331,7 +2338,9 @@ reply_raw6(int so, char *reply, int outlen, struct rec
sin6.sin6_family = AF_INET6;
memcpy(&sin6.sin6_addr, (char *)&sin_src->sin6_addr, sizeof(struct in6_addr));
sin6.sin6_port = sin_src->sin6_port;
+#ifndef __linux__
sin6.sin6_len = sizeof(struct sockaddr_in6);
+#endif
pseudo = (struct ip6_hdr_pseudo *)&csum[0];
pseudo->ip6ph_nxt = IPPROTO_UDP;
@@ -2341,7 +2350,11 @@ reply_raw6(int so, char *reply, int outlen, struct rec
memcpy((char *)&csum[sizeof(struct ip6_hdr_pseudo)], udp, udplen);
+#ifdef __linux__
+ udp->check = in_cksum((u_short *)&csum[0], sizeof(struct ip6_hdr_pseudo) + udplen, 0);
+#else
udp->uh_sum = in_cksum((u_short *)&csum[0], sizeof(struct ip6_hdr_pseudo) + udplen, 0);
+#endif
if (sendto(so, buf, udplen, 0, (struct sockaddr *)(&sr->dest), sizeof(struct sockaddr_in6)) < 0) {
repomaster@centroid.eu