diff --git a/sys/kern/kern_intr.c b/sys/kern/kern_intr.c index 63d84694a560..f4b04c3f71b4 100644 --- a/sys/kern/kern_intr.c +++ b/sys/kern/kern_intr.c @@ -1147,7 +1147,7 @@ swi_sched(void *cookie, int flags) entropy.event = (uintptr_t)ih; entropy.td = curthread; random_harvest(&entropy, sizeof(entropy), 1, 0, - RANDOM_INTERRUPT); + RANDOM_SWI); } /* diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c index e8d395ad46cb..638b3647f6ba 100644 --- a/sys/net/if_ethersubr.c +++ b/sys/net/if_ethersubr.c @@ -638,9 +638,8 @@ ether_input_internal(struct ifnet *ifp, struct mbuf *m) m->m_flags |= M_PROMISC; } - /* First chunk of an mbuf contains good entropy */ if (harvest.ethernet) - random_harvest(m, 16, 3, 0, RANDOM_NET); + random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_ETHER); ether_demux(ifp, m); CURVNET_RESTORE(); diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index e917793a0fba..56b3103b4b76 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -922,9 +922,8 @@ tunwrite(struct cdev *dev, struct uio *uio, int flag) m_freem(m); return (EAFNOSUPPORT); } - /* First chunk of an mbuf contains good junk */ if (harvest.point_to_point) - random_harvest(m, 16, 3, 0, RANDOM_NET); + random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_TUN); ifp->if_ibytes += m->m_pkthdr.len; ifp->if_ipackets++; CURVNET_SET(ifp->if_vnet); diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index e6ac5085368d..72fc16201df9 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -774,9 +774,8 @@ ng_iface_rcvdata(hook_p hook, item_p item) m_freem(m); return (EAFNOSUPPORT); } - /* First chunk of an mbuf contains good junk */ if (harvest.point_to_point) - random_harvest(m, 16, 3, 0, RANDOM_NET); + random_harvest(&(m->m_data), 12, 3, 0, RANDOM_NET_NG); M_SETFIB(m, ifp->if_fib); netisr_dispatch(isr, m); return (0); diff --git a/sys/sys/random.h b/sys/sys/random.h index 5cf1611e359c..2f86c82e854a 100644 --- a/sys/sys/random.h +++ b/sys/sys/random.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2000 Mark R. V. Murray + * Copyright (c) 2000-2013 Mark R. V. Murray * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -42,8 +42,11 @@ enum esource { RANDOM_WRITE = 0, RANDOM_KEYBOARD, RANDOM_MOUSE, - RANDOM_NET, + RANDOM_NET_TUN, + RANDOM_NET_ETHER, + RANDOM_NET_NG, RANDOM_INTERRUPT, + RANDOM_SWI, RANDOM_PURE, ENTROPYSOURCE }; @@ -57,6 +60,7 @@ struct harvest_select { int point_to_point; int interrupt; int swi; + int namei; }; extern struct harvest_select harvest;