---- inet_net_pton.c.orig 2004-11-25 11:38:29.000000000 -0800
-+++ inet_net_pton.c 2005-02-24 16:53:40.000000000 -0800
-@@ -21,6 +21,8 @@
- #include <sys/cdefs.h>
- __FBSDID("$FreeBSD: src/lib/libc/net/inet_net_pton.c,v 1.9 2003/09/15 23:38:06 fenner Exp $");
-
-+#include "xlocale_private.h"
+--- inet_net_pton.c.orig 2008-09-01 22:59:17.000000000 -0700
++++ inet_net_pton.c 2008-09-01 23:00:34.000000000 -0700
+@@ -18,6 +18,10 @@
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $";
+ #endif
+
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
-@@ -97,19 +99,20 @@
- digits[] = "0123456789";
- int n, ch, tmp, dirty, bits;
- const u_char *odst = dst;
-+ locale_t loc = __current_locale();
-
- ch = *src++;
- if (ch == '0' && (src[0] == 'x' || src[0] == 'X')
-- && isascii(src[1]) && isxdigit(src[1])) {
-+ && isascii(src[1]) && isxdigit_l(src[1], loc)) {
- /* Hexadecimal: Eat nybble string. */
- if (size <= 0)
- goto emsgsize;
- *dst = 0, dirty = 0;
- src++; /* skip x or X. */
- while ((ch = *src++) != '\0' &&
-- isascii(ch) && isxdigit(ch)) {
-- if (isupper(ch))
-- ch = tolower(ch);
-+ isascii(ch) && isxdigit_l(ch, loc)) {
-+ if (isupper_l(ch, loc))
-+ ch = tolower_l(ch, loc);
- n = strchr(xdigits, ch) - xdigits;
- assert(n >= 0 && n <= 15);
- *dst |= n;
-@@ -122,7 +125,7 @@
- }
- if (dirty)
- size--;
-- } else if (isascii(ch) && isdigit(ch)) {
-+ } else if (isascii(ch) && isdigit_l(ch, loc)) {
- /* Decimal: eat dotted digit string. */
- for (;;) {
- tmp = 0;
-@@ -134,7 +137,7 @@
- if (tmp > 255)
- goto enoent;
- } while ((ch = *src++) != '\0' &&
-- isascii(ch) && isdigit(ch));
-+ isascii(ch) && isdigit_l(ch, loc));
- if (size-- <= 0)
- goto emsgsize;
- *dst++ = (u_char) tmp;
-@@ -143,14 +146,14 @@
- if (ch != '.')
- goto enoent;
- ch = *src++;
-- if (!isascii(ch) || !isdigit(ch))
-+ if (!isascii(ch) || !isdigit_l(ch, loc))
- goto enoent;
- }
- } else
- goto enoent;
++/* the algorithms only can deal with ASCII, so we optimize for it */
++#define USE_ASCII
++
+ #include <sys/cdefs.h>
+ __FBSDID("$FreeBSD: src/lib/libc/inet/inet_net_pton.c,v 1.3 2007/06/03 17:20:26 ume Exp $");
- bits = -1;
-- if (ch == '/' && isascii(src[0]) && isdigit(src[0]) && dst > odst) {
-+ if (ch == '/' && isascii(src[0]) && isdigit_l(src[0], loc) && dst > odst) {
- /* CIDR width specifier. Nothing can follow it. */
- ch = *src++; /* Skip over the /. */
- bits = 0;
-@@ -159,7 +162,7 @@
+@@ -135,11 +139,11 @@ inet_net_pton_ipv4(const char *src, u_ch
assert(n >= 0 && n <= 9);
bits *= 10;
bits += n;
-- } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
-+ } while ((ch = *src++) != '\0' && isascii(ch) && isdigit_l(ch, loc));
++ if (bits > 32)
++ goto emsgsize;
+ } while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
if (ch != '\0')
goto enoent;
- if (bits > 32)
+- if (bits > 32)
+- goto emsgsize;
+ }
+
+ /* Firey death and destruction unless we prefetched EOS. */