# IPv6 extension functions (isInNetEx, dnsResolveEx, myIpAddressEx)

Source: https://findproxyforurl.net/rules/ex-functions-not-portable/ · last updated 2026-10-15

Rule PAC-K003 (`ex-functions-not-portable`), severity medium, category: Compatibility across engines.

The Ex functions come from Microsoft's IPv6 extensions to the PAC format. Chromium and WinHTTP implement them; Firefox does not. On an engine without them the call throws and the request is treated as a script failure.

## Why it matters

`isInNetEx`, `dnsResolveEx`, `myIpAddressEx`, `isResolvableEx`, `sortIpAddressList` and
`getClientVersion` are not part of the original PAC function set. Microsoft defined them for
IPv6 support; Chromium added implementations; Firefox has declined to. A PAC that calls
them unconditionally fails on Firefox with a `ReferenceError` (silent DIRECT). If they are
needed, guard the call with `typeof isInNetEx === "function"` and provide a fallback path.


## How to fix

Prefer the portable v1 functions; if an Ex function is required, guard it with typeof checks and provide a fallback branch.

## Bad

```js
function FindProxyForURL(url, host) {
  if (isInNetEx(host, "fd00::/8")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Good

```js
function FindProxyForURL(url, host) {
  if (typeof isInNetEx === "function" && isInNetEx(host, "fd00::/8")) {
    return "DIRECT";
  }
  if (shExpMatch(host, "fd*:*")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```

## Engine behaviour

- chromium: The Ex functions are implemented (isResolvableEx in the JS helper library, dnsResolveEx/myIpAddressEx/sortIpAddressList as native bindings in proxy_resolver_v8.cc). (source: code, verified 2026-10-04)
- firefox: Ex functions are not implemented; dnsResolveEx, isInNetEx, myIpAddressEx, sortIpAddressList, isResolvableEx and getClientVersion are undefined. (source: lab, verified 2026-10-12)
- pacparser: Four of the six are present (dnsResolveEx, isInNetEx, myIpAddressEx, isResolvableEx); sortIpAddressList and getClientVersion are undefined. Measured in 1.4.6 and 1.5.3. (source: lab, verified 2026-10-04)
- winhttp: All six are present (isResolvableEx, isInNetEx, dnsResolveEx, myIpAddressEx, sortIpAddressList, getClientVersion). dnsResolveEx lists IPv4 and IPv6 addresses separated by ';' with IPv6 in brackets, and returns false for a name that does not resolve; isInNetEx needs a prefix such as /8, does not look up host names and is false for /0; getClientVersion returns "1.0". (source: lab, verified 2026-10-11)
