Returns the scope of the address.
(addr)
| 851 | |
| 852 | |
| 853 | def in6_getscope(addr): |
| 854 | # type: (str) -> int |
| 855 | """ |
| 856 | Returns the scope of the address. |
| 857 | """ |
| 858 | if in6_isgladdr(addr) or in6_isuladdr(addr): |
| 859 | scope = IPV6_ADDR_GLOBAL |
| 860 | elif in6_islladdr(addr): |
| 861 | scope = IPV6_ADDR_LINKLOCAL |
| 862 | elif in6_issladdr(addr): |
| 863 | scope = IPV6_ADDR_SITELOCAL |
| 864 | elif in6_ismaddr(addr): |
| 865 | if in6_ismgladdr(addr): |
| 866 | scope = IPV6_ADDR_GLOBAL |
| 867 | elif in6_ismlladdr(addr): |
| 868 | scope = IPV6_ADDR_LINKLOCAL |
| 869 | elif in6_ismsladdr(addr): |
| 870 | scope = IPV6_ADDR_SITELOCAL |
| 871 | elif in6_ismnladdr(addr): |
| 872 | scope = IPV6_ADDR_LOOPBACK |
| 873 | else: |
| 874 | scope = -1 |
| 875 | elif addr == '::1': |
| 876 | scope = IPV6_ADDR_LOOPBACK |
| 877 | else: |
| 878 | scope = -1 |
| 879 | return scope |
| 880 | |
| 881 | |
| 882 | def in6_get_common_plen(a, b): |
no test coverage detected
searching dependent graphs…