Add const qualifier to in6_addrhash() function.
Add in6ifa_ifwithaddr() function. It is similar to ifa_ifwithaddr, but does fast lookup in the hash of inet6 addresses. Obtained from: Yandex LLC Sponsored by: Yandex LLC
This commit is contained in:
parent
80803aa289
commit
343e440f63
@ -1714,6 +1714,29 @@ in6ifa_ifpforlinklocal(struct ifnet *ifp, int ignoreflags)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* find the internet address corresponding to a given address.
|
||||
* ifaddr is returned referenced.
|
||||
*/
|
||||
struct in6_ifaddr *
|
||||
in6ifa_ifwithaddr(const struct in6_addr *addr, uint32_t zoneid)
|
||||
{
|
||||
struct in6_ifaddr *ia;
|
||||
|
||||
IN6_IFADDR_RLOCK();
|
||||
LIST_FOREACH(ia, IN6ADDR_HASH(addr), ia6_hash) {
|
||||
if (IN6_ARE_ADDR_EQUAL(IA6_IN6(ia), addr)) {
|
||||
if (zoneid != 0 &&
|
||||
zoneid != ia->ia_addr.sin6_scope_id)
|
||||
continue;
|
||||
ifa_ref(&ia->ia_ifa);
|
||||
break;
|
||||
}
|
||||
}
|
||||
IN6_IFADDR_RUNLOCK();
|
||||
return (ia);
|
||||
}
|
||||
|
||||
/*
|
||||
* find the internet address corresponding to a given interface and address.
|
||||
* ifaddr is returned referenced.
|
||||
|
@ -526,7 +526,7 @@ VNET_DECLARE(u_long, in6_ifaddrhmask);
|
||||
(&V_in6_ifaddrhashtbl[IN6ADDR_HASHVAL(x) & V_in6_ifaddrhmask])
|
||||
|
||||
static __inline uint32_t
|
||||
in6_addrhash(struct in6_addr *in6)
|
||||
in6_addrhash(const struct in6_addr *in6)
|
||||
{
|
||||
uint32_t x;
|
||||
|
||||
@ -812,6 +812,7 @@ void in6_setmaxmtu(void);
|
||||
int in6_if2idlen(struct ifnet *);
|
||||
struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int);
|
||||
struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, struct in6_addr *);
|
||||
struct in6_ifaddr *in6ifa_ifwithaddr(const struct in6_addr *, uint32_t);
|
||||
struct in6_ifaddr *in6ifa_llaonifp(struct ifnet *);
|
||||
char *ip6_sprintf(char *, const struct in6_addr *);
|
||||
int in6_addr2zoneid(struct ifnet *, struct in6_addr *, u_int32_t *);
|
||||
|
Loading…
Reference in New Issue
Block a user