summaryrefslogtreecommitdiffstats
path: root/usr.sbin/IPXrouted/af.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/IPXrouted/af.c')
-rw-r--r--usr.sbin/IPXrouted/af.c30
1 files changed, 24 insertions, 6 deletions
diff --git a/usr.sbin/IPXrouted/af.c b/usr.sbin/IPXrouted/af.c
index 0936b43..05034ab 100644
--- a/usr.sbin/IPXrouted/af.c
+++ b/usr.sbin/IPXrouted/af.c
@@ -35,7 +35,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: af.c,v 1.4 1997/02/22 16:00:54 peter Exp $
*/
#ifndef lint
@@ -93,14 +93,32 @@ ipxnet_hash(sipx, hp)
register struct sockaddr_ipx *sipx;
struct afhash *hp;
{
- register long hash = 0;
- register u_short *s = sipx->sipx_addr.x_host.s_host;
- union ipx_net_u net;
+ long hash;
+#if 0
+ u_short *s = sipx->sipx_addr.x_host.s_host;
+#endif
+ u_char *c;
+
+ c = sipx->sipx_addr.x_net.c_net;
- net.net_e = sipx->sipx_addr.x_net;
- hp->afh_nethash = net.long_e;
+#define IMVAL 33
+ hash = 0;
+ hash = hash * IMVAL + *c++;
+ hash = hash * IMVAL + *c++;
+ hash = hash * IMVAL + *c++;
+ hash = hash * IMVAL + *c++;
+#undef IMVAL
+
+ hp->afh_nethash = hash;
+ hp->afh_nethash ^= (hash >> 8);
+ hp->afh_nethash ^= (hash >> 16);
+ hp->afh_nethash ^= (hash >> 24);
+
+#if 0
+ hash = 0;
hash = *s++; hash <<= 8; hash += *s++; hash <<= 8; hash += *s;
hp->afh_hosthash = hash;
+#endif
}
int
OpenPOWER on IntegriCloud