From: Joe Stringer <joestrin...@nicira.com> Signed-off-by: Joe Stringer <joestrin...@nicira.com> --- acinclude.m4 | 1 + datapath/linux/compat/include/linux/random.h | 7 +++++++ 2 files changed, 8 insertions(+)
diff --git a/acinclude.m4 b/acinclude.m4 index da1d39704c7b..090712e356df 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -381,6 +381,7 @@ AC_DEFUN([OVS_CHECK_LINUX_COMPAT], [ [OVS_DEFINE([HAVE_NF_CT_TMPL_ALLOC_TAKES_STRUCT_ZONE])]) OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32]) + OVS_GREP_IFELSE([$KSRC/include/linux/random.h], [prandom_u32_max]) OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [get_link_net]) OVS_GREP_IFELSE([$KSRC/include/net/rtnetlink.h], [name_assign_type]) diff --git a/datapath/linux/compat/include/linux/random.h b/datapath/linux/compat/include/linux/random.h index f2a6d6aa1468..5c088a2d860b 100644 --- a/datapath/linux/compat/include/linux/random.h +++ b/datapath/linux/compat/include/linux/random.h @@ -7,4 +7,11 @@ #define prandom_u32() random32() #endif +#ifndef HAVE_PRANDOM_U32_MAX +static inline u32 prandom_u32_max(u32 ep_ro) +{ + return (u32)(((u64) prandom_u32() * ep_ro) >> 32); +} +#endif + #endif -- 2.1.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev