From owner-freebsd-net Sat Jun 29 5:34:33 2002 Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3B84637B400 for ; Sat, 29 Jun 2002 05:34:31 -0700 (PDT) Received: from iguana.icir.org (iguana.icir.org [192.150.187.36]) by mx1.FreeBSD.org (Postfix) with ESMTP id E48BF43E09 for ; Sat, 29 Jun 2002 05:34:30 -0700 (PDT) (envelope-from rizzo@iguana.icir.org) Received: (from rizzo@localhost) by iguana.icir.org (8.11.6/8.11.3) id g5TCYUf70567; Sat, 29 Jun 2002 05:34:30 -0700 (PDT) (envelope-from rizzo) Date: Sat, 29 Jun 2002 05:34:30 -0700 From: Luigi Rizzo To: net@freebsd.org Subject: ipflow_has ? Message-ID: <20020629053430.A70505@iguana.icir.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, looking at the code in ip_flow.c, i notice that the hash function ipflow_hash() uses both the source and destination address as parameters, and additionally, it never considers the lower two bits of the destination addres. The code is below, IPFLOW_HASHBITS is 6: unsigned hash = tos; int idx; for (idx = 0; idx < 32; idx += IPFLOW_HASHBITS) hash += (dst.s_addr >> (32 - idx)) + (src.s_addr >> idx); return hash & (IPFLOW_HASHSIZE-1); Of course it is just an optimization, but shouldn't routing decisions be based on the dst address only ? Just using the dst address would slightly simplify the function, and especially has the potential of collapsing a lot of information in the ipflow cache -- consider the case of a router box in front of a busy web server. Comments ? cheers luigi To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message