Module Name:    src
Committed By:   darrenr
Date:           Sat Jun 28 07:59:26 UTC 2014

Modified Files:
        src/external/bsd/ipf/dist: ip_dstlist.c
        src/sys/external/bsd/ipf/netinet: ip_dstlist.c

Log Message:
#534 destination list hashing not endian neutral


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/ipf/dist/ip_dstlist.c
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/ipf/netinet/ip_dstlist.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ipf/dist/ip_dstlist.c
diff -u src/external/bsd/ipf/dist/ip_dstlist.c:1.2 src/external/bsd/ipf/dist/ip_dstlist.c:1.3
--- src/external/bsd/ipf/dist/ip_dstlist.c:1.2	Sun Jul 22 14:27:35 2012
+++ src/external/bsd/ipf/dist/ip_dstlist.c	Sat Jun 28 07:59:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_dstlist.c,v 1.2 2012/07/22 14:27:35 darrenr Exp $	*/
+/*	$NetBSD: ip_dstlist.c,v 1.3 2014/06/28 07:59:26 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1195,7 +1195,7 @@ ipf_dstlist_select(fin, d)
 		MD5Update(&ctx, (u_char *)&fin->fin_dst6,
 			  sizeof(fin->fin_dst6));
 		MD5Final((u_char *)hash, &ctx);
-		x = hash[0] % d->ipld_nodes;
+		x = ntohl(hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 
@@ -1205,7 +1205,7 @@ ipf_dstlist_select(fin, d)
 		MD5Update(&ctx, (u_char *)&fin->fin_src6,
 			  sizeof(fin->fin_src6));
 		MD5Final((u_char *)hash, &ctx);
-		x = hash[0] % d->ipld_nodes;
+		x = ntohl(hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 
@@ -1215,7 +1215,7 @@ ipf_dstlist_select(fin, d)
 		MD5Update(&ctx, (u_char *)&fin->fin_dst6,
 			  sizeof(fin->fin_dst6));
 		MD5Final((u_char *)hash, &ctx);
-		x = hash[0] % d->ipld_nodes;
+		x = ntohl(hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 

Index: src/sys/external/bsd/ipf/netinet/ip_dstlist.c
diff -u src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.7 src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.8
--- src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.7	Tue Apr  1 15:19:29 2014
+++ src/sys/external/bsd/ipf/netinet/ip_dstlist.c	Sat Jun 28 07:59:26 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_dstlist.c,v 1.7 2014/04/01 15:19:29 christos Exp $	*/
+/*	$NetBSD: ip_dstlist.c,v 1.8 2014/06/28 07:59:26 darrenr Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1141,7 +1141,7 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		MD5Update(&ctx, (u_char *)&fin->fin_dst6,
 			  sizeof(fin->fin_dst6));
 		MD5Final(h.bytes, &ctx);
-		x = h.hash[0] % d->ipld_nodes;
+		x = ntohl(h.hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 
@@ -1151,7 +1151,7 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		MD5Update(&ctx, (u_char *)&fin->fin_src6,
 			  sizeof(fin->fin_src6));
 		MD5Final(h.bytes, &ctx);
-		x = h.hash[0] % d->ipld_nodes;
+		x = ntohl(h.hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 
@@ -1161,7 +1161,7 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		MD5Update(&ctx, (u_char *)&fin->fin_dst6,
 			  sizeof(fin->fin_dst6));
 		MD5Final(h.bytes, &ctx);
-		x = h.hash[0] % d->ipld_nodes;
+		x = ntohl(h.hash[0]) % d->ipld_nodes;
 		sel = d->ipld_dests[x];
 		break;
 

Reply via email to