* return length of part which dst and src are equal * hard coding... */
| 1806 | * hard coding... |
| 1807 | */ |
| 1808 | int |
| 1809 | in6_matchlen(struct in6_addr *src, struct in6_addr *dst) |
| 1810 | { |
| 1811 | int match = 0; |
| 1812 | u_char *s = (u_char *)src, *d = (u_char *)dst; |
| 1813 | u_char *lim = s + 16, r; |
| 1814 | |
| 1815 | while (s < lim) |
| 1816 | if ((r = (*d++ ^ *s++)) != 0) { |
| 1817 | while (r < 128) { |
| 1818 | match++; |
| 1819 | r <<= 1; |
| 1820 | } |
| 1821 | break; |
| 1822 | } else |
| 1823 | match += 8; |
| 1824 | return match; |
| 1825 | } |
| 1826 | |
| 1827 | /* XXX: to be scope conscious */ |
| 1828 | int |
no outgoing calls
no test coverage detected