Beispiel #1
0
/*
 *      Get ip_vs_dest associated with supplied parameters.
 */
static inline struct ip_vs_dest *
ip_vs_sh_get(struct ip_vs_service *svc, struct ip_vs_sh_state *s,
	     const union nf_inet_addr *addr, __be16 port)
{
	unsigned int hash = ip_vs_sh_hashkey(svc->af, addr, port, 0);
	struct ip_vs_dest *dest = rcu_dereference(s->buckets[hash].dest);

	return (!dest || is_unavailable(dest)) ? NULL : dest;
}
Beispiel #2
0
/* As ip_vs_sh_get, but with fallback if selected server is unavailable */
static inline struct ip_vs_dest *
ip_vs_sh_get_fallback(struct ip_vs_service *svc, struct ip_vs_sh_state *s,
		      const union nf_inet_addr *addr, __be16 port)
{
	unsigned int offset;
	unsigned int hash;
	struct ip_vs_dest *dest;

	for (offset = 0; offset < IP_VS_SH_TAB_SIZE; offset++) {
		hash = ip_vs_sh_hashkey(svc->af, addr, port, offset);
		dest = rcu_dereference(s->buckets[hash].dest);
		if (!dest)
			break;
		if (is_unavailable(dest))
			IP_VS_DBG_BUF(6, "SH: selected unavailable server "
				      "%s:%d (offset %d)",
				      IP_VS_DBG_ADDR(svc->af, &dest->addr),
				      ntohs(dest->port), offset);
		else
			return dest;
	}

	return NULL;
}
Beispiel #3
0
/*
 *      Get ip_vs_dest associated with supplied parameters.
 */
static inline struct ip_vs_dest *
ip_vs_sh_get(struct ip_vs_sh_bucket *tbl, __u32 addr)
{
	return (tbl[ip_vs_sh_hashkey(addr)]).dest;
}
Beispiel #4
0
/*
 *      Get ip_vs_dest associated with supplied parameters.
 */
static inline struct ip_vs_dest *
ip_vs_sh_get(int af, struct ip_vs_sh_bucket *tbl,
             const union nf_inet_addr *addr)
{
    return (tbl[ip_vs_sh_hashkey(af, addr)]).dest;
}
Beispiel #5
0
/*
 *      Get ip_vs_dest associated with supplied parameters.
 */
static inline struct ip_vs_dest *
ip_vs_sh_get(int af, struct ip_vs_sh_state *s, const union nf_inet_addr *addr)
{
	return rcu_dereference(s->buckets[ip_vs_sh_hashkey(af, addr)].dest);
}