mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
fixup addr6 check.
git-svn-id: file:///svn/unbound/trunk@677 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
aecdb781fc
commit
fed59bca84
5 changed files with 10 additions and 8 deletions
|
|
@ -4,6 +4,7 @@
|
|||
- fixup the fact that the query section was not compressed to,
|
||||
the code was there but was called by value instead of by reference.
|
||||
And test for the case, uses xxd and nc.
|
||||
- more portable ip6 check for sockaddr types.
|
||||
|
||||
8 October 2007: Wouter
|
||||
- --disable-rpath option in configure for 64bit systems with
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ iter_filter_unsuitable(struct iter_env* iter_env, struct module_env* env,
|
|||
if(donotq_lookup(iter_env->donotq, &a->addr, a->addrlen)) {
|
||||
return -1; /* server is on the donotquery list */
|
||||
}
|
||||
if(!iter_env->supports_ipv6 && addr_is_ip6(&a->addr)) {
|
||||
if(!iter_env->supports_ipv6 && addr_is_ip6(&a->addr, a->addrlen)) {
|
||||
return -1; /* there is no ip6 available */
|
||||
}
|
||||
/* check lameness - need zone , class info */
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ outnet_tcp_take_into_use(struct waiting_tcp* w, uint8_t* pkt, size_t pkt_len)
|
|||
log_assert(pkt);
|
||||
/* open socket */
|
||||
#ifdef INET6
|
||||
if(addr_is_ip6(&w->addr))
|
||||
if(addr_is_ip6(&w->addr, w->addrlen))
|
||||
s = socket(PF_INET6, SOCK_STREAM, IPPROTO_TCP);
|
||||
else
|
||||
#endif
|
||||
|
|
@ -643,7 +643,7 @@ select_port(struct outside_network* outnet, struct pending* pend,
|
|||
|
||||
log_assert(outnet && pend);
|
||||
/* first select ip4 or ip6. */
|
||||
if(addr_is_ip6(&pend->addr))
|
||||
if(addr_is_ip6(&pend->addr, pend->addrlen))
|
||||
nummax = (int)outnet->num_udp6;
|
||||
else nummax = (int)outnet->num_udp4;
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ select_port(struct outside_network* outnet, struct pending* pend,
|
|||
if(chosen < 0) chosen = 0;
|
||||
if(chosen >= nummax) chosen = nummax-1;
|
||||
|
||||
if(addr_is_ip6(&pend->addr))
|
||||
if(addr_is_ip6(&pend->addr, pend->addrlen))
|
||||
pend->c = outnet->udp6_ports[chosen];
|
||||
else pend->c = outnet->udp4_ports[chosen];
|
||||
log_assert(pend->c);
|
||||
|
|
|
|||
|
|
@ -312,10 +312,10 @@ sockaddr_cmp(struct sockaddr_storage* addr1, socklen_t len1,
|
|||
}
|
||||
|
||||
int
|
||||
addr_is_ip6(struct sockaddr_storage* addr)
|
||||
addr_is_ip6(struct sockaddr_storage* addr, socklen_t len)
|
||||
{
|
||||
short family = *(short*)addr;
|
||||
if(family == AF_INET6)
|
||||
if(len == (socklen_t)sizeof(struct sockaddr_in6) &&
|
||||
((struct sockaddr_in6*)addr)->sin6_family == AF_INET6)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -203,8 +203,9 @@ int sockaddr_cmp(struct sockaddr_storage* addr1, socklen_t len1,
|
|||
/**
|
||||
* Checkout address family.
|
||||
* @param addr: the sockaddr to examine.
|
||||
* @param len: the length of addr.
|
||||
* return: true if sockaddr is ip6.
|
||||
*/
|
||||
int addr_is_ip6(struct sockaddr_storage* addr);
|
||||
int addr_is_ip6(struct sockaddr_storage* addr, socklen_t len);
|
||||
|
||||
#endif /* NET_HELP_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue