Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic Add RNG entropy collection support of rnd(9) to r...



details:   https://anonhg.NetBSD.org/src/rev/c20b98ee3c2a
branches:  trunk
changeset: 786777:c20b98ee3c2a
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri May 10 14:55:08 2013 +0000

description:
Add RNG entropy collection support of rnd(9) to re(4).
Taken from rtk(4), and briefly checked by rndctl(8).

diffstat:

 sys/dev/ic/rtl8169.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (53 lines):

diff -r dda2858318a9 -r c20b98ee3c2a sys/dev/ic/rtl8169.c
--- a/sys/dev/ic/rtl8169.c      Fri May 10 14:05:57 2013 +0000
+++ b/sys/dev/ic/rtl8169.c      Fri May 10 14:55:08 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtl8169.c,v 1.138 2013/05/10 14:05:57 tsutsui Exp $    */
+/*     $NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1997, 1998-2003
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.138 2013/05/10 14:05:57 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtl8169.c,v 1.139 2013/05/10 14:55:08 tsutsui Exp $");
 /* $FreeBSD: /repoman/r/ncvs/src/sys/dev/re/if_re.c,v 1.20 2004/04/11 20:34:08 ru Exp $ */
 
 /*
@@ -134,6 +134,7 @@
 #include <netinet/ip.h>                /* XXX for IP_MAXPACKET */
 
 #include <net/bpf.h>
+#include <sys/rnd.h>
 
 #include <sys/bus.h>
 
@@ -860,6 +861,9 @@
        if_attach(ifp);
        ether_ifattach(ifp, eaddr);
 
+       rnd_attach_source(&sc->rnd_source, device_xname(sc->sc_dev),
+           RND_TYPE_NET, 0);
+
        if (pmf_device_register(sc->sc_dev, NULL, NULL))
                pmf_class_network_register(sc->sc_dev, ifp);
        else
@@ -951,6 +955,7 @@
        /* Delete all remaining media. */
        ifmedia_delete_instance(&sc->mii.mii_media, IFM_INST_ANY);
 
+       rnd_detach_source(&sc->rnd_source);
        ether_ifdetach(ifp);
        if_detach(ifp);
 
@@ -1476,6 +1481,8 @@
        if (handled && !IFQ_IS_EMPTY(&ifp->if_snd))
                re_start(ifp);
 
+       rnd_add_uint32(&sc->rnd_source, status);
+
        return handled;
 }
 



Home | Main Index | Thread Index | Old Index