Many platforms with 4 byte integers define RAND_MAX as INT_MAX but some (Solaris and derivatives for example), RAND_MAX is only 32767 but INT_MAX is 2147483647. This change allows falling back to the posix random() and srandom() variants with casts to int if both int and long are 4 bytes, then defining a consistent KAM_RAND_MAX of 2147483647. If both INT_MAX and RAND_MAX are 2 bytes, then we are stuck with ANSI rand(). You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/701
-- Commit Summary --
* core: add portable rand() macros * ims_charging: update to use kam_rand() * auth: update to use kam_rand() * carrierroute: update to use kam_rand() * cdp: update to use kam_rand() * cfgutils: update to use kam_rand() * dialog: update to use kam_rand() * dispatcher: update to use kam_rand() * drouting: update to use kam_rand() * ims_auth: update to use kam_rand() * ims_dialog: update to use kam_rand() * ims_registrar_scscf: update to use kam_rand() * iptrtpproxy: update to use kam_rand() * lcr: update to use kam_rand() * nat_traversal: update to use kam_rand() * nsq: update to use kam_rand() * pipelimit: update to use kam_rand() * presence: update to use kam_rand() * registrar: update to use kam_rand() * rls: update to use kam_rand() * sipcapture: update to use kam_rand() * tm: update to use kam_rand() * tsilo: update to use kam_rand() * usrloc: update to use kam_rand() * xmpp: update to use kam_rand() * xprint: update to use kam_rand() * core: update to use kam_rand()
-- File Changes --
M main.c (9) M modules/auth/auth_mod.c (5) M modules/carrierroute/cr_func.c (3) M modules/carrierroute/prime_hash.c (4) M modules/cdp/peermanager.c (6) M modules/cdp/session.c (4) M modules/cdp/utils.h (1) M modules/cfgutils/cfgutils.c (5) M modules/dialog/dlg_hash.c (3) M modules/dispatcher/dispatch.c (6) M modules/dispatcher/dispatch.h (1) M modules/dispatcher/dispatcher.c (2) M modules/drouting/drouting.c (11) M modules/ims_auth/authorize.c (5) M modules/ims_charging/ro_session_hash.c (2) M modules/ims_charging/ro_session_hash.h (1) M modules/ims_dialog/dlg_hash.c (3) M modules/ims_registrar_scscf/reg_mod.h (1) M modules/ims_registrar_scscf/registrar_notify.c (2) M modules/ims_registrar_scscf/save.c (2) M modules/ims_registrar_scscf/sip_msg.c (2) M modules/iptrtpproxy/iptrtpproxy.c (3) M modules/lcr/lcr_mod.c (3) M modules/nat_traversal/nat_traversal.c (9) M modules/nsq/reader.c (5) M modules/pipelimit/pipelimit.c (3) M modules/presence/presence.c (3) M modules/registrar/sip_msg.c (3) M modules/rls/notify.c (5) M modules/sipcapture/sipcapture.c (5) M modules/tm/callid.c (7) M modules/tm/h_table.c (5) M modules/tm/uac.c (3) M modules/tsilo/ts_hash.c (3) M modules/usrloc/ul_mi.c (3) M modules/xmpp/util.c (4) M modules/xprint/xp_lib.c (5) M msg_translator.c (3) M pt.c (13) A rand/kam_rand.h (35) M select_core.c (5)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/701.patch https://github.com/kamailio/kamailio/pull/701.diff
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/701