Lines Matching refs:addr
73 * @addr: IPv4 address
80 static unsigned int sel_netnode_hashfn_ipv4(__be32 addr)
84 return (addr & (SEL_NETNODE_HASH_SIZE - 1));
89 * @addr: IPv6 address
96 static unsigned int sel_netnode_hashfn_ipv6(const struct in6_addr *addr)
101 return (addr->s6_addr32[3] & (SEL_NETNODE_HASH_SIZE - 1));
106 * @addr: IP address
110 * Search the network node table and return the record matching @addr. If an
114 static struct sel_netnode *sel_netnode_find(const void *addr, u16 family)
121 idx = sel_netnode_hashfn_ipv4(*(__be32 *)addr);
124 idx = sel_netnode_hashfn_ipv6(addr);
135 if (node->nsec.addr.ipv4 == *(__be32 *)addr)
139 if (ipv6_addr_equal(&node->nsec.addr.ipv6,
140 addr))
162 idx = sel_netnode_hashfn_ipv4(node->nsec.addr.ipv4);
165 idx = sel_netnode_hashfn_ipv6(&node->nsec.addr.ipv6);
189 * @addr: the IP address
200 static int sel_netnode_sid_slow(void *addr, u16 family, u32 *sid)
207 node = sel_netnode_find(addr, family);
219 addr, sizeof(struct in_addr), sid);
220 new->nsec.addr.ipv4 = *(__be32 *)addr;
224 addr, sizeof(struct in6_addr), sid);
225 new->nsec.addr.ipv6 = *(struct in6_addr *)addr;
251 * @addr: the IP address
263 int sel_netnode_sid(void *addr, u16 family, u32 *sid)
268 node = sel_netnode_find(addr, family);
276 return sel_netnode_sid_slow(addr, family, sid);