[sr-dev] git:5.2:c5f1ac9b: dispatcher: Don't take modulus of hash twice

Henning Westerholt hw at kamailio.org
Tue Feb 5 21:29:12 CET 2019


Module: kamailio
Branch: 5.2
Commit: c5f1ac9be0fe28ab3967f4f0ed085d4a272c7437
URL: https://github.com/kamailio/kamailio/commit/c5f1ac9be0fe28ab3967f4f0ed085d4a272c7437

Author: Alex Hermann <alex at hexla.nl>
Committer: Henning Westerholt <hw at kamailio.org>
Date: 2019-02-05T21:25:11+01:00

dispatcher: Don't take modulus of hash twice

(cherry picked from commit 5b23ce265b43adda75731a90fdf1a3a47daa3a51)

---

Modified: src/modules/dispatcher/dispatch.c

---

Diff:  https://github.com/kamailio/kamailio/commit/c5f1ac9be0fe28ab3967f4f0ed085d4a272c7437.diff
Patch: https://github.com/kamailio/kamailio/commit/c5f1ac9be0fe28ab3967f4f0ed085d4a272c7437.patch

---

diff --git a/src/modules/dispatcher/dispatch.c b/src/modules/dispatcher/dispatch.c
index 59cf1d9302..5d72f71686 100644
--- a/src/modules/dispatcher/dispatch.c
+++ b/src/modules/dispatcher/dispatch.c
@@ -2096,7 +2096,7 @@ int ds_manage_routes(sip_msg_t *msg, ds_select_state_t *rstate)
 			}
 			break;
 		case DS_ALG_RANDOM: /* 6 - random selection */
-			hash = kam_rand() % idx->nr;
+			hash = kam_rand();
 			break;
 		case DS_ALG_HASHPV: /* 7 - hash on PV value */
 			if(ds_hash_pvar(msg, &hash) != 0) {




More information about the sr-dev mailing list