# isInNet called with an IPv6 address

Source: https://findproxyforurl.net/rules/isinnet-with-ipv6/ · last updated 2026-10-11

Rule PAC-K014 (`isinnet-with-ipv6`), severity medium, category: Compatibility across engines.

isInNet is defined for dotted-quad IPv4 addresses and masks. An IPv6 network or mask makes the test false on every engine; the IPv6-capable isInNetEx exists only in some engines.

## Why it matters

The v1 helper parses four decimal octets. `isInNet(host, "fd00::", "ffff::")` is never true.
`isInNetEx(host, "fd00::/8")` works for an IPv6 address in Chromium and Windows (WinHTTP)
but throws in Firefox (PAC-K003); on Windows it is false when `host` is a name, because
`isInNetEx` there does not look names up (lab, 2026-10-11). For the few IPv6 ranges that matter in a PAC (loopback, link-local,
unique-local) a string prefix test is portable and sufficient.


## How to fix

Use string tests for well-known IPv6 ranges (host == "::1", shExpMatch(host, "fe80:*")) or a guarded isInNetEx with fallback.

## Bad

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

## Good

```js
function FindProxyForURL(url, host) {
  if (shExpMatch(host, "fd*:*") || shExpMatch(host, "fc*:*")) {
    return "DIRECT";
  }
  return "PROXY proxy.corp.example:8080";
}
```
