Commit Diff
Diff:
0876915152e50ed41aa39bd49466b8cf7c333f96
dc729c6b129a81fdfeef155196a38a4dd36f7f96
Commit:
dc729c6b129a81fdfeef155196a38a4dd36f7f96
Tree:
ab02b4bb5425ed143b6a562554462ee9b073eced
Author:
pbug <pbug@delphinusdns.org>
Committer:
pbug <pbug@delphinusdns.org>
Date:
Tue Oct 5 12:28:47 2010 UTC
Message:
* make IPv6 queries work tested on OpenBSD
blob - 0f83f8d72dbdf6669aec5009011e3751d139b015
blob + 1bdc06fbd5b4b4ce04b4886f9cb4b5898aa91128
--- recurse.c
+++ recurse.c
@@ -85,7 +85,7 @@ struct recurseentry {
} *rn1, *rn2, *rnp;
-static const char rcsid[] = "$Id: recurse.c,v 1.27 2010/10/03 14:41:34 pbug Exp $";
+static const char rcsid[] = "$Id: recurse.c,v 1.28 2010/10/05 12:28:47 pbug Exp $";
/*
* INIT_RECURSE - initialize the recurse singly linked list
@@ -2162,6 +2162,7 @@ netlookup6(DB *db, struct recurses *sr)
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(sr->port);
+ sin6.sin6_len = sizeof(struct sockaddr_in6);
if (bind(sr->so, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) {
syslog(LOG_ERR, "bind: %m");
@@ -2197,7 +2198,8 @@ netlookup6(DB *db, struct recurses *sr)
sin6.sin6_family = AF_INET6;
sin6.sin6_port = htons(53);
- memcpy(&sin6.sin6_addr, &sr->aaaa[0], sizeof(struct in6_addr));
+ /* pjp */
+ memcpy((char *)&sin6.sin6_addr, (char *)&sr->aaaa[0], sizeof(struct in6_addr));
/* XXX we use buf here in order to preserve
* the state of query...
@@ -2276,7 +2278,7 @@ lookup_aaaa(DB *db, struct recurses *sr, struct ns *ns
sd = &sdomain;
if ((sd->flags & DOMAIN_HAVE_AAAA) == DOMAIN_HAVE_AAAA) {
- memcpy((char *)&sr->aaaa[sr->aaaa_count], (char *)&sd->aaaa[0], sizeof(struct in6_addr));
+ memcpy((char *)&sr->aaaa[sr->aaaa_count], (char *)sd->aaaa[0], sizeof(struct in6_addr));
sd->a_count++;
found = 1;
blob - 2675956a615bc51bc46b14730d6b570789f725bc
blob + 1ce5dbec007e7fcc521c9fadf9514e8186959a95
--- reply.c
+++ reply.c
@@ -77,7 +77,7 @@ struct collects {
} *cn1, *cn2, *cnp;
-static const char rcsid[] = "$Id: reply.c,v 1.36 2010/09/30 09:12:32 pbug Exp $";
+static const char rcsid[] = "$Id: reply.c,v 1.37 2010/10/05 12:28:47 pbug Exp $";
/*
* REPLY_A() - replies a DNS question (*q) on socket (so)
@@ -2320,7 +2320,7 @@ reply_raw6(int so, char *reply, int outlen, struct rec
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
- memcpy(&sin6.sin6_addr, sin_dst, sizeof(struct in6_addr));
+ memcpy((char *)&sin6.sin6_addr, (char *)&sin_dst->sin6_addr, sizeof(struct in6_addr));
if (bind(so, (struct sockaddr *)&sin6, sizeof(sin6)) < 0) {
syslog(LOG_ERR, "bind6: %m");
@@ -2329,21 +2329,22 @@ reply_raw6(int so, char *reply, int outlen, struct rec
memset(&sin6, 0, sizeof(sin6));
sin6.sin6_family = AF_INET6;
- memcpy(&sin6.sin6_addr, sin_src, sizeof(struct in6_addr));
+ memcpy(&sin6.sin6_addr, (char *)&sin_src->sin6_addr, sizeof(struct in6_addr));
sin6.sin6_port = sin_src->sin6_port;
+ sin6.sin6_len = sizeof(struct sockaddr_in6);
pseudo = (struct ip6_hdr_pseudo *)&csum[0];
pseudo->ip6ph_nxt = IPPROTO_UDP;
- pseudo->ip6ph_len = htons(sizeof(struct udphdr));
+ pseudo->ip6ph_len = htons(udplen);
memcpy((char *)&pseudo->ip6ph_src, &sin_dst->sin6_addr, sizeof(struct in6_addr));
memcpy((char *)&pseudo->ip6ph_dst, &sin_src->sin6_addr, sizeof(struct in6_addr));
- memcpy((char *)&csum[sizeof(struct ip6_hdr_pseudo)], udp, sizeof(struct udphdr));
+ memcpy((char *)&csum[sizeof(struct ip6_hdr_pseudo)], udp, udplen);
- udp->uh_sum = in_cksum((u_short *)&csum[0], sizeof(struct ip6_hdr_pseudo) + sizeof(struct udphdr), 0);
+ udp->uh_sum = in_cksum((u_short *)&csum[0], sizeof(struct ip6_hdr_pseudo) + udplen, 0);
- if (sendto(so, buf, udplen, 0, (struct sockaddr *)(&sr->dest), sizeof(struct sockaddr)) < 0) {
+ if (sendto(so, buf, udplen, 0, (struct sockaddr *)(&sr->dest), sizeof(struct sockaddr_in6)) < 0) {
syslog(LOG_ERR, "sendto: %m");
}
}
repomaster@centroid.eu