Lines Matching refs:addr
62 * @addr: IPv4 address
69 static unsigned int sel_netnode_hashfn_ipv4(__be32 addr)
73 return (addr & (SEL_NETNODE_HASH_SIZE - 1));
78 * @addr: IPv6 address
85 static unsigned int sel_netnode_hashfn_ipv6(const struct in6_addr *addr)
90 return (addr->s6_addr32[3] & (SEL_NETNODE_HASH_SIZE - 1));
95 * @addr: IP address
99 * Search the network node table and return the record matching @addr. If an
103 static struct sel_netnode *sel_netnode_find(const void *addr, u16 family)
110 idx = sel_netnode_hashfn_ipv4(*(const __be32 *)addr);
113 idx = sel_netnode_hashfn_ipv6(addr);
124 if (node->nsec.addr.ipv4 == *(const __be32 *)addr)
128 if (ipv6_addr_equal(&node->nsec.addr.ipv6,
129 addr))
151 idx = sel_netnode_hashfn_ipv4(node->nsec.addr.ipv4);
154 idx = sel_netnode_hashfn_ipv6(&node->nsec.addr.ipv6);
179 * @addr: the IP address
190 static int sel_netnode_sid_slow(void *addr, u16 family, u32 *sid)
197 node = sel_netnode_find(addr, family);
208 addr, sizeof(struct in_addr), sid);
210 new->nsec.addr.ipv4 = *(__be32 *)addr;
214 addr, sizeof(struct in6_addr), sid);
216 new->nsec.addr.ipv6 = *(struct in6_addr *)addr;
238 * @addr: the IP address
250 int sel_netnode_sid(void *addr, u16 family, u32 *sid)
255 node = sel_netnode_find(addr, family);
263 return sel_netnode_sid_slow(addr, family, sid);