summaryrefslogtreecommitdiff
path: root/net/bind9/patches/patch-ac
blob: 2b758c01bf9e0c21f59f978231d9576f3e31896d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
$NetBSD: patch-ac,v 1.5.14.1 2006/09/07 11:20:43 ghen Exp $

--- lib/lwres/getaddrinfo.c.orig	2005-06-10 08:54:33.000000000 +0900
+++ lib/lwres/getaddrinfo.c
@@ -30,6 +30,10 @@
 #include <lwres/netdb.h>
 #include <lwres/stdlib.h>
 
+#ifdef __KAME__
+#include <net/if.h>
+#endif
+
 #define SA(addr)	((struct sockaddr *)(addr))
 #define SIN(addr)	((struct sockaddr_in *)(addr))
 #define SIN6(addr)	((struct sockaddr_in6 *)(addr))
@@ -252,14 +256,22 @@ lwres_getaddrinfo(const char *hostname, 
 			p = strchr(ntmp, '%');
 			ep = NULL;
 
+#ifdef __KAME__
+			if (p != NULL) {
+				scopeid = if_nametoindex(p + 1);
+				if (scopeid)
+					p = NULL;
+			}
+#endif
 			/*
 			 * Vendors may want to support non-numeric
 			 * scopeid around here.
 			 */
 
-			if (p != NULL)
+			if (p != NULL) {
 				scopeid = (lwres_uint32_t)strtoul(p + 1,
 								  &ep, 10);
+			}
 			if (p != NULL && ep != NULL && ep[0] == '\0')
 				*p = '\0';
 			else {