diff options
| author | Gleb Smirnoff <glebius@FreeBSD.org> | 2006-10-11 12:31:14 +0000 |
|---|---|---|
| committer | Gleb Smirnoff <glebius@FreeBSD.org> | 2006-10-11 12:31:14 +0000 |
| commit | 96a0326e147aa972dd0cda0ae91656a7f1efb6c6 (patch) | |
| tree | 5adfe4048ff78bf3f1208a4d5390cd2ef64a862e | |
| parent | 428b67b194d3955cacdd0ec10cf4ddbba7f6c61c (diff) | |
Notes
| -rw-r--r-- | sys/netgraph/netflow/netflow.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/netgraph/netflow/netflow.c b/sys/netgraph/netflow/netflow.c index 6393e1fa3e04..659b689d9446 100644 --- a/sys/netgraph/netflow/netflow.c +++ b/sys/netgraph/netflow/netflow.c @@ -56,18 +56,18 @@ static const char rcs_id[] = #define NBUCKETS (65536) /* must be power of 2 */ -/* This hash is for TCP or UDP packets */ -#define FULL_HASH(addr1,addr2,port1,port2)\ - (((addr1 >> 16) ^ \ - (addr2 & 0x00FF) ^ \ - ((port1 ^ port2) << 8) )& \ - (NBUCKETS - 1)) +/* This hash is for TCP or UDP packets. */ +#define FULL_HASH(addr1, addr2, port1, port2) \ + (((addr1 ^ (addr1 >> 16) ^ \ + htons(addr2 ^ (addr2 >> 16))) ^ \ + srcport ^ htons(dstport)) & \ + (NBUCKETS - 1)) -/* This hash is for all other IP packets */ -#define ADDR_HASH(addr1,addr2)\ - (((addr1 >> 16) ^ \ - (addr2 & 0x00FF) )& \ - (NBUCKETS - 1)) +/* This hash is for all other IP packets. */ +#define ADDR_HASH(addr1, addr2) \ + ((addr1 ^ (addr1 >> 16) ^ \ + htons(addr2 ^ (addr2 >> 16))) & \ + (NBUCKETS - 1)) /* Macros to shorten logical constructions */ /* XXX: priv must exist in namespace */ |
