FreeBSD/sys/netgraph/netflow/netflow.c
/*
 * Generate hash for a given flow record.
 *
 * FIB is not used here, because:
 * most VRFS will carry public IPv4 addresses which are unique even
 * without FIB private addresses can overlap, but this is worked out
 * via flow_rec bcmp() containing fib id. In IPv6 world addresses are
 * all globally unique (it's not fully true, there is FC00::/7 for example,
 * but chances of address overlap are MUCH smaller)
 */
Generate hash for a given flow record.
FIB is not used here, because:
most VRFS will carry public IPv4 addresses which are unique even
without FIB private addresses can overlap, but this is worked out
via flow_rec bcmp() containing fib id. In IPv6 world addresses are
all globally unique (it's not fully true, there is FC00::/7 for example,
but chances of address overlap are MUCH smaller)
Generate hash for a given flow record . FIB is not used here because : most VRFS will carry public IPv4 addresses which are unique even without FIB private addresses can overlap but this is worked out via flow_rec bcmp () containing fib id . In IPv6 world addresses are all globally unique ( it ' s not fully true there is FC00 :: / 7 for example but chances of address overlap are MUCH smaller )
static inline uint32_t
ip_hash(struct flow_rec *r)
{
	switch (r->r_ip_p) {
	case IPPROTO_TCP:
	case IPPROTO_UDP:
		return FULL_HASH(r->r_src.s_addr, r->r_dst.s_addr,
		    r->r_sport, r->r_dport);
	default:
		return ADDR_HASH(r->r_src.s_addr, r->r_dst.s_addr);
	}
}
static inline uint32_t ip_hash ( struct flow_rec * r ) { switch ( r -> r_ip_p ) { case IPPROTO_TCP : case IPPROTO_UDP : return FULL_HASH ( r -> r_src . s_addr , r -> r_dst . s_addr , r -> r_sport , r -> r_dport ) ; default : return ADDR_HASH ( r -> r_src . s_addr , r -> r_dst . s_addr ) ; } }
Generate hash for a given flow record.
Generate hash for a given flow record .