mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-20 23:00:56 -05:00
- Implement ipv6%interface notation for scope_id usage.
git-svn-id: file:///svn/unbound/trunk@2519 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
28c9738062
commit
ddddbf284f
2 changed files with 11 additions and 0 deletions
|
|
@ -2,6 +2,7 @@
|
|||
- fix unbound-anchor for broken strptime on OSX lion, detected
|
||||
in configure.
|
||||
- Detect if GOST really works, openssl1.0 on OSX fails.
|
||||
- Implement ipv6%interface notation for scope_id usage.
|
||||
|
||||
17 October 2011: Wouter
|
||||
- better documentation for inform_super (Thanks Yang Zhe).
|
||||
|
|
|
|||
|
|
@ -188,11 +188,21 @@ ipstrtoaddr(const char* ip, int port, struct sockaddr_storage* addr,
|
|||
if(!ip) return 0;
|
||||
p = (uint16_t) port;
|
||||
if(str_is_ip6(ip)) {
|
||||
char buf[MAX_ADDR_STRLEN];
|
||||
char* s;
|
||||
struct sockaddr_in6* sa = (struct sockaddr_in6*)addr;
|
||||
*addrlen = (socklen_t)sizeof(struct sockaddr_in6);
|
||||
memset(sa, 0, *addrlen);
|
||||
sa->sin6_family = AF_INET6;
|
||||
sa->sin6_port = (in_port_t)htons(p);
|
||||
if((s=strchr(ip, '%'))) { /* ip6%interface, rfc 4007 */
|
||||
if(s-ip >= MAX_ADDR_STRLEN)
|
||||
return 0;
|
||||
strncpy(buf, ip, MAX_ADDR_STRLEN);
|
||||
buf[s-ip]=0;
|
||||
sa->sin6_scope_id = atoi(s+1);
|
||||
ip = buf;
|
||||
}
|
||||
if(inet_pton((int)sa->sin6_family, ip, &sa->sin6_addr) <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue