* Get a scope of the address. Node-local, link-local, site-local or global. */
| 226 | * Get a scope of the address. Node-local, link-local, site-local or global. |
| 227 | */ |
| 228 | int |
| 229 | in6_addrscope(const struct in6_addr *addr) |
| 230 | { |
| 231 | |
| 232 | if (IN6_IS_ADDR_MULTICAST(addr)) { |
| 233 | /* |
| 234 | * Addresses with reserved value F must be treated as |
| 235 | * global multicast addresses. |
| 236 | */ |
| 237 | if (IPV6_ADDR_MC_SCOPE(addr) == 0x0f) |
| 238 | return (IPV6_ADDR_SCOPE_GLOBAL); |
| 239 | return (IPV6_ADDR_MC_SCOPE(addr)); |
| 240 | } |
| 241 | if (IN6_IS_ADDR_LINKLOCAL(addr) || |
| 242 | IN6_IS_ADDR_LOOPBACK(addr)) |
| 243 | return (IPV6_ADDR_SCOPE_LINKLOCAL); |
| 244 | if (IN6_IS_ADDR_SITELOCAL(addr)) |
| 245 | return (IPV6_ADDR_SCOPE_SITELOCAL); |
| 246 | return (IPV6_ADDR_SCOPE_GLOBAL); |
| 247 | } |
| 248 | |
| 249 | /* |
| 250 | * ifp - note that this might be NULL |
no outgoing calls
no test coverage detected